1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.spring.aop;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.model.BaseModel;
20  import com.liferay.portal.model.BaseModelExtension;
21  
22  import java.util.List;
23  
24  /**
25   * <a href="BaseModelExtensionHandler.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author     Raymond Aug�
28   * @deprecated
29   */
30  public class BaseModelExtensionHandler<T>
31      extends AbstractModelExtensionHandler<T> {
32  
33      public Object extendSingle(BaseModel<T> model) {
34          if (model instanceof BaseModelExtension<?>) {
35              return model;
36          }
37          else {
38              BaseModelExtension<T> extension = getBaseModelExtension().extend(
39                  model);
40  
41              if (_log.isDebugEnabled()) {
42                  StringBuilder sb = new StringBuilder();
43  
44                  sb.append("Extending ");
45                  sb.append(model.getClass().getName());
46                  sb.append(" to ");
47                  sb.append(extension.getClass().getName());
48  
49                  _log.debug(sb.toString());
50              }
51  
52              return extension;
53          }
54      }
55  
56      public Object extendList(List<BaseModel<T>> models) {
57          return new WrappedList(models);
58      }
59  
60      private static final Log _log =
61          LogFactoryUtil.getLog(BaseModelExtensionHandler.class);
62  
63  }