diff --git a/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java b/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java index d77f203d10..59a331da5d 100644 --- a/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java +++ b/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java @@ -649,16 +649,16 @@ public class ModelEntity extends ModelInfo implements Comparable, S } public List getRelationsList(boolean includeOne, boolean includeOneNoFk, boolean includeMany) { - List relationsList = FastList.newInstance(); - Iterator allIter = this.getRelationsIterator(); + List relationsList = FastList.newInstance(); + Iterator allIter = this.getRelationsIterator(); while (allIter.hasNext()) { ModelRelation modelRelation = allIter.next(); if (includeOne && "one".equals(modelRelation.getType())) { - relationsList.add(modelRelation); + relationsList.add(modelRelation); } else if (includeOneNoFk && "one-nofk".equals(modelRelation.getType())) { - relationsList.add(modelRelation); + relationsList.add(modelRelation); } else if (includeMany && "many".equals(modelRelation.getType())) { - relationsList.add(modelRelation); + relationsList.add(modelRelation); } } return relationsList; diff --git a/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java b/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java index 97bb1e897e..94fc3e6d26 100644 --- a/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java +++ b/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java @@ -51,7 +51,7 @@ public class EntityEcaUtil { public static UtilCache entityEcaReaders = new UtilCache("entity.EcaReaders", 0, 0, false); public static Map>> getEntityEcaCache(String entityEcaReaderName) { - Map>> ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName); + Map>> ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName); if (ecaCache == null) { synchronized (EntityEcaUtil.class) { ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName); diff --git a/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java b/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java index ff403e6cf6..04405f6d47 100644 --- a/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java +++ b/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java @@ -47,193 +47,193 @@ import org.xml.sax.SAXException; */ public class ArtifactInfoFactory { - static public class ArtifactInfoContext { - protected String delegatorName; - protected ModelReader entityModelReader; + static public class ArtifactInfoContext { + protected String delegatorName; + protected ModelReader entityModelReader; protected DispatchContext dispatchContext; protected Map>> entityEcaCache; protected Map>> serviceEcaCache; public ArtifactInfoContext(String delegatorName) throws GenericEntityException { - this.delegatorName = delegatorName; - this.entityModelReader = ModelReader.getModelReader(delegatorName); - this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null); - this.entityEcaCache = EntityEcaUtil.getEntityEcaCache(EntityEcaUtil.getEntityEcaReaderName(delegatorName)); - this.serviceEcaCache = ServiceEcaUtil.ecaCache; + this.delegatorName = delegatorName; + this.entityModelReader = ModelReader.getModelReader(delegatorName); + this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null); + this.entityEcaCache = EntityEcaUtil.getEntityEcaCache(EntityEcaUtil.getEntityEcaReaderName(delegatorName)); + this.serviceEcaCache = ServiceEcaUtil.ecaCache; } public ModelReader getEntityModelReader() { - return this.entityModelReader; + return this.entityModelReader; } public DispatchContext getDispatchContext() { - return this.dispatchContext; + return this.dispatchContext; } public ModelEntity getModelEntity(String entityName) throws GenericEntityException { - return this.getEntityModelReader().getModelEntity(entityName); + return this.getEntityModelReader().getModelEntity(entityName); } public ModelService getModelService(String serviceName) throws GenericServiceException { - return this.getDispatchContext().getModelService(serviceName); + return this.getDispatchContext().getModelService(serviceName); } public ModelForm getModelForm(String formName, String formLocation) throws ParserConfigurationException, SAXException, IOException { - return FormFactory.getFormFromLocation(formLocation, formName, this.entityModelReader, this.dispatchContext); + return FormFactory.getFormFromLocation(formLocation, formName, this.entityModelReader, this.dispatchContext); } public ModelScreen getModelScreen(String screenName, String screenLocation) throws ParserConfigurationException, SAXException, IOException { - return ScreenFactory.getScreenFromLocation(screenLocation, screenName); + return ScreenFactory.getScreenFromLocation(screenLocation, screenName); + } + } + + static public class EntityInfo { + protected ArtifactInfoContext aic; + protected ModelEntity modelEntity; + + public EntityInfo(String entityName, ArtifactInfoContext aic) throws GenericEntityException { + this.aic = aic; + this.modelEntity = this.aic.getModelEntity(entityName); + } + + public List getEntitiesRelatedOne() { + List entityList = FastList.newInstance(); + // TODO: implement this + return entityList; } - } - - static public class EntityInfo { - protected ArtifactInfoContext aic; - protected ModelEntity modelEntity; - - public EntityInfo(String entityName, ArtifactInfoContext aic) throws GenericEntityException { - this.aic = aic; - this.modelEntity = this.aic.getModelEntity(entityName); - } - - public List getEntitiesRelatedOne() { - List entityList = FastList.newInstance(); - // TODO: implement this - return entityList; - } - public List getEntitiesRelatedMany() { - List entityList = FastList.newInstance(); - // TODO: implement this - return entityList; - } - - /** Get the Services that use this Entity */ - public List getServicesUsingEntity() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - /** Get the Services called by Entity ECA */ - public List getServicesCalledByEntityEca() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - public List getEntityEcaRules() { - List eecaList = FastList.newInstance(); - // TODO: implement this - return eecaList; - } - - public List getFormsUsingEntity() { - List formList = FastList.newInstance(); - // TODO: implement this - return formList; - } - - public List getScreensUsingEntity() { - List screenList = FastList.newInstance(); - // TODO: implement this - return screenList; - } - } + public List getEntitiesRelatedMany() { + List entityList = FastList.newInstance(); + // TODO: implement this + return entityList; + } + + /** Get the Services that use this Entity */ + public List getServicesUsingEntity() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + /** Get the Services called by Entity ECA */ + public List getServicesCalledByEntityEca() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List getEntityEcaRules() { + List eecaList = FastList.newInstance(); + // TODO: implement this + return eecaList; + } + + public List getFormsUsingEntity() { + List formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List getScreensUsingEntity() { + List screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } + } - static public class ServiceInfo { - protected ArtifactInfoContext aic; - protected ModelService modelService; - - public ServiceInfo(String serviceName, ArtifactInfoContext aic) throws GenericServiceException { - this.aic = aic; - this.modelService = this.aic.getModelService(serviceName); - } - - public List getEntitiesUsedByService() { - List entityList = FastList.newInstance(); - // TODO: implement this - return entityList; - } - - public List getServicesCallingService() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - public List getServicesCalledByService() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - public List getServicesCalledByServiceEca() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - public List getServiceEcaRulesTriggeredByService() { - List secaList = FastList.newInstance(); - // TODO: implement this - return secaList; - } - - public List getServicesCallingServiceByEca() { - List serviceList = FastList.newInstance(); - // TODO: implement this - return serviceList; - } - - public List getServiceEcaRulesCallingService() { - List secaList = FastList.newInstance(); - // TODO: implement this - return secaList; - } - - public List getFormsCallingService() { - List formList = FastList.newInstance(); - // TODO: implement this - return formList; - } - - public List getFormsBasedOnService() { - List formList = FastList.newInstance(); - // TODO: implement this - return formList; - } - - public List getScreensCallingService() { - List screenList = FastList.newInstance(); - // TODO: implement this - return screenList; - } - - public List getRequestsWithEventCallingService() { - List screenList = FastList.newInstance(); - // TODO: implement this - return screenList; - } - } + static public class ServiceInfo { + protected ArtifactInfoContext aic; + protected ModelService modelService; + + public ServiceInfo(String serviceName, ArtifactInfoContext aic) throws GenericServiceException { + this.aic = aic; + this.modelService = this.aic.getModelService(serviceName); + } + + public List getEntitiesUsedByService() { + List entityList = FastList.newInstance(); + // TODO: implement this + return entityList; + } + + public List getServicesCallingService() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List getServicesCalledByService() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List getServicesCalledByServiceEca() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List getServiceEcaRulesTriggeredByService() { + List secaList = FastList.newInstance(); + // TODO: implement this + return secaList; + } + + public List getServicesCallingServiceByEca() { + List serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List getServiceEcaRulesCallingService() { + List secaList = FastList.newInstance(); + // TODO: implement this + return secaList; + } + + public List getFormsCallingService() { + List formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List getFormsBasedOnService() { + List formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List getScreensCallingService() { + List screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } + + public List getRequestsWithEventCallingService() { + List screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } + } - static public class FormInfo { - protected ArtifactInfoContext aic; - protected ModelForm modelForm; - - public FormInfo(String formName, String formLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { - this.aic = aic; + static public class FormInfo { + protected ArtifactInfoContext aic; + protected ModelForm modelForm; + + public FormInfo(String formName, String formLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { + this.aic = aic; this.modelForm = aic.getModelForm(formName, formLocation); - } - } + } + } - static public class ScreenInfo { - protected ArtifactInfoContext aic; - protected ModelScreen modelScreen; - - public ScreenInfo(String screenName, String screenLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { - this.aic = aic; + static public class ScreenInfo { + protected ArtifactInfoContext aic; + protected ModelScreen modelScreen; + + public ScreenInfo(String screenName, String screenLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { + this.aic = aic; this.modelScreen = aic.getModelScreen(screenName, screenLocation); - } - } + } + } } diff --git a/framework/widget/src/org/ofbiz/widget/form/ModelForm.java b/framework/widget/src/org/ofbiz/widget/form/ModelForm.java index aa678fc710..0ce43e9f36 100644 --- a/framework/widget/src/org/ofbiz/widget/form/ModelForm.java +++ b/framework/widget/src/org/ofbiz/widget/form/ModelForm.java @@ -69,7 +69,7 @@ public class ModelForm extends ModelWidget { public static final String module = ModelForm.class.getName(); public static final String DEFAULT_FORM_RESULT_LIST_NAME = "defaultFormResultList"; - protected ModelReader entityModelReader; + protected ModelReader entityModelReader; protected DispatchContext dispatchContext; protected String formLocation; @@ -609,24 +609,24 @@ public class ModelForm extends ModelWidget { if (modelParam.formDisplay) { if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) { ModelEntity modelEntity; - try { - modelEntity = this.entityModelReader.getModelEntity(modelParam.entityName); - if (modelEntity != null) { - ModelField modelField = modelEntity.getField(modelParam.fieldName); - if (modelField != null) { - // okay, populate using the entity field info... - ModelFormField modelFormField = this.addFieldFromEntityField(modelEntity, modelField, autoFieldsService.defaultFieldType, autoFieldsService.defaultPosition); - if (UtilValidate.isNotEmpty(autoFieldsService.mapName)) { - modelFormField.setMapName(autoFieldsService.mapName); - } - modelFormField.setRequiredField(!modelParam.optional); - // continue to skip creating based on service param - continue; - } - } - } catch (GenericEntityException e) { - Debug.logError(e, module); - } + try { + modelEntity = this.entityModelReader.getModelEntity(modelParam.entityName); + if (modelEntity != null) { + ModelField modelField = modelEntity.getField(modelParam.fieldName); + if (modelField != null) { + // okay, populate using the entity field info... + ModelFormField modelFormField = this.addFieldFromEntityField(modelEntity, modelField, autoFieldsService.defaultFieldType, autoFieldsService.defaultPosition); + if (UtilValidate.isNotEmpty(autoFieldsService.mapName)) { + modelFormField.setMapName(autoFieldsService.mapName); + } + modelFormField.setRequiredField(!modelParam.optional); + // continue to skip creating based on service param + continue; + } + } + } catch (GenericEntityException e) { + Debug.logError(e, module); + } } ModelFormField modelFormField = this.addFieldFromServiceParam(modelService, modelParam, autoFieldsService.defaultFieldType, autoFieldsService.defaultPosition); @@ -654,11 +654,11 @@ public class ModelForm extends ModelWidget { autoFieldsEntities.add(autoFieldsEntity); // read entity def and auto-create fields ModelEntity modelEntity = null; - try { - modelEntity = this.entityModelReader.getModelEntity(autoFieldsEntity.entityName); - } catch (GenericEntityException e) { - Debug.logError(e, module); - } + try { + modelEntity = this.entityModelReader.getModelEntity(autoFieldsEntity.entityName); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } if (modelEntity == null) { throw new IllegalArgumentException("Error finding Entity with name " + autoFieldsEntity.entityName + " for auto-fields-entity in a form widget"); }