Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java Fri Mar 27 16:56:58 2009 @@ -61,13 +61,13 @@ public static final String module = ListFinder.class.getName(); protected String label; - + protected FlexibleStringExpander filterByDateStrExdr; protected FlexibleStringExpander distinctStrExdr; protected FlexibleStringExpander delegatorNameExdr; protected FlexibleMapAccessor<Object> listAcsr; protected FlexibleStringExpander resultSetTypeExdr; - + protected List<FlexibleStringExpander> selectFieldExpanderList; protected List<FlexibleStringExpander> orderByExpanderList; protected OutputHandler outputHandler; @@ -88,7 +88,7 @@ // process select-field selectFieldExpanderList = EntityFinderUtil.makeSelectFieldExpanderList(element); - + // process order-by List<? extends Element> orderByElementList = UtilXml.childElementList(element, "order-by"); if (orderByElementList.size() > 0) { @@ -125,18 +125,18 @@ String delegatorName = this.delegatorNameExdr.expandString(context); ModelEntity modelEntity = delegator.getModelEntity(entityName); String resultSetTypeString = this.resultSetTypeExdr.expandString(context); - + if (modelEntity == null) { throw new IllegalArgumentException("In find entity by " + label + " could not find definition for entity with name [" + entityName + "]."); } - + boolean useCache = "true".equals(useCacheStr); boolean filterByDate = "true".equals(filterByDateStr); boolean distinct = "true".equals(distinctStr); int resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; if ("forward".equals(resultSetTypeString)) resultSetType = ResultSet.TYPE_FORWARD_ONLY; - + if (delegatorName != null && delegatorName.length() > 0) { delegator = GenericDelegator.getGenericDelegator(delegatorName); } @@ -156,8 +156,8 @@ throw new IllegalArgumentException("In find entity by " + label + " cannot have use-cache set to true and specify a having-condition-list (can only use a where condition with condition-expr or condition-list)."); } } - - + + // get the list of fieldsToSelect from selectFieldExpanderList Set<String> fieldsToSelect = EntityFinderUtil.makeFieldsToSelect(selectFieldExpanderList, context); @@ -168,7 +168,7 @@ // get the list of orderByFields from orderByExpanderList List<String> orderByFields = EntityFinderUtil.makeOrderByFieldList(this.orderByExpanderList, context); - + try { // if filterByDate, do a date filter on the results based on the now-timestamp if (filterByDate) { @@ -179,7 +179,7 @@ whereEntityCondition = filterByDateCondition; } } - + if (useCache) { List<GenericValue> results = delegator.findList(entityName, whereEntityCondition, fieldsToSelect, orderByFields, null, true); this.outputHandler.handleOutput(results, context, listAcsr); @@ -190,7 +190,7 @@ Debug.logError(newE, "ERROR: Cannot do a by " + label + " find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.", module); useTransaction = false; } - + EntityFindOptions options = new EntityFindOptions(); options.setDistinct(distinct); options.setResultSetType(resultSetType); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java Fri Mar 27 16:56:58 2009 @@ -43,7 +43,7 @@ */ public class PrimaryKeyFinder extends Finder { public static final String module = PrimaryKeyFinder.class.getName(); - + protected FlexibleMapAccessor<Object> valueNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; protected Map<FlexibleMapAccessor<Object>, Object> fieldMap; @@ -67,7 +67,7 @@ public void runFind(Map<String, Object> context, GenericDelegator delegator) throws GeneralException { String entityName = this.entityNameExdr.expandString(context); - + String useCacheString = this.useCacheStrExdr.expandString(context); // default to false boolean useCacheBool = "true".equals(useCacheString); @@ -78,7 +78,7 @@ ModelEntity modelEntity = delegator.getModelEntity(entityName); GenericValue valueOut = runFind(modelEntity, context, delegator, useCacheBool, autoFieldMapBool, this.fieldMap, this.selectFieldExpanderList); - + //Debug.logInfo("PrimaryKeyFinder: valueOut=" + valueOut, module); //Debug.logInfo("PrimaryKeyFinder: going into=" + this.valueNameAcsr.getOriginalName(), module); if (!valueNameAcsr.isEmpty()) { @@ -89,10 +89,10 @@ } } } - + public static GenericValue runFind(ModelEntity modelEntity, Map<String, Object> context, GenericDelegator delegator, boolean useCache, boolean autoFieldMap, Map<FlexibleMapAccessor<Object>, Object> fieldMap, List<FlexibleStringExpander> selectFieldExpanderList) throws GeneralException { - + // assemble the field map Map<String, Object> entityContext = FastMap.newInstance(); if (autoFieldMap) { @@ -113,15 +113,15 @@ //Debug.logInfo("PrimaryKeyFinder: entityContext=" + entityContext, module); // then convert the types... modelEntity.convertFieldMapInPlace(entityContext, delegator); - + // get the list of fieldsToSelect from selectFieldExpanderList Set<String> fieldsToSelect = EntityFinderUtil.makeFieldsToSelect(selectFieldExpanderList, context); - + //if fieldsToSelect != null and useCacheBool is true, throw an error if (fieldsToSelect != null && useCache) { throw new IllegalArgumentException("Error in entity-one definition, cannot specify select-field elements when use-cache is set to true"); } - + try { GenericValue valueOut = null; GenericPK entityPK = delegator.makePK(modelEntity.getEntityName(), entityContext); @@ -140,7 +140,7 @@ } else { if (Debug.infoOn()) Debug.logInfo("Returning null because found incomplete primary key in find: " + entityPK, module); } - + return valueOut; } catch (GenericEntityException e) { String errMsg = "Error finding entity value by primary key with entity-one: " + e.toString(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java Fri Mar 27 16:56:58 2009 @@ -25,7 +25,7 @@ import java.lang.reflect.Proxy; public abstract class AbstractCursorHandler implements InvocationHandler { - + protected String cursorName; protected int fetchSize; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorStatement.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorStatement.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorStatement.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorStatement.java Fri Mar 27 16:56:58 2009 @@ -29,7 +29,7 @@ public class CursorStatement extends AbstractCursorHandler { - + protected ResultSet currentResultSet; protected Statement stmt; protected boolean beganTransaction; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Fri Mar 27 16:56:58 2009 @@ -583,7 +583,7 @@ } if (Debug.infoOn()) Debug.logInfo("Created " + numIndicesCreated + " indices", module); } - + if (datasourceInfo.checkIndicesOnStart) { int numIndicesCreated = 0; // TODO: check each key-map to make sure it exists in the index, if any differences warn and then remove the index and recreate it @@ -665,10 +665,10 @@ } } if (Debug.infoOn()) Debug.logInfo("Created " + numIndicesCreated + " indices", module); - + } - + timer.timerString("Finished Checking Entity Database"); } @@ -1326,7 +1326,7 @@ pkCount += checkPrimaryKeyInfo(rsPks, lookupSchemaName, needsUpperCase, colInfo, messages); } } - + Debug.logInfo("Reviewed " + pkCount + " primary key fields from database.", module); } } catch (SQLException e) { @@ -1349,7 +1349,7 @@ } } } - + public int checkPrimaryKeyInfo(ResultSet rsPks, String lookupSchemaName, boolean needsUpperCase, Map<String, Map<String, ColumnCheckInfo>> colInfo, Collection<String> messages) throws SQLException { int pkCount = 0; try { @@ -1372,11 +1372,11 @@ Debug.logWarning("Got primary key information for a column that we didn't get column information for: tableName=[" + tableName + "], columnName=[" + columnName + "]", module); continue; } - - + + // KEY_SEQ short => sequence number within primary key // PK_NAME String => primary key name (may be null) - + ccInfo.isPk = true; ccInfo.pkSeq = rsPks.getShort("KEY_SEQ"); ccInfo.pkName = rsPks.getString("PK_NAME"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java Fri Mar 27 16:56:58 2009 @@ -44,7 +44,7 @@ /** Module Name Used for debugging */ public static final String module = SQLProcessor.class.getName(); - + /** Used for testing connections when test is enabled */ public static List<String> CONNECTION_TEST_LIST = new ArrayList<String>(); public static int MAX_CONNECTIONS = 1000; @@ -64,7 +64,7 @@ // / The database resources to be used private ResultSet _rs = null; - + private ResultSetMetaData _rsmd = null; // / The SQL String used. Use for debugging only @@ -78,10 +78,10 @@ // / true in case the connection shall be closed. private boolean _bDeleteConnection = false; - + private Map<String, String> _needClobWorkAroundWrite = null; private Map<String, String> _needBlobWorkAroundWrite = null; - + /** * Construct an object based on the helper/datasource * @@ -108,7 +108,7 @@ _manualTX = false; } } - + ResultSetMetaData getResultSetMetaData() { if (_rsmd == null) { // try the ResultSet, if not null, or try the PreparedStatement, also if not null @@ -135,7 +135,7 @@ if (_connection == null) { return; } - + if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:commit() _manualTX=" + _manualTX, module); if (_manualTX) { @@ -161,7 +161,7 @@ if (_connection == null) { return; } - + if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:rollback() _manualTX=" + _manualTX, module); try { @@ -269,7 +269,7 @@ // test the connection testConnection(_connection); - + /* causes problems w/ postgres ?? if (Debug.verboseOn()) { int isoLevel = -999; @@ -291,7 +291,7 @@ } } */ - + // always try to set auto commit to false, but if we can't then later on we won't commit try { if (_connection.getAutoCommit()) { @@ -318,7 +318,7 @@ } if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.getConnection] : con=" + _connection, module); - + _bDeleteConnection = true; return _connection; } @@ -781,7 +781,7 @@ ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(field); oos.close(); - + byte[] buf = os.toByteArray(); os.close(); ByteArrayInputStream is = new ByteArrayInputStream(buf); @@ -801,7 +801,7 @@ _ind++; } - + /** * Set the next binding variable of the currently active prepared statement * to write the serialized data of 'field' to a Blob with the given bytes. @@ -832,7 +832,7 @@ } super.finalize(); } - + protected void testConnection(Connection con) throws GenericEntityException { if (SQLProcessor.ENABLE_TEST) { if (SQLProcessor.CONNECTION_TEST_LIST.contains(con.toString())) { @@ -864,10 +864,10 @@ stmt.setFetchSize(fetchSize); } } - + private void checkLockWaitInfo(Exception sqle) { String eMsg = sqle.getMessage(); - + // see if there is a lock wait timeout error, if so try to get and print more info about it // the string for Derby is "A lock could not be obtained within the time requested" // the string for MySQL is "Lock wait timeout exceeded; try restarting transaction" Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Fri Mar 27 16:56:58 2009 @@ -69,7 +69,7 @@ */ public class SqlJdbcUtil { public static final String module = GenericDAO.class.getName(); - + public static final int CHAR_BUFFER_SIZE = 4096; /** Makes the FROM clause and when necessary the JOIN clause(s) as well */ @@ -162,7 +162,7 @@ if (condBuffer.length() > 0) { condBuffer.append(" AND "); } - + condBuffer.append(viewLink.getEntityAlias()); condBuffer.append("."); condBuffer.append(filterColName(linkField.getColName())); @@ -497,20 +497,20 @@ int typeValue = getType(fieldType); ResultSetMetaData rsmd = rs.getMetaData(); int colType = rsmd.getColumnType(ind); - + if (typeValue <= 4 || typeValue >= 11) { switch (typeValue) { case 1: if (java.sql.Types.CLOB == colType) { // Debug.logInfo("For field " + curField.getName() + " of entity " + entity.getEntityName() + " getString is a CLOB, trying getCharacterStream", module); // if the String is empty, try to get a text input stream, this is required for some databases for larger fields, like CLOBs - + Clob valueClob = rs.getClob(ind); Reader valueReader = null; if (valueClob != null) { valueReader = valueClob.getCharacterStream(); } - + //Reader valueReader = rs.getCharacterStream(ind); if (valueReader != null) { char[] inCharBuffer = new char[CHAR_BUFFER_SIZE]; @@ -551,7 +551,7 @@ byte[] originalBytes = rs.getBytes(ind); obj = deserializeField(originalBytes, ind, curField); - + if (obj != null) { entity.dangerousSetNoCheckButFast(curField, obj); } else { @@ -570,7 +570,7 @@ fieldBytes = rs.getBytes(ind); originalObject = fieldBytes; } - + if (originalObject != null) { // for backward compatibility, check to see if there is a serialized object and if so return that Object blobObject = deserializeField(fieldBytes, ind, curField); @@ -585,7 +585,7 @@ } } } - + break; case 13: entity.dangerousSetNoCheckButFast(curField, new SerialClob(rs.getClob(ind))); @@ -656,7 +656,7 @@ throw new GenericDataSourceException("SQL Exception while getting value : " + curField.getName() + " [" + curField.getColName() + "] (" + ind + ")", sqle); } } - + private static Object deserializeField(byte[] fieldBytes, int ind, ModelField curField) throws GenericDataSourceException { // NOTE DEJ20071022: the following code is to convert the byte[] back into an object; if that fails //just return the byte[]; this was for the ByteWrapper thing which is now deprecated, so this may @@ -697,7 +697,7 @@ } } } - + return null; } @@ -714,7 +714,7 @@ throw new GenericModelException("GenericDAO.getValue: definition fieldType " + modelField.getType() + " not found, cannot setValue for field " + entityName + "." + modelField.getName() + "."); } - + // if the value is the GenericEntity.NullField, treat as null if (fieldValue == GenericEntity.NULL_FIELD) { fieldValue = null; @@ -843,16 +843,16 @@ fieldTypeMap.put("BigDecimal", 9); fieldTypeMap.put("java.lang.Boolean", 10); fieldTypeMap.put("Boolean", 10); - + fieldTypeMap.put("java.lang.Object", 11); fieldTypeMap.put("Object", 11); - + fieldTypeMap.put("java.sql.Blob", 12); fieldTypeMap.put("Blob", 12); fieldTypeMap.put("byte[]", 12); fieldTypeMap.put("java.nio.ByteBuffer", 12); fieldTypeMap.put("java.nio.HeapByteBuffer", 12); - + fieldTypeMap.put("java.sql.Clob", 13); fieldTypeMap.put("Clob", 13); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java Fri Mar 27 16:56:58 2009 @@ -53,7 +53,7 @@ /** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */ protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<String, ModelMemberEntity>(); - + /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */ protected List<ModelAliasAll> aliasAlls = new ArrayList<ModelAliasAll>(); @@ -62,28 +62,28 @@ /** List of view links to define how entities are connected (or "joined") */ protected List<ModelViewLink> viewLinks = new ArrayList<ModelViewLink>(); - + /** relations defining relationships between this entity and other entities */ protected List<ModelRelation> relations = new ArrayList<ModelRelation>(); - + public DynamicViewEntity() { } - + public ModelViewEntity makeModelViewEntity(GenericDelegator delegator) { ModelViewEntity modelViewEntity = new ModelViewEntity(this, delegator.getModelReader()); return modelViewEntity; } - + public String getOneRealEntityName() { // return first entity name for memberModelMemberEntities Map if (this.memberModelMemberEntities.size() == 0) { return null; } - + ModelMemberEntity modelMemberEntity = this.memberModelMemberEntities.entrySet().iterator().next().getValue(); return modelMemberEntity.getEntityName(); } - + /** Getter for property entityName. * @return Value of property entityName. * @@ -91,7 +91,7 @@ public String getEntityName() { return entityName; } - + /** Setter for property entityName. * @param entityName New value of property entityName. * @@ -99,7 +99,7 @@ public void setEntityName(String entityName) { this.entityName = entityName; } - + /** Getter for property packageName. * @return Value of property packageName. * @@ -107,7 +107,7 @@ public String getPackageName() { return packageName; } - + /** Setter for property packageName. * @param packageName New value of property packageName. * @@ -115,7 +115,7 @@ public void setPackageName(String packageName) { this.packageName = packageName; } - + /** Getter for property defaultResourceName. * @return Value of property defaultResourceName. * @@ -123,7 +123,7 @@ public String getDefaultResourceName() { return defaultResourceName; } - + /** Setter for property defaultResourceName. * @param defaultResourceName New value of property defaultResourceName. * @@ -131,7 +131,7 @@ public void setDefaultResourceName(String defaultResourceName) { this.defaultResourceName = defaultResourceName; } - + /** Getter for property title. * @return Value of property title. * @@ -139,7 +139,7 @@ public String getTitle() { return title; } - + /** Setter for property title. * @param title New value of property title. * @@ -152,20 +152,20 @@ ModelMemberEntity modelMemberEntity = new ModelMemberEntity(entityAlias, entityName); this.memberModelMemberEntities.put(entityAlias, modelMemberEntity); } - + public Iterator<Map.Entry<String, ModelMemberEntity>> getModelMemberEntitiesEntryIter() { return this.memberModelMemberEntities.entrySet().iterator(); } - + public void addAliasAll(String entityAlias, String prefix) { ModelAliasAll aliasAll = new ModelAliasAll(entityAlias, prefix); this.aliasAlls.add(aliasAll); } - + public void addAllAliasAllsToList(List<ModelAliasAll> addList) { addList.addAll(this.aliasAlls); } - + public void addAlias(String entityAlias, String name) { this.addAlias(entityAlias, name, null, null, null, null, null); } @@ -174,7 +174,7 @@ public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function) { addAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, null); } - + public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function, ComplexAliasMember complexAliasMember) { if (entityAlias == null && complexAliasMember == null) { throw new IllegalArgumentException("entityAlias cannot be null if this is not a complex alias in call to DynamicViewEntity.addAlias"); @@ -182,32 +182,32 @@ if (name == null) { throw new IllegalArgumentException("name cannot be null in call to DynamicViewEntity.addAlias"); } - + ModelAlias alias = new ModelAlias(entityAlias, name, field, colAlias, primKey, groupBy, function); if (complexAliasMember != null) { alias.setComplexAliasMember(complexAliasMember); } this.aliases.add(alias); } - + public void addAllAliasesToList(List<ModelAlias> addList) { addList.addAll(this.aliases); } - + public void addViewLink(String entityAlias, String relEntityAlias, Boolean relOptional, List<ModelKeyMap> modelKeyMaps) { ModelViewLink modelViewLink = new ModelViewLink(entityAlias, relEntityAlias, relOptional, modelKeyMaps); this.viewLinks.add(modelViewLink); } - + public void addAllViewLinksToList(List<ModelViewLink> addList) { addList.addAll(this.viewLinks); } - + public void addRelation(String type, String title, String relEntityName, List<ModelKeyMap> modelKeyMaps) { ModelRelation relation = new ModelRelation(type, title, relEntityName, null, modelKeyMaps); this.relations.add(relation); } - + public void addAllRelationsToList(List<ModelRelation> addList) { addList.addAll(this.relations); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Fri Mar 27 16:56:58 2009 @@ -243,7 +243,7 @@ this.noAutoStamp = UtilXml.checkBoolean(entityElement.getAttribute("no-auto-stamp"), false); this.neverCache = UtilXml.checkBoolean(entityElement.getAttribute("never-cache"), false); this.autoClearCache = UtilXml.checkBoolean(entityElement.getAttribute("auto-clear-cache"), true); - + String sequenceBankSizeStr = UtilXml.checkEmpty(entityElement.getAttribute("sequence-bank-size")); if (UtilValidate.isNotEmpty(sequenceBankSizeStr)) { try { @@ -297,14 +297,14 @@ if (!field.isPk) this.nopks.add(field); } } - + this.populateRelated(reader, extendEntityElement); this.populateIndexes(extendEntityElement); } - + // ===== GETTERS/SETTERS ===== - + public ModelReader getModelReader() { return modelReader; } @@ -387,7 +387,7 @@ public void setAutoClearCache(boolean autoClearCache) { this.autoClearCache = autoClearCache; } - + public boolean getHasFieldWithAuditLog() { if (this.hasFieldWithAuditLog == null) { this.hasFieldWithAuditLog = false; @@ -433,7 +433,7 @@ public Integer getSequenceBankSize() { return this.sequenceBankSize; } - + public void updatePkLists() { pks = FastList.newInstance(); nopks = FastList.newInstance(); @@ -493,7 +493,7 @@ newList.addAll(this.pks); return newList; } - + public List<ModelField> getPkFieldsUnmodifiable() { return Collections.unmodifiableList(this.pks); } @@ -1219,7 +1219,7 @@ /* This DOESN'T WORK, so forget it... using two passes //sort list by fk dependencies - + if (this.getEntityName().equals(otherModelEntity.getEntityName())) { return 0; } @@ -1234,7 +1234,7 @@ return -1; } } - + //look through relations for dependencies from the other to this entity Iterator otherRelationsIter = otherModelEntity.getRelationsIterator(); while (otherRelationsIter.hasNext()) { @@ -1245,7 +1245,7 @@ return 1; } } - + return 0; */ @@ -1444,7 +1444,7 @@ public Element toXmlElement(Document document) { return this.toXmlElement(document, this.getPackageName()); } - + /** * Writes entity model information in the Apple EOModelBundle format. * @@ -1461,7 +1461,7 @@ public void writeEoModelText(PrintWriter writer, String entityPrefix, String helperName, Set<String> entityNameIncludeSet, ModelReader entityModelReader) throws GenericEntityException { if (entityPrefix == null) entityPrefix = ""; if (helperName == null) helperName = "localderby"; - + UtilPlist.writePlistPropertyMap(this.createEoModelMap(entityPrefix, helperName, entityNameIncludeSet, entityModelReader), 0, writer, false); } @@ -1469,7 +1469,7 @@ public Map<String, Object> createEoModelMap(String entityPrefix, String helperName, Set<String> entityNameIncludeSet, ModelReader entityModelReader) throws GenericEntityException { final boolean useRelationshipNames = false; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); - + Map<String, Object> topLevelMap = FastMap.newInstance(); topLevelMap.put("name", this.getEntityName()); @@ -1493,18 +1493,18 @@ classPropertiesList.add(relationship.getCombinedName()); } } - + // attributes List<Map<String, Object>> attributesList = FastList.newInstance(); topLevelMap.put("attributes", attributesList); for (ModelField field: this.fields) { if (field.getIsAutoCreatedInternal()) continue; - + ModelFieldType fieldType = modelFieldTypeReader.getModelFieldType(field.getType()); - + Map<String, Object> attributeMap = FastMap.newInstance(); attributesList.add(attributeMap); - + if (field.getIsPk()) { attributeMap.put("name", field.getName() + "*"); } else { @@ -1530,7 +1530,7 @@ attributeMap.put("externalType", sqlType); } } - + // primaryKeyAttributes List<String> primaryKeyAttributesList = FastList.newInstance(); topLevelMap.put("primaryKeyAttributes", primaryKeyAttributesList); @@ -1543,10 +1543,10 @@ for (ModelRelation relationship: this.relations) { if (entityNameIncludeSet.contains(relationship.getRelEntityName())) { ModelEntity relEntity = entityModelReader.getModelEntity(relationship.getRelEntityName()); - + Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + if (useRelationshipNames || relationship.isAutoRelation()) { relationshipMap.put("name", relationship.getCombinedName()); } else { @@ -1561,21 +1561,21 @@ relationshipMap.put("isMandatory", "Y"); } relationshipMap.put("joinSemantic", "EOInnerJoin"); - - + + List<Map<String, Object>> joinsMapList = FastList.newInstance(); relationshipMap.put("joins", joinsMapList); for (ModelKeyMap keyMap: relationship.getKeyMapsClone()) { Map<String, Object> joinsMap = FastMap.newInstance(); joinsMapList.add(joinsMap); - + ModelField thisField = this.getField(keyMap.getFieldName()); if (thisField != null && thisField.getIsPk()) { joinsMap.put("sourceAttribute", keyMap.getFieldName() + "*"); } else { joinsMap.put("sourceAttribute", keyMap.getFieldName()); } - + ModelField relField = null; if (relEntity != null) relField = relEntity.getField(keyMap.getRelFieldName()); if (relField != null && relField.getIsPk()) { @@ -1589,7 +1589,7 @@ if (relationshipsMapList.size() > 0) { topLevelMap.put("relationships", relationshipsMapList); } - + return topLevelMap; } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java Fri Mar 27 16:56:58 2009 @@ -45,7 +45,7 @@ protected boolean isNotNull = false; protected boolean isAutoCreatedInternal = false; protected boolean enableAuditLog = false; - + /** validators to be called when an update is done */ protected List<String> validators = new ArrayList<String>(); @@ -135,7 +135,7 @@ public void setIsPk(boolean isPk) { this.isPk = isPk; } - + public boolean getIsNotNull() { return this.isNotNull; } @@ -151,7 +151,7 @@ public void setEncrypt(boolean encrypt) { this.encrypt = encrypt; } - + public boolean getEnableAuditLog() { return this.enableAuditLog; } @@ -163,7 +163,7 @@ public void setIsAutoCreatedInternal(boolean isAutoCreatedInternal) { this.isAutoCreatedInternal = isAutoCreatedInternal; } - + /** validators to be called when an update is done */ public String getValidator(int index) { return this.validators.get(index); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java Fri Mar 27 16:56:58 2009 @@ -27,7 +27,7 @@ * */ public class ModelInfo { - + public static final String module = ModelInfo.class.getName(); protected ModelInfo def; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Fri Mar 27 16:56:58 2009 @@ -119,7 +119,7 @@ ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement); entityResourceHandlers.add(handler); } - + // get all of the component resource model stuff, ie specified in each ofbiz-component.xml file for (ComponentConfig.EntityResourceInfo componentResourceInfo: ComponentConfig.getAllEntityResourceInfos("model")) { if (modelName.equals(componentResourceInfo.readerName)) { @@ -170,7 +170,7 @@ } catch (GenericConfigException e) { Debug.logError(e, "Could not get resource URL", module); } - + // utilTimer.timerString(" After createModelEntity -- " + i + " --"); if (modelEntity != null) { modelEntity.setLocation(resourceLocation); @@ -204,7 +204,7 @@ List<Element> tempExtendEntityElementList = FastList.newInstance(); UtilTimer utilTimer = new UtilTimer(); - + for (ResourceHandler entityResourceHandler: entityResourceHandlers) { // utilTimer.timerString("Before getDocument in file " + entityFileName); @@ -254,7 +254,7 @@ } utilTimer.timerString("Finished " + entityResourceHandler.toString() + " - Total Entities: " + i + " FINISHED"); } - + // all entity elements in, now go through extend-entity elements and add their stuff for (Element extendEntityElement: tempExtendEntityElementList) { String entityName = UtilXml.checkEmpty(extendEntityElement.getAttribute("entity-name")); @@ -266,29 +266,29 @@ // do a pass on all of the view entities now that all of the entities have // loaded and populate the fields for (ModelViewEntity curViewEntity: tempViewEntityList) { - + curViewEntity.populateFields(this); for (ModelViewEntity.ModelMemberEntity mve: curViewEntity.getAllModelMemberEntities()) { - + ModelEntity me = (ModelEntity) entityCache.get(mve.getEntityName()); if (me == null) throw new GenericEntityConfException("View " + curViewEntity.getEntityName() + " references non-existant entity: " + mve.getEntityName()); me.addViewEntity(curViewEntity); } } - + // auto-create relationships TreeSet<String> orderedMessages = new TreeSet<String>(); for (String curEntityName: new TreeSet<String>(this.getEntityNames())) { ModelEntity curModelEntity = this.getModelEntity(curEntityName); if (curModelEntity instanceof ModelViewEntity) { // for view-entities auto-create relationships for all member-entity relationships that have all corresponding fields in the view-entity - + } else { // for entities auto-create many relationships for all type one relationships - + // just in case we add a new relation to the same entity, keep in a separate list and add them at the end List<ModelRelation> newSameEntityRelations = FastList.newInstance(); - + Iterator<ModelRelation> relationsIter = curModelEntity.getRelationsIterator(); while (relationsIter.hasNext()) { ModelRelation modelRelation = relationsIter.next(); @@ -305,7 +305,7 @@ if (curModelEntity.getEntityName().equals(relatedEnt.getEntityName()) && "Parent".equals(targetTitle)) { targetTitle = "Child"; } - + // create the new relationship even if one exists so we can show what we are looking for in the info message ModelRelation newRel = new ModelRelation(); newRel.setModelEntity(relatedEnt); @@ -325,7 +325,7 @@ if (curModelEntity.containsAllPkFieldNames(curEntityKeyFields)) { // always use one-nofk, we don't want auto-fks getting in for these automatic ones newRel.setType("one-nofk"); - + // to keep it clean, remove any additional keys that aren't part of the PK List<String> curPkFieldNames = curModelEntity.getPkFieldNames(); Iterator<ModelKeyMap> nrkmIter = newRel.getKeyMapsIterator(); @@ -339,7 +339,7 @@ } else { newRel.setType("many"); } - + ModelRelation existingRelation = relatedEnt.getRelation(targetTitle + curModelEntity.getEntityName()); if (existingRelation == null) { numAutoRelations++; @@ -372,7 +372,7 @@ } } } - + if (newSameEntityRelations.size() > 0) { for (ModelRelation newRel: newSameEntityRelations) { curModelEntity.addRelation(newRel); @@ -380,7 +380,7 @@ } } } - + for (String message: orderedMessages) { Debug.logInfo(message, module); } @@ -489,18 +489,18 @@ } return ec.keySet(); } - + /** Get all entities, organized by package */ public Map<String, TreeSet<String>> getEntitiesByPackage(Set<String> packageFilterSet, Set<String> entityFilterSet) throws GenericEntityException { Map<String, TreeSet<String>> entitiesByPackage = FastMap.newInstance(); - + //put the entityNames TreeSets in a HashMap by packageName Iterator<String> ecIter = this.getEntityNames().iterator(); while (ecIter.hasNext()) { String entityName = (String) ecIter.next(); ModelEntity entity = this.getModelEntity(entityName); String packageName = entity.getPackageName(); - + if (UtilValidate.isNotEmpty(packageFilterSet)) { // does it match any of these? boolean foundMatch = false; @@ -518,7 +518,7 @@ //Debug.logInfo("Not including entity " + entityName + " becuase it is not in the entity set: " + entityFilterSet, module); continue; } - + TreeSet<String> entities = entitiesByPackage.get(entity.getPackageName()); if (entities == null) { entities = new TreeSet<String>(); @@ -526,7 +526,7 @@ } entities.add(entityName); } - + return entitiesByPackage; } @@ -580,7 +580,7 @@ ModelField field = new ModelField(name, type, colName, isPk); return field; } - + public ModelField createModelField(Element fieldElement) { if (fieldElement == null) { return null; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java Fri Mar 27 16:56:58 2009 @@ -56,7 +56,7 @@ /** the main entity of this relation */ protected ModelEntity mainEntity = null; - + protected boolean isAutoRelation = false; /** Default Constructor */ @@ -100,7 +100,7 @@ } } } - + public String getCombinedName() { return this.title + this.relEntityName; } @@ -162,7 +162,7 @@ public Iterator<ModelKeyMap> getKeyMapsIterator() { return this.keyMaps.iterator(); } - + public List<ModelKeyMap> getKeyMapsClone() { List<ModelKeyMap> kmList = FastList.newInstance(); kmList.addAll(this.keyMaps); @@ -273,20 +273,20 @@ public void setAutoRelation(boolean isAutoRelation) { this.isAutoRelation = isAutoRelation; } - + // FIXME: CCE public boolean equals(Object other) { ModelRelation otherRel = (ModelRelation) other; - + if (!otherRel.type.equals(this.type)) return false; if (!otherRel.title.equals(this.title)) return false; if (!otherRel.relEntityName.equals(this.relEntityName)) return false; - + Set<ModelKeyMap> thisKeyNames = new HashSet<ModelKeyMap>(this.keyMaps); Set<ModelKeyMap> otherKeyNames = new HashSet<ModelKeyMap>(otherRel.keyMaps); if (!thisKeyNames.containsAll(otherKeyNames)) return false; if (!otherKeyNames.containsAll(thisKeyNames)) return false; - + return true; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java Fri Mar 27 16:56:58 2009 @@ -27,9 +27,9 @@ * */ public class ModelUtil { - + public static final String module = ModelUtil.class.getName(); - + /** * Changes the first letter of the passed String to upper case. * @param string The passed String @@ -153,22 +153,22 @@ if (dbBuf.charAt(i - 1) == '_') { continue; } - + char curChar = dbBuf.charAt(i); if (vowelBag.indexOf(curChar) > 0) { dbBuf.deleteCharAt(i); } } } - + // remove all double underscores while (dbBuf.indexOf("__") > 0) { dbBuf.deleteCharAt(dbBuf.indexOf("__")); } - + while (dbBuf.length() > desiredLength) { boolean removedChars = false; - + int usIndex = dbBuf.lastIndexOf("_"); while (usIndex > 0 && dbBuf.length() > desiredLength) { // if this is the first word in the group, don't pull letters off unless it is 4 letters or more @@ -176,13 +176,13 @@ if (prevUsIndex < 0 && usIndex < 4) { break; } - + // don't remove characters to reduce the size two less than three characters between underscores if (prevUsIndex >= 0 && (usIndex - prevUsIndex) <= 4) { usIndex = prevUsIndex; continue; } - + // delete the second to last character instead of the last, better chance of being unique dbBuf.deleteCharAt(usIndex - 2); removedChars = true; @@ -192,7 +192,7 @@ break; } } - + // now delete the char at the end of the string if necessary if (dbBuf.length() > desiredLength) { int removeIndex = dbBuf.length() - 1; @@ -204,24 +204,24 @@ removedChars = true; } } - + // remove all double underscores while (dbBuf.indexOf("__") > 0) { dbBuf.deleteCharAt(dbBuf.indexOf("__")); removedChars = true; } - + // if we didn't remove anything break out to avoid an infinite loop if (!removedChars) { break; } } - + // remove all double underscores while (dbBuf.indexOf("__") > 0) { dbBuf.deleteCharAt(dbBuf.indexOf("__")); } - + while (dbBuf.length() > desiredLength) { // still not short enough, get more aggressive // don't remove the first segment, just remove the second over and over until we are short enough @@ -234,7 +234,7 @@ } } } - + //Debug.logInfo("Shortened " + dbName + " to " + dbBuf.toString(), module); return dbBuf.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Fri Mar 27 16:56:58 2009 @@ -110,7 +110,7 @@ ModelViewEntity.ModelAlias alias = new ModelAlias(aliasElement); this.aliases.add(alias); } - + for (Element viewLinkElement: UtilXml.childElementList(entityElement, "view-link")) { ModelViewLink viewLink = new ModelViewLink(viewLinkElement); this.addViewLink(viewLink); @@ -122,32 +122,32 @@ // before finishing, make sure the table name is null, this should help bring up errors early... this.tableName = null; } - + public ModelViewEntity(DynamicViewEntity dynamicViewEntity, ModelReader modelReader) { this.entityName = dynamicViewEntity.getEntityName(); this.packageName = dynamicViewEntity.getPackageName(); this.title = dynamicViewEntity.getTitle(); this.defaultResourceName = dynamicViewEntity.getDefaultResourceName(); - + // member-entities Iterator<Map.Entry<String, ModelMemberEntity>> modelMemberEntitiesEntryIter = dynamicViewEntity.getModelMemberEntitiesEntryIter(); while (modelMemberEntitiesEntryIter.hasNext()) { Map.Entry<String, ModelMemberEntity> entry = modelMemberEntitiesEntryIter.next(); this.addMemberModelMemberEntity(entry.getValue()); } - + // alias-alls dynamicViewEntity.addAllAliasAllsToList(this.aliasAlls); - + // aliases dynamicViewEntity.addAllAliasesToList(this.aliases); - + // view-links dynamicViewEntity.addAllViewLinksToList(this.viewLinks); - + // relations dynamicViewEntity.addAllRelationsToList(this.relations); - + // finalize stuff // note that this doesn't result in a call to populateReverseLinks because a DynamicViewEntity should never be cached anyway, and will blow up when attempting to make the reverse links to the DynamicViewEntity this.populateFieldsBasic(modelReader); @@ -200,7 +200,7 @@ public ModelAlias getAlias(int index) { return this.aliases.get(index); } - + public ModelAlias getAlias(String name) { Iterator<ModelAlias> aliasIter = getAliasesIterator(); while (aliasIter.hasNext()) { @@ -266,7 +266,7 @@ public void addViewLink(ModelViewLink viewLink) { this.viewLinks.add(viewLink); } - + public String colNameString(String separator, String afterLast, boolean alias, ModelField... flds) { return colNameString(Arrays.asList(flds), separator, afterLast, alias); } @@ -316,10 +316,10 @@ Debug.logError("[ModelViewEntity.populateFields] ERROR: could not find ModelEntity for entity name: " + aliasedEntityName, module); return null; } - + return aliasedEntity; } - + public ModelField getAliasedField(ModelEntity aliasedEntity, String field, ModelReader modelReader) { ModelField aliasedField = aliasedEntity.getField(field); if (aliasedField == null) { @@ -328,12 +328,12 @@ } return aliasedField; } - + public void populateFields(ModelReader modelReader) { populateFieldsBasic(modelReader); populateReverseLinks(); } - + public void populateFieldsBasic(ModelReader modelReader) { if (this.memberModelEntities == null) { this.memberModelEntities = FastMap.newInstance(); @@ -404,12 +404,12 @@ } else { field.isPk = aliasedField.isPk; } - + field.encrypt = aliasedField.encrypt; field.type = aliasedField.type; field.validators = aliasedField.validators; - + field.colName = alias.entityAlias + "." + SqlJdbcUtil.filterColName(aliasedField.colName); if (UtilValidate.isEmpty(field.description)) { field.description = aliasedField.description; @@ -422,7 +422,7 @@ } else { this.nopks.add(field); } - + if ("count".equals(alias.function) || "count-distinct".equals(alias.function)) { // if we have a "count" function we have to change the type field.type = "numeric"; @@ -438,7 +438,7 @@ } } } - + protected ModelConversion getOrCreateModelConversion(String aliasName) { ModelEntity member = getMemberModelEntity(aliasName); if (member == null) { @@ -446,7 +446,7 @@ Debug.logWarning(errMsg, module); throw new RuntimeException("Cannot create View Entity: " + errMsg); } - + Map<String, ModelConversion> aliasConversions = conversions.get(member.getEntityName()); if (aliasConversions == null) { aliasConversions = FastMap.newInstance(); @@ -586,7 +586,7 @@ // if specified as excluded, leave it out continue; } - + if (UtilValidate.isNotEmpty(prefix)) { StringBuilder newAliasBuffer = new StringBuilder(prefix); //make sure the first letter is uppercase to delineate the field name @@ -594,7 +594,7 @@ newAliasBuffer.append(aliasName.substring(1)); aliasName = newAliasBuffer.toString(); } - + ModelAlias existingAlias = this.getAlias(aliasName); if (existingAlias != null) { //log differently if this is part of a view-link key-map because that is a common case when a field will be auto-expanded multiple times @@ -619,7 +619,7 @@ } } } - + //already exists, oh well... probably an override, but log just in case String warnMsg = "Throwing out field alias in view entity " + this.getEntityName() + " because one already exists with the alias name [" + aliasName + "] and field name [" + modelMemberEntity.getEntityAlias() + "(" + aliasedEntity.getEntityName() + ")." + fieldName + "], existing field name is [" + existingAlias.getEntityAlias() + "." + existingAlias.getField() + "]"; if (isInViewLink) { @@ -629,7 +629,7 @@ } continue; } - + ModelAlias expandedAlias = new ModelAlias(); expandedAlias.name = aliasName; expandedAlias.field = fieldName; @@ -639,7 +639,7 @@ expandedAlias.function = function; expandedAlias.groupBy = groupBy; expandedAlias.description = modelField.getDescription(); - + aliases.add(expandedAlias); } } @@ -687,7 +687,7 @@ this.prefix = UtilXml.checkEmpty(aliasAllElement.getAttribute("prefix")).intern(); this.groupBy = "true".equals(UtilXml.checkEmpty(aliasAllElement.getAttribute("group-by"))); this.function = UtilXml.checkEmpty(aliasAllElement.getAttribute("function")); - + List<? extends Element> excludes = UtilXml.childElementList(aliasAllElement, "exclude"); if (UtilValidate.isNotEmpty(excludes)) { this.fieldsToExclude = new HashSet<String>(); @@ -695,7 +695,7 @@ this.fieldsToExclude.add(excludeElement.getAttribute("field").intern()); } } - + } public String getEntityAlias() { @@ -755,13 +755,13 @@ this.groupBy = "true".equals(UtilXml.checkEmpty(aliasElement.getAttribute("group-by"))); this.function = UtilXml.checkEmpty(aliasElement.getAttribute("function")).intern(); this.description = UtilXml.checkEmpty(UtilXml.childElementValue(aliasElement, "description")).intern(); - + Element complexAliasElement = UtilXml.firstChildElement(aliasElement, "complex-alias"); if (complexAliasElement != null) { complexAliasMember = new ComplexAlias(complexAliasElement); } } - + public ModelAlias(String entityAlias, String name, String field, String colAlias, Boolean isPk, Boolean groupBy, String function) { this.entityAlias = entityAlias; this.name = name; @@ -775,15 +775,15 @@ } this.function = function; } - + public void setComplexAliasMember(ComplexAliasMember complexAliasMember) { this.complexAliasMember = complexAliasMember; } - + public boolean isComplexAlias() { return complexAliasMember != null; } - + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { if (complexAliasMember != null) { complexAliasMember.makeAliasColName(colNameBuffer, fieldTypeBuffer, modelViewEntity, modelReader); @@ -797,7 +797,7 @@ public String getName() { return this.name; } - + public String getColAlias() { return this.colAlias; } @@ -834,15 +834,15 @@ public static interface ComplexAliasMember extends Serializable { public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader); } - + public static class ComplexAlias implements ComplexAliasMember { protected List<ComplexAliasMember> complexAliasMembers = FastList.newInstance(); protected String operator; - + public ComplexAlias(String operator) { this.operator = operator; } - + public ComplexAlias(Element complexAliasElement) { this.operator = complexAliasElement.getAttribute("operator").intern(); // handle all complex-alias and complex-alias-field sub-elements @@ -855,11 +855,11 @@ } } } - + public void addComplexAliasMember(ComplexAliasMember complexAliasMember) { this.complexAliasMembers.add(complexAliasMember); } - + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { if (complexAliasMembers.size() == 0) { return; @@ -882,13 +882,13 @@ } } } - + public static class ComplexAliasField implements ComplexAliasMember { protected String entityAlias = ""; protected String field = ""; protected String defaultValue = null; protected String function = null; - + public ComplexAliasField(Element complexAliasFieldElement) { this.entityAlias = complexAliasFieldElement.getAttribute("entity-alias").intern(); this.field = complexAliasFieldElement.getAttribute("field").intern(); @@ -909,9 +909,9 @@ public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { ModelEntity modelEntity = modelViewEntity.getAliasedEntity(entityAlias, modelReader); ModelField modelField = modelViewEntity.getAliasedField(modelEntity, field, modelReader); - + String colName = entityAlias + "." + modelField.getColName(); - + if (UtilValidate.isNotEmpty(defaultValue)) { colName = "COALESCE(" + colName + "," + defaultValue + ")"; } @@ -924,9 +924,9 @@ colName = prefix + colName + ")"; } } - + colNameBuffer.append(colName); - + //set fieldTypeBuffer if not already set if (fieldTypeBuffer.length() == 0) { fieldTypeBuffer.append(modelField.type); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Fri Mar 27 16:56:58 2009 @@ -65,7 +65,7 @@ protected void setUp() throws Exception { this.delegator = GenericDelegator.getGenericDelegator(DELEGATOR_NAME); } - + /* * Tests storing values with the delegator's .create, .makeValue, and .storeAll methods */ @@ -400,7 +400,7 @@ return; } } - + /* * This test will use the large number of unique items from above and test the EntityListIterator looping through the list */ @@ -464,7 +464,7 @@ delegator.removeByAnd("Testing", "testingId", "timeout-test"); } } - + /* * This test will verify that the same transaction transaction which takes less time than timeout will be committed. */ @@ -512,7 +512,7 @@ GenericValue testingBlob = delegator.makeValue("TestBlob", "testBlobId", "byte-blob"); testingBlob.setBytes("testBlobField", b); testingBlob.create(); - + TestCase.assertTrue("Blob with byte value successfully created...", true); } catch (Exception ex) { TestCase.fail(ex.getMessage()); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DebugXaResource.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DebugXaResource.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DebugXaResource.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DebugXaResource.java Fri Mar 27 16:56:58 2009 @@ -31,7 +31,7 @@ public DebugXaResource(String info) { this.ex = new Exception(info); } - + public DebugXaResource() { this.ex = new Exception(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java Fri Mar 27 16:56:58 2009 @@ -42,9 +42,9 @@ * A dumb, non-working transaction manager. */ public class DumbFactory implements TransactionFactoryInterface { - + public static final String module = DumbFactory.class.getName(); - + public TransactionManager getTransactionManager() { return new TransactionManager() { public void begin() throws NotSupportedException, SystemException { @@ -101,11 +101,11 @@ } }; } - + public String getTxMgrName() { return "dumb"; } - + public Connection getConnection(String helperName) throws SQLException, GenericEntityException { DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); @@ -117,6 +117,6 @@ return null; } } - + public void shutdown() {} } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java Fri Mar 27 16:56:58 2009 @@ -47,7 +47,7 @@ * Central source for Tyrex JTA objects from JNDI */ public class JNDIFactory implements TransactionFactoryInterface { - + // Debug module name public static final String module = JNDIFactory.class.getName(); @@ -128,11 +128,11 @@ } return userTransaction; } - + public String getTxMgrName() { return "jndi"; } - + public Connection getConnection(String helperName) throws SQLException, GenericEntityException { DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); @@ -145,7 +145,7 @@ } else { // Debug.logError("JNDI loaded is the configured transaction manager but no jndi-jdbc element was specified in the " + helperName + " datasource. Please check your configuration.", module); } - + if (datasourceInfo.inlineJdbcElement != null) { Connection otherCon = ConnectionFactory.getManagedConnection(helperName, datasourceInfo.inlineJdbcElement); return TransactionFactory.getCursorConnection(helperName, otherCon); @@ -154,7 +154,7 @@ return null; } } - + public static Connection getJndiConnection(String jndiName, String jndiServerName) throws SQLException, GenericEntityException { // if (Debug.verboseOn()) Debug.logVerbose("Trying JNDI name " + jndiName, module); DataSource ds; @@ -241,6 +241,6 @@ } return null; } - + public void shutdown() {} } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java Fri Mar 27 16:56:58 2009 @@ -31,10 +31,10 @@ public TransactionManager getTransactionManager(); public UserTransaction getUserTransaction(); - + public String getTxMgrName(); - + public Connection getConnection(String helperName) throws SQLException, GenericEntityException; - + public void shutdown(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Fri Mar 27 16:56:58 2009 @@ -162,7 +162,7 @@ return STATUS_NO_TRANSACTION; } } - + public static String getStatusString() throws GenericTransactionException { return getTransactionStateString(getStatus()); } @@ -216,7 +216,7 @@ clearTransactionStamps(); clearTransactionBeginStack(); clearSetRollbackOnlyCause(); - + Debug.logError(e, "Rollback Only was set when trying to commit transaction here; throwing rollbackOnly cause exception", module); throw new GenericTransactionException("Roll back error, could not commit transaction, was rolled back instead because of: " + rollbackOnlyCause.getCauseMessage(), rollbackOnlyCause.getCauseThrowable()); } else { @@ -246,7 +246,7 @@ 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); } - + /** Rolls back transaction in the current thread IF transactions are available * AND if beganTransaction is true; if beganTransaction is not true, * setRollbackOnly is called to insure that the transaction will be rolled back @@ -563,7 +563,7 @@ transactionBeginStackSave.set(el); } el.add(0, e); - + Long curThreadId = Thread.currentThread().getId(); List<Exception> ctEl = allThreadsTransactionBeginStackSave.get(curThreadId); if (ctEl == null) { @@ -579,7 +579,7 @@ if (UtilValidate.isNotEmpty(ctEl)) { ctEl.remove(0); } - + // then do the more reliable ThreadLocal one List<Exception> el = transactionBeginStackSave.get(); if (UtilValidate.isNotEmpty(el)) { @@ -612,14 +612,14 @@ if (!Debug.infoOn()) { return; } - + for (Map.Entry<Long, Exception> attbsMapEntry : allThreadsTransactionBeginStack.entrySet()) { Long curThreadId = (Long) attbsMapEntry.getKey(); Exception transactionBeginStack = attbsMapEntry.getValue(); List<Exception> txBeginStackList = allThreadsTransactionBeginStackSave.get(curThreadId); - + Debug.logInfo(transactionBeginStack, "===================================================\n===================================================\n Current tx begin stack for thread [" + curThreadId + "]:", module); - + if (UtilValidate.isNotEmpty(txBeginStackList)) { int stackLevel = 0; for (Exception stack : txBeginStackList) { @@ -631,7 +631,7 @@ } } } - + private static void setTransactionBeginStack() { Exception e = new Exception("Tx Stack Placeholder"); setTransactionBeginStack(e); @@ -650,7 +650,7 @@ private static Exception clearTransactionBeginStack() { Long curThreadId = Thread.currentThread().getId(); allThreadsTransactionBeginStack.remove(curThreadId); - + Exception e = transactionBeginStack.get(); if (e == null) { Exception e2 = new Exception("Current Stack Trace"); @@ -685,7 +685,7 @@ public void logError(String message) { Debug.logError(this.getCauseThrowable(), (message == null ? "" : message) + this.getCauseMessage(), module); } public boolean isEmpty() { return (UtilValidate.isEmpty(this.getCauseMessage()) && this.getCauseThrowable() == null); } } - + private static void pushSetRollbackOnlyCauseSave(RollbackOnlyCause e) { List<RollbackOnlyCause> el = setRollbackOnlyCauseSave.get(); if (el == null) { @@ -742,7 +742,7 @@ // ======================================= // SUSPENDED TRANSACTIONS START TIMESTAMPS // ======================================= - + /** * Maintain the suspended transactions together with their timestamps */ @@ -751,7 +751,7 @@ return UtilGenerics.checkMap(new ListOrderedMap()); } }; - + /** * Put the stamp to remember later * @param t transaction just suspended Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexFactory.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexFactory.java Fri Mar 27 16:56:58 2009 @@ -39,7 +39,7 @@ } /* public class TyrexFactory implements TransactionFactoryInterface { - + public static final String module = TyrexFactory.class.getName(); protected static TransactionDomain td = null; @@ -131,11 +131,11 @@ return null; } } - + public String getTxMgrName() { return "tyrex"; } - + public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); @@ -147,7 +147,7 @@ } catch (Exception ex) { Debug.logError(ex, "Tyrex is the configured transaction manager but there was an error getting a database Connection through Tyrex for the " + helperName + " datasource. Please check your configuration, class path, etc.", module); } - + Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else if (datasourceInfo.tyrexDataSourceElement != null) { @@ -176,7 +176,7 @@ return null; } } - + public void shutdown() { TyrexConnectionFactory.closeAll(); if (td != null) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/DistributedCacheClear.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/DistributedCacheClear.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/DistributedCacheClear.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/DistributedCacheClear.java Fri Mar 27 16:56:58 2009 @@ -38,6 +38,6 @@ public void distributedClearCacheLineByCondition(String entityName, EntityCondition condition); public void distributedClearCacheLine(GenericPK primaryKey); - + public void clearAllCaches(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java Fri Mar 27 16:56:58 2009 @@ -86,7 +86,7 @@ try { SecretKey decryptKey = this.getKey(keyName, false); byte[] decryptedBytes = DesCrypt.decrypt(decryptKey, encryptedBytes); - + decryptedObj = UtilObject.getObject(decryptedBytes); } catch (GeneralException e) { try { @@ -101,7 +101,7 @@ throw new EntityCryptoException(e); } } - + // NOTE: this is definitely for debugging purposes only, do not uncomment in production server for security reasons: Debug.logInfo("Decrypted value [" + encryptedString + "] to result: " + decryptedObj, module); return decryptedObj; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataAssert.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataAssert.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataAssert.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataAssert.java Fri Mar 27 16:56:58 2009 @@ -67,17 +67,17 @@ return rowsChecked; } - + public static void checkValueList(List valueList, GenericDelegator delegator, List<Object> errorMessages) throws GenericEntityException { if (valueList == null) return; - + Iterator valueIter = valueList.iterator(); while (valueIter.hasNext()) { GenericValue checkValue = (GenericValue) valueIter.next(); checkSingleValue(checkValue, delegator, errorMessages); } } - + public static void checkSingleValue(GenericValue checkValue, GenericDelegator delegator, List<Object> errorMessages) throws GenericEntityException { if (checkValue == null) { errorMessages.add("Got a value to check was null"); @@ -85,7 +85,7 @@ } // to check get the PK, find by that, compare all fields GenericPK checkPK = null; - + try { checkPK = checkValue.getPrimaryKey(); GenericValue currentValue = delegator.findOne(checkPK.getEntityName(), checkPK, false); @@ -101,7 +101,7 @@ ModelEntity.STAMP_FIELD.equals(nonpkFieldName) || ModelEntity.STAMP_TX_FIELD.equals(nonpkFieldName)) { continue; } - + Object checkField = checkValue.get(nonpkFieldName); Object currentField = currentValue.get(nonpkFieldName); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Fri Mar 27 16:56:58 2009 @@ -87,7 +87,7 @@ public static List<URL> getUrlList(String helperName, String componentName, List readerNames) { String paths = getPathsString(helperName); List<URL> urlList = new LinkedList<URL>(); - + // first get files from resources if (readerNames != null) { for (Object readerInfo: readerNames) { @@ -107,7 +107,7 @@ Debug.logInfo("Could not find entity-data-reader named: " + readerName + ". Creating a new reader with this name. ", module); entityDataReaderInfo = new EntityDataReaderInfo(readerName); } - + if (entityDataReaderInfo != null) { for (Element resourceElement: entityDataReaderInfo.resourceElements) { ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement); @@ -118,7 +118,7 @@ Debug.logWarning(errorMsg, module); } } - + // get all of the component resource model stuff, ie specified in each ofbiz-component.xml file for (ComponentConfig.EntityResourceInfo componentResourceInfo: ComponentConfig.getAllEntityResourceInfos("data", componentName)) { if (readerName.equals(componentResourceInfo.readerName)) { @@ -140,7 +140,7 @@ String errorMsg = "Could not find datasource named: " + helperName; Debug.logWarning(errorMsg, module); } - + // get files from the paths string if (paths != null && paths.length() > 0) { StringTokenizer tokenizer = new StringTokenizer(paths, ";"); @@ -188,7 +188,7 @@ public static int loadData(URL dataUrl, String helperName, GenericDelegator delegator, List<Object> errorMessages, int txTimeout, boolean dummyFks, boolean maintainTxs, boolean tryInsert) throws GenericEntityException { int rowsChanged = 0; - + if (dataUrl == null) { String errMsg = "Cannot load data, dataUrl was null"; errorMessages.add(errMsg); @@ -254,7 +254,7 @@ toStore.add(delegator.makeValue("SecurityPermission", "permissionId", baseName + "_CREATE", "description", "Permission to Create a " + entity.getEntityName() + " entity.")); toStore.add(delegator.makeValue("SecurityPermission", "permissionId", baseName + "_UPDATE", "description", "Permission to Update a " + entity.getEntityName() + " entity.")); toStore.add(delegator.makeValue("SecurityPermission", "permissionId", baseName + "_DELETE", "description", "Permission to Delete a " + entity.getEntityName() + " entity.")); - + toStore.add(delegator.makeValue("SecurityGroupPermission", "groupId", "FLEXADMIN", "permissionId", baseName + "_VIEW")); toStore.add(delegator.makeValue("SecurityGroupPermission", "groupId", "FLEXADMIN", "permissionId", baseName + "_CREATE")); toStore.add(delegator.makeValue("SecurityGroupPermission", "groupId", "FLEXADMIN", "permissionId", baseName + "_UPDATE")); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java Fri Mar 27 16:56:58 2009 @@ -47,7 +47,7 @@ /** Module Name Used for debugging */ public static final String module = EntityListIterator.class.getName(); - + protected SQLProcessor sqlp; protected ResultSet resultSet; protected ModelEntity modelEntity; @@ -58,7 +58,7 @@ protected GenericDelegator delegator = null; private boolean haveShowHasNextWarning = false; - + public EntityListIterator(SQLProcessor sqlp, ModelEntity modelEntity, List<ModelField> selectFields, ModelFieldTypeReader modelFieldTypeReader) { this.sqlp = sqlp; this.resultSet = sqlp.getResultSet(); @@ -237,10 +237,10 @@ // DEJ20050207 To further discourage use of this, and to find existing use, always log a big warning showing where it is used: Exception whereAreWe = new Exception(); Debug.logWarning(whereAreWe, "WARNING: For performance reasons do not use the EntityListIterator.hasNext() method, just call next() until it returns null; see JavaDoc comments in the EntityListIterator class for details and an example", module); - + haveShowHasNextWarning = true; } - + try { if (resultSet.isLast() || resultSet.isAfterLast()) { return false; @@ -443,7 +443,7 @@ try { if (number == 0) return FastList.newInstance(); List<GenericValue> list = FastList.newInstance(); - + // just in case the caller missed the 1 based thingy if (start == 0) start = 1; @@ -488,7 +488,7 @@ throw new GenericEntityException(e.getNonNestedMessage(), e.getNested()); } } - + public int getResultsSizeAfterPartialList() throws GenericEntityException { if (this.last()) { return this.currentIndex(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java Fri Mar 27 16:56:58 2009 @@ -173,14 +173,14 @@ public boolean getDisableEeca() { return this.disableEeca; } - + public List<Object> getMessageList() { if (this.checkDataOnly && this.messageList == null) { messageList = FastList.newInstance(); } return this.messageList; } - + public void setMessageList(List<Object> messageList) { this.messageList = messageList; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityTypeUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityTypeUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityTypeUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityTypeUtil.java Fri Mar 27 16:56:58 2009 @@ -32,7 +32,7 @@ * extensibility pattern and that can be of various types as identified in the database. */ public class EntityTypeUtil { - + public static final String module = EntityTypeUtil.class.getName(); public static boolean isType(Collection<GenericValue> thisCollection, String typeRelation, GenericValue targetType) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=759234&r1=759233&r2=759234&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Fri Mar 27 16:56:58 2009 @@ -455,7 +455,7 @@ entity.store(); } } - + public static <T> List<T> getFieldListFromEntityList(List<GenericValue> genericValueList, String fieldName, boolean distinct) { if (genericValueList == null || fieldName == null) { return null; @@ -465,7 +465,7 @@ if (distinct) { distinctSet = FastSet.newInstance(); } - + for (GenericValue value: genericValueList) { T fieldValue = UtilGenerics.<T>cast(value.get(fieldName)); if (fieldValue != null) { @@ -479,10 +479,10 @@ } } } - + return fieldList; } - + public static <T> List<T> getFieldListFromEntityListIterator(EntityListIterator genericValueEli, String fieldName, boolean distinct) { if (genericValueEli == null || fieldName == null) { return null; @@ -492,7 +492,7 @@ if (distinct) { distinctSet = FastSet.newInstance(); } - + GenericValue value = null; while ((value = genericValueEli.next()) != null) { T fieldValue = UtilGenerics.<T>cast(value.get(fieldName)); @@ -507,7 +507,7 @@ } } } - + return fieldList; } } |
Free forum by Nabble | Edit this page |