You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/27 17:57:00 UTC
svn commit: r759234 [1/3] - in
/ofbiz/trunk/framework/entity/src/org/ofbiz/entity: ./ cache/ condition/
config/ connection/ datasource/ eca/ finder/ jdbc/ model/ test/
transaction/ util/
Author: doogie
Date: Fri Mar 27 16:56:58 2009
New Revision: 759234
URL: http://svn.apache.org/viewvc?rev=759234&view=rev
Log:
Fix lines that *only* have whitespace.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorStatement.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DebugXaResource.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/DistributedCacheClear.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataAssert.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityTypeUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java Fri Mar 27 16:56:58 2009
@@ -138,11 +138,11 @@
EntityListIterator find(String entityName, EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
throws GenericEntityException;
-
+
List<GenericValue> findList(String entityName, EntityCondition entityCondition,
Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache)
throws GenericEntityException;
-
+
int removeByAnd(String entityName, Object... fields) throws GenericEntityException;
int removeByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Fri Mar 27 16:56:58 2009
@@ -108,12 +108,12 @@
protected EntityEcaHandler<?> entityEcaHandler = null;
protected SequenceUtil sequencer = null;
protected EntityCrypto crypto = null;
-
+
/** A ThreadLocal variable to allow other methods to specify a user identifier (usually the userLoginId, though technically the Entity Engine doesn't know anything about the UserLogin entity) */
protected static ThreadLocal<List<Object>> userIdentifierStack = new ThreadLocal<List<Object>>();
/** A ThreadLocal variable to allow other methods to specify a session identifier (usually the visitId, though technically the Entity Engine doesn't know anything about the Visit entity) */
protected static ThreadLocal<List<Object>> sessionIdentifierStack = new ThreadLocal<List<Object>>();
-
+
public static GenericDelegator getGenericDelegator(String delegatorName) {
if (delegatorName == null) {
@@ -153,7 +153,7 @@
}
return curValList;
}
-
+
public static String getCurrentUserIdentifier() {
List<Object> curValList = getUserIdentifierStack();
Object curVal = curValList.size() > 0 ? curValList.get(0) : null;
@@ -163,7 +163,7 @@
return curVal.toString();
}
}
-
+
public static void pushUserIdentifier(String userIdentifier) {
if (userIdentifier == null) {
return;
@@ -171,7 +171,7 @@
List<Object> curValList = getUserIdentifierStack();
curValList.add(0, userIdentifier);
}
-
+
public static String popUserIdentifier() {
List<Object> curValList = getUserIdentifierStack();
if (curValList.size() == 0) {
@@ -180,7 +180,7 @@
return (String) curValList.remove(0);
}
}
-
+
public static void clearUserIdentifierStack() {
List<Object> curValList = getUserIdentifierStack();
curValList.clear();
@@ -194,7 +194,7 @@
}
return curValList;
}
-
+
public static String getCurrentSessionIdentifier() {
List<Object> curValList = getSessionIdentifierStack();
Object curVal = curValList.size() > 0 ? curValList.get(0) : null;
@@ -204,7 +204,7 @@
return curVal.toString();
}
}
-
+
public static void pushSessionIdentifier(String sessionIdentifier) {
if (sessionIdentifier == null) {
return;
@@ -212,7 +212,7 @@
List<Object> curValList = getSessionIdentifierStack();
curValList.add(0, sessionIdentifier);
}
-
+
public static String popSessionIdentifier() {
List<Object> curValList = getSessionIdentifierStack();
if (curValList.size() == 0) {
@@ -221,7 +221,7 @@
return (String) curValList.remove(0);
}
}
-
+
public static void clearSessionIdentifierStack() {
List<Object> curValList = getSessionIdentifierStack();
curValList.clear();
@@ -348,7 +348,7 @@
public String getDelegatorName() {
return this.delegatorName;
}
-
+
protected DelegatorInfo getDelegatorInfo() {
if (this.delegatorInfo == null) {
this.delegatorInfo = EntityConfigUtil.getDelegatorInfo(this.delegatorName);
@@ -397,7 +397,7 @@
*/
public Map<String, ModelEntity> getModelEntityMapByGroup(String groupName) throws GenericEntityException {
Set<String> entityNameSet = getModelGroupReader().getEntityNamesByGroup(groupName);
-
+
if (this.getDelegatorInfo().defaultGroupName.equals(groupName)) {
// add all entities with no group name to the Set
Set<String> allEntityNames = this.getModelReader().getEntityNames();
@@ -407,7 +407,7 @@
}
}
}
-
+
Map<String, ModelEntity> entities = FastMap.newInstance();
if (entityNameSet == null || entityNameSet.size() == 0) {
return entities;
@@ -678,13 +678,13 @@
*/
public GenericValue createSetNextSeqId(GenericValue value) throws GenericEntityException {
boolean doCacheClear = true;
-
+
GenericHelper helper = getEntityHelper(value.getEntityName());
// just make sure it is this delegator...
value.setDelegator(this);
// this will throw an IllegalArgumentException if the entity for the value does not have one pk field, or if it already has a value set for the one pk field
value.setNextSeqId();
-
+
boolean beganTransaction = false;
try {
if (alwaysUseTransaction) {
@@ -707,7 +707,7 @@
if (value != null && value.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(value, false, false);
}
-
+
try {
value = helper.create(value);
} catch (GenericEntityException e) {
@@ -718,10 +718,10 @@
throw e;
} else {
Debug.logInfo("Error creating entity record with a sequenced value [" + value.getPrimaryKey() + "], trying again about to refresh bank for entity [" + value.getEntityName() + "]", module);
-
+
// found an existing value... was probably a duplicate key, so clean things up and try again
this.sequencer.forceBankRefresh(value.getEntityName(), 1);
-
+
value.setNextSeqId();
value = helper.create(value);
Debug.logInfo("Successfully created new entity record on retry with a sequenced value [" + value.getPrimaryKey() + "], after getting refreshed bank for entity [" + value.getEntityName() + "]", module);
@@ -741,7 +741,7 @@
}
ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_CREATE, value, false);
-
+
return value;
} catch (GenericEntityException e) {
String errMsg = "Failure in create operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction.";
@@ -759,7 +759,7 @@
TransactionUtil.commit(beganTransaction);
}
}
-
+
/** Creates a Entity in the form of a GenericValue and write it to the datasource
*@param value The GenericValue to create a value in the datasource from
*@param doCacheClear boolean that specifies whether or not to automatically clear cache entries related to this operation
@@ -789,7 +789,7 @@
if (value != null && value.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(value, false, false);
}
-
+
value = helper.create(value);
if (value != null) {
@@ -805,7 +805,7 @@
}
ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_CREATE, value, false);
-
+
return value;
} catch (GenericEntityException e) {
String errMsg = "Failure in create operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction.";
@@ -934,12 +934,12 @@
}
ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_REMOVE, primaryKey, false);
-
+
// if audit log on for any fields, save old value before removing so it's still there
if (primaryKey != null && primaryKey.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(this.findOne(primaryKey.getEntityName(), primaryKey, false), true, true);
}
-
+
int num = helper.removeByPrimaryKey(primaryKey);
this.saveEntitySyncRemoveInfo(primaryKey);
@@ -995,17 +995,17 @@
}
ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_REMOVE, value, false);
-
+
// if audit log on for any fields, save old value before actual remove
if (value != null && value.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(value, true, true);
}
-
+
int num = helper.removeByPrimaryKey(value.getPrimaryKey());
this.saveEntitySyncRemoveInfo(value.getPrimaryKey());
ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_REMOVE, value, false);
-
+
return num;
} catch (GenericEntityException e) {
String errMsg = "Failure in removeValue operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction.";
@@ -1259,12 +1259,12 @@
ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_STORE, value, false);
this.encryptFields(value);
-
+
// if audit log on for any fields, save old value before the update so we still have both
if (value != null && value.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(value, true, false);
}
-
+
int retVal = helper.store(value);
// refresh the valueObject to get the new version
@@ -1273,7 +1273,7 @@
}
ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_STORE, value, false);
-
+
return retVal;
} catch (GenericEntityException e) {
String errMsg = "Failure in store operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction.";
@@ -1511,7 +1511,7 @@
return value;
}
}
-
+
boolean beganTransaction = false;
try {
if (alwaysUseTransaction) {
@@ -1545,7 +1545,7 @@
this.putInPrimaryKeyCache(primaryKey, GenericValue.NULL_VALUE);
}
}
-
+
ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, (value == null ? primaryKey : value), false);
return value;
} catch (GenericEntityException e) {
@@ -2290,7 +2290,7 @@
public List<GenericValue> findList(String entityName, EntityCondition entityCondition,
Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache)
throws GenericEntityException {
-
+
EntityEcaRuleRunner<?> ecaRunner = null;
GenericValue dummyValue = null;
if (useCache) {
@@ -2298,13 +2298,13 @@
ModelEntity modelEntity = getModelReader().getModelEntity(entityName);
dummyValue = GenericValue.create(modelEntity);
ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CHECK, EntityEcaHandler.OP_FIND, dummyValue, false);
-
+
List<GenericValue> cacheList = this.cache.get(entityName, entityCondition, orderBy);
if (cacheList != null) {
return cacheList;
}
}
-
+
boolean beganTransaction = false;
try {
if (alwaysUseTransaction) {
@@ -2315,7 +2315,7 @@
eli.setDelegator(this);
List<GenericValue> list = eli.getCompleteList();
eli.close();
-
+
if (useCache) {
ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_PUT, EntityEcaHandler.OP_FIND, dummyValue, false);
this.cache.put(entityName, entityCondition, orderBy, list);
@@ -3079,7 +3079,7 @@
}
}
}
-
+
// might be null, but will usually match the entity name
ModelEntity seqModelEntity = this.getModelEntity(seqName);
@@ -3204,7 +3204,7 @@
}
}
}
-
+
public Object encryptFieldValue(String entityName, Object fieldValue) throws EntityCryptoException {
if (fieldValue != null) {
if (fieldValue instanceof String && UtilValidate.isEmpty((String) fieldValue)) {
@@ -3226,7 +3226,7 @@
public void decryptFields(GenericEntity entity) throws GenericEntityException {
ModelEntity model = entity.getModelEntity();
String entityName = model.getEntityName();
-
+
Iterator<ModelField> i = model.getFieldsIterator();
while (i.hasNext()) {
ModelField field = i.next();
@@ -3272,24 +3272,24 @@
}
}
}
-
+
protected void createEntityAuditLogSingle(GenericValue value, ModelField mf, boolean isUpdate, boolean isRemove) throws GenericEntityException {
if (value == null || mf == null || !mf.getEnableAuditLog()) {
return;
}
-
+
GenericValue entityAuditLog = this.makeValue("EntityAuditLog");
entityAuditLog.set("auditHistorySeqId", this.getNextSeqId("EntityAuditLog"));
entityAuditLog.set("changedEntityName", value.getEntityName());
entityAuditLog.set("changedFieldName", mf.getName());
-
+
String pkCombinedValueText = value.getPkShortValueString();
if (pkCombinedValueText.length() > 250) {
// uh-oh, the string is too long!
pkCombinedValueText = pkCombinedValueText.substring(0, 250);
}
entityAuditLog.set("pkCombinedValueText", pkCombinedValueText);
-
+
GenericValue oldGv = null;
if (isUpdate) {
// it's an update, get it from the database
@@ -3313,7 +3313,7 @@
}
entityAuditLog.set("oldValueText", oldValueText);
}
-
+
if (!isRemove) {
String newValueText = null;
Object newValue = value.get(mf.getName());
@@ -3329,7 +3329,7 @@
entityAuditLog.set("changedDate", UtilDateTime.nowTimestamp());
entityAuditLog.set("changedByInfo", getCurrentUserIdentifier());
entityAuditLog.set("changedSessionInfo", getCurrentSessionIdentifier());
-
+
this.create(entityAuditLog);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Fri Mar 27 16:56:58 2009
@@ -102,16 +102,16 @@
/** This is an internal field used to specify that a value has come from a sync process and that the auto-stamps should not be over-written */
protected boolean isFromEntitySync = false;
-
+
/** Creates new GenericEntity - Should never be used, prefer the other options. */
protected GenericEntity() { }
-
+
/** Creates new GenericEntity */
public static GenericEntity createGenericEntity(ModelEntity modelEntity) {
if (modelEntity == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter");
}
-
+
GenericEntity newEntity = new GenericEntity();
newEntity.init(modelEntity);
return newEntity;
@@ -122,7 +122,7 @@
if (modelEntity == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter");
}
-
+
GenericEntity newEntity = new GenericEntity();
newEntity.init(modelEntity, fields);
return newEntity;
@@ -133,7 +133,7 @@
if (value == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null value parameter");
}
-
+
GenericEntity newEntity = new GenericEntity();
newEntity.init(value);
return newEntity;
@@ -146,7 +146,7 @@
}
this.modelEntity = modelEntity;
this.entityName = modelEntity.getEntityName();
-
+
// check some things
if (this.entityName == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null entityName in the modelEntity parameter");
@@ -161,7 +161,7 @@
this.modelEntity = modelEntity;
this.entityName = modelEntity.getEntityName();
setFields(fields);
-
+
// check some things
if (this.entityName == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null entityName in the modelEntity parameter");
@@ -179,7 +179,7 @@
this.modelEntity = modelEntity;
this.entityName = modelEntity.getEntityName();
set(modelEntity.getOnlyPk().getName(), singlePkValue);
-
+
// check some things
if (this.entityName == null) {
throw new IllegalArgumentException("Cannot create a GenericEntity with a null entityName in the modelEntity parameter");
@@ -213,7 +213,7 @@
this.mutable = true;
this.isFromEntitySync = false;
}
-
+
public void refreshFromValue(GenericEntity newValue) throws GenericEntityException {
if (newValue == null) {
throw new GenericEntityException("Could not refresh value, new value not found for: " + this);
@@ -264,7 +264,7 @@
public void setIsFromEntitySync(boolean isFromEntitySync) {
this.isFromEntitySync = isFromEntitySync;
}
-
+
public String getEntityName() {
return entityName;
}
@@ -342,7 +342,7 @@
}
return true;
}
-
+
public String getPkShortValueString() {
StringBuffer sb = new StringBuffer();
for (ModelField curPk: this.getModelEntity().getPkFieldsUnmodifiable()) {
@@ -442,13 +442,13 @@
set(name, null);
return;
}
-
+
boolean isNullString = false;
if ("null".equals(value)) {
// count this as a null too, but only for numbers and stuff, not for Strings
isNullString = true;
}
-
+
ModelField field = getModelEntity().getField(name);
if (field == null) set(name, value); // this will get an error in the set() method...
@@ -538,18 +538,18 @@
public void setBytes(String name, byte[] bytes) {
this.set(name, bytes);
}
-
+
public void setNextSeqId() {
List<String> pkFieldNameList = this.modelEntity.getPkFieldNames();
if (pkFieldNameList.size() != 1) {
throw new IllegalArgumentException("Cannot setNextSeqId for entity [" + this.getEntityName() + "] that does not have a single primary key field, instead has [" + pkFieldNameList.size() + "]");
}
-
+
String pkFieldName = pkFieldNameList.get(0);
if (this.get(pkFieldName) != null) {
// don't throw exception, too much of a pain and usually intended: throw new IllegalArgumentException("Cannot setNextSeqId, pk field [" + pkFieldName + "] of entity [" + this.getEntityName() + "] already has a value [" + this.get(pkFieldName) + "]");
}
-
+
String sequencedValue = this.getDelegator().getNextSeqId(this.getEntityName());
this.set(pkFieldName, sequencedValue);
}
@@ -705,7 +705,7 @@
}
fieldValue = null;
}
-
+
// In case of view entity try to retrieve the field heading from the real entity linked to the view
ModelEntity modelEntityToUse = this.getModelEntity();
if (modelEntityToUse instanceof ModelViewEntity) {
@@ -803,8 +803,8 @@
public void setNonPKFields(Map<? extends Object, ? extends Object> fields, boolean setIfEmpty) {
setAllFields(fields, setIfEmpty, null, Boolean.FALSE);
}
-
-
+
+
/** Intelligently sets fields on this entity from the Map of fields passed in
* @param fields The fields Map to get the values from
* @param setIfEmpty Used to specify whether empty/null values in the field Map should over-write non-empty values in this entity
@@ -825,7 +825,7 @@
} else {
iter = this.getModelEntity().getFieldsIterator();
}
-
+
while (iter != null && iter.hasNext()) {
ModelField curField = iter.next();
String fieldName = curField.getName();
@@ -835,7 +835,7 @@
} else {
sourceFieldName = curField.getName();
}
-
+
if (fields.containsKey(sourceFieldName)) {
Object field = fields.get(sourceFieldName);
@@ -1017,7 +1017,7 @@
while (modelFields.hasNext()) {
ModelField modelField = modelFields.next();
String name = modelField.getName();
-
+
String type = modelField.getType();
if (type != null && type.equals("blob")) {
Object obj = get(name);
@@ -1031,11 +1031,11 @@
}
} else {
String valueStr = this.getString(name);
-
+
if (valueStr != null) {
StringBuilder value = new StringBuilder(valueStr);
boolean needsCdata = false;
-
+
// check each character, if line-feed or carriage-return is found set needsCdata to true; also look for invalid characters
for (int i = 0; i < value.length(); i++) {
char curChar = value.charAt(i);
@@ -1049,7 +1049,7 @@
25 = tm
*
*/
-
+
switch (curChar) {
case '\'':
value.replace(i, i+1, "'");
@@ -1111,7 +1111,7 @@
}
}
}
-
+
if (needsCdata) {
// use valueStr instead of the escaped value, not needed or wanted in a CDATA block
cdataMap.put(name, valueStr);
@@ -1373,7 +1373,7 @@
public static class NullGenericEntity extends GenericEntity implements NULL {
protected NullGenericEntity() { }
-
+
public String getEntityName() {
return "[null-entity]";
}
@@ -1381,10 +1381,10 @@
return "[null-entity]";
}
}
-
+
public static class NullField implements NULL, Comparable<NullField> {
protected NullField() { }
-
+
public String toString() {
return "[null-field]";
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java Fri Mar 27 16:56:58 2009
@@ -35,9 +35,9 @@
return new GenericPK();
}
};
-
+
protected GenericPK() { }
-
+
/** Creates new GenericPK */
public static GenericPK create(ModelEntity modelEntity) {
GenericPK newPK = genericPKFactory.object();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Fri Mar 27 16:56:58 2009
@@ -53,7 +53,7 @@
return new GenericValue();
}
};
-
+
/** Map to cache various related entity collections */
public transient Map<String, List<GenericValue>> relatedCache = null;
@@ -102,7 +102,7 @@
newValue.init(primaryKey);
return newValue;
}
-
+
public void reset() {
// from GenericEntity
super.reset();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java Fri Mar 27 16:56:58 2009
@@ -44,7 +44,7 @@
return new GenericValueHtmlWrapper();
}
};
-
+
/** Creates new GenericValueHtmlWrapper from existing GenericValue */
public static GenericValueHtmlWrapper create(GenericValue value) {
GenericValueHtmlWrapper newValue = genericValueHtmlWrapperFactory.object();
@@ -76,13 +76,13 @@
return value;
}
}
-
+
// another experimental object, this one specifically for FTL
public static class GenericValueHtmlWrapperForFtl extends MapModel {
public GenericValueHtmlWrapperForFtl(GenericValue gv, BeansWrapper wrapper) {
super(gv, wrapper);
}
-
+
public TemplateModel get(String key) {
TemplateModel tm = null;
try {
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java Fri Mar 27 16:56:58 2009
@@ -55,7 +55,7 @@
Debug.logWarning("Tried to put a value of the " + entityName + " entity in the cache but this entity has never-cache set to true, not caching.", module);
return null;
}
-
+
Map<K, V> conditionCache = getOrCreateConditionCache(entityName, condition);
synchronized (conditionCache) {
return conditionCache.put(key, value);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java Fri Mar 27 16:56:58 2009
@@ -82,7 +82,7 @@
}
return oldEntity;
}
-
+
public GenericValue put(GenericPK pk, GenericValue entity) {
GenericValue oldEntity = entityCache.put(pk, entity);
if (pk.getModelEntity().getAutoClearCache()) {
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java Fri Mar 27 16:56:58 2009
@@ -47,7 +47,7 @@
// the valueList was not found for the given ordering, so grab the first one and order it in memory
Iterator<List<GenericValue>> it = conditionCache.values().iterator();
if (it.hasNext()) valueList = it.next();
-
+
synchronized (conditionCache) {
if (valueList != null) {
valueList = EntityUtil.orderBy(valueList, orderBy);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java Fri Mar 27 16:56:58 2009
@@ -43,7 +43,7 @@
* Encapsulates operations between entities and entity fields. This is a immutable class.
*/
public class EntityComparisonOperator extends EntityOperator<Boolean> {
-
+
public static final String module = EntityComparisonOperator.class.getName();
protected static PatternMatcher matcher = new Perl5Matcher();
@@ -86,13 +86,13 @@
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);
-
+
// if this is an IN operator and the rhs Object isEmpty, add "1=0" instead of the normal SQL. Note that "FALSE" does not work with all databases.
if (this.idInt == EntityOperator.ID_IN && UtilValidate.isEmpty(rhs)) {
sql.append("1=0");
return;
}
-
+
ModelField field;
if (lhs instanceof EntityConditionValue) {
EntityConditionValue ecv = (EntityConditionValue) lhs;
@@ -126,7 +126,7 @@
addValue(sql, field, rhs, entityConditionParams);
}
}
-
+
public boolean compare(Comparable lhs, Object rhs) {
throw new UnsupportedOperationException(codeString);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java Fri Mar 27 16:56:58 2009
@@ -43,7 +43,7 @@
*
*/
public abstract class EntityCondition extends EntityConditionBase implements Reusable {
-
+
public static EntityExpr makeCondition(Object lhs, EntityComparisonOperator operator, Object rhs) {
EntityExpr expr = EntityExpr.entityExprFactory.object();
expr.init(lhs, operator, rhs);
@@ -163,7 +163,7 @@
abstract public EntityCondition freeze();
abstract public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator);
-
+
public void visit(EntityConditionVisitor visitor) {
throw new IllegalArgumentException(getClass().getName() + ".visit not implemented");
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java Fri Mar 27 16:56:58 2009
@@ -85,7 +85,7 @@
return modelAlias.getColAlias();
}
}
-
+
String colName = getColName(modelField, fieldName);
if (includeTableNamePrefix && datasourceInfo != null) {
String tableName = modelEntity.getTableName(datasourceInfo);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java Fri Mar 27 16:56:58 2009
@@ -55,7 +55,7 @@
protected EntityConditionFunction(int id, String code, EntityCondition condition) {
init(id, code, condition);
}
-
+
public void init(int id, String code, EntityCondition condition) {
idInt = id;
codeString = code;
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java Fri Mar 27 16:56:58 2009
@@ -35,7 +35,7 @@
return new EntityConditionList();
}
};
-
+
protected EntityConditionList() {
super();
}
@@ -49,15 +49,15 @@
public EntityConditionList(List<T> conditionList, EntityJoinOperator operator) {
init(conditionList, operator);
}
-
+
public int getConditionListSize() {
return super.getConditionListSize();
}
-
+
public Iterator<T> getConditionIterator() {
return super.getConditionIterator();
}
-
+
public void accept(EntityConditionVisitor visitor) {
visitor.acceptEntityConditionList(this);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java Fri Mar 27 16:56:58 2009
@@ -66,19 +66,19 @@
public EntityOperator getOperator() {
return this.operator;
}
-
+
public T getCondition(int index) {
return this.conditionList.get(index);
}
-
+
protected int getConditionListSize() {
return this.conditionList.size();
}
-
+
protected Iterator<T> getConditionIterator() {
return this.conditionList.iterator();
}
-
+
public void visit(EntityConditionVisitor visitor) {
visitor.acceptEntityJoinOperator(operator, conditionList);
}
@@ -108,11 +108,11 @@
cond.encryptConditionFields(modelEntity, delegator);
}
}
-
+
public boolean equals(Object obj) {
if (!(obj instanceof EntityConditionListBase)) return false;
EntityConditionListBase other = (EntityConditionListBase) obj;
-
+
boolean isEqual = conditionList.equals(other.conditionList) && operator.equals(other.operator);
//if (!isEqual) {
// Debug.logWarning("EntityConditionListBase.equals is false:\n this.operator=" + this.operator + "; other.operator=" + other.operator +
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java Fri Mar 27 16:56:58 2009
@@ -38,9 +38,9 @@
protected String keyFieldName = null;
protected EntityCondition whereCond = null;
protected Boolean requireAll = null;
-
+
protected EntityConditionSubSelect() { }
-
+
public EntityConditionSubSelect(String entityName, String keyFieldName, EntityCondition whereCond, boolean requireAll, GenericDelegator delegator) {
this(delegator.getModelEntity(entityName), keyFieldName, whereCond, requireAll);
}
@@ -101,7 +101,7 @@
} catch (GenericEntityException e) {
String errMsg = "Could not generate sub-select SQL: " + e.toString();
Debug.logError(e, errMsg, module);
-
+
}
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java Fri Mar 27 16:56:58 2009
@@ -67,7 +67,7 @@
public void toString(StringBuilder sb) {
addSqlValue(sb, null, new ArrayList<EntityConditionParam>(), false, null);
}
-
+
public String toString() {
StringBuilder sql = new StringBuilder();
toString(sql);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java Fri Mar 27 16:56:58 2009
@@ -37,17 +37,17 @@
return new EntityDateFilterCondition();
}
};
-
+
protected String fromDateName = null;
protected String thruDateName = null;
protected EntityDateFilterCondition() {}
-
+
/** @deprecated Use EntityCondition.makeConditionDate() instead */
public EntityDateFilterCondition(String fromDateName, String thruDateName) {
init(fromDateName, thruDateName);
}
-
+
public void init(String fromDateName, String thruDateName) {
this.fromDateName = fromDateName;
this.thruDateName = thruDateName;
@@ -57,7 +57,7 @@
this.fromDateName = null;
this.thruDateName = null;
}
-
+
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
EntityCondition condition = makeCondition();
return condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Fri Mar 27 16:56:58 2009
@@ -52,7 +52,7 @@
return new EntityExpr();
}
};
-
+
private Object lhs = null;
private EntityOperator<?> operator = null;
private Object rhs = null;
@@ -98,7 +98,7 @@
throw new IllegalArgumentException("BETWEEN Operator requires a Collection with 2 elements for the right/rhs argument");
}
}
-
+
if (lhs instanceof String) {
this.lhs = EntityFieldValue.makeFieldValue((String) lhs);
} else {
@@ -106,10 +106,10 @@
}
this.operator = operator;
this.rhs = rhs;
-
+
//Debug.logInfo("new EntityExpr internal field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module);
}
-
+
public void init(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
if (lhs == null) {
throw new IllegalArgumentException("The left EntityCondition argument cannot be null");
@@ -125,7 +125,7 @@
this.operator = operator;
this.rhs = rhs;
}
-
+
public void reset() {
this.lhs = null;
this.operator = null;
@@ -164,7 +164,7 @@
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) {
// if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module);
-
+
this.checkRhsType(modelEntity, null);
StringBuilder sql = new StringBuilder();
@@ -211,7 +211,7 @@
}
}
}
-
+
public void visit(EntityConditionVisitor visitor) {
visitor.acceptEntityOperator(operator, lhs, rhs);
}
@@ -219,7 +219,7 @@
public void accept(EntityConditionVisitor visitor) {
visitor.acceptEntityExpr(this);
}
-
+
public void checkRhsType(ModelEntity modelEntity, GenericDelegator delegator) {
if (this.rhs == null || this.rhs == GenericEntity.NULL_FIELD || modelEntity == null) return;
@@ -227,20 +227,20 @@
if (this.rhs instanceof EntityFunction) {
value = ((EntityFunction) this.rhs).getOriginalValue();
}
-
+
if (value instanceof Collection) {
Collection valueCol = (Collection) value;
if (valueCol.size() > 0) {
value = valueCol.iterator().next();
}
}
-
+
if (delegator == null) {
// this will be the common case for now as the delegator isn't available where we want to do this
// we'll cheat a little here and assume the default delegator
delegator = GenericDelegator.getGenericDelegator("default");
}
-
+
String fieldName = null;
if (this.lhs instanceof EntityFieldValue) {
EntityFieldValue efv = (EntityFieldValue) this.lhs;
@@ -249,7 +249,7 @@
// nothing to check
return;
}
-
+
ModelField curField = modelEntity.getField(fieldName);
if (UtilValidate.isEmpty(curField)) {
throw new IllegalArgumentException("FieldName " + fieldName + " not found for entity: " + modelEntity.getEntityName());
@@ -263,7 +263,7 @@
if (type == null) {
throw new IllegalArgumentException("Type " + curField.getType() + " not found for entity [" + modelEntity.getEntityName() + "]; probably because there is no datasource (helper) setup for the entity group that this entity is in: [" + delegator.getEntityGroupName(modelEntity.getEntityName()) + "]");
}
-
+
// make sure the type matches the field Java type
if (!ObjectType.instanceOf(value, type.getJavaType())) {
String errMsg = "In entity field [" + modelEntity.getEntityName() + "." + curField.getName() + "] set the value passed in [" + value.getClass().getName() + "] is not compatible with the Java type of the field [" + type.getJavaType() + "]";
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java Fri Mar 27 16:56:58 2009
@@ -40,7 +40,7 @@
return new EntityFieldMap();
}
};
-
+
protected Map<String, ? extends Object> fieldMap = null;
protected EntityFieldMap() {
@@ -60,7 +60,7 @@
return list;
}
-
+
/** @deprecated Use EntityCondition.makeCondition() instead */
public EntityFieldMap(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) {
this.init(compOp, joinOp, keysValues);
@@ -80,7 +80,7 @@
public EntityFieldMap(Map<String, ? extends Object> fieldMap, EntityJoinOperator operator) {
this.init(fieldMap, EntityOperator.EQUALS, operator);
}
-
+
public void init(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) {
super.init(makeConditionList(EntityUtil.makeFields(keysValues), compOp), joinOp);
this.fieldMap = EntityUtil.makeFields(keysValues);
@@ -103,19 +103,19 @@
public Object getField(String name) {
return this.fieldMap.get(name);
}
-
+
public boolean containsField(String name) {
return this.fieldMap.containsKey(name);
}
-
+
public Iterator<String> getFieldKeyIterator() {
return Collections.unmodifiableSet(this.fieldMap.keySet()).iterator();
}
-
+
public Iterator<Map.Entry<String, Object>> getFieldEntryIterator() {
return Collections.unmodifiableMap(this.fieldMap).entrySet().iterator();
}
-
+
public void accept(EntityConditionVisitor visitor) {
visitor.acceptEntityFieldMap(this);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java Fri Mar 27 16:56:58 2009
@@ -43,9 +43,9 @@
return new EntityFieldValue();
}
};
-
+
protected String fieldName = null;
-
+
public static EntityFieldValue makeFieldValue(String fieldName) {
EntityFieldValue efv = EntityFieldValue.entityFieldValueFactory.object();
efv.init(fieldName);
@@ -53,16 +53,16 @@
}
protected EntityFieldValue() {}
-
+
/** @deprecated Use EntityFieldValue.makeFieldValue() instead */
public EntityFieldValue(String fieldName) {
this.init(fieldName);
}
-
+
public void init(String fieldName) {
this.fieldName = fieldName;
}
-
+
public void reset() {
this.fieldName = null;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java Fri Mar 27 16:56:58 2009
@@ -214,7 +214,7 @@
}
whereStringBuilder.append(')');
}
-
+
protected void appendRHSBetweenList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, Object rhs) {
if (rhs instanceof Collection) {
Iterator rhsIter = ((Collection) rhs).iterator();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java Fri Mar 27 16:56:58 2009
@@ -47,7 +47,7 @@
return new EntityWhereString();
}
};
-
+
protected String sqlString;
protected EntityWhereString() {}
@@ -56,11 +56,11 @@
public EntityWhereString(String sqlString) {
init(sqlString);
}
-
+
public void init(String sqlString) {
this.sqlString = sqlString;
}
-
+
public void reset() {
this.sqlString = null;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java Fri Mar 27 16:56:58 2009
@@ -68,7 +68,7 @@
public void addOrderBy(EntityConditionValue value, boolean descending) {
addOrderBy(new OrderByItem(value, descending));
}
-
+
public void addOrderBy(OrderByItem orderByItem) {
orderByList.add(orderByItem);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java Fri Mar 27 16:56:58 2009
@@ -38,12 +38,12 @@
public List<? extends Element> sqlLoadPaths;
public List<? extends Element> readDatas;
public Element datasourceElement;
-
+
public static final int TYPE_JNDI_JDBC = 1;
public static final int TYPE_INLINE_JDBC = 2;
public static final int TYPE_TYREX_DATA_SOURCE = 3;
public static final int TYPE_OTHER = 4;
-
+
public Element jndiJdbcElement;
public Element tyrexDataSourceElement;
public Element inlineJdbcElement;
@@ -155,7 +155,7 @@
this.alwaysUseConstraintKeyword = "true".equals(datasourceElement.getAttribute("always-use-constraint-keyword"));
this.dropFkUseForeignKeyKeyword = "true".equals(datasourceElement.getAttribute("drop-fk-use-foreign-key-keyword"));
this.useBinaryTypeForBlob = "true".equals(datasourceElement.getAttribute("use-binary-type-for-blob"));
-
+
this.tableType = datasourceElement.getAttribute("table-type");
this.characterSet = datasourceElement.getAttribute("character-set");
this.collate = datasourceElement.getAttribute("collate");
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java Fri Mar 27 16:56:58 2009
@@ -57,15 +57,15 @@
this.useDistributedCacheClear = "true".equalsIgnoreCase(element.getAttribute("distributed-cache-clear-enabled"));
this.distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name");
if (UtilValidate.isEmpty(this.distributedCacheClearClassName)) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices";
-
+
this.distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id");
if (UtilValidate.isEmpty(this.distributedCacheClearUserLoginId)) this.distributedCacheClearUserLoginId = "admin";
this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix");
-
+
this.defaultGroupName = element.getAttribute("default-group-name");
if (UtilValidate.isEmpty(this.defaultGroupName)) this.defaultGroupName = "org.ofbiz";
-
+
for (Element groupMapElement: UtilXml.childElementList(element, "group-map")) {
groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name"));
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Fri Mar 27 16:56:58 2009
@@ -38,7 +38,7 @@
*
*/
public class EntityConfigUtil {
-
+
public static final String module = EntityConfigUtil.class.getName();
public static final String ENTITY_ENGINE_XML_FILENAME = "entityengine.xml";
@@ -233,7 +233,7 @@
public static DatasourceInfo getDatasourceInfo(String name) {
return datasourceInfos.get(name);
}
-
+
public static Map<String, DatasourceInfo> getDatasourceInfos() {
return datasourceInfos;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java Fri Mar 27 16:56:58 2009
@@ -26,7 +26,7 @@
*/
public class FieldTypeInfo extends NamedInfo {
public Element resourceElement;
-
+
public FieldTypeInfo(Element element) {
super(element);
resourceElement = element;
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Fri Mar 27 16:56:58 2009
@@ -90,7 +90,7 @@
// wrap it with a LocalXAConnectionFactory
XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf);
-
+
// configure the pool settings
GenericObjectPool pool = new GenericObjectPool();
pool.setTimeBetweenEvictionRunsMillis(600000);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java Fri Mar 27 16:56:58 2009
@@ -38,7 +38,7 @@
* MinervaConnectionFactory - Central source for Minerva JDBC Objects
*/
public class MinervaConnectionFactory implements ConnectionFactoryInterface {
-
+
public static final String module = MinervaConnectionFactory.class.getName();
protected static Map<String, XAPoolDataSource> dsCache = FastMap.newInstance();
@@ -47,7 +47,7 @@
if (pds != null) {
return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
}
-
+
synchronized (MinervaConnectionFactory.class) {
pds = dsCache.get(helperName);
if (pds != null) {
@@ -61,10 +61,10 @@
if (ds == null)
throw new GenericEntityException("XADataSource was not created, big problem!");
-
+
ds.setDriver(jotmJdbcElement.getAttribute("jdbc-driver"));
ds.setURL(jotmJdbcElement.getAttribute("jdbc-uri"));
-
+
String transIso = jotmJdbcElement.getAttribute("isolation-level");
if (transIso != null && transIso.length() > 0) {
if ("Serializable".equals(transIso)) {
@@ -79,15 +79,15 @@
pds.setTransactionIsolation(Connection.TRANSACTION_NONE);
}
}
-
+
// set the datasource in the pool
pds.setDataSource(ds);
pds.setJDBCUser(jotmJdbcElement.getAttribute("jdbc-username"));
pds.setJDBCPassword(jotmJdbcElement.getAttribute("jdbc-password"));
-
+
// set the transaction manager in the pool
pds.setTransactionManager(TransactionFactory.getTransactionManager());
-
+
// configure the pool settings
try {
pds.setMaxSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize")));
@@ -107,14 +107,14 @@
Debug.logError(e, "Problems with pool settings", module);
pds.setMinSize(2);
}
-
+
// cache the pool
dsCache.put(helperName, pds);
-
+
return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
}
}
-
+
public void closeAll() {
for (String helperName: dsCache.keySet()) {
XAPoolDataSource pds = dsCache.remove(helperName);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java Fri Mar 27 16:56:58 2009
@@ -84,7 +84,7 @@
return null;
}
-
+
public static void closeAll() {
Set cacheKeys = dsCache.keySet();
Iterator i = cacheKeys.iterator();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java Fri Mar 27 16:56:58 2009
@@ -37,27 +37,27 @@
* JotmFactory - Central source for JOTM JDBC Objects
*/
public class XaPoolConnectionFactory {
-
+
public static final String module = XaPoolConnectionFactory.class.getName();
-
+
protected static Map dsCache = new HashMap();
-
+
public static Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException {
StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.get(helperName);
if (pds != null) {
if (Debug.verboseOn()) Debug.logVerbose(helperName + " pool size: " + pds.pool.getCount(), module);
return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
}
-
+
synchronized (XaPoolConnectionFactory.class) {
pds = (StandardXAPoolDataSource) dsCache.get(helperName);
if (pds != null) {
return pds.getConnection();
}
-
+
// the xapool wrapper class
String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class");
-
+
StandardXADataSource ds = null;
try {
//ds = new StandardXADataSource();
@@ -72,17 +72,17 @@
} catch (IllegalAccessException e) {
throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);
}
-
+
if (ds == null)
throw new GenericEntityException("StandardXaDataSource was not created, big problem!");
-
+
ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver"));
ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri"));
ds.setUser(jotmJdbcElement.getAttribute("jdbc-username"));
ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password"));
ds.setDescription(helperName);
ds.setTransactionManager(TransactionFactory.getTransactionManager());
-
+
String transIso = jotmJdbcElement.getAttribute("isolation-level");
if (transIso != null && transIso.length() > 0) {
if ("Serializable".equals(transIso)) {
@@ -97,17 +97,17 @@
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
}
}
-
+
// set the datasource in the pool
pds.setDataSource(ds);
pds.setDescription(ds.getDescription());
pds.setUser(ds.getUser());
pds.setPassword(ds.getPassword());
Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);
-
+
// set the transaction manager in the pool
pds.setTransactionManager(TransactionFactory.getTransactionManager());
-
+
// configure the pool settings
try {
pds.setMaxSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize")));
@@ -116,7 +116,7 @@
pds.setLifeTime(Long.parseLong(jotmJdbcElement.getAttribute("pool-lifetime")));
pds.setDeadLockMaxWait(Long.parseLong(jotmJdbcElement.getAttribute("pool-deadlock-maxwait")));
pds.setDeadLockRetryWait(Long.parseLong(jotmJdbcElement.getAttribute("pool-deadlock-retrywait")));
-
+
// set the test statement to test connections
String testStmt = jotmJdbcElement.getAttribute("pool-jdbc-test-stmt");
if (testStmt != null && testStmt.length() > 0) {
@@ -128,14 +128,14 @@
} catch (Exception e) {
Debug.logError(e, "Problems with pool settings", module);
}
-
+
// cache the pool
dsCache.put(helperName, pds);
-
+
return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
}
}
-
+
public static void closeAll() {
Set cacheKeys = dsCache.keySet();
Iterator i = cacheKeys.iterator();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Fri Mar 27 16:56:58 2009
@@ -882,7 +882,7 @@
// put this inside an if statement so that we don't have to generate the string when not used...
Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module);
}
-
+
boolean isGroupBy = false;
ModelViewEntity modelViewEntity = null;
String groupByString = null;
@@ -893,14 +893,14 @@
isGroupBy = true;
}
}
-
+
// To get a count of the rows that will be returned when there is a GROUP BY, must do something like:
// SELECT COUNT(1) FROM (SELECT COUNT(1) FROM OFBIZ.POSTAL_ADDRESS PA GROUP BY PA.CITY) TEMP_NAME
// instead of a simple:
// SELECT COUNT(1) FROM OFBIZ.POSTAL_ADDRESS PA GROUP BY PA.CITY
StringBuilder sqlBuffer = new StringBuilder("SELECT ");
-
+
if (isGroupBy) {
sqlBuffer.append("COUNT(1) FROM (SELECT ");
}
@@ -961,7 +961,7 @@
sqlBuffer.append(" HAVING ");
sqlBuffer.append(entityCondHavingString);
}
-
+
if (isGroupBy) {
sqlBuffer.append(") TEMP_NAME");
}
@@ -998,7 +998,7 @@
count = resultSet.getLong(1);
}
return count;
-
+
} catch (SQLException e) {
throw new GenericDataSourceException("Error getting count value", e);
} finally {
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java Fri Mar 27 16:56:58 2009
@@ -30,7 +30,7 @@
*
*/
public class GenericHelperFactory {
-
+
public static final String module = GenericHelperFactory.class.getName();
// protected static UtilCache helperCache = new UtilCache("entity.GenericHelpers", 0, 0);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java Fri Mar 27 16:56:58 2009
@@ -26,19 +26,19 @@
*
*/
public interface EntityEcaHandler<T> {
-
+
public static final String EV_VALIDATE = "validate";
public static final String EV_RUN = "run";
public static final String EV_RETURN = "return";
public static final String EV_CACHE_CLEAR = "cache-clear";
public static final String EV_CACHE_CHECK = "cache-check";
public static final String EV_CACHE_PUT = "cache-put";
-
+
public static final String OP_CREATE = "create";
public static final String OP_STORE = "store";
public static final String OP_REMOVE = "remove";
public static final String OP_FIND = "find";
-
+
public void setDelegator(GenericDelegator delegator);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java Fri Mar 27 16:56:58 2009
@@ -35,14 +35,14 @@
*
*/
public class ByAndFinder extends ListFinder {
-
+
public static final String module = ByAndFinder.class.getName();
-
+
protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
public ByAndFinder(Element element) {
super(element, "and");
-
+
// process field-map
this.fieldMap = EntityFinderUtil.makeFieldMap(element);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Fri Mar 27 16:56:58 2009
@@ -59,9 +59,9 @@
*
*/
public class EntityFinderUtil {
-
+
public static final String module = EntityFinderUtil.class.getName();
-
+
public static Map<FlexibleMapAccessor<Object>, Object> makeFieldMap(Element element) {
Map<FlexibleMapAccessor<Object>, Object> fieldMap = null;
List<? extends Element> fieldMapElementList = UtilXml.childElementList(element, "field-map");
@@ -114,7 +114,7 @@
}
}
}
-
+
public static List<FlexibleStringExpander> makeSelectFieldExpanderList(Element element) {
List<FlexibleStringExpander> selectFieldExpanderList = null;
List<? extends Element> selectFieldElementList = UtilXml.childElementList(element, "select-field");
@@ -126,7 +126,7 @@
}
return selectFieldExpanderList;
}
-
+
public static Set<String> makeFieldsToSelect(List<FlexibleStringExpander> selectFieldExpanderList, Map<String, Object> context) {
Set<String> fieldsToSelect = null;
if (UtilValidate.isNotEmpty(selectFieldExpanderList)) {
@@ -137,7 +137,7 @@
}
return fieldsToSelect;
}
-
+
public static List<String> makeOrderByFieldList(List<FlexibleStringExpander> orderByExpanderList, Map<String, Object> context) {
List<String> orderByFields = null;
if (UtilValidate.isNotEmpty(orderByExpanderList)) {
@@ -148,7 +148,7 @@
}
return orderByFields;
}
-
+
public static interface Condition extends Serializable {
public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator);
}
@@ -161,7 +161,7 @@
protected boolean ignoreIfNull;
protected boolean ignoreIfEmpty;
protected boolean ignoreCase;
-
+
public ConditionExpr(Element conditionExprElement) {
this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("field-name"));
if (this.fieldNameExdr.isEmpty()) {
@@ -181,15 +181,15 @@
this.ignoreCase = "true".equals(conditionExprElement.getAttribute("ignore-case"));
this.ignoreExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("ignore"));
}
-
+
public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
ModelEntity modelEntity = delegator.getModelEntity(entityName);
if (modelEntity == null) {
throw new IllegalArgumentException("Error in Entity Find: could not find entity with name [" + entityName + "]");
}
-
+
String fieldName = fieldNameExdr.expandString(context);
-
+
Object value = null;
// start with the environment variable, will override if exists and a value is specified
if (envNameAcsr != null) {
@@ -219,14 +219,14 @@
value = StringUtil.split((String)value, delim);
}
}
-
+
// don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection
if (!((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN)
&& value instanceof Collection)) {
// now to a type conversion for the target fieldName
value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context);
}
-
+
if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module);
if (this.ignoreIfNull && value == null) {
@@ -239,7 +239,7 @@
if ("true".equals(this.ignoreExdr.expandString(context))) {
return null;
}
-
+
if (operator == EntityOperator.NOT_EQUAL && value != null) {
// since some databases don't consider nulls in != comparisons, explicitly include them
// this makes more sense logically, but if anyone ever needs it to not behave this way we should add an "or-null" attribute that is true by default
@@ -264,14 +264,14 @@
}
}
}
-
+
public static class ConditionList implements Condition {
List<Condition> conditionList = new LinkedList<Condition>();
FlexibleStringExpander combineExdr;
-
+
public ConditionList(Element conditionListElement) {
this.combineExdr = FlexibleStringExpander.getInstance(conditionListElement.getAttribute("combine"));
-
+
List<? extends Element> subElements = UtilXml.childElementList(conditionListElement);
for (Element subElement: subElements) {
if ("condition-expr".equals(subElement.getNodeName())) {
@@ -285,7 +285,7 @@
}
}
}
-
+
public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
if (this.conditionList.size() == 0) {
return null;
@@ -294,7 +294,7 @@
Condition condition = this.conditionList.get(0);
return condition.createCondition(context, entityName, delegator);
}
-
+
List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>();
for (Condition curCondition: conditionList) {
EntityCondition econd = curCondition.createCondition(context, entityName, delegator);
@@ -302,19 +302,19 @@
entityConditionList.add(econd);
}
}
-
+
String operatorName = combineExdr.expandString(context);
EntityOperator operator = EntityOperator.lookup(operatorName);
if (operator == null) {
throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName);
}
-
+
return EntityCondition.makeCondition(entityConditionList, (EntityJoinOperator) operator);
}
}
public static class ConditionObject implements Condition {
protected FlexibleMapAccessor<Object> fieldNameAcsr;
-
+
public ConditionObject(Element conditionExprElement) {
this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field-name"));
if (this.fieldNameAcsr.isEmpty()) {
@@ -322,13 +322,13 @@
this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("name"));
}
}
-
+
public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
EntityCondition condition = (EntityCondition) fieldNameAcsr.get(context);
return condition;
}
}
-
+
public static interface OutputHandler extends Serializable {
public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr);
public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr);
@@ -336,12 +336,12 @@
public static class LimitRange implements OutputHandler {
FlexibleStringExpander startExdr;
FlexibleStringExpander sizeExdr;
-
+
public LimitRange(Element limitRangeElement) {
this.startExdr = FlexibleStringExpander.getInstance(limitRangeElement.getAttribute("start"));
this.sizeExdr = FlexibleStringExpander.getInstance(limitRangeElement.getAttribute("size"));
}
-
+
int getStart(Map<String, Object> context) {
String startStr = this.startExdr.expandString(context);
try {
@@ -352,7 +352,7 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
int getSize(Map<String, Object> context) {
String sizeStr = this.sizeExdr.expandString(context);
try {
@@ -363,7 +363,7 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
int start = getStart(context);
int size = getSize(context);
@@ -380,22 +380,22 @@
public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
int start = getStart(context);
int size = getSize(context);
-
+
int end = start + size;
if (end > results.size()) end = results.size();
-
+
listAcsr.put(context, results.subList(start, end));
}
}
public static class LimitView implements OutputHandler {
FlexibleStringExpander viewIndexExdr;
FlexibleStringExpander viewSizeExdr;
-
+
public LimitView(Element limitViewElement) {
this.viewIndexExdr = FlexibleStringExpander.getInstance(limitViewElement.getAttribute("view-index"));
this.viewSizeExdr = FlexibleStringExpander.getInstance(limitViewElement.getAttribute("view-size"));
}
-
+
int getIndex(Map<String, Object> context) {
String viewIndexStr = this.viewIndexExdr.expandString(context);
try {
@@ -406,7 +406,7 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
int getSize(Map<String, Object> context) {
String viewSizeStr = this.viewSizeExdr.expandString(context);
try {
@@ -417,11 +417,11 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
int index = this.getIndex(context);
int size = this.getSize(context);
-
+
try {
listAcsr.put(context, eli.getPartialList(((index - 1) * size) + 1, size));
eli.close();
@@ -435,11 +435,11 @@
public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
int index = this.getIndex(context);
int size = this.getSize(context);
-
+
int begin = index * size;
int end = index * size + size;
if (end > results.size()) end = results.size();
-
+
listAcsr.put(context, results.subList(begin, end));
}
}
@@ -447,7 +447,7 @@
public UseIterator(Element useIteratorElement) {
// no parameters, nothing to do
}
-
+
public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
listAcsr.put(context, eli);
}
@@ -460,7 +460,7 @@
public GetAll() {
// no parameters, nothing to do
}
-
+
public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) {
try {
listAcsr.put(context, eli.getCompleteList());
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java?rev=759234&r1=759233&r2=759234&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java Fri Mar 27 16:56:58 2009
@@ -34,7 +34,7 @@
this.entityNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("entity-name"));
this.useCacheStrExdr = FlexibleStringExpander.getInstance(element.getAttribute("use-cache"));
}
-
+
public String getEntityName() {
String entName = this.entityNameExdr.getOriginal();
// if there is expansion syntax