Fixed tabs to spaces; it is evil that eclipse comes with this sort of default...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@628703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -649,16 +649,16 @@ public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, S
|
||||
}
|
||||
|
||||
public List<ModelRelation> getRelationsList(boolean includeOne, boolean includeOneNoFk, boolean includeMany) {
|
||||
List<ModelRelation> relationsList = FastList.newInstance();
|
||||
Iterator<ModelRelation> allIter = this.getRelationsIterator();
|
||||
List<ModelRelation> relationsList = FastList.newInstance();
|
||||
Iterator<ModelRelation> 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;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class EntityEcaUtil {
|
||||
public static UtilCache entityEcaReaders = new UtilCache("entity.EcaReaders", 0, 0, false);
|
||||
|
||||
public static Map<String, Map<String, List<EntityEcaRule>>> getEntityEcaCache(String entityEcaReaderName) {
|
||||
Map<String, Map<String, List<EntityEcaRule>>> ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName);
|
||||
Map<String, Map<String, List<EntityEcaRule>>> ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName);
|
||||
if (ecaCache == null) {
|
||||
synchronized (EntityEcaUtil.class) {
|
||||
ecaCache = (Map) entityEcaReaders.get(entityEcaReaderName);
|
||||
|
||||
@@ -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<String, Map<String, List<EntityEcaRule>>> entityEcaCache;
|
||||
protected Map<String, Map<String, List<ServiceEcaRule>>> 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<ModelEntity> getEntitiesRelatedOne() {
|
||||
List<ModelEntity> 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<ModelEntity> getEntitiesRelatedOne() {
|
||||
List<ModelEntity> entityList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return entityList;
|
||||
}
|
||||
|
||||
public List<ModelEntity> getEntitiesRelatedMany() {
|
||||
List<ModelEntity> entityList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return entityList;
|
||||
}
|
||||
|
||||
/** Get the Services that use this Entity */
|
||||
public List<ModelService> getServicesUsingEntity() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
/** Get the Services called by Entity ECA */
|
||||
public List<ModelService> getServicesCalledByEntityEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<EntityEcaRule> getEntityEcaRules() {
|
||||
List<EntityEcaRule> eecaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return eecaList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsUsingEntity() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getScreensUsingEntity() {
|
||||
List<ModelScreen> screenList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return screenList;
|
||||
}
|
||||
}
|
||||
public List<ModelEntity> getEntitiesRelatedMany() {
|
||||
List<ModelEntity> entityList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return entityList;
|
||||
}
|
||||
|
||||
/** Get the Services that use this Entity */
|
||||
public List<ModelService> getServicesUsingEntity() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
/** Get the Services called by Entity ECA */
|
||||
public List<ModelService> getServicesCalledByEntityEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<EntityEcaRule> getEntityEcaRules() {
|
||||
List<EntityEcaRule> eecaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return eecaList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsUsingEntity() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getScreensUsingEntity() {
|
||||
List<ModelScreen> 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<ModelEntity> getEntitiesUsedByService() {
|
||||
List<ModelEntity> entityList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return entityList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCallingService() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCalledByService() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCalledByServiceEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ServiceEcaRule> getServiceEcaRulesTriggeredByService() {
|
||||
List<ServiceEcaRule> secaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return secaList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCallingServiceByEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ServiceEcaRule> getServiceEcaRulesCallingService() {
|
||||
List<ServiceEcaRule> secaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return secaList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsCallingService() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsBasedOnService() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getScreensCallingService() {
|
||||
List<ModelScreen> screenList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return screenList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getRequestsWithEventCallingService() {
|
||||
List<ModelScreen> 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<ModelEntity> getEntitiesUsedByService() {
|
||||
List<ModelEntity> entityList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return entityList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCallingService() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCalledByService() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCalledByServiceEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ServiceEcaRule> getServiceEcaRulesTriggeredByService() {
|
||||
List<ServiceEcaRule> secaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return secaList;
|
||||
}
|
||||
|
||||
public List<ModelService> getServicesCallingServiceByEca() {
|
||||
List<ModelService> serviceList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return serviceList;
|
||||
}
|
||||
|
||||
public List<ServiceEcaRule> getServiceEcaRulesCallingService() {
|
||||
List<ServiceEcaRule> secaList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return secaList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsCallingService() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelForm> getFormsBasedOnService() {
|
||||
List<ModelForm> formList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return formList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getScreensCallingService() {
|
||||
List<ModelScreen> screenList = FastList.newInstance();
|
||||
// TODO: implement this
|
||||
return screenList;
|
||||
}
|
||||
|
||||
public List<ModelScreen> getRequestsWithEventCallingService() {
|
||||
List<ModelScreen> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user