001
014
015 package com.liferay.portal.tools.servicebuilder;
016
017 import com.liferay.util.TextFormatter;
018
019 import java.util.List;
020
021
024 public class EntityFinder {
025
026 public EntityFinder(
027 String name, String returnType, boolean unique, String where,
028 boolean dbIndex, List<EntityColumn> columns) {
029
030 _name = name;
031 _returnType = returnType;
032 _unique = unique;
033 _where = where;
034 _dbIndex = dbIndex;
035 _columns = columns;
036 }
037
038 public List<EntityColumn> getColumns() {
039 return _columns;
040 }
041
042 public String getName() {
043 return _name;
044 }
045
046 public String getNames() {
047 return TextFormatter.formatPlural(new String(_name));
048 }
049
050 public String getReturnType() {
051 return _returnType;
052 }
053
054 public String getWhere() {
055 return _where;
056 }
057
058 public boolean hasArrayableOperator() {
059 for (EntityColumn column : _columns) {
060 if (column.hasArrayableOperator()) {
061 return true;
062 }
063 }
064
065 return false;
066 }
067
068 public boolean hasColumn(String name) {
069 return Entity.hasColumn(name, _columns);
070 }
071
072 public boolean isCollection() {
073 if ((_returnType != null) && _returnType.equals("Collection")) {
074 return true;
075 }
076 else {
077 return false;
078 }
079 }
080
081 public boolean isDBIndex() {
082 return _dbIndex;
083 }
084
085 public boolean isUnique() {
086 return _unique;
087 }
088
089 private List<EntityColumn> _columns;
090 private boolean _dbIndex;
091 private String _name;
092 private String _returnType;
093 private boolean _unique;
094 private String _where;
095
096 }