Author: jonesde
Date: Sun Feb 24 21:47:34 2008 New Revision: 630737 URL: http://svn.apache.org/viewvc?rev=630737&view=rev Log: Some refactoring of the entity eomodeld export, wrote initial service and eca calling/called graph, still needs data gathering though Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java (with props) ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (with props) ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java (with props) ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java (with props) ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java (with props) Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java Sun Feb 24 21:47:34 2008 @@ -18,7 +18,13 @@ *******************************************************************************/ package org.ofbiz.base.util; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.ParseException; @@ -550,5 +556,10 @@ for (int i = 0; i < indentLevel; i++) writer.print(indentFourString); writer.println(");"); + } + public static void writePlistFile(Map<String, Object> eoModelMap, String eomodeldFullPath, String filename) throws FileNotFoundException, UnsupportedEncodingException { + PrintWriter plistWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(eomodeldFullPath, filename)), "UTF-8"))); + UtilFormatOut.writePlistPropertyMap(eoModelMap, 0, plistWriter, false); + plistWriter.close(); } } 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=630737&r1=630736&r2=630737&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 Sun Feb 24 21:47:34 2008 @@ -1395,10 +1395,15 @@ * @param helperName */ public void writeEoModelText(PrintWriter writer, String entityPrefix, String helperName, Set<String> entityNameIncludeSet) { - final boolean useRelationshipNames = false; - if (entityPrefix == null) entityPrefix = ""; if (helperName == null) helperName = "localderby"; + + UtilFormatOut.writePlistPropertyMap(this.createEoModelMap(entityPrefix, helperName, entityNameIncludeSet), 0, writer, false); + } + + + public Map<String, Object> createEoModelMap(String entityPrefix, String helperName, Set<String> entityNameIncludeSet) { + final boolean useRelationshipNames = false; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); Map<String, Object> topLevelMap = FastMap.newInstance(); @@ -1436,7 +1441,6 @@ attributeMap.put("name", field.getName()); attributeMap.put("columnName", field.getColName()); attributeMap.put("valueClassName", fieldType.getJavaType()); - attributeMap.put("name", field.getName()); String sqlType = fieldType.getSqlType(); if (sqlType.indexOf("(") >= 0) { @@ -1500,6 +1504,6 @@ topLevelMap.put("relationships", relationshipsMapList); } - UtilFormatOut.writePlistPropertyMap(topLevelMap, 0, writer, false); + return topLevelMap; } } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java Sun Feb 24 21:47:34 2008 @@ -115,6 +115,10 @@ } } + public String getShortDisplayDescription() { + return this.name + "[" + this.type + "," + this.mode + "]" + (optional ? "" : "*"); + } + public Object getDefaultValue() { Object defaultValueObj = null; if (this.type != null) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Sun Feb 24 21:47:34 2008 @@ -46,6 +46,11 @@ import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.entity.model.ModelField; +import org.ofbiz.entity.model.ModelFieldType; +import org.ofbiz.entity.model.ModelFieldTypeReader; +import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelRelation; import org.ofbiz.service.group.GroupModel; import org.ofbiz.service.group.GroupServiceModel; import org.ofbiz.service.group.ServiceGroupReader; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Sun Feb 24 21:47:34 2008 @@ -75,6 +75,14 @@ this.ignoreError = !"false".equals(action.getAttribute("ignore-error")); this.persist = "true".equals(action.getAttribute("persist")); } + + public String getServiceName() { + return this.serviceName; + } + + public String getShortDisplayDescription() { + return this.serviceName + "[" + this.serviceMode + (this.persist ? ",persist" : "") + "]"; + } public boolean runAction(String selfService, DispatchContext dctx, Map<String, Object> context, Map<String, Object> result) throws GenericServiceException { if (serviceName.equals(selfService)) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java Sun Feb 24 21:47:34 2008 @@ -18,20 +18,19 @@ *******************************************************************************/ package org.ofbiz.service.eca; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.ofbiz.service.DispatchContext; -import org.ofbiz.service.GenericServiceException; -import org.ofbiz.service.LocalDispatcher; -import org.ofbiz.service.ServiceUtil; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; - +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; import org.w3c.dom.Element; /** @@ -84,6 +83,28 @@ } } + public String getShortDisplayDescription(boolean moreDetail) { + StringBuilder buf = new StringBuilder(); + if (isService) { + buf.append("[").append(conditionService).append("]"); + } else { + buf.append("["); + if (UtilValidate.isNotEmpty(lhsMapName)) buf.append(lhsMapName).append("."); + buf.append(lhsValueName); + buf.append(":").append(operator).append(":"); + if (UtilValidate.isNotEmpty(rhsMapName)) buf.append(rhsMapName).append("."); + buf.append(rhsValueName); + + if (moreDetail) { + if (UtilValidate.isNotEmpty(compareType)) buf.append(compareType); + if (UtilValidate.isNotEmpty(format)) buf.append(format); + } + + buf.append("]"); + } + return buf.toString(); + } + public boolean eval(String serviceName, DispatchContext dctx, Map context) throws GenericServiceException { if (serviceName == null || dctx == null || context == null || dctx.getClassLoader() == null) { throw new GenericServiceException("Cannot have null Service, Context or DispatchContext!"); @@ -173,15 +194,15 @@ public String toString() { StringBuilder buf = new StringBuilder(); - buf.append("[").append(conditionService).append("]"); - buf.append("[").append(lhsMapName).append("]"); - buf.append("[").append(lhsValueName).append("]"); - buf.append("[").append(operator).append("]"); - buf.append("[").append(rhsMapName).append("]"); - buf.append("[").append(rhsValueName).append("]"); - buf.append("[").append(isConstant).append("]"); - buf.append("[").append(compareType).append("]"); - buf.append("[").append(format).append("]"); + if (UtilValidate.isNotEmpty(conditionService)) buf.append("[").append(conditionService).append("]"); + if (UtilValidate.isNotEmpty(lhsMapName)) buf.append("[").append(lhsMapName).append("]"); + if (UtilValidate.isNotEmpty(lhsValueName)) buf.append("[").append(lhsValueName).append("]"); + if (UtilValidate.isNotEmpty(operator)) buf.append("[").append(operator).append("]"); + if (UtilValidate.isNotEmpty(rhsMapName)) buf.append("[").append(rhsMapName).append("]"); + if (UtilValidate.isNotEmpty(rhsValueName)) buf.append("[").append(rhsValueName).append("]"); + if (UtilValidate.isNotEmpty(isConstant)) buf.append("[").append(isConstant).append("]"); + if (UtilValidate.isNotEmpty(compareType)) buf.append("[").append(compareType).append("]"); + if (UtilValidate.isNotEmpty(format)) buf.append("[").append(format).append("]"); return buf.toString(); } } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java Sun Feb 24 21:47:34 2008 @@ -18,20 +18,17 @@ *******************************************************************************/ package org.ofbiz.service.eca; -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import javolution.util.FastList; -import javolution.util.FastSet; -import org.ofbiz.service.DispatchContext; -import org.ofbiz.service.GenericServiceException; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilXml; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; import org.w3c.dom.Element; /** @@ -83,6 +80,26 @@ if (Debug.verboseOn()) Debug.logVerbose("actions and sets (intermixed): " + actionsAndSets, module); } + public String getShortDisplayName() { + return this.serviceName + ":" + this.eventName; + } + + public List<ServiceEcaAction> getEcaActionList() { + List<ServiceEcaAction> actionList = FastList.newInstance(); + for (Object actionOrSet: this.actionsAndSets) { + if (actionOrSet instanceof ServiceEcaAction) { + actionList.add((ServiceEcaAction) actionOrSet); + } + } + return actionList; + } + + public List<ServiceEcaCondition> getEcaConditionList() { + List<ServiceEcaCondition> condList = FastList.newInstance(); + condList.addAll(this.conditions); + return condList; + } + public void eval(String serviceName, DispatchContext dctx, Map<String, Object> context, Map<String, Object> result, boolean isError, boolean isFailure, Set<String> actionsRun) throws GenericServiceException { if (!enabled) { Debug.logInfo("Service ECA [" + this.serviceName + "] on [" + this.eventName + "] is disabled; not running.", module); Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=630737&r1=630736&r2=630737&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Sun Feb 24 21:47:34 2008 @@ -24,8 +24,10 @@ import javax.xml.parsers.ParserConfigurationException; -import javolution.util.FastList; +import javolution.util.FastMap; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelReader; @@ -47,14 +49,44 @@ */ public class ArtifactInfoFactory { + public static EntityArtifactInfo makeEntityArtifactInfo(String entityName, String delegatorName) throws GeneralException { + return new EntityArtifactInfo(entityName, ArtifactInfoContext.makeArtifactInfoContext(delegatorName)); + } + + public static ServiceArtifactInfo makeServiceArtifactInfo(String serviceName, String delegatorName) throws GeneralException { + return new ServiceArtifactInfo(serviceName, ArtifactInfoContext.makeArtifactInfoContext(delegatorName)); + } + + public static FormWidgetArtifactInfo makeFormWidgetArtifactInfo(String formName, String formLocation, String delegatorName) throws GeneralException, IOException, SAXException, ParserConfigurationException { + return new FormWidgetArtifactInfo(formName, formLocation, ArtifactInfoContext.makeArtifactInfoContext(delegatorName)); + } + + public static ScreenWidgetArtifactInfo makeScreenWidgetArtifactInfo(String screenName, String screenLocation, String delegatorName) throws GeneralException, IOException, SAXException, ParserConfigurationException { + return new ScreenWidgetArtifactInfo(screenName, screenLocation, ArtifactInfoContext.makeArtifactInfoContext(delegatorName)); + } + static public class ArtifactInfoContext { + protected static Map<String, ArtifactInfoContext> artifactInfoContextCache = FastMap.newInstance(); + 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 { + public static ArtifactInfoContext makeArtifactInfoContext(String delegatorName) throws GenericEntityException { + if (UtilValidate.isEmpty(delegatorName)) { + delegatorName = "default"; + } + + ArtifactInfoContext aic = artifactInfoContextCache.get(delegatorName); + if (aic == null) { + aic = new ArtifactInfoContext(delegatorName); + } + return aic; + } + + protected ArtifactInfoContext(String delegatorName) throws GenericEntityException { this.delegatorName = delegatorName; this.entityModelReader = ModelReader.getModelReader(delegatorName); this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null); @@ -84,156 +116,6 @@ public ModelScreen getModelScreen(String screenName, String screenLocation) throws ParserConfigurationException, SAXException, IOException { 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; - } - - 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 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; - this.modelScreen = aic.getModelScreen(screenName, screenLocation); } } } Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java?rev=630737&view=auto ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java (added) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java Sun Feb 24 21:47:34 2008 @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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 + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.webtools.artifactinfo; + +import java.util.List; + +import javolution.util.FastList; + +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entityext.eca.EntityEcaRule; +import org.ofbiz.webtools.artifactinfo.ArtifactInfoFactory.ArtifactInfoContext; + +/** + * + */ +public class EntityArtifactInfo { + protected ArtifactInfoContext aic; + protected ModelEntity modelEntity; + + public EntityArtifactInfo(String entityName, ArtifactInfoContext aic) throws GenericEntityException { + this.aic = aic; + this.modelEntity = this.aic.getModelEntity(entityName); + } + + public ModelEntity getModelEntity() { + return this.modelEntity; + } + + public List<EntityArtifactInfo> getEntitiesRelatedOne() { + List<EntityArtifactInfo> entityList = FastList.newInstance(); + // TODO: implement this + return entityList; + } + + public List<EntityArtifactInfo> getEntitiesRelatedMany() { + List<EntityArtifactInfo> entityList = FastList.newInstance(); + // TODO: implement this + return entityList; + } + + /** Get the Services that use this Entity */ + public List<ServiceArtifactInfo> getServicesUsingEntity() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + /** Get the Services called by Entity ECA */ + public List<ServiceArtifactInfo> getServicesCalledByEntityEca() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List<EntityEcaRule> getEntityEcaRules() { + List<EntityEcaRule> eecaList = FastList.newInstance(); + // TODO: implement this + return eecaList; + } + + public List<FormWidgetArtifactInfo> getFormsUsingEntity() { + List<FormWidgetArtifactInfo> formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List<ScreenWidgetArtifactInfo> getScreensUsingEntity() { + List<ScreenWidgetArtifactInfo> screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } +} Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java?rev=630737&view=auto ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (added) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java Sun Feb 24 21:47:34 2008 @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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 + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.webtools.artifactinfo; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import org.ofbiz.webtools.artifactinfo.ArtifactInfoFactory.ArtifactInfoContext; +import org.ofbiz.widget.form.ModelForm; +import org.xml.sax.SAXException; + +/** + * + */ +public class FormWidgetArtifactInfo { + protected ArtifactInfoContext aic; + protected ModelForm modelForm; + + public FormWidgetArtifactInfo(String formName, String formLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { + this.aic = aic; + this.modelForm = aic.getModelForm(formName, formLocation); + } +} Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java?rev=630737&view=auto ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java (added) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java Sun Feb 24 21:47:34 2008 @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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 + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.webtools.artifactinfo; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import org.ofbiz.webtools.artifactinfo.ArtifactInfoFactory.ArtifactInfoContext; +import org.ofbiz.widget.screen.ModelScreen; +import org.xml.sax.SAXException; + +/** + * + */ +public class ScreenWidgetArtifactInfo { + protected ArtifactInfoContext aic; + protected ModelScreen modelScreen; + + public ScreenWidgetArtifactInfo(String screenName, String screenLocation, ArtifactInfoContext aic) throws ParserConfigurationException, SAXException, IOException { + this.aic = aic; + this.modelScreen = aic.getModelScreen(screenName, screenLocation); + } +} Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java?rev=630737&view=auto ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java (added) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java Sun Feb 24 21:47:34 2008 @@ -0,0 +1,299 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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 + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.webtools.artifactinfo; + +import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javolution.util.FastList; +import javolution.util.FastMap; +import javolution.util.FastSet; + +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.ModelParam; +import org.ofbiz.service.ModelService; +import org.ofbiz.webtools.artifactinfo.ArtifactInfoFactory.ArtifactInfoContext; + +/** + * + */ +public class ServiceArtifactInfo { + protected ArtifactInfoContext aic; + protected ModelService modelService; + protected String displayPrefix = null; + + public ServiceArtifactInfo(String serviceName, ArtifactInfoContext aic) throws GenericServiceException { + this.aic = aic; + this.modelService = this.aic.getModelService(serviceName); + } + + public ModelService getModelService() { + return this.modelService; + } + + public void setDisplayPrefix(String displayPrefix) { + this.displayPrefix = displayPrefix; + } + + public String getDisplayPrefixedName() { + return (this.displayPrefix != null ? this.displayPrefix : "") + this.modelService.name; + } + + public List<EntityArtifactInfo> getEntitiesUsedByService() { + List<EntityArtifactInfo> entityList = FastList.newInstance(); + // TODO: implement this + return entityList; + } + + public List<ServiceArtifactInfo> getServicesCallingService() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: *implement this + return serviceList; + } + + public List<ServiceArtifactInfo> getServicesCalledByService() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: *implement this + return serviceList; + } + + public List<ServiceArtifactInfo> getServicesCalledByServiceEcas() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List<ServiceEcaArtifactInfo> getServiceEcaRulesTriggeredByService() { + List<ServiceEcaArtifactInfo> secaList = FastList.newInstance(); + // TODO: *implement this + return secaList; + } + + public List<ServiceArtifactInfo> getServicesCallingServiceByEcas() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: implement this + return serviceList; + } + + public List<ServiceEcaArtifactInfo> getServiceEcaRulesCallingService() { + List<ServiceEcaArtifactInfo> secaList = FastList.newInstance(); + // TODO: *implement this + return secaList; + } + + public List<FormWidgetArtifactInfo> getFormsCallingService() { + List<FormWidgetArtifactInfo> formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List<FormWidgetArtifactInfo> getFormsBasedOnService() { + List<FormWidgetArtifactInfo> formList = FastList.newInstance(); + // TODO: implement this + return formList; + } + + public List<ScreenWidgetArtifactInfo> getScreensCallingService() { + List<ScreenWidgetArtifactInfo> screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } + + public List<ScreenWidgetArtifactInfo> getRequestsWithEventCallingService() { + List<ScreenWidgetArtifactInfo> screenList = FastList.newInstance(); + // TODO: implement this + return screenList; + } + + public void writeServiceCallGraphEoModel(String eomodeldFullPath) throws GeneralException, FileNotFoundException, UnsupportedEncodingException { + // TODO: add support for parameters with recursion: int callingHops, int calledHops, + boolean useMoreDetailedNames = true; + + Set<String> allDiagramEntitiesWithPrefixes = FastSet.newInstance(); + List<ServiceArtifactInfo> allServiceList = FastList.newInstance(); + List<ServiceEcaArtifactInfo> allServiceEcaList = FastList.newInstance(); + + // all services that call this service + List<ServiceArtifactInfo> callingServiceList = this.getServicesCallingService(); + + // set the prefix and add to the all list + for (ServiceArtifactInfo callingService: callingServiceList) { + callingService.setDisplayPrefix("Calling:"); + allDiagramEntitiesWithPrefixes.add(callingService.getDisplayPrefixedName()); + allServiceList.add(callingService); + } + + // all services this service calls + List<ServiceArtifactInfo> calledServiceList = this.getServicesCalledByService(); + + for (ServiceArtifactInfo calledService: calledServiceList) { + calledService.setDisplayPrefix("Called:"); + allDiagramEntitiesWithPrefixes.add(calledService.getDisplayPrefixedName()); + allServiceList.add(calledService); + } + + // all SECAs and triggering services that call this service as an action + List<ServiceEcaArtifactInfo> callingServiceEcaList = this.getServiceEcaRulesCallingService(); + + for (ServiceEcaArtifactInfo callingServiceEca: callingServiceEcaList) { + callingServiceEca.setDisplayPrefix("Triggering:"); + allDiagramEntitiesWithPrefixes.add(callingServiceEca.getDisplayPrefixedName()); + allServiceEcaList.add(callingServiceEca); + } + + // all SECAs and corresponding services triggered by this service + List<ServiceEcaArtifactInfo> calledServiceEcaList = this.getServiceEcaRulesTriggeredByService(); + + for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaList) { + calledServiceEca.setDisplayPrefix("Called:"); + allDiagramEntitiesWithPrefixes.add(calledServiceEca.getDisplayPrefixedName()); + allServiceEcaList.add(calledServiceEca); + } + + // write index.eomodeld file + Map<String, Object> indexEoModelMap = FastMap.newInstance(); + indexEoModelMap.put("EOModelVersion", "\"2.1\""); + List<Map<String, Object>> entitiesMapList = FastList.newInstance(); + indexEoModelMap.put("entities", entitiesMapList); + for (String entityName: allDiagramEntitiesWithPrefixes) { + Map<String, Object> entitiesMap = FastMap.newInstance(); + entitiesMapList.add(entitiesMap); + entitiesMap.put("className", "EOGenericRecord"); + entitiesMap.put("name", entityName); + } + UtilFormatOut.writePlistFile(indexEoModelMap, eomodeldFullPath, "index.eomodeld"); + + // write this service description file + Map<String, Object> thisServiceEoModelMap = createEoModelMap(allServiceList, allServiceEcaList, useMoreDetailedNames); + UtilFormatOut.writePlistFile(thisServiceEoModelMap, eomodeldFullPath, this.getDisplayPrefixedName() + ".plist"); + + // write service description files + for (ServiceArtifactInfo callingService: callingServiceList) { + Map<String, Object> serviceEoModelMap = callingService.createEoModelMap(UtilMisc.toList(this), null, useMoreDetailedNames); + UtilFormatOut.writePlistFile(serviceEoModelMap, eomodeldFullPath, callingService.getDisplayPrefixedName() + ".plist"); + } + for (ServiceArtifactInfo calledService: calledServiceList) { + Map<String, Object> serviceEoModelMap = calledService.createEoModelMap(UtilMisc.toList(this), null, useMoreDetailedNames); + UtilFormatOut.writePlistFile(serviceEoModelMap, eomodeldFullPath, calledService.getDisplayPrefixedName() + ".plist"); + } + + // write SECA description files + for (ServiceEcaArtifactInfo callingServiceEca: callingServiceEcaList) { + // add List<ServiceArtifactInfo> for services that trigger this eca rule + List<ServiceArtifactInfo> ecaCallingServiceList = callingServiceEca.getServicesTriggeringServiceEca(); + for (ServiceArtifactInfo ecaCallingService: ecaCallingServiceList) { + ecaCallingService.setDisplayPrefix("Triggering:"); + } + ecaCallingServiceList.add(this); + + Map<String, Object> serviceEcaEoModelMap = callingServiceEca.createEoModelMap(ecaCallingServiceList, useMoreDetailedNames); + UtilFormatOut.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, callingServiceEca.getDisplayPrefixedName() + ".plist"); + } + for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaList) { + // add List<ServiceArtifactInfo> for services this eca rule calls in action + List<ServiceArtifactInfo> ecaCalledServiceList = calledServiceEca.getServicesCalledByServiceEcaActions(); + for (ServiceArtifactInfo ecaCalledService: ecaCalledServiceList) { + ecaCalledService.setDisplayPrefix("Called:"); + } + ecaCalledServiceList.add(this); + + Map<String, Object> serviceEcaEoModelMap = calledServiceEca.createEoModelMap(ecaCalledServiceList, useMoreDetailedNames); + UtilFormatOut.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, calledServiceEca.getDisplayPrefixedName() + ".plist"); + } + } + + public Map<String, Object> createEoModelMap(List<ServiceArtifactInfo> relatedServiceList, List<ServiceEcaArtifactInfo> relatedServiceEcaList, boolean useMoreDetailedNames) { + if (relatedServiceList == null) relatedServiceList = FastList.newInstance(); + if (relatedServiceEcaList == null) relatedServiceEcaList = FastList.newInstance(); + Map<String, Object> topLevelMap = FastMap.newInstance(); + + topLevelMap.put("name", this.getDisplayPrefixedName()); + topLevelMap.put("className", "EOGenericRecord"); + + // for classProperties add attribute names AND relationship names to get a nice, complete chart + List<String> classPropertiesList = FastList.newInstance(); + topLevelMap.put("classProperties", classPropertiesList); + for (ModelParam param: this.modelService.getModelParamList()) { + if (useMoreDetailedNames) { + classPropertiesList.add(param.getShortDisplayDescription()); + } else { + classPropertiesList.add(param.name); + } + } + for (ServiceArtifactInfo sai: relatedServiceList) { + classPropertiesList.add(sai.getDisplayPrefixedName()); + } + for (ServiceEcaArtifactInfo seai: relatedServiceEcaList) { + classPropertiesList.add(seai.getDisplayPrefixedName()); + } + + // attributes + List<Map<String, Object>> attributesList = FastList.newInstance(); + topLevelMap.put("attributes", attributesList); + for (ModelParam param: this.modelService.getModelParamList()) { + Map<String, Object> attributeMap = FastMap.newInstance(); + attributesList.add(attributeMap); + + if (useMoreDetailedNames) { + attributeMap.put("name", param.getShortDisplayDescription()); + } else { + attributeMap.put("name", param.name); + } + attributeMap.put("valueClassName", param.type); + attributeMap.put("externalType", param.type); + } + + // relationships + List<Map<String, Object>> relationshipsMapList = FastList.newInstance(); + + for (ServiceArtifactInfo sai: relatedServiceList) { + Map<String, Object> relationshipMap = FastMap.newInstance(); + relationshipsMapList.add(relationshipMap); + + relationshipMap.put("name", sai.getDisplayPrefixedName()); + relationshipMap.put("destination", sai.getDisplayPrefixedName()); + + // not sure if we can use these, or need them, for this type of diagram + //relationshipMap.put("isToMany", "N"); + //relationshipMap.put("joinSemantic", "EOInnerJoin"); + //relationshipMap.put("joins", joinsMapList); + //joinsMap.put("sourceAttribute", keyMap.getFieldName()); + //joinsMap.put("destinationAttribute", keyMap.getRelFieldName()); + } + for (ServiceEcaArtifactInfo seai: relatedServiceEcaList) { + Map<String, Object> relationshipMap = FastMap.newInstance(); + relationshipsMapList.add(relationshipMap); + + relationshipMap.put("name", seai.getDisplayPrefixedName()); + relationshipMap.put("destination", seai.getDisplayPrefixedName()); + } + + if (relationshipsMapList.size() > 0) { + topLevelMap.put("relationships", relationshipsMapList); + } + + return topLevelMap; + } +} Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java?rev=630737&view=auto ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java (added) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java Sun Feb 24 21:47:34 2008 @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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 + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.webtools.artifactinfo; + +import java.util.List; +import java.util.Map; + +import javolution.util.FastList; +import javolution.util.FastMap; + +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.eca.ServiceEcaAction; +import org.ofbiz.service.eca.ServiceEcaCondition; +import org.ofbiz.service.eca.ServiceEcaRule; +import org.ofbiz.webtools.artifactinfo.ArtifactInfoFactory.ArtifactInfoContext; + +/** + * + */ +public class ServiceEcaArtifactInfo { + protected ArtifactInfoContext aic; + protected ServiceEcaRule serviceEcaRule; + protected String displayPrefix = null; + + public ServiceEcaArtifactInfo(ServiceEcaRule serviceEcaRule, ArtifactInfoContext aic) throws GenericServiceException { + this.aic = aic; + this.serviceEcaRule = serviceEcaRule; + } + + public ServiceEcaRule getServiceEcaRule() { + return this.serviceEcaRule; + } + + public void setDisplayPrefix(String displayPrefix) { + this.displayPrefix = displayPrefix; + } + + public String getDisplayPrefixedName() { + return (this.displayPrefix != null ? this.displayPrefix : "") + this.serviceEcaRule.getShortDisplayName(); + } + + public List<ServiceArtifactInfo> getServicesCalledByServiceEcaActions() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: *implement this + return serviceList; + } + + public List<ServiceArtifactInfo> getServicesTriggeringServiceEca() { + List<ServiceArtifactInfo> serviceList = FastList.newInstance(); + // TODO: *implement this + return serviceList; + } + + public Map<String, Object> createEoModelMap(List<ServiceArtifactInfo> relatedServiceList, boolean useMoreDetailedNames) { + if (relatedServiceList == null) relatedServiceList = FastList.newInstance(); + Map<String, Object> topLevelMap = FastMap.newInstance(); + + topLevelMap.put("name", this.getDisplayPrefixedName()); + topLevelMap.put("className", "EOGenericRecord"); + + // for classProperties add attribute names AND relationship names to get a nice, complete chart + List<String> classPropertiesList = FastList.newInstance(); + topLevelMap.put("classProperties", classPropertiesList); + // actions + for (ServiceEcaAction ecaAction: this.serviceEcaRule.getEcaActionList()) { + if (useMoreDetailedNames) { + classPropertiesList.add(ecaAction.getShortDisplayDescription()); + } else { + classPropertiesList.add(ecaAction.getServiceName()); + } + } + // conditions + for (ServiceEcaCondition ecaCondition: this.serviceEcaRule.getEcaConditionList()) { + classPropertiesList.add(ecaCondition.getShortDisplayDescription(useMoreDetailedNames)); + } + + /* going to try this without any attributes... + // attributes + List<Map<String, Object>> attributesList = FastList.newInstance(); + topLevelMap.put("attributes", attributesList); + for (ModelParam param: this.modelService.getModelParamList()) { + Map<String, Object> attributeMap = FastMap.newInstance(); + attributesList.add(attributeMap); + + if (useMoreDetailedNames) { + attributeMap.put("name", param.getShortDisplayDescription()); + } else { + attributeMap.put("name", param.name); + } + attributeMap.put("valueClassName", param.type); + attributeMap.put("externalType", param.type); + } + */ + + // relationships + List<Map<String, Object>> relationshipsMapList = FastList.newInstance(); + + for (ServiceArtifactInfo sai: relatedServiceList) { + Map<String, Object> relationshipMap = FastMap.newInstance(); + relationshipsMapList.add(relationshipMap); + + relationshipMap.put("name", sai.getDisplayPrefixedName()); + relationshipMap.put("destination", sai.getDisplayPrefixedName()); + + // not sure if we can use these, or need them, for this type of diagram + //relationshipMap.put("isToMany", "N"); + //relationshipMap.put("joinSemantic", "EOInnerJoin"); + //relationshipMap.put("joins", joinsMapList); + //joinsMap.put("sourceAttribute", keyMap.getFieldName()); + //joinsMap.put("destinationAttribute", keyMap.getRelFieldName()); + } + + if (relationshipsMapList.size() > 0) { + topLevelMap.put("relationships", relationshipsMapList); + } + + return topLevelMap; + } +} Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |