1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.tools.servicebuilder;
16  
17  import java.util.List;
18  
19  /**
20   * <a href="EntityFinder.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class EntityFinder {
25  
26      public EntityFinder(
27          String name, String returnType, boolean unique, String where,
28          boolean dbIndex, List<EntityColumn> columns) {
29  
30          _name = name;
31          _returnType = returnType;
32          _unique = unique;
33          _where = where;
34          _dbIndex = dbIndex;
35          _columns = columns;
36      }
37  
38      public List<EntityColumn> getColumns() {
39          return _columns;
40      }
41  
42      public String getName() {
43          return _name;
44      }
45  
46      public String getReturnType() {
47          return _returnType;
48      }
49  
50      public String getWhere() {
51          return _where;
52      }
53  
54      public boolean hasColumn(String name) {
55          return Entity.hasColumn(name, _columns);
56      }
57  
58      public boolean isCollection() {
59          if ((_returnType != null) && _returnType.equals("Collection")) {
60              return true;
61          }
62          else {
63              return false;
64          }
65      }
66  
67      public boolean isDBIndex() {
68          return _dbIndex;
69      }
70  
71      public boolean isUnique() {
72          return _unique;
73      }
74  
75      private List<EntityColumn> _columns;
76      private boolean _dbIndex;
77      private String _name;
78      private String _returnType;
79      private boolean _unique;
80      private String _where;
81  
82  }