Sorry for the big commit, got a bit carried away.
Added override and deprecated annotations wherever they were missing Removed the use of any deprecated classes/methods (except OutputFormat in UtilXml) A few other random generics and misc. cleanups git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@791212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1655,6 +1655,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findOne() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException {
|
||||
return findOne(primaryKey.getEntityName(), primaryKey, false);
|
||||
}
|
||||
@@ -1665,6 +1666,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findOne() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKeyCache(GenericPK primaryKey) throws GenericEntityException {
|
||||
return findOne(primaryKey.getEntityName(), primaryKey, true);
|
||||
}
|
||||
@@ -1676,6 +1678,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findOne() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKey(String entityName, Object... fields) throws GenericEntityException {
|
||||
return findByPrimaryKey(entityName, UtilMisc.<String, Object>toMap(fields));
|
||||
}
|
||||
@@ -1697,6 +1700,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findOne() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKeySingle(String entityName, Object singlePkValue) throws GenericEntityException {
|
||||
return findOne(entityName, makePKSingle(entityName, singlePkValue), false);
|
||||
}
|
||||
@@ -1728,6 +1732,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findOne() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKeyCacheSingle(String entityName, Object singlePkValue) throws GenericEntityException {
|
||||
return findOne(entityName, makePKSingle(entityName, singlePkValue), true);
|
||||
}
|
||||
@@ -1739,6 +1744,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return The GenericValue corresponding to the primaryKey
|
||||
*@deprecated Use findByPrimaryKeyPartial(GenericPK, Set<String>) instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, String... keys) throws GenericEntityException {
|
||||
return findByPrimaryKeyPartial(primaryKey, UtilMisc.makeSetWritable(Arrays.asList(keys)));
|
||||
}
|
||||
@@ -1799,6 +1805,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue objects corresponding to the passed primaryKey objects
|
||||
*@deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAllByPrimaryKeys(Collection<GenericPK> primaryKeys) throws GenericEntityException {
|
||||
boolean beganTransaction = false;
|
||||
try {
|
||||
@@ -1861,6 +1868,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue objects corresponding to the passed primaryKey objects
|
||||
*@deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAllByPrimaryKeysCache(Collection<GenericPK> primaryKeys) throws GenericEntityException {
|
||||
boolean beganTransaction = false;
|
||||
try {
|
||||
@@ -1930,6 +1938,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAll(String entityName) throws GenericEntityException {
|
||||
return this.findList(entityName, null, null, null, null, false);
|
||||
}
|
||||
@@ -1941,6 +1950,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAll(String entityName, String... orderBy) throws GenericEntityException {
|
||||
return findList(entityName, null, null, Arrays.asList(orderBy), null, false);
|
||||
}
|
||||
@@ -1952,6 +1962,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAll(String entityName, List<String> orderBy) throws GenericEntityException {
|
||||
return this.findList(entityName, null, null, orderBy, null, false);
|
||||
}
|
||||
@@ -1962,6 +1973,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAllCache(String entityName) throws GenericEntityException {
|
||||
return this.findList(entityName, null, null, null, null, true);
|
||||
}
|
||||
@@ -1973,6 +1985,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAllCache(String entityName, String... orderBy) throws GenericEntityException {
|
||||
return findList(entityName, null, null, Arrays.asList(orderBy), null, true);
|
||||
}
|
||||
@@ -1984,6 +1997,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List containing all Generic entities
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findAllCache(String entityName, List<String> orderBy) throws GenericEntityException {
|
||||
return this.findList(entityName, null, null, orderBy, null, true);
|
||||
}
|
||||
@@ -2016,6 +2030,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByOr(String entityName, Object... fields) throws GenericEntityException {
|
||||
EntityCondition ecl = EntityCondition.makeCondition(EntityOperator.OR, fields);
|
||||
return this.findList(entityName, ecl, null, null, null, false);
|
||||
@@ -2028,6 +2043,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByOr(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
|
||||
EntityCondition ecl = EntityCondition.makeCondition(fields, EntityOperator.OR);
|
||||
return this.findList(entityName, ecl, null, null, null, false);
|
||||
@@ -2055,6 +2071,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByOr(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
|
||||
EntityCondition ecl = EntityCondition.makeCondition(fields, EntityOperator.OR);
|
||||
return this.findList(entityName, ecl, null, orderBy, null, false);
|
||||
@@ -2067,6 +2084,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByAndCache(String entityName, Object... fields) throws GenericEntityException {
|
||||
return this.findByAndCache(entityName, UtilMisc.<String, Object>toMap(fields));
|
||||
}
|
||||
@@ -2099,6 +2117,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, T... expressions) throws GenericEntityException {
|
||||
EntityConditionList<T> ecl = EntityCondition.makeCondition(EntityOperator.AND, expressions);
|
||||
return this.findList(entityName, ecl, null, null, null, false);
|
||||
@@ -2111,6 +2130,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, List<T> expressions) throws GenericEntityException {
|
||||
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.AND);
|
||||
return this.findList(entityName, ecl, null, null, null, false);
|
||||
@@ -2124,6 +2144,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, List<T> expressions, List<String> orderBy) throws GenericEntityException {
|
||||
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.AND);
|
||||
return this.findList(entityName, ecl, null, orderBy, null, false);
|
||||
@@ -2136,6 +2157,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, T... expressions) throws GenericEntityException {
|
||||
return this.findList(entityName, EntityCondition.makeCondition(EntityOperator.AND, expressions), null, null, null, false);
|
||||
}
|
||||
@@ -2147,6 +2169,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, List<T> expressions) throws GenericEntityException {
|
||||
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.OR);
|
||||
return this.findList(entityName, ecl, null, null, null, false);
|
||||
@@ -2160,6 +2183,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue instances that match the query
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, List<T> expressions, List<String> orderBy) throws GenericEntityException {
|
||||
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.OR);
|
||||
return this.findList(entityName, ecl, null, orderBy, null, false);
|
||||
@@ -2169,6 +2193,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 0 references
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByLike(String entityName, Object... fields) throws GenericEntityException {
|
||||
Map<String, ? extends Object> fieldMap = UtilMisc.<String, Object>toMap(fields);
|
||||
List<EntityExpr> likeExpressions = FastList.newInstance();
|
||||
@@ -2185,6 +2210,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 1 references; all changed to findList
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByLike(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
|
||||
List<EntityExpr> likeExpressions = FastList.newInstance();
|
||||
if (fields != null) {
|
||||
@@ -2200,6 +2226,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 1 references; all changed to findList
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByLike(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
|
||||
List<EntityExpr> likeExpressions = FastList.newInstance();
|
||||
if (fields != null) {
|
||||
@@ -2220,6 +2247,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue objects representing the result
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByCondition(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
|
||||
return this.findList(entityName, entityCondition, UtilMisc.toSet(fieldsToSelect), orderBy, null, false);
|
||||
}
|
||||
@@ -2235,6 +2263,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue objects representing the result
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByCondition(String entityName, EntityCondition whereEntityCondition,
|
||||
EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
|
||||
throws GenericEntityException {
|
||||
@@ -2276,6 +2305,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
*@return List of GenericValue objects representing the result
|
||||
*@deprecated Use findList() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> findByConditionCache(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
|
||||
return this.findList(entityName, entityCondition, UtilMisc.collectionToSet(fieldsToSelect), orderBy, null, true);
|
||||
}
|
||||
@@ -2290,6 +2320,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
|
||||
*@deprecated Use find() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition entityCondition,
|
||||
Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
|
||||
return this.find(entityName, entityCondition, null, UtilMisc.collectionToSet(fieldsToSelect), orderBy, null);
|
||||
@@ -2307,6 +2338,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
|
||||
*@deprecated Use find() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition,
|
||||
EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
|
||||
throws GenericEntityException {
|
||||
@@ -2462,6 +2494,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 3 references; all changed to findCoundByCondition
|
||||
*@deprecated Use findCountByCondition() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public long findCountByAnd(String entityName) throws GenericEntityException {
|
||||
return findCountByCondition(entityName, null, null, null);
|
||||
}
|
||||
@@ -2470,6 +2503,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 1 references; all changed to use findCountByCondition
|
||||
*@deprecated Use findCountByCondition() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public long findCountByAnd(String entityName, Object... fields) throws GenericEntityException {
|
||||
return findCountByCondition(entityName, EntityCondition.makeCondition(UtilMisc.<String, Object>toMap(fields), EntityOperator.AND), null, null);
|
||||
}
|
||||
@@ -2478,6 +2512,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 8 references; all changed to use findCountByCondition
|
||||
*@deprecated Use findCountByCondition() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public long findCountByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
|
||||
return findCountByCondition(entityName, EntityCondition.makeCondition(fields, EntityOperator.AND), null, null);
|
||||
}
|
||||
@@ -2486,6 +2521,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* NOTE 20080502: 17 references; all changed to use remaining findCountByCondition
|
||||
*@deprecated Use findCountByCondition() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public long findCountByCondition(String entityName, EntityCondition whereEntityCondition,
|
||||
EntityCondition havingEntityCondition) throws GenericEntityException {
|
||||
return findCountByCondition(entityName, whereEntityCondition, havingEntityCondition, null);
|
||||
@@ -2600,6 +2636,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances as specified in the relation definition
|
||||
*@deprecated Use getMultiRelation() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo) throws GenericEntityException {
|
||||
return getMultiRelation(value, relationNameOne, relationNameTwo, null);
|
||||
}
|
||||
@@ -2613,6 +2650,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances as specified in the relation definition
|
||||
*@deprecated Use getRelated() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> getRelated(String relationName, GenericValue value) throws GenericEntityException {
|
||||
return getRelated(relationName, null, null, value);
|
||||
}
|
||||
@@ -2627,6 +2665,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances as specified in the relation definition
|
||||
*@deprecated Use getRelated() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> getRelatedByAnd(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityException {
|
||||
return this.getRelated(relationName, byAndFields, null, value);
|
||||
}
|
||||
@@ -2642,6 +2681,7 @@ public class GenericDelegator implements DelegatorInterface {
|
||||
* @return List of GenericValue instances as specified in the relation definition
|
||||
*@deprecated Use getRelated() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GenericValue> getRelatedOrderBy(String relationName, List<String> orderBy, GenericValue value) throws GenericEntityException {
|
||||
return this.getRelated(relationName, null, orderBy, value);
|
||||
}
|
||||
|
||||
@@ -1156,6 +1156,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
*@param obj The object (GenericEntity) to compare this two
|
||||
*@return boolean stating if the two objects are equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof GenericEntity)) return false;
|
||||
|
||||
@@ -1170,6 +1171,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
/** Creates a hashCode for the entity, using the default String hashCode and Map hashCode, overrides the default hashCode
|
||||
*@return Hashcode corresponding to this entity
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// divide both by two (shift to right one bit) to maintain scale and add together
|
||||
if (generateHashCode) {
|
||||
@@ -1189,6 +1191,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
*
|
||||
*@return String corresponding to this entity
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder theString = new StringBuilder();
|
||||
theString.append("[GenericEntity:");
|
||||
@@ -1297,6 +1300,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
/** Clones this GenericEntity, this is a shallow clone & uses the default shallow HashMap clone
|
||||
*@return Object that is a clone of this GenericEntity
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
GenericEntity newEntity = new GenericEntity();
|
||||
newEntity.init(this);
|
||||
@@ -1374,9 +1378,11 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
public static class NullGenericEntity extends GenericEntity implements NULL {
|
||||
protected NullGenericEntity() { }
|
||||
|
||||
@Override
|
||||
public String getEntityName() {
|
||||
return "[null-entity]";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[null-entity]";
|
||||
}
|
||||
@@ -1385,6 +1391,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
|
||||
public static class NullField implements NULL, Comparable<NullField> {
|
||||
protected NullField() { }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[null-field]";
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.ofbiz.entity.model.ModelEntity;
|
||||
public class GenericPK extends GenericEntity {
|
||||
|
||||
protected static final ObjectFactory<GenericPK> genericPKFactory = new ObjectFactory<GenericPK>() {
|
||||
@Override
|
||||
protected GenericPK create() {
|
||||
return new GenericPK();
|
||||
}
|
||||
@@ -69,6 +70,7 @@ public class GenericPK extends GenericEntity {
|
||||
/** Clones this GenericPK, this is a shallow clone & uses the default shallow HashMap clone
|
||||
*@return Object that is a clone of this GenericPK
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
GenericPK newEntity = GenericPK.create(this);
|
||||
newEntity.setDelegator(internalDelegator);
|
||||
|
||||
@@ -49,6 +49,7 @@ public class GenericValue extends GenericEntity implements Reusable {
|
||||
public static final GenericValue NULL_VALUE = new NullGenericValue();
|
||||
|
||||
protected static final ObjectFactory<GenericValue> genericValueFactory = new ObjectFactory<GenericValue>() {
|
||||
@Override
|
||||
protected GenericValue create() {
|
||||
return new GenericValue();
|
||||
}
|
||||
@@ -103,6 +104,7 @@ public class GenericValue extends GenericEntity implements Reusable {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
// from GenericEntity
|
||||
super.reset();
|
||||
@@ -113,6 +115,7 @@ public class GenericValue extends GenericEntity implements Reusable {
|
||||
this.originalDbValues = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizedWithDatasource() {
|
||||
super.synchronizedWithDatasource();
|
||||
this.copyOriginalDbValues();
|
||||
@@ -490,6 +493,7 @@ public class GenericValue extends GenericEntity implements Reusable {
|
||||
/** Clones this GenericValue, this is a shallow clone & uses the default shallow HashMap clone
|
||||
*@return Object that is a clone of this GenericValue
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
GenericValue newEntity = GenericValue.create(this);
|
||||
newEntity.setDelegator(internalDelegator);
|
||||
@@ -497,9 +501,11 @@ public class GenericValue extends GenericEntity implements Reusable {
|
||||
}
|
||||
|
||||
protected static class NullGenericValue extends GenericValue implements NULL {
|
||||
@Override
|
||||
public String getEntityName() {
|
||||
return "[null-entity-value]";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[null-entity-value]";
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import freemarker.template.TemplateModelException;
|
||||
@SuppressWarnings("serial")
|
||||
public class GenericValueHtmlWrapper extends GenericValue {
|
||||
protected static final ObjectFactory<GenericValueHtmlWrapper> genericValueHtmlWrapperFactory = new ObjectFactory<GenericValueHtmlWrapper>() {
|
||||
@Override
|
||||
protected GenericValueHtmlWrapper create() {
|
||||
return new GenericValueHtmlWrapper();
|
||||
}
|
||||
@@ -68,6 +69,7 @@ public class GenericValueHtmlWrapper extends GenericValue {
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Object get(Object name) {
|
||||
Object value = super.get(name);
|
||||
if (value instanceof String) {
|
||||
@@ -83,6 +85,7 @@ public class GenericValueHtmlWrapper extends GenericValue {
|
||||
super(gv, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateModel get(String key) {
|
||||
TemplateModel tm = null;
|
||||
try {
|
||||
|
||||
@@ -29,14 +29,17 @@ public class EntityObjectCache extends AbstractEntityConditionCache<String, Obje
|
||||
super(delegatorName, "object-list");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String entityName, EntityCondition condition, String name) {
|
||||
return super.get(entityName, condition, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object put(String entityName, EntityCondition condition, String name, Object value) {
|
||||
return super.put(entityName, getFrozenConditionKey(condition), name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object remove(String entityName, EntityCondition condition, String name) {
|
||||
return super.remove(entityName, condition, name);
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class EntityClause {
|
||||
return secondModelEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder outputBuffer = new StringBuilder();
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Compiler;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.GenericModelException;
|
||||
@@ -68,6 +67,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity entity, Object lhs, Object rhs) throws GenericModelException {
|
||||
if (lhs instanceof EntityConditionValue) {
|
||||
EntityConditionValue ecv = (EntityConditionValue) lhs;
|
||||
@@ -79,11 +79,13 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor, Object lhs, Object rhs) {
|
||||
visitor.accept(lhs);
|
||||
visitor.accept(rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) {
|
||||
//Debug.logInfo("EntityComparisonOperator.addSqlValue field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module);
|
||||
|
||||
@@ -135,6 +137,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
|
||||
return Boolean.valueOf(mapMatches(delegator, map, lhs, rhs));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map, Object lhs, Object rhs) {
|
||||
Object leftValue;
|
||||
@@ -158,6 +161,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
|
||||
return compare((Comparable) leftValue, rightValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze(Object lhs, Object rhs) {
|
||||
return EntityCondition.makeCondition(freeze(lhs), this, freeze(rhs));
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ public abstract class EntityCondition extends EntityConditionBase implements Reu
|
||||
return ews;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return makeWhereString(null, FastList.<EntityConditionParam>newInstance(), null);
|
||||
}
|
||||
|
||||
@@ -101,10 +101,12 @@ public abstract class EntityConditionBase implements Serializable {
|
||||
SqlJdbcUtil.addValue(buffer, params == null ? null : field, value, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
throw new UnsupportedOperationException("equals:" + getClass().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
throw new UnsupportedOperationException("hashCode: " + getClass().getName());
|
||||
}
|
||||
|
||||
@@ -37,12 +37,15 @@ public abstract class EntityConditionFunction extends EntityCondition {
|
||||
|
||||
public static class NOT extends EntityConditionFunction {
|
||||
public NOT(EntityCondition nested) { super(ID_NOT, "NOT", nested); }
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
return !condition.mapMatches(delegator, map);
|
||||
}
|
||||
@Override
|
||||
public EntityCondition freeze() {
|
||||
return new NOT(condition.freeze());
|
||||
}
|
||||
@Override
|
||||
public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) {
|
||||
// nothing to do here...
|
||||
}
|
||||
@@ -79,20 +82,24 @@ public abstract class EntityConditionFunction extends EntityCondition {
|
||||
return idInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityConditionFunction(this, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityConditionFunction)) return false;
|
||||
EntityConditionFunction otherFunc = (EntityConditionFunction) obj;
|
||||
return this.idInt == otherFunc.idInt && (this.condition != null ? condition.equals(otherFunc.condition) : otherFunc.condition != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return idInt.hashCode() ^ condition.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(codeString).append('(');
|
||||
@@ -101,6 +108,7 @@ public abstract class EntityConditionFunction extends EntityCondition {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCondition(ModelEntity modelEntity) throws GenericModelException {
|
||||
condition.checkCondition(modelEntity);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class EntityConditionList<T extends EntityCondition> extends EntityCondit
|
||||
public static final String module = EntityConditionList.class.getName();
|
||||
|
||||
protected static final ObjectFactory<EntityConditionList> entityConditionListFactory = new ObjectFactory<EntityConditionList>() {
|
||||
@Override
|
||||
protected EntityConditionList create() {
|
||||
return new EntityConditionList();
|
||||
}
|
||||
@@ -41,23 +42,28 @@ public class EntityConditionList<T extends EntityCondition> extends EntityCondit
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityConditionList(EntityJoinOperator operator, T... conditionList) {
|
||||
init(operator, conditionList);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityConditionList(List<T> conditionList, EntityJoinOperator operator) {
|
||||
init(conditionList, operator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConditionListSize() {
|
||||
return super.getConditionListSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> getConditionIterator() {
|
||||
return super.getConditionIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityConditionList(this);
|
||||
}
|
||||
|
||||
@@ -79,10 +79,12 @@ public abstract class EntityConditionListBase<T extends EntityCondition> extends
|
||||
return this.conditionList.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityJoinOperator(operator, conditionList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
|
||||
// if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module);
|
||||
StringBuilder sql = new StringBuilder();
|
||||
@@ -90,25 +92,30 @@ public abstract class EntityConditionListBase<T extends EntityCondition> extends
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCondition(ModelEntity modelEntity) throws GenericModelException {
|
||||
// if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName(), module);
|
||||
operator.validateSql(modelEntity, conditionList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
return operator.mapMatches(delegator, map, conditionList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze() {
|
||||
return operator.freeze(conditionList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) {
|
||||
for (T cond: this.conditionList) {
|
||||
cond.encryptConditionFields(modelEntity, delegator);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityConditionListBase)) return false;
|
||||
EntityConditionListBase other = (EntityConditionListBase) obj;
|
||||
@@ -122,6 +129,7 @@ public abstract class EntityConditionListBase<T extends EntityCondition> extends
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return conditionList.hashCode() + operator.hashCode();
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class EntityConditionParam implements Serializable {
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return modelField.getColName() + "=" + fieldValue.toString();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class EntityConditionSubSelect extends EntityConditionValue {
|
||||
this.requireAll = requireAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity parentModelEntity, List<EntityConditionParam> entityConditionParams,
|
||||
boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) {
|
||||
if (localModelEntity instanceof ModelViewEntity && datasourceInfo == null) {
|
||||
@@ -105,24 +106,29 @@ public class EntityConditionSubSelect extends EntityConditionValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityConditionValue freeze() {
|
||||
return new EntityConditionSubSelect(localModelEntity, keyFieldName, (whereCond != null ? whereCond.freeze() : null), requireAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelField getModelField(ModelEntity modelEntity) {
|
||||
// do nothing for now
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable getValue(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
// do nothing for now
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity modelEntity) throws GenericModelException {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
if (whereCond != null) whereCond.visit(visitor);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ public abstract class EntityConditionValue extends EntityConditionBase {
|
||||
addSqlValue(sb, null, new ArrayList<EntityConditionParam>(), false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
toString(sql);
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.ofbiz.entity.model.ModelEntity;
|
||||
public class EntityDateFilterCondition extends EntityCondition {
|
||||
|
||||
protected static final ObjectFactory<EntityDateFilterCondition> entityDateFilterConditionFactory = new ObjectFactory<EntityDateFilterCondition>() {
|
||||
@Override
|
||||
protected EntityDateFilterCondition create() {
|
||||
return new EntityDateFilterCondition();
|
||||
}
|
||||
@@ -44,6 +45,7 @@ public class EntityDateFilterCondition extends EntityCondition {
|
||||
protected EntityDateFilterCondition() {}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeConditionDate() instead */
|
||||
@Deprecated
|
||||
public EntityDateFilterCondition(String fromDateName, String thruDateName) {
|
||||
init(fromDateName, thruDateName);
|
||||
}
|
||||
@@ -58,43 +60,52 @@ public class EntityDateFilterCondition extends EntityCondition {
|
||||
this.thruDateName = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
|
||||
EntityCondition condition = makeCondition();
|
||||
return condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCondition(ModelEntity modelEntity) throws GenericModelException {
|
||||
EntityCondition condition = makeCondition();
|
||||
condition.checkCondition(modelEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
EntityCondition condition = makeCondition();
|
||||
return condition.mapMatches(delegator, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityDateFilterCondition)) return false;
|
||||
EntityDateFilterCondition other = (EntityDateFilterCondition) obj;
|
||||
return equals(fromDateName, other.fromDateName) && equals(thruDateName, other.thruDateName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode(fromDateName) ^ hashCode(thruDateName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityDateFilterCondition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityDateFilterCondition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) {
|
||||
// nothing to do here...
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ package org.ofbiz.entity.condition;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javolution.context.ObjectFactory;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
@@ -33,12 +31,10 @@ import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.GenericEntity;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericModelException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.entity.config.DatasourceInfo;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelField;
|
||||
import org.ofbiz.entity.model.ModelFieldType;
|
||||
import org.ofbiz.entity.model.ModelFieldTypeReader;
|
||||
|
||||
/**
|
||||
* Encapsulates simple expressions used for specifying queries
|
||||
@@ -48,6 +44,7 @@ public class EntityExpr extends EntityCondition {
|
||||
public static final String module = EntityExpr.class.getName();
|
||||
|
||||
protected static final ObjectFactory<EntityExpr> entityExprFactory = new ObjectFactory<EntityExpr>() {
|
||||
@Override
|
||||
protected EntityExpr create() {
|
||||
return new EntityExpr();
|
||||
}
|
||||
@@ -60,21 +57,25 @@ public class EntityExpr extends EntityCondition {
|
||||
protected EntityExpr() {}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityExpr(Object lhs, EntityComparisonOperator operator, Object rhs) {
|
||||
this.init(lhs, operator, rhs);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityExpr(String lhs, EntityComparisonOperator operator, Object rhs) {
|
||||
this.init(lhs, operator, rhs);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityExpr(String lhs, boolean leftUpper, EntityComparisonOperator operator, Object rhs, boolean rightUpper) {
|
||||
this.init(leftUpper ? EntityFunction.UPPER_FIELD(lhs) : lhs, operator, rightUpper ? EntityFunction.UPPER(rhs) : rhs);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityExpr(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
|
||||
this.init(lhs, operator, rhs);
|
||||
}
|
||||
@@ -133,20 +134,24 @@ public class EntityExpr extends EntityCondition {
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public void setLUpper(boolean upper) {
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public boolean isLUpper() {
|
||||
return lhs instanceof EntityFunction.UPPER;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public boolean isRUpper() {
|
||||
return rhs instanceof EntityFunction.UPPER;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public void setRUpper(boolean upper) {
|
||||
}
|
||||
|
||||
@@ -162,6 +167,7 @@ public class EntityExpr extends EntityCondition {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
|
||||
// if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module);
|
||||
|
||||
@@ -172,10 +178,12 @@ public class EntityExpr extends EntityCondition {
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
return operator.mapMatches(delegator, map, lhs, rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCondition(ModelEntity modelEntity) throws GenericModelException {
|
||||
// if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName(), module);
|
||||
if (lhs instanceof EntityCondition) {
|
||||
@@ -184,6 +192,7 @@ public class EntityExpr extends EntityCondition {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addValue(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params) {
|
||||
if (rhs instanceof EntityFunction.UPPER) {
|
||||
if (value instanceof String) {
|
||||
@@ -193,10 +202,12 @@ public class EntityExpr extends EntityCondition {
|
||||
super.addValue(buffer, field, value, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze() {
|
||||
return operator.freeze(lhs, rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) {
|
||||
if (this.lhs instanceof String) {
|
||||
ModelField modelField = modelEntity.getField((String) this.lhs);
|
||||
@@ -212,10 +223,12 @@ public class EntityExpr extends EntityCondition {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityOperator(operator, lhs, rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityExpr(this);
|
||||
}
|
||||
@@ -272,6 +285,7 @@ public class EntityExpr extends EntityCondition {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityExpr)) return false;
|
||||
EntityExpr other = (EntityExpr) obj;
|
||||
@@ -286,6 +300,7 @@ public class EntityExpr extends EntityCondition {
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode(lhs) +
|
||||
hashCode(operator) +
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.ofbiz.entity.util.EntityUtil;
|
||||
public class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
|
||||
|
||||
protected static final ObjectFactory<EntityFieldMap> entityFieldMapFactory = new ObjectFactory<EntityFieldMap>() {
|
||||
@Override
|
||||
protected EntityFieldMap create() {
|
||||
return new EntityFieldMap();
|
||||
}
|
||||
@@ -62,21 +63,25 @@ public class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
|
||||
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityFieldMap(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) {
|
||||
this.init(compOp, joinOp, keysValues);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityFieldMap(Map<String, ? extends Object> fieldMap, EntityComparisonOperator compOp, EntityJoinOperator joinOp) {
|
||||
this.init(fieldMap, compOp, joinOp);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityFieldMap(EntityJoinOperator operator, Object... keysValues) {
|
||||
this.init(EntityOperator.EQUALS, operator, keysValues);
|
||||
}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeCondition() instead */
|
||||
@Deprecated
|
||||
public EntityFieldMap(Map<String, ? extends Object> fieldMap, EntityJoinOperator operator) {
|
||||
this.init(fieldMap, EntityOperator.EQUALS, operator);
|
||||
}
|
||||
@@ -95,6 +100,7 @@ public class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
|
||||
this.operator = joinOp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
this.fieldMap = null;
|
||||
@@ -116,6 +122,7 @@ public class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
|
||||
return Collections.unmodifiableMap(this.fieldMap).entrySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityFieldMap(this);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.ofbiz.entity.model.ModelField;
|
||||
public class EntityFieldValue extends EntityConditionValue implements Reusable {
|
||||
|
||||
protected static final ObjectFactory<EntityFieldValue> entityFieldValueFactory = new ObjectFactory<EntityFieldValue>() {
|
||||
@Override
|
||||
protected EntityFieldValue create() {
|
||||
return new EntityFieldValue();
|
||||
}
|
||||
@@ -55,6 +56,7 @@ public class EntityFieldValue extends EntityConditionValue implements Reusable {
|
||||
protected EntityFieldValue() {}
|
||||
|
||||
/** @deprecated Use EntityFieldValue.makeFieldValue() instead */
|
||||
@Deprecated
|
||||
public EntityFieldValue(String fieldName) {
|
||||
this.init(fieldName);
|
||||
}
|
||||
@@ -71,24 +73,29 @@ public class EntityFieldValue extends EntityConditionValue implements Reusable {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return fieldName.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityFieldValue)) return false;
|
||||
EntityFieldValue otherValue = (EntityFieldValue) obj;
|
||||
return fieldName.equals(otherValue.fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelField getModelField(ModelEntity modelEntity) {
|
||||
return getField(modelEntity, fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) {
|
||||
sql.append(getColName(tableAliases, modelEntity, fieldName, includeTableNamePrefix, datasourceInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity modelEntity) throws GenericModelException {
|
||||
ModelField field = getModelField(modelEntity);
|
||||
if (field == null) {
|
||||
@@ -96,6 +103,7 @@ public class EntityFieldValue extends EntityConditionValue implements Reusable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
@@ -107,14 +115,17 @@ public class EntityFieldValue extends EntityConditionValue implements Reusable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityFieldValue(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityFieldValue(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityConditionValue freeze() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -81,18 +81,22 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
public Integer getValue(Object value) { return value.toString().length(); }
|
||||
};
|
||||
protected static final SQLFunctionFactory<Integer, LENGTH> lengthFactory = new SQLFunctionFactory<Integer, LENGTH>() {
|
||||
@Override
|
||||
protected LENGTH create() {
|
||||
return new LENGTH();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(LENGTH function, Object value) {
|
||||
function.init(value);
|
||||
}
|
||||
};
|
||||
protected LENGTH() {}
|
||||
/** @deprecated Use EntityCondition.LENGTH() instead */
|
||||
@Deprecated
|
||||
public LENGTH(EntityConditionValue nested) { init(nested); }
|
||||
/** @deprecated Use EntityCondition.LENGTH() instead */
|
||||
@Deprecated
|
||||
public LENGTH(Object value) { init(value); }
|
||||
public void init(Object value) {
|
||||
super.init(FETCHER, SQLFunction.LENGTH, value);
|
||||
@@ -104,18 +108,22 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
public String getValue(Object value) { return value.toString().trim(); }
|
||||
};
|
||||
protected static final SQLFunctionFactory<String, TRIM> trimFactory = new SQLFunctionFactory<String, TRIM>() {
|
||||
@Override
|
||||
protected TRIM create() {
|
||||
return new TRIM();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(TRIM function, Object value) {
|
||||
function.init(value);
|
||||
}
|
||||
};
|
||||
protected TRIM() {}
|
||||
/** @deprecated Use EntityCondition.TRIM() instead */
|
||||
@Deprecated
|
||||
public TRIM(EntityConditionValue nested) { init(nested); }
|
||||
/** @deprecated Use EntityCondition.TRIM() instead */
|
||||
@Deprecated
|
||||
public TRIM(Object value) { init(value); }
|
||||
public void init(Object value) {
|
||||
super.init(FETCHER, SQLFunction.TRIM, value);
|
||||
@@ -127,18 +135,22 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
public String getValue(Object value) { return value.toString().toUpperCase(); }
|
||||
};
|
||||
protected static final SQLFunctionFactory<String, UPPER> upperFactory = new SQLFunctionFactory<String, UPPER>() {
|
||||
@Override
|
||||
protected UPPER create() {
|
||||
return new UPPER();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(UPPER function, Object value) {
|
||||
function.init(value);
|
||||
}
|
||||
};
|
||||
protected UPPER() {}
|
||||
/** @deprecated Use EntityCondition.UPPER() instead */
|
||||
@Deprecated
|
||||
public UPPER(EntityConditionValue nested) { init(nested); }
|
||||
/** @deprecated Use EntityCondition.UPPER() instead */
|
||||
@Deprecated
|
||||
public UPPER(Object value) { init(value); }
|
||||
public void init(Object value) {
|
||||
super.init(FETCHER, SQLFunction.UPPER, value);
|
||||
@@ -150,18 +162,22 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
public String getValue(Object value) { return value.toString().toLowerCase(); }
|
||||
};
|
||||
protected static final SQLFunctionFactory<String, LOWER> lowerFactory = new SQLFunctionFactory<String, LOWER>() {
|
||||
@Override
|
||||
protected LOWER create() {
|
||||
return new LOWER();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(LOWER function, Object value) {
|
||||
function.init(value);
|
||||
}
|
||||
};
|
||||
protected LOWER() {}
|
||||
/** @deprecated Use EntityCondition.LOWER() instead */
|
||||
@Deprecated
|
||||
public LOWER(EntityConditionValue nested) { init(nested); }
|
||||
/** @deprecated Use EntityCondition.LOWER() instead */
|
||||
@Deprecated
|
||||
public LOWER(Object value) { init(value); }
|
||||
public void init(Object value) {
|
||||
super.init(FETCHER, SQLFunction.LOWER, value);
|
||||
@@ -202,6 +218,7 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
this.fetcher = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityConditionValue freeze() {
|
||||
if (nested != null) {
|
||||
return new EntityFunction<T>(fetcher, function, nested.freeze()) {};
|
||||
@@ -222,10 +239,12 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
return function.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return function.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityFunction)) return false;
|
||||
EntityFunction otherFunc = (EntityFunction) obj;
|
||||
@@ -234,6 +253,7 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
(this.value != null ? value.equals(otherFunc.value) : otherFunc.value == null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceinfo) {
|
||||
sql.append(function.name()).append('(');
|
||||
if (nested != null) {
|
||||
@@ -244,6 +264,7 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
sql.append(')');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
if (nested != null) {
|
||||
visitor.acceptEntityConditionValue(nested);
|
||||
@@ -252,10 +273,12 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityFunction(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelField getModelField(ModelEntity modelEntity) {
|
||||
if (nested != null) {
|
||||
return nested.getModelField(modelEntity);
|
||||
@@ -263,12 +286,14 @@ public abstract class EntityFunction<T extends Comparable> extends EntityConditi
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity modelEntity) throws GenericModelException {
|
||||
if (nested != null) {
|
||||
nested.validateSql(modelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
Object value = nested != null ? nested.getValue(delegator, map) : this.value;
|
||||
return value != null ? fetcher.getValue(value) : null;
|
||||
|
||||
@@ -44,6 +44,7 @@ public class EntityJoinOperator extends EntityOperator<Boolean> {
|
||||
this.shortCircuitValue = shortCircuitValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) {
|
||||
sql.append('(');
|
||||
sql.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams, datasourceInfo));
|
||||
@@ -79,6 +80,7 @@ public class EntityJoinOperator extends EntityOperator<Boolean> {
|
||||
return ((EntityCondition) item).freeze();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze(Object lhs, Object rhs) {
|
||||
return EntityCondition.makeCondition(freeze(lhs), this, freeze(rhs));
|
||||
}
|
||||
@@ -99,11 +101,13 @@ public class EntityJoinOperator extends EntityOperator<Boolean> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor, Object lhs, Object rhs) {
|
||||
((EntityCondition) lhs).visit(visitor);
|
||||
visitor.visit(rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entityMatches(GenericEntity entity, Object lhs, Object rhs) {
|
||||
return entityMatches(entity, (EntityCondition) lhs, (EntityCondition) rhs);
|
||||
}
|
||||
@@ -126,6 +130,7 @@ public class EntityJoinOperator extends EntityOperator<Boolean> {
|
||||
return castBoolean(mapMatches(delegator, map, lhs, rhs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map, Object lhs, Object rhs) {
|
||||
if (((EntityCondition) lhs).mapMatches(delegator, map)) return shortCircuitValue;
|
||||
if (((EntityCondition) rhs).mapMatches(delegator, map)) return shortCircuitValue;
|
||||
@@ -145,6 +150,7 @@ public class EntityJoinOperator extends EntityOperator<Boolean> {
|
||||
return !shortCircuitValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity modelEntity, Object lhs, Object rhs) throws GenericModelException {
|
||||
validateSql(modelEntity, (EntityCondition) lhs, (EntityCondition) rhs);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,9 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
}
|
||||
|
||||
public static final EntityComparisonOperator EQUALS = new EntityComparisonOperator(ID_EQUALS, "=") {
|
||||
@Override
|
||||
public boolean compare(Comparable lhs, Object rhs) { return EntityComparisonOperator.compareEqual(lhs, rhs); }
|
||||
@Override
|
||||
protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) {
|
||||
if (rhs == null || rhs == GenericEntity.NULL_FIELD) {
|
||||
//Debug.logInfo("makeRHSWhereString: field IS NULL: " + field.getName(), module);
|
||||
@@ -91,7 +93,9 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
};
|
||||
static { register( "equals", EQUALS ); }
|
||||
public static final EntityComparisonOperator NOT_EQUAL = new EntityComparisonOperator(ID_NOT_EQUAL, "<>") {
|
||||
@Override
|
||||
public boolean compare(Comparable lhs, Object rhs) { return EntityComparisonOperator.compareNotEqual(lhs, rhs); }
|
||||
@Override
|
||||
protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) {
|
||||
if (rhs == null || rhs == GenericEntity.NULL_FIELD) {
|
||||
sb.append(" IS NOT NULL");
|
||||
@@ -104,36 +108,44 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
static { register( "not-equals", NOT_EQUAL ); }
|
||||
static { register( "notEqual", NOT_EQUAL ); }
|
||||
public static final EntityComparisonOperator LESS_THAN = new EntityComparisonOperator(ID_LESS_THAN, "<") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareLessThan(lhs, rhs); }
|
||||
};
|
||||
static { register( "less", LESS_THAN ); }
|
||||
static { register( "less-than", LESS_THAN ); }
|
||||
static { register( "lessThan", LESS_THAN ); }
|
||||
public static final EntityComparisonOperator GREATER_THAN = new EntityComparisonOperator(ID_GREATER_THAN, ">") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareGreaterThan(lhs, rhs); }
|
||||
};
|
||||
static { register( "greater", GREATER_THAN ); }
|
||||
static { register( "greater-than", GREATER_THAN ); }
|
||||
static { register( "greaterThan", GREATER_THAN ); }
|
||||
public static final EntityComparisonOperator LESS_THAN_EQUAL_TO = new EntityComparisonOperator(ID_LESS_THAN_EQUAL_TO, "<=") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareLessThanEqualTo(lhs, rhs); }
|
||||
};
|
||||
static { register( "less-equals", LESS_THAN_EQUAL_TO ); }
|
||||
static { register( "less-than-equal-to", LESS_THAN_EQUAL_TO ); }
|
||||
static { register( "lessThanEqualTo", LESS_THAN_EQUAL_TO ); }
|
||||
public static final EntityComparisonOperator GREATER_THAN_EQUAL_TO = new EntityComparisonOperator(ID_GREATER_THAN_EQUAL_TO, ">=") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareGreaterThanEqualTo(lhs, rhs); }
|
||||
};
|
||||
static { register( "greater-equals", GREATER_THAN_EQUAL_TO ); }
|
||||
static { register( "greater-than-equal-to", GREATER_THAN_EQUAL_TO ); }
|
||||
static { register( "greaterThanEqualTo", GREATER_THAN_EQUAL_TO ); }
|
||||
public static final EntityComparisonOperator IN = new EntityComparisonOperator(ID_IN, "IN") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareIn(lhs, rhs); }
|
||||
@Override
|
||||
protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { appendRHSList(entityConditionParams, sb, field, rhs); }
|
||||
};
|
||||
static { register( "in", IN ); }
|
||||
public static final EntityComparisonOperator BETWEEN = new EntityComparisonOperator(ID_BETWEEN, "BETWEEN") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return EntityComparisonOperator.compareIn(lhs, rhs); }
|
||||
@Override
|
||||
protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { appendRHSBetweenList(entityConditionParams, sb, field, rhs); }
|
||||
};
|
||||
static { register( "between", BETWEEN ); }
|
||||
@@ -144,15 +156,19 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
public static final EntityJoinOperator OR = new EntityJoinOperator(ID_OR, "OR", true);
|
||||
static { register( "or", OR ); }
|
||||
public static final EntityComparisonOperator LIKE = new EntityComparisonOperator(ID_LIKE, "LIKE") {
|
||||
@Override
|
||||
public boolean compare(Comparable lhs, Object rhs) { return EntityComparisonOperator.compareLike(lhs, rhs); }
|
||||
};
|
||||
static { register( "like", LIKE ); }
|
||||
public static final EntityComparisonOperator NOT_LIKE = new EntityComparisonOperator(ID_NOT_LIKE, "NOT LIKE") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return !EntityComparisonOperator.compareLike(lhs, rhs); }
|
||||
};
|
||||
static { register( "not-like", NOT_LIKE); }
|
||||
public static final EntityComparisonOperator NOT_IN = new EntityComparisonOperator(ID_NOT_IN, "NOT IN") {
|
||||
@Override
|
||||
public <T> boolean compare(Comparable<T> lhs, T rhs) { return !EntityComparisonOperator.compareIn(lhs, rhs); }
|
||||
@Override
|
||||
protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { appendRHSList(entityConditionParams, sb, field, rhs); }
|
||||
};
|
||||
static { register( "not-in", NOT_IN ); }
|
||||
@@ -177,15 +193,18 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
return idInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return codeString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.codeString.hashCode();
|
||||
}
|
||||
|
||||
// FIXME: CCE
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
EntityOperator otherOper = (EntityOperator) obj;
|
||||
return this.idInt == otherOper.idInt;
|
||||
@@ -253,6 +272,7 @@ public abstract class EntityOperator<T> extends EntityConditionBase {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(WILDCARD)";
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.ofbiz.entity.model.ModelEntity;
|
||||
public class EntityWhereString extends EntityCondition {
|
||||
|
||||
protected static final ObjectFactory<EntityWhereString> entityWhereStringFactory = new ObjectFactory<EntityWhereString>() {
|
||||
@Override
|
||||
protected EntityWhereString create() {
|
||||
return new EntityWhereString();
|
||||
}
|
||||
@@ -53,6 +54,7 @@ public class EntityWhereString extends EntityCondition {
|
||||
protected EntityWhereString() {}
|
||||
|
||||
/** @deprecated Use EntityCondition.makeConditionWhere() instead */
|
||||
@Deprecated
|
||||
public EntityWhereString(String sqlString) {
|
||||
init(sqlString);
|
||||
}
|
||||
@@ -65,17 +67,21 @@ public class EntityWhereString extends EntityCondition {
|
||||
this.sqlString = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
|
||||
return sqlString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCondition(ModelEntity modelEntity) throws GenericModelException {// no nothing, this is always assumed to be fine... could do funky SQL syntax checking, but hey this is a HACK anyway
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entityMatches(GenericEntity entity) {
|
||||
throw new UnsupportedOperationException("Cannot do entityMatches on a WhereString, ie no SQL evaluation in EE; Where String is: " + sqlString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map) {
|
||||
throw new UnsupportedOperationException("Cannot do mapMatches on a WhereString, ie no SQL evaluation in EE; Where String is: " + sqlString);
|
||||
}
|
||||
@@ -84,24 +90,29 @@ public class EntityWhereString extends EntityCondition {
|
||||
return sqlString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityCondition freeze() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) {
|
||||
// nothing to do here...
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(EntityConditionVisitor visitor) {
|
||||
visitor.acceptEntityWhereString(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EntityWhereString)) return false;
|
||||
EntityWhereString other = (EntityWhereString) obj;
|
||||
return equals(sqlString, other.sqlString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode(sqlString);
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ public class OrderByItem implements Comparator<GenericEntity> {
|
||||
sb.append(descending ? " DESC" : " ASC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object obj) {
|
||||
if (!(obj instanceof OrderByItem)) return false;
|
||||
OrderByItem that = (OrderByItem) obj;
|
||||
@@ -163,6 +164,7 @@ public class OrderByItem implements Comparator<GenericEntity> {
|
||||
return getValue().equals(that.getValue()) && getDescending() == that.getDescending();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getValue());
|
||||
|
||||
@@ -104,12 +104,14 @@ public class OrderByList implements Comparator<GenericEntity> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object obj) {
|
||||
if (!(obj instanceof OrderByList)) return false;
|
||||
OrderByList that = (OrderByList) obj;
|
||||
return orderByList.equals(that.orderByList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return makeOrderByString(null, false, null);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public abstract class ListFinder extends Finder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runFind(Map<String, Object> context, GenericDelegator delegator) throws GeneralException {
|
||||
String entityName = this.entityNameExdr.expandString(context);
|
||||
String useCacheStr = this.useCacheStrExdr.expandString(context);
|
||||
|
||||
@@ -65,6 +65,7 @@ public class PrimaryKeyFinder extends Finder {
|
||||
selectFieldExpanderList = EntityFinderUtil.makeSelectFieldExpanderList(entityOneElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runFind(Map<String, Object> context, GenericDelegator delegator) throws GeneralException {
|
||||
String entityName = this.entityNameExdr.expandString(context);
|
||||
|
||||
|
||||
@@ -3324,6 +3324,7 @@ public class DatabaseUtil {
|
||||
/** Comma separated list of column names in the primary tables foreign keys */
|
||||
public String fkColumnName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FK Reference from table " + fkTableName + " called " + fkName + " to PK in table " + pkTableName;
|
||||
}
|
||||
|
||||
@@ -824,6 +824,7 @@ public class SQLProcessor {
|
||||
_ind++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
this.close();
|
||||
|
||||
@@ -470,6 +470,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public ModelField getPk(int index) {
|
||||
return this.pks.get(index);
|
||||
}
|
||||
@@ -489,6 +490,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
/**
|
||||
* @deprecated Use getPkFieldsUnmodifiable instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<ModelField> getPksCopy() {
|
||||
List<ModelField> newList = FastList.newInstance();
|
||||
newList.addAll(this.pks);
|
||||
@@ -515,6 +517,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public ModelField getNopk(int index) {
|
||||
return this.nopks.get(index);
|
||||
}
|
||||
@@ -536,6 +539,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public ModelField getField(int index) {
|
||||
return this.fields.get(index);
|
||||
}
|
||||
@@ -547,6 +551,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
/**
|
||||
* @deprecated Use getFieldsUnmodifiable instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<ModelField> getFieldsCopy() {
|
||||
List<ModelField> newList = FastList.newInstance();
|
||||
newList.addAll(this.fields);
|
||||
@@ -1340,6 +1345,7 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
this.noAutoStamp = noAutoStamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ModelEntity[" + getEntityName() + "]";
|
||||
}
|
||||
|
||||
@@ -181,16 +181,19 @@ public class ModelField extends ModelChild {
|
||||
return this.validators.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
ModelField other = (ModelField) obj;
|
||||
return other.getName().equals(getName()) && other.getModelEntity() == getModelEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getModelEntity().hashCode() ^ getName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getModelEntity() + "@" + getName();
|
||||
}
|
||||
|
||||
@@ -90,11 +90,13 @@ public class ModelIndex extends ModelChild {
|
||||
|
||||
/** @deprecated
|
||||
* the main entity of this relation */
|
||||
@Deprecated
|
||||
public ModelEntity getMainEntity() {
|
||||
return getModelEntity();
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public void setMainEntity(ModelEntity mainEntity) {
|
||||
setModelEntity(mainEntity);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,15 @@ public class ModelInfo {
|
||||
}
|
||||
|
||||
public static final ModelInfo DEFAULT = new ModelInfo() {
|
||||
@Override
|
||||
public String getTitle() { return "None"; }
|
||||
@Override
|
||||
public String getAuthor() { return "None"; }
|
||||
@Override
|
||||
public String getCopyright() { return "Copyright 2001-2009 The Apache Software Foundation"; }
|
||||
@Override
|
||||
public String getVersion() { return "1.0"; }
|
||||
@Override
|
||||
public String getDescription() { return "None"; }
|
||||
};
|
||||
|
||||
|
||||
@@ -87,10 +87,12 @@ public class ModelKeyMap implements java.io.Serializable {
|
||||
return UtilMisc.toList(new ModelKeyMap(fieldName1, relFieldName1), new ModelKeyMap(fieldName2, relFieldName2), new ModelKeyMap(fieldName3, relFieldName3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.fieldName.hashCode() + this.relFieldName.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof ModelKeyMap)) return false;
|
||||
ModelKeyMap otherKeyMap = (ModelKeyMap) other;
|
||||
|
||||
@@ -149,11 +149,13 @@ public class ModelRelation extends ModelChild {
|
||||
|
||||
/** @deprecated
|
||||
* the main entity of this relation */
|
||||
@Deprecated
|
||||
public ModelEntity getMainEntity() {
|
||||
return getModelEntity();
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public void setMainEntity(ModelEntity mainEntity) {
|
||||
setModelEntity(mainEntity);
|
||||
}
|
||||
@@ -275,6 +277,7 @@ public class ModelRelation extends ModelChild {
|
||||
}
|
||||
|
||||
// FIXME: CCE
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
ModelRelation otherRel = (ModelRelation) other;
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ public class ModelViewEntity extends ModelEntity {
|
||||
}
|
||||
|
||||
/** The col-name of the Field, the alias of the field if this is on a view-entity */
|
||||
@Override
|
||||
public String getColNameOrAlias(String fieldName) {
|
||||
ModelField modelField = this.getField(fieldName);
|
||||
String fieldString = modelField.getColName();
|
||||
@@ -281,10 +282,12 @@ public class ModelViewEntity extends ModelEntity {
|
||||
return this.byConditionFinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String colNameString(String separator, String afterLast, boolean alias, ModelField... flds) {
|
||||
return colNameString(Arrays.asList(flds), separator, afterLast, alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String colNameString(List<ModelField> flds, String separator, String afterLast, boolean alias) {
|
||||
StringBuilder returnString = new StringBuilder();
|
||||
|
||||
@@ -659,6 +662,7 @@ public class ModelViewEntity extends ModelEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ModelViewEntity[" + getEntityName() + "]";
|
||||
}
|
||||
@@ -1031,10 +1035,12 @@ public class ModelViewEntity extends ModelEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return fromModelEntity.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ModelConversion)) return false;
|
||||
ModelConversion other = (ModelConversion) obj;
|
||||
@@ -1046,6 +1052,7 @@ public class ModelViewEntity extends ModelEntity {
|
||||
fieldMap.put(fromFieldName, toFieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
//return fromModelEntity.getEntityName() + ":" + fieldMap + ":" + wildcards;
|
||||
return aliasName + "(" + fromModelEntity.getEntityName() + ")";
|
||||
|
||||
@@ -36,16 +36,19 @@ public class DebugXaResource extends GenericXaResource {
|
||||
this.ex = new Exception();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit(Xid xid, boolean onePhase) throws XAException {
|
||||
TransactionUtil.debugResMap.remove(xid);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Xid : " + xid.toString() + " cleared [commit]", module);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback(Xid xid) throws XAException {
|
||||
TransactionUtil.debugResMap.remove(xid);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Xid : " + xid.toString() + " cleared [rollback]", module);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enlist() throws XAException {
|
||||
super.enlist();
|
||||
TransactionUtil.debugResMap.put(xid, this);
|
||||
|
||||
@@ -198,6 +198,7 @@ public abstract class GenericXaResource extends Thread implements XAResource {
|
||||
}
|
||||
|
||||
// thread run method
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (timeout != null) {
|
||||
|
||||
@@ -252,6 +252,7 @@ public class TransactionUtil implements Status {
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public static void rollback(boolean beganTransaction) throws GenericTransactionException {
|
||||
Debug.logWarning("WARNING: called rollback without debug/error info; it is recommended to always pass this to make otherwise tricky bugs much easier to track down.", module);
|
||||
rollback(beganTransaction, null, null);
|
||||
@@ -757,6 +758,7 @@ public class TransactionUtil implements Status {
|
||||
* Maintain the suspended transactions together with their timestamps
|
||||
*/
|
||||
private static ThreadLocal<Map<Transaction, Timestamp>> suspendedTxStartStamps = new ThreadLocal<Map<Transaction, Timestamp>>() {
|
||||
@Override
|
||||
public Map<Transaction, Timestamp> initialValue() {
|
||||
return UtilGenerics.checkMap(new ListOrderedMap());
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* A very simple class to wrap a byte array for persistence.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ByteWrapper implements Serializable {
|
||||
protected byte[] bytes;
|
||||
|
||||
|
||||
@@ -510,6 +510,7 @@ public class EntityListIterator implements ListIterator<GenericValue> {
|
||||
throw new GeneralRuntimeException("CursorListIterator currently only supports read-only access");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (!closed) {
|
||||
|
||||
Reference in New Issue
Block a user