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.model.BaseModel;
18  import com.liferay.portal.model.BaseModelExtension;
19  import com.liferay.portal.model.ModelExtensionHandler;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  /**
25   * <a href="AbstractModelExtensionHandler.java.html"><b><i>View Source</i></b>
26   * </a>
27   *
28   * @author     Raymond Aug�
29   * @deprecated
30   */
31  public abstract class AbstractModelExtensionHandler<T>
32      implements ModelExtensionHandler<T> {
33  
34      public Object extendList(List<BaseModel<T>> models) {
35          return new WrappedList(models);
36      }
37  
38      public BaseModelExtension<T> getBaseModelExtension() {
39          return _baseModelExtension;
40      }
41  
42      public List<String> getExtensionMethodNames() {
43          return _extensionMethodNames;
44      }
45  
46      public void setBaseModelExtensionClass(
47          BaseModelExtension<T> baseModelExtension) {
48  
49          _baseModelExtension = baseModelExtension;
50      }
51  
52      public void setExtensionMethodNames(List<String> extensionMethodNames) {
53          _extensionMethodNames = extensionMethodNames;
54      }
55  
56      public class WrappedList extends ArrayList<BaseModel<T>> {
57  
58          public WrappedList(List<BaseModel<T>> models) {
59              super(models);
60          }
61  
62          public BaseModel<T> get(int index) {
63              return (BaseModel<T>)extendSingle(super.get(index));
64          }
65  
66      }
67  
68      private BaseModelExtension<T> _baseModelExtension;
69      private List<String> _extensionMethodNames;
70  
71  }