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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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"); } @@ -1025,9 +1025,9 @@ Debug.logVerbose(e, module); Debug.logWarning("- order by not in select [ DETECTION FAILED ]", module); } - try { + try { //this doesn't work in HSQLDB, other databases? - //crashed (vm-death) with MS SQL Server 2000, runs properly with MS SQL Server 2005 + //crashed (vm-death) with MS SQL Server 2000, runs properly with MS SQL Server 2005 //Debug.logInfo("- named parameters [" + dbData.supportsNamedParameters() + "]", module); Debug.logInfo("- named parameters [ SKIPPED ]", module); } catch (Exception e) { @@ -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"); @@ -1746,7 +1746,7 @@ } } - if (field.getIsNotNull() || field.getIsPk()) { + if (field.getIsNotNull() || field.getIsPk()) { if (this.datasourceInfo.alwaysUseConstraintKeyword) { sqlBuf.append(" CONSTRAINT NOT NULL, "); } else { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ExecQueryCallbackFunctionIF.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ExecQueryCallbackFunctionIF.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ExecQueryCallbackFunctionIF.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ExecQueryCallbackFunctionIF.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -38,13 +38,13 @@ /** * SQLProcessor - provides utitlity functions to ease database access - * + * */ public class SQLProcessor { /** 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) { @@ -148,7 +148,7 @@ rollback(); } catch (GenericDataSourceException rbsqle) { Debug.logError(rbsqle, "Got another error when trying to rollback after error committing transaction: " + sqle.toString()); - } + } throw new GenericDataSourceException("SQL Exception occurred on commit", sqle); } } @@ -161,7 +161,7 @@ if (_connection == null) { return; } - + if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:rollback() _manualTX=" + _manualTX, module); try { @@ -188,7 +188,7 @@ * * @throws GenericDataSourceException */ - public void close() throws GenericDataSourceException { + public void close() throws GenericDataSourceException { if (_manualTX) { if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:close() calling commit : _manualTX=" + _manualTX, module); commit(); @@ -238,7 +238,7 @@ } _connection = null; - } + } } /** @@ -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()) { @@ -303,7 +303,7 @@ } } } catch (SQLException e) { - throw new GenericDataSourceException("Cannot get autoCommit status from connection", e); + throw new GenericDataSourceException("Cannot get autoCommit status from connection", e); } try { @@ -318,8 +318,8 @@ } if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.getConnection] : con=" + _connection, module); - - _bDeleteConnection = true; + + _bDeleteConnection = true; return _connection; } @@ -731,9 +731,9 @@ /** * Set the next binding variable of the currently active prepared statement - * + * * @param field - * + * * @throws SQLException */ public void setValue(Blob field) throws SQLException { @@ -752,9 +752,9 @@ /** * Set the next binding variable of the currently active prepared statement - * + * * @param field - * + * * @throws SQLException */ public void setValue(Clob field) throws SQLException { @@ -769,9 +769,9 @@ /** * Set the next binding variable of the currently active prepared statement * to write the serialized data of 'field' to a BLOB. - * + * * @param field - * + * * @throws SQLException */ public void setBinaryStream(Object field) throws SQLException { @@ -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,13 +801,13 @@ _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. - * + * * @param bytes - * + * * @throws SQLException */ public void setBytes(byte[] bytes) throws SQLException { @@ -832,15 +832,15 @@ } super.finalize(); } - + protected void testConnection(Connection con) throws GenericEntityException { if (SQLProcessor.ENABLE_TEST) { if (SQLProcessor.CONNECTION_TEST_LIST.contains(con.toString())) { - throw new GenericEntityException("Connection the exact same as index " + SQLProcessor.CONNECTION_TEST_LIST.indexOf(con.toString())); - } + throw new GenericEntityException("Connection the exact same as index " + SQLProcessor.CONNECTION_TEST_LIST.indexOf(con.toString())); + } SQLProcessor.CONNECTION_TEST_LIST.add(con.toString()); if (SQLProcessor.CONNECTION_TEST_LIST.size() > SQLProcessor.MAX_CONNECTIONS) { - SQLProcessor.CONNECTION_TEST_LIST.remove(0); + SQLProcessor.CONNECTION_TEST_LIST.remove(0); } } } @@ -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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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,10 +656,10 @@ 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 + //just return the byte[]; this was for the ByteWrapper thing which is now deprecated, so this may //be removed in the near future to enhance performance InputStream binaryInput = null; if (fieldBytes != null && fieldBytes.length > 0) { @@ -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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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/ModelChild.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -111,9 +111,9 @@ /** Can be used to disable automatically creating update stamp fields and populating them on inserts and updates */ protected boolean noAutoStamp = false; - /** An indicator to specify if this entity is never cached. - * If true causes the delegator to not clear caches on write and to not get - * from cache on read showing a warning messages to that effect + /** An indicator to specify if this entity is never cached. + * If true causes the delegator to not clear caches on write and to not get + * from cache on read showing a warning messages to that effect */ protected boolean neverCache = false; @@ -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; } @@ -368,9 +368,9 @@ this.dependentOn = dependentOn; } - /** An indicator to specify if this entity is never cached. - * If true causes the delegator to not clear caches on write and to not get - * from cache on read showing a warning messages to that effect + /** An indicator to specify if this entity is never cached. + * If true causes the delegator to not clear caches on write and to not get + * from cache on read showing a warning messages to that effect */ public boolean getNeverCache() { return this.neverCache; @@ -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,16 +1444,16 @@ public Element toXmlElement(Document document) { return this.toXmlElement(document, this.getPackageName()); } - + /** - * Writes entity model information in the Apple EOModelBundle format. - * + * Writes entity model information in the Apple EOModelBundle format. + * * For document structure and definition see: http://developer.apple.com/documentation/InternetWeb/Reference/WO_BundleReference/Articles/EOModelBundle.html - * + * * For examples see the JavaRealEstate.framework and JavaBusinessLogic.framework packages which are in the /Library/Frameworks directory after installing the WebObjects Examples package (get latest version of WebObjects download for this). - * + * * This is based on examples and documentation from WebObjects 5.4, downloaded 20080221. - * + * * @param writer * @param entityPrefix * @param helperName @@ -1461,15 +1461,15 @@ 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); } public Map<String, Object> createEoModelMap(String entityPrefix, String helperName, Set<String> entityNameIncludeSet, ModelReader entityModelReader) throws GenericEntityException { - final boolean useRelationshipNames = false; + 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/ModelEntityChecker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -33,7 +33,7 @@ /** * Generic Entity - Entity Definition Checker - * + * */ public class ModelEntityChecker { 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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/ModelFieldType.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -62,7 +62,7 @@ String className = element.getAttribute("class"); if (methodName != null) { this.validators.add(new ModelFieldValidator(className.intern(), methodName.intern())); - } + } } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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/ModelKeyMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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++; @@ -353,14 +353,14 @@ // don't warn if the target title+entity = current title+entity if (!(targetTitle + curModelEntity.getEntityName()).equals(modelRelation.getTitle() + modelRelation.getRelEntityName())) { //String errorMsg = "Relation already exists to entity [] with title [" + targetTitle + "],from entity []"; - String message = "Entity [" + relatedEnt.getPackageName() + ":" + relatedEnt.getEntityName() + "] already has identical relationship to entity [" + - curModelEntity.getEntityName() + "] title [" + targetTitle + "]; would auto-create: type [" + + String message = "Entity [" + relatedEnt.getPackageName() + ":" + relatedEnt.getEntityName() + "] already has identical relationship to entity [" + + curModelEntity.getEntityName() + "] title [" + targetTitle + "]; would auto-create: type [" + newRel.getType() + "] and fields [" + newRel.keyMapString(",", "") + "]"; orderedMessages.add(message); } } else { - String message = "Existing relationship with the same name, but different specs found from what would be auto-created for Entity [" + relatedEnt.getEntityName() + "] ant relationship to entity [" + - curModelEntity.getEntityName() + "] title [" + targetTitle + "]; would auto-create: type [" + + String message = "Existing relationship with the same name, but different specs found from what would be auto-created for Entity [" + relatedEnt.getEntityName() + "] ant relationship to entity [" + + curModelEntity.getEntityName() + "] title [" + targetTitle + "]; would auto-create: type [" + newRel.getType() + "] and fields [" + newRel.keyMapString(",", "") + "]"; //Debug.logInfo(message, module); } @@ -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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -27,10 +27,10 @@ * */ 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 * @return A String with an upper case first letter @@ -44,7 +44,7 @@ return sb.toString(); } - /** + /** * Changes the first letter of the passed String to lower case. * * @param string The passed String @@ -60,12 +60,12 @@ } /** Converts a database name to a Java class name. - * The naming conventions used to allow for this are as follows: a database name (table or - * column) is in all capital letters, and the words are separated by an underscore - * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all - * lower case letters, except the letter at the beginning of each word (for example: - * NeatEntityName or RandomFieldName). The convention of using a capital letter at - * the beginning of a class name in Java, or a lower-case letter for the beginning of a + * The naming conventions used to allow for this are as follows: a database name (table or + * column) is in all capital letters, and the words are separated by an underscore + * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all + * lower case letters, except the letter at the beginning of each word (for example: + * NeatEntityName or RandomFieldName). The convention of using a capital letter at + * the beginning of a class name in Java, or a lower-case letter for the beginning of a * variable name in Java is also used along with the Java name convention above. * @param columnName The database name * @return The Java class name @@ -75,12 +75,12 @@ } /** Converts a database name to a Java variable name. - * The naming conventions used to allow for this are as follows: a database name (table or - * column) is in all capital letters, and the words are separated by an underscore - * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all - * lower case letters, except the letter at the beginning of each word (for example: - * NeatEntityName or RandomFieldName). The convention of using a capital letter at - * the beginning of a class name in Java, or a lower-case letter for the beginning of a + * The naming conventions used to allow for this are as follows: a database name (table or + * column) is in all capital letters, and the words are separated by an underscore + * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all + * lower case letters, except the letter at the beginning of each word (for example: + * NeatEntityName or RandomFieldName). The convention of using a capital letter at + * the beginning of a class name in Java, or a lower-case letter for the beginning of a * variable name in Java is also used along with the Java name convention above. * @param columnName The database name * @return The Java variable name @@ -106,14 +106,14 @@ return fieldName.toString(); } - /** + /** * Converts a Java variable name to a database name. - * The naming conventions used to allow for this are as follows: a database name (table or - * column) is in all capital letters, and the words are separated by an underscore - * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all - * lower case letters, except the letter at the beginning of each word (for example: - * NeatEntityName or RandomFieldName). The convention of using a capital letter at - * the beginning of a class name in Java, or a lower-case letter for the beginning of a + * The naming conventions used to allow for this are as follows: a database name (table or + * column) is in all capital letters, and the words are separated by an underscore + * (for example: NEAT_ENTITY_NAME or RANDOM_FIELD_NAME); a Java name (ejb or field) is in all + * lower case letters, except the letter at the beginning of each word (for example: + * NeatEntityName or RandomFieldName). The convention of using a capital letter at + * the beginning of a class name in Java, or a lower-case letter for the beginning of a * variable name in Java is also used along with the Java name convention above. * @param javaName The Java variable name * @return The database name @@ -138,8 +138,8 @@ } public static String vowelBag = "aeiouyAEIOUY"; - /** Start by removing all vowels, then pull 1 letter at a time off the end of each _ separated segment, go until it is less than or equal to the desired length - * + /** Start by removing all vowels, then pull 1 letter at a time off the end of each _ separated segment, go until it is less than or equal to the desired length + * * @param dbName * @param desiredLength * @return shortened 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,13 +234,13 @@ } } } - + //Debug.logInfo("Shortened " + dbName + " to " + dbBuf.toString(), module); return dbBuf.toString(); } - /** - * Converts a package name to a path by replacing all '.' characters with the File.separatorChar character. + /** + * Converts a package name to a path by replacing all '.' characters with the File.separatorChar character. * Is therefore platform independent. * @param packageName The package name. * @return The path name corresponding to the specified package name. @@ -250,7 +250,7 @@ return packageName.replace('.', File.separatorChar); } - /** + /** * Replaces all occurances of oldString in mainString with newString * @param mainString The original string * @param oldString The string to replace @@ -271,7 +271,7 @@ return "very-long"; } else if (sqlTypeName.equalsIgnoreCase("TEXT")) { return "very-long"; - } else if (sqlTypeName.equalsIgnoreCase("INT") || sqlTypeName.equalsIgnoreCase("SMALLINT") || + } else if (sqlTypeName.equalsIgnoreCase("INT") || sqlTypeName.equalsIgnoreCase("SMALLINT") || sqlTypeName.equalsIgnoreCase("DECIMAL") || sqlTypeName.equalsIgnoreCase("NUMERIC")) { if (length > 18 || precision > 6) return "invalid-" + sqlTypeName + ":" + length + ":" + precision; if (precision == 0) return "numeric"; 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=757065&r1=757064&r2=757065&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 Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -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,34 +122,34 @@ // 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 + // 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/serialize/SerializeException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/SerializeException.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/SerializeException.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/SerializeException.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializable.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializable.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializable.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializable.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -403,7 +403,7 @@ public static Object deserializeCustom(Element element) throws SerializeException { String tagName = element.getTagName(); if ("cus-obj".equals(tagName)) { - String value = UtilXml.elementValue(element); + String value = UtilXml.elementValue(element); if (value != null) { byte[] valueBytes = StringUtil.fromHexString(value); if (valueBytes != null) { |
Free forum by Nabble | Edit this page |