|
Author: doogie
Date: Wed Jan 27 19:51:03 2010 New Revision: 903800 URL: http://svn.apache.org/viewvc?rev=903800&view=rev Log: Don't store references to connected ModelEntity; instead, just store the entity name. This helps the connected object graph at runtime, as it used to be view->entity->view->entity, in very long loops. This is one part of the fix. Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java 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=903800&r1=903799&r2=903800&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 Wed Jan 27 19:51:03 2010 @@ -75,7 +75,7 @@ protected List<ModelMemberEntity> allModelMemberEntities = FastList.newInstance(); /** Contains member-entity ModelEntities: key is alias, value is ModelEntity; populated with fields */ - protected Map<String, ModelEntity> memberModelEntities = null; + protected Map<String, String> memberModelEntities = null; /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */ protected List<ModelAliasAll> aliasAlls = FastList.newInstance(); @@ -194,7 +194,8 @@ this.memberModelEntities = FastMap.newInstance(); populateFields(this.getModelReader()); } - return this.memberModelEntities.get(alias); + String entityName = this.memberModelEntities.get(alias); + return entityName != null ? this.getModelReader().getModelEntityNoCheck(entityName) : null; } public void addMemberModelMemberEntity(ModelMemberEntity modelMemberEntity) { @@ -315,9 +316,10 @@ } } - for (Map.Entry<String, ModelEntity> memberEntityEntry: this.memberModelEntities.entrySet()) { - if (memberEntityEntry.getValue() instanceof ModelViewEntity) { - ModelViewEntity memberViewEntity = (ModelViewEntity) memberEntityEntry.getValue(); + for (Map.Entry<String, String> memberEntityEntry: this.memberModelEntities.entrySet()) { + ModelEntity modelEntity = this.getModelReader().getModelEntityNoCheck(memberEntityEntry.getValue()); + if (modelEntity instanceof ModelViewEntity) { + ModelViewEntity memberViewEntity = (ModelViewEntity) modelEntity; entityAliasStack.add(memberEntityEntry.getKey()); memberViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, whereConditions, havingConditions, orderByList, entityAliasStack); entityAliasStack.remove(entityAliasStack.size() - 1); @@ -407,7 +409,7 @@ if (aliasedEntity == null) { continue; } - memberModelEntities.put(entry.getKey(), aliasedEntity); + memberModelEntities.put(entry.getKey(), aliasedEntityName); Iterator<ModelField> aliasedFieldIterator = aliasedEntity.getFieldsIterator(); while (aliasedFieldIterator.hasNext()) { ModelField aliasedModelField = aliasedFieldIterator.next(); |
| Free forum by Nabble | Edit this page |
