Author: doogie
Date: Fri Mar 27 16:59:04 2009 New Revision: 759244 URL: http://svn.apache.org/viewvc?rev=759244&view=rev Log: Fix lines that *only* have whitespace. Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java Fri Mar 27 16:59:04 2009 @@ -44,7 +44,7 @@ * Web Event for doing updates on Generic Entities */ public class GenericWebEvent { - + public static final String module = GenericWebEvent.class.getName(); public static final String err_resource = "WebtoolsErrorUiLabels"; @@ -147,7 +147,7 @@ request.setAttribute("_ERROR_MESSAGE_", errMsgPk); return "error"; } - + // if this is a delete, do that before getting all of the non-pk parameters and validating them if (updateMode.equals("DELETE")) { // Remove associated/dependent entries from other tables here @@ -178,7 +178,7 @@ Map<String, String> messageMap = UtilMisc.toMap("fieldType", field.getType()); errMsgNonPk += UtilProperties.getMessage(GenericWebEvent.err_resource, "genericWebEvent.fatal_error_param", messageMap, locale) + "."; } - + String fval = request.getParameter(field.getName()); if (fval != null && fval.length() > 0) { try { @@ -193,12 +193,12 @@ findByEntity.set(field.getName(), null); } } - + if (errMsgNonPk.length() > 0) { request.setAttribute("_ERROR_MESSAGE_", errMsgNonPk); return "error"; } - + // if the updateMode is CREATE, check to see if an entity with the specified primary key already exists if (updateMode.equals("CREATE")) { @@ -317,7 +317,7 @@ } else { Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode); String errMsg = UtilProperties.getMessage(GenericWebEvent.err_resource, "genericWebEvent.update_of_param_failed", messageMap, locale)+ "."; - + request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("updateGeneric: Update Mode specified (" + updateMode + ") was not valid for entity: " + findByEntity.toString(), module); return "error"; Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Fri Mar 27 16:59:04 2009 @@ -273,7 +273,7 @@ "maintainTimeStamps", maintainTimeStamps, "txTimeout", txTimeout, "userLogin", userLogin); - + try { URL furl = f.toURI().toURL(); parseEntityXmlFileArgs.put("url", furl); @@ -331,7 +331,7 @@ boolean maintainTxs = "true".equals((String) context.get("maintainTimeStamps")); boolean tryInserts = "true".equals((String) context.get("mostlyInserts")); boolean checkDataOnly = "true".equals((String) context.get("checkDataOnly")); - + Integer txTimeoutInt = (Integer) context.get("txTimeout"); int txTimeout = txTimeoutInt != null ? txTimeoutInt.intValue() : -1; @@ -373,7 +373,7 @@ NumberFormat changedFormat = NumberFormat.getIntegerInstance(); changedFormat.setMinimumIntegerDigits(5); changedFormat.setGroupingUsed(false); - + List<Object> errorMessages = FastList.newInstance(); List<String> infoMessages = FastList.newInstance(); int totalRowsChanged = 0; @@ -416,19 +416,19 @@ messages.add("=-=-=-=-=-=-= Here is a summary of the data " + (checkDataOnly ? "check" : "load") + ":"); messages.addAll(infoMessages); } - + if (errorMessages.size() > 0) { messages.add("=-=-=-=-=-=-= The following errors occured in the data " + (checkDataOnly ? "check" : "load") + ":"); messages.addAll(errorMessages); } messages.add("=-=-=-=-=-=-= Finished the data " + (checkDataOnly ? "check" : "load") + " with " + totalRowsChanged + " rows " + (checkDataOnly ? "checked" : "changed") + "."); - + Map<String, Object> resultMap = ServiceUtil.returnSuccess(); resultMap.put("messages", messages); return resultMap; } - + public static Map<String, Object> parseEntityXmlFile(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); @@ -554,7 +554,7 @@ Map<String, Object> resp = UtilMisc.<String, Object>toMap("results", results); return resp; } - + /** Get entity reference data. Returns the number of entities in * <code>numberOfEntities</code> and a List of Maps - * <code>packagesList</code>.<br/> Each Map contains:<br/> @@ -611,12 +611,12 @@ Locale locale = (Locale) context.get("locale"); ClassLoader loader = Thread.currentThread().getContextClassLoader(); Map<String, Object> resultMap = ServiceUtil.returnSuccess(); - + ModelReader reader = delegator.getModelReader(); Map<String, TreeSet<String>> entitiesByPackage = FastMap.newInstance(); TreeSet<String> packageNames = new TreeSet<String>(); TreeSet<String> tableNames = new TreeSet<String>(); - + //put the entityNames TreeSets in a HashMap by packageName try { Collection<String> ec = reader.getEntityNames(); @@ -638,7 +638,7 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError("ERROR: getting entity names: " + e.getMessage()); } - + String search = (String) context.get("search"); List<Map<String, Object>> packagesList = FastList.newInstance(); Iterator piter = packageNames.iterator(); @@ -735,19 +735,19 @@ List<Map<String, Object>> indexList = FastList.newInstance(); for (int r = 0; r < entity.getIndexesSize(); r++) { List<String> fieldNameList = FastList.newInstance(); - + ModelIndex index = entity.getIndex(r); for (Iterator<String> fieldIterator = index.getIndexFieldsIterator(); fieldIterator.hasNext();) { fieldNameList.add(fieldIterator.next()); } - + Map<String, Object> indexMap = FastMap.newInstance(); indexMap.put("name", index.getName()); indexMap.put("description", index.getDescription()); indexMap.put("fieldNameList", fieldNameList); indexList.add(indexMap); } - + entityMap.put("entityName", entityName); entityMap.put("helperName", helperName); entityMap.put("groupName", groupName); @@ -770,27 +770,27 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError("ERROR: getting entity info: " + e.getMessage()); } - + resultMap.put("packagesList", packagesList); return resultMap; } - + public static Map<String, Object> exportEntityEoModelBundle(DispatchContext dctx, Map<String, ? extends Object> context) { String eomodeldFullPath = (String) context.get("eomodeldFullPath"); String entityPackageNameOrig = (String) context.get("entityPackageName"); String entityGroupId = (String) context.get("entityGroupId"); String datasourceName = (String) context.get("datasourceName"); String entityNamePrefix = (String) context.get("entityNamePrefix"); - + if (datasourceName == null) datasourceName = "localderby"; - + ModelReader reader = dctx.getDelegator().getModelReader(); - + try { if (!eomodeldFullPath.endsWith(".eomodeld")) { eomodeldFullPath = eomodeldFullPath + ".eomodeld"; } - + File outdir = new File(eomodeldFullPath); if (!outdir.exists()) { outdir.mkdir(); @@ -801,12 +801,12 @@ if (!outdir.canWrite()) { return ServiceUtil.returnError("eomodel Full Path is not write-able: " + eomodeldFullPath); } - + Set<String> entityNames = new TreeSet<String>(); if (UtilValidate.isNotEmpty(entityPackageNameOrig)) { Set<String> entityPackageNameSet = FastSet.newInstance(); entityPackageNameSet.addAll(StringUtil.split(entityPackageNameOrig, ",")); - + Debug.logInfo("Exporting with entityPackageNameSet: " + entityPackageNameSet, module); Map<String, TreeSet<String>> entitiesByPackage = reader.getEntitiesByPackage(entityPackageNameSet, null); @@ -830,7 +830,7 @@ filterEntityNameIter.remove(); } } - + // write the index.eomodeld file Map<String, Object> topLevelMap = FastMap.newInstance(); topLevelMap.put("EOModelVersion", "\"2.1\""); @@ -843,13 +843,13 @@ entitiesMap.put("name", entityName); } UtilPlist.writePlistFile(topLevelMap, eomodeldFullPath, "index.eomodeld", true); - + // write each <EntityName>.plist file for (String curEntityName: entityNames) { ModelEntity modelEntity = reader.getModelEntity(curEntityName); UtilPlist.writePlistFile(modelEntity.createEoModelMap(entityNamePrefix, datasourceName, entityNames, reader), eomodeldFullPath, curEntityName +".plist", true); } - + return ServiceUtil.returnSuccess("Exported eomodeld file for " + entityNames.size() + " entities to: " + eomodeldFullPath); } catch (UnsupportedEncodingException e) { return ServiceUtil.returnError("ERROR saving file: " + e.toString()); @@ -880,20 +880,20 @@ } return resultMap; } - - + + public static Map<String, Object> exportServiceEoModelBundle(DispatchContext dctx, Map<String, ? extends Object> context) { String eomodeldFullPath = (String) context.get("eomodeldFullPath"); String serviceName = (String) context.get("serviceName"); - + if (eomodeldFullPath.endsWith("/")) { eomodeldFullPath = eomodeldFullPath + serviceName + ".eomodeld"; } - + if (!eomodeldFullPath.endsWith(".eomodeld")) { eomodeldFullPath = eomodeldFullPath + ".eomodeld"; } - + File outdir = new File(eomodeldFullPath); if (!outdir.exists()) { outdir.mkdir(); @@ -904,7 +904,7 @@ if (!outdir.canWrite()) { return ServiceUtil.returnError("eomodel Full Path is not write-able: " + eomodeldFullPath); } - + try { ArtifactInfoFactory aif = ArtifactInfoFactory.getArtifactInfoFactory("default"); ServiceArtifactInfo serviceInfo = aif.getServiceArtifactInfo(serviceName); @@ -917,7 +917,7 @@ } catch (FileNotFoundException e) { return ServiceUtil.returnError("ERROR: file/directory not found: " + e.toString()); } - + return ServiceUtil.returnSuccess(); } } Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java Fri Mar 27 16:59:04 2009 @@ -28,11 +28,11 @@ */ public abstract class ArtifactInfoBase implements Comparable<ArtifactInfoBase> { protected ArtifactInfoFactory aif; - + public ArtifactInfoBase(ArtifactInfoFactory aif) { this.aif = aif; } - + public boolean equals(Object obj) { if (obj instanceof ArtifactInfoBase) { return this.equals(obj); @@ -40,21 +40,21 @@ return false; } } - + public int compareTo(ArtifactInfoBase that) { if (that == null) return -1; String thisName = this.getDisplayType() + ":" + this.getDisplayName(); String thatName = that.getDisplayType() + ":" + that.getDisplayName(); return thisName.compareTo(thatName); } - + abstract public String getDisplayName(); abstract public String getDisplayType(); abstract public String getType(); abstract public String getUniqueId(); abstract public URL getLocationURL() throws MalformedURLException; - - + + //public static List<ArtifactInfoBase> sortArtifactInfoSetByDisplayName(Set<ArtifactInfoBase> artifactInfoSet) { //SortedMap<String, ArtifactInfoBase> sortedMap = FastMap.newInstance(); //} 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=759244&r1=759243&r2=759244&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 Fri Mar 27 16:59:04 2009 @@ -65,7 +65,7 @@ public static final String module = ArtifactInfoFactory.class.getName(); protected static UtilCache<String, ArtifactInfoFactory> artifactInfoFactoryCache = new UtilCache<String, ArtifactInfoFactory>("ArtifactInfoFactory"); - + public static final String EntityInfoTypeId = "entity"; public static final String ServiceInfoTypeId = "service"; public static final String ServiceEcaInfoTypeId = "serviceEca"; @@ -73,13 +73,13 @@ public static final String ScreenWidgetInfoTypeId = "screen"; public static final String ControllerRequestInfoTypeId = "request"; public static final String ControllerViewInfoTypeId = "view"; - + 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 Map<String, EntityArtifactInfo> allEntityInfos = FastMap.newInstance(); public Map<String, ServiceArtifactInfo> allServiceInfos = FastMap.newInstance(); public Map<ServiceEcaRule, ServiceEcaArtifactInfo> allServiceEcaInfos = FastMap.newInstance(); @@ -95,7 +95,7 @@ public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosBasedOnServiceName = FastMap.newInstance(); public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance(); public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToServiceName = FastMap.newInstance(); - + public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = FastMap.newInstance(); public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance(); public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance(); @@ -104,22 +104,22 @@ public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosExtendingForm = FastMap.newInstance(); public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToForm = FastMap.newInstance(); - + public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToScreen = FastMap.newInstance(); public Map<String, Set<ControllerViewArtifactInfo>> allViewInfosReferringToScreen = FastMap.newInstance(); - + public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToView = FastMap.newInstance(); - + public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosTargetingRequest = FastMap.newInstance(); public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToRequest = FastMap.newInstance(); public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToRequest = FastMap.newInstance(); public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToRequest = FastMap.newInstance(); - + public static ArtifactInfoFactory getArtifactInfoFactory(String delegatorName) throws GeneralException { if (UtilValidate.isEmpty(delegatorName)) { delegatorName = "default"; } - + ArtifactInfoFactory aif = artifactInfoFactoryCache.get(delegatorName); if (aif == null) { aif = new ArtifactInfoFactory(delegatorName); @@ -127,28 +127,28 @@ } return aif; } - + protected ArtifactInfoFactory(String delegatorName) throws GeneralException { 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.prepareAll(); } - + public void prepareAll() throws GeneralException { Set<String> entityNames = this.getEntityModelReader().getEntityNames(); for (String entityName: entityNames) { this.getEntityArtifactInfo(entityName); } - + Set<String> serviceNames = this.getDispatchContext().getAllServiceNames(); for (String serviceName: serviceNames) { this.getServiceArtifactInfo(serviceName); } - + // how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents(); @@ -230,34 +230,34 @@ } } } - + public ModelReader getEntityModelReader() { return this.entityModelReader; } - + public DispatchContext getDispatchContext() { return this.dispatchContext; } - + public ModelEntity getModelEntity(String entityName) throws GenericEntityException { return this.getEntityModelReader().getModelEntity(entityName); } - + public ModelService getModelService(String serviceName) throws GenericServiceException { return this.getDispatchContext().getModelService(serviceName); } - + public ModelForm getModelForm(String formNameAndLocation) throws ParserConfigurationException, SAXException, IOException { return getModelForm(formNameAndLocation.substring(formNameAndLocation.indexOf("#") + 1), formNameAndLocation.substring(0, formNameAndLocation.indexOf("#"))); } public ModelForm getModelForm(String formName, String formLocation) throws ParserConfigurationException, SAXException, IOException { 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); } - + public ConfigXMLReader.RequestMap getControllerRequestMap(URL controllerXmlUrl, String requestUri) { return ConfigXMLReader.getControllerConfig(controllerXmlUrl).requestMapMap.get(requestUri); } @@ -276,7 +276,7 @@ } return curInfo; } - + public ServiceArtifactInfo getServiceArtifactInfo(String serviceName) throws GeneralException { ServiceArtifactInfo curInfo = this.allServiceInfos.get(serviceName); if (curInfo == null) { @@ -286,7 +286,7 @@ } return curInfo; } - + public ServiceEcaArtifactInfo getServiceEcaArtifactInfo(ServiceEcaRule ecaRule) throws GeneralException { ServiceEcaArtifactInfo curInfo = this.allServiceEcaInfos.get(ecaRule); if (curInfo == null) { @@ -296,7 +296,7 @@ } return curInfo; } - + public FormWidgetArtifactInfo getFormWidgetArtifactInfo(String formNameAndLocation) throws GeneralException { return getFormWidgetArtifactInfo(formNameAndLocation.substring(formNameAndLocation.indexOf("#") + 1), formNameAndLocation.substring(0, formNameAndLocation.indexOf("#"))); } @@ -309,7 +309,7 @@ } return curInfo; } - + public ScreenWidgetArtifactInfo getScreenWidgetArtifactInfo(String screenName, String screenLocation) throws GeneralException { ScreenWidgetArtifactInfo curInfo = this.allScreenInfos.get(screenLocation + "#" + screenName); if (curInfo == null) { @@ -324,7 +324,7 @@ } return curInfo; } - + public ControllerRequestArtifactInfo getControllerRequestArtifactInfo(URL controllerXmlUrl, String requestUri) throws GeneralException { ControllerRequestArtifactInfo curInfo = this.allControllerRequestInfos.get(controllerXmlUrl.toExternalForm() + "#" + requestUri); if (curInfo == null) { @@ -334,7 +334,7 @@ } return curInfo; } - + public ControllerViewArtifactInfo getControllerViewArtifactInfo(URL controllerXmlUrl, String viewUri) throws GeneralException { ControllerViewArtifactInfo curInfo = this.allControllerViewInfos.get(controllerXmlUrl.toExternalForm() + "#" + viewUri); if (curInfo == null) { @@ -343,7 +343,7 @@ } return curInfo; } - + public ArtifactInfoBase getArtifactInfoByUniqueIdAndType(String uniqueId, String type) { if (uniqueId.contains("#")) { int poundIndex = uniqueId.indexOf('#'); @@ -352,7 +352,7 @@ return getArtifactInfoByNameAndType(uniqueId, null, type); } } - + public ArtifactInfoBase getArtifactInfoByNameAndType(String artifactName, String artifactLocation, String type) { try { if ("entity".equals(type)) { @@ -375,14 +375,14 @@ } return null; } - + public Set<ArtifactInfoBase> getAllArtifactInfosByNamePartial(String artifactNamePartial, String type) { Set<ArtifactInfoBase> aiBaseSet = FastSet.newInstance(); - + if (UtilValidate.isEmpty(artifactNamePartial)) { return aiBaseSet; } - + if (UtilValidate.isEmpty(type) || "entity".equals(type)) { for (Map.Entry<String, EntityArtifactInfo> curEntry: allEntityInfos.entrySet()) { if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { @@ -425,7 +425,7 @@ } } } - + return aiBaseSet; } } Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -40,20 +40,20 @@ protected URL controllerXmlUrl; protected String requestUri; - + protected ConfigXMLReader.RequestMap requestInfoMap; - + protected ServiceArtifactInfo serviceCalledByRequestEvent = null; protected Set<ControllerRequestArtifactInfo> requestsThatAreResponsesToThisRequest = new TreeSet<ControllerRequestArtifactInfo>(); protected Set<ControllerViewArtifactInfo> viewsThatAreResponsesToThisRequest = new TreeSet<ControllerViewArtifactInfo>(); - + public ControllerRequestArtifactInfo(URL controllerXmlUrl, String requestUri, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.controllerXmlUrl = controllerXmlUrl; this.requestUri = requestUri; - + this.requestInfoMap = aif.getControllerRequestMap(controllerXmlUrl, requestUri); - + if (this.requestInfoMap == null) { throw new GeneralException("Controller request with name [" + requestUri + "] is not defined in controller file [" + controllerXmlUrl + "]."); } @@ -62,11 +62,11 @@ throw new GeneralException("Could not find Controller Request [" + requestUri + "] at URL [" + controllerXmlUrl.toExternalForm() + "]"); } } - + /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allControllerRequestInfos in ArtifactInfoFactory.getControllerRequestArtifactInfo */ public void populateAll() throws GeneralException { // populate serviceCalledByRequestEvent, requestsThatAreResponsesToThisRequest, viewsThatAreResponsesToThisRequest and related reverse maps - + if (this.requestInfoMap.event != null && "service".equals(this.requestInfoMap.event.type)) { String serviceName = (String) this.requestInfoMap.event.invoke; try { @@ -79,7 +79,7 @@ Debug.logWarning(e.toString(), module); } } - + Map<String, ConfigXMLReader.RequestResponse> requestResponseMap = UtilGenerics.checkMap(this.requestInfoMap.requestResponseMap); for (ConfigXMLReader.RequestResponse response: requestResponseMap.values()) { if ("view".equals(response.type)) { @@ -120,15 +120,15 @@ } } } - + public URL getControllerXmlUrl() { return this.controllerXmlUrl; } - + public String getRequestUri() { return this.requestUri; } - + public String getDisplayName() { String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl); if (location.endsWith("/WEB-INF/controller.xml")) { @@ -136,23 +136,23 @@ } return this.requestUri + " (" + location + ")"; } - + public String getDisplayType() { return "Controller Request"; } - + public String getType() { return ArtifactInfoFactory.ControllerRequestInfoTypeId; } - + public String getUniqueId() { return this.controllerXmlUrl.toExternalForm() + "#" + this.requestUri; } - + public URL getLocationURL() throws MalformedURLException { return this.controllerXmlUrl; } - + public boolean equals(Object obj) { if (obj instanceof ControllerRequestArtifactInfo) { ControllerRequestArtifactInfo that = (ControllerRequestArtifactInfo) obj; @@ -161,32 +161,32 @@ return false; } } - + /** Get the Services that are called by this Request */ public ServiceArtifactInfo getServiceCalledByRequestEvent() { return serviceCalledByRequestEvent; } - + public Set<FormWidgetArtifactInfo> getFormInfosReferringToRequest() { return this.aif.allFormInfosReferringToRequest.get(this.getUniqueId()); } - + public Set<FormWidgetArtifactInfo> getFormInfosTargetingRequest() { return this.aif.allFormInfosTargetingRequest.get(this.getUniqueId()); } - + public Set<ScreenWidgetArtifactInfo> getScreenInfosReferringToRequest() { return this.aif.allScreenInfosReferringToRequest.get(this.getUniqueId()); } - + public Set<ControllerRequestArtifactInfo> getRequestsThatAreResponsesToThisRequest() { return this.requestsThatAreResponsesToThisRequest; } - + public Set<ControllerRequestArtifactInfo> getRequestsThatThisRequestIsResponsTo() { return this.aif.allRequestInfosReferringToRequest.get(this.getUniqueId()); } - + public Set<ControllerViewArtifactInfo> getViewsThatAreResponsesToThisRequest() { return this.viewsThatAreResponsesToThisRequest; } Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -38,18 +38,18 @@ protected URL controllerXmlUrl; protected String viewUri; - + protected ConfigXMLReader.ViewMap viewInfoMap; - + protected ScreenWidgetArtifactInfo screenCalledByThisView = null; - + public ControllerViewArtifactInfo(URL controllerXmlUrl, String viewUri, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.controllerXmlUrl = controllerXmlUrl; this.viewUri = viewUri; - + this.viewInfoMap = aif.getControllerViewMap(controllerXmlUrl, viewUri); - + if (this.viewInfoMap == null) { throw new GeneralException("Could not find Controller View [" + viewUri + "] at URL [" + controllerXmlUrl.toExternalForm() + "]"); } @@ -75,15 +75,15 @@ } } } - + public URL getControllerXmlUrl() { return this.controllerXmlUrl; } - + public String getViewUri() { return this.viewUri; } - + public String getDisplayName() { String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl); if (location.endsWith("/WEB-INF/controller.xml")) { @@ -91,23 +91,23 @@ } return this.viewUri + " (" + location + ")"; } - + public String getDisplayType() { return "Controller View"; } - + public String getType() { return ArtifactInfoFactory.ControllerViewInfoTypeId; } - + public String getUniqueId() { return this.controllerXmlUrl.toExternalForm() + "#" + this.viewUri; } - + public URL getLocationURL() throws MalformedURLException { return this.controllerXmlUrl; } - + public boolean equals(Object obj) { if (obj instanceof ControllerViewArtifactInfo) { ControllerViewArtifactInfo that = (ControllerViewArtifactInfo) obj; @@ -117,11 +117,11 @@ return false; } } - + public Set<ControllerRequestArtifactInfo> getRequestsThatThisViewIsResponseTo() { return this.aif.allRequestInfosReferringToView.get(this.getUniqueId()); } - + public ScreenWidgetArtifactInfo getScreenCalledByThisView() { return screenCalledByThisView; } Modified: 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=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -38,51 +38,51 @@ */ public class EntityArtifactInfo extends ArtifactInfoBase { protected ModelEntity modelEntity; - + protected Set<EntityArtifactInfo> entitiesRelatedOne = new TreeSet<EntityArtifactInfo>(); protected Set<EntityArtifactInfo> entitiesRelatedMany = new TreeSet<EntityArtifactInfo>(); - + public EntityArtifactInfo(String entityName, ArtifactInfoFactory aif) throws GenericEntityException { super(aif); this.modelEntity = this.aif.getModelEntity(entityName); } - + public void populateAll() throws GeneralException { List<ModelRelation> relationOneList = modelEntity.getRelationsOneList(); for (ModelRelation relationOne: relationOneList) { this.entitiesRelatedOne.add(this.aif.getEntityArtifactInfo(relationOne.getRelEntityName())); } - + List<ModelRelation> relationManyList = modelEntity.getRelationsManyList(); for (ModelRelation relationMany: relationManyList) { this.entitiesRelatedMany.add(this.aif.getEntityArtifactInfo(relationMany.getRelEntityName())); } } - + public ModelEntity getModelEntity() { return this.modelEntity; } - + public String getDisplayName() { return this.getUniqueId(); } - + public String getDisplayType() { return "Entity"; } - + public String getType() { return ArtifactInfoFactory.EntityInfoTypeId; } - + public String getUniqueId() { return this.modelEntity.getEntityName(); } - + public URL getLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.modelEntity.getLocation(), null); } - + public boolean equals(Object obj) { if (obj instanceof EntityArtifactInfo) { return this.modelEntity.getEntityName().equals(((EntityArtifactInfo) obj).modelEntity.getEntityName()); @@ -90,7 +90,7 @@ return false; } } - + public Set<EntityArtifactInfo> getEntitiesRelatedOne() { return this.entitiesRelatedOne; } @@ -98,29 +98,29 @@ public Set<EntityArtifactInfo> getEntitiesRelatedMany() { return this.entitiesRelatedMany; } - + /** Get the Services that use this Entity */ public Set<ServiceArtifactInfo> getServicesUsingEntity() { return this.aif.allServiceInfosReferringToEntityName.get(this.modelEntity.getEntityName()); } - + /** Get the Services called by Entity ECA */ public Set<ServiceArtifactInfo> getServicesCalledByEntityEca() { Set<ServiceArtifactInfo> serviceSet = FastSet.newInstance(); // TODO: implement this return serviceSet; } - + public Set<EntityEcaRule> getEntityEcaRules() { Set<EntityEcaRule> eecaSet = FastSet.newInstance(); // TODO: implement this return eecaSet; } - + public Set<FormWidgetArtifactInfo> getFormsUsingEntity() { return this.aif.allFormInfosReferringToEntityName.get(this.modelEntity.getEntityName()); } - + public Set<ScreenWidgetArtifactInfo> getScreensUsingEntity() { return this.aif.allScreenInfosReferringToEntityName.get(this.modelEntity.getEntityName()); } Modified: 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=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -44,16 +44,16 @@ public static final String module = FormWidgetArtifactInfo.class.getName(); protected ModelForm modelForm; - + protected String formName; protected String formLocation; - + protected Set<EntityArtifactInfo> entitiesUsedInThisForm = new TreeSet<EntityArtifactInfo>(); protected Set<ServiceArtifactInfo> servicesUsedInThisForm = new TreeSet<ServiceArtifactInfo>(); protected FormWidgetArtifactInfo formThisFormExtends = null; protected Set<ControllerRequestArtifactInfo> requestsLinkedToInForm = new TreeSet<ControllerRequestArtifactInfo>(); protected Set<ControllerRequestArtifactInfo> requestsTargetedByInForm = new TreeSet<ControllerRequestArtifactInfo>(); - + public FormWidgetArtifactInfo(String formName, String formLocation, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.formName = formName; @@ -68,7 +68,7 @@ throw new GeneralException(e); } } - + /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allFormInfos in ArtifactInfoFactory.getFormWidgetArtifactInfo */ public void populateAll() throws GeneralException { // populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (and reverse in aif.allFormInfosExtendingForm) @@ -78,7 +78,7 @@ this.populateLinkedRequests(); this.populateTargetedRequests(); } - + protected void populateFormExtended() throws GeneralException { // populate formThisFormExtends and the reverse-associate cache in the aif if (this.modelForm.getParentFormName() != null) { @@ -93,7 +93,7 @@ Debug.logWarning("Form [" + formName + "] reference in form [" + this.formName + "] in resource [" + this.formLocation + "] does not exist!", module); return; } - + // the forward reference this.formThisFormExtends = aif.getFormWidgetArtifactInfo(formName); // the reverse reference @@ -114,7 +114,7 @@ Debug.logWarning("Entity [" + entityName + "] reference in form [" + this.formName + "] in resource [" + this.formLocation + "] does not exist!", module); continue; } - + // the forward reference this.entitiesUsedInThisForm.add(aif.getEntityArtifactInfo(entityName)); // the reverse reference @@ -137,7 +137,7 @@ Debug.logWarning("Service [" + serviceName + "] reference in form [" + this.formName + "] in resource [" + this.formLocation + "] does not exist!", module); continue; } - + // the forward reference this.servicesUsedInThisForm.add(aif.getServiceArtifactInfo(serviceName)); // the reverse reference @@ -147,12 +147,12 @@ protected void populateLinkedRequests() throws GeneralException{ Set<String> allRequestUniqueId = this.modelForm.getLinkedRequestsLocationAndUri(); - + for (String requestUniqueId: allRequestUniqueId) { if (requestUniqueId.contains("${")) { continue; } - + if (requestUniqueId.indexOf("#") > -1) { String controllerXmlUrl = requestUniqueId.substring(0, requestUniqueId.indexOf("#")); String requestUri = requestUniqueId.substring(requestUniqueId.indexOf("#") + 1); @@ -165,12 +165,12 @@ } protected void populateTargetedRequests() throws GeneralException{ Set<String> allRequestUniqueId = this.modelForm.getTargetedRequestsLocationAndUri(); - + for (String requestUniqueId: allRequestUniqueId) { if (requestUniqueId.contains("${")) { continue; } - + if (requestUniqueId.indexOf("#") > -1) { String controllerXmlUrl = requestUniqueId.substring(0, requestUniqueId.indexOf("#")); String requestUri = requestUniqueId.substring(requestUniqueId.indexOf("#") + 1); @@ -181,28 +181,28 @@ } } } - + public String getDisplayName() { // remove the component:// from the location return this.formName + " (" + this.formLocation.substring(12) + ")"; } - + public String getDisplayType() { return "Form Widget"; } - + public String getType() { return ArtifactInfoFactory.FormWidgetInfoTypeId; } - + public String getUniqueId() { return this.formLocation + "#" + this.formName; } - + public URL getLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.formLocation, null); } - + public boolean equals(Object obj) { if (obj instanceof FormWidgetArtifactInfo) { return (this.modelForm.getName().equals(((FormWidgetArtifactInfo) obj).modelForm.getName()) && @@ -215,27 +215,27 @@ public Set<EntityArtifactInfo> getEntitiesUsedInForm() { return this.entitiesUsedInThisForm; } - + public Set<ServiceArtifactInfo> getServicesUsedInForm() { return this.servicesUsedInThisForm; } - + public FormWidgetArtifactInfo getFormThisFormExtends() { return this.formThisFormExtends; } - + public Set<FormWidgetArtifactInfo> getFormsExtendingThisForm() { return this.aif.allFormInfosExtendingForm.get(this.getUniqueId()); } - + public Set<ScreenWidgetArtifactInfo> getScreensIncludingThisForm() { return this.aif.allScreenInfosReferringToForm.get(this.getUniqueId()); } - + public Set<ControllerRequestArtifactInfo> getRequestsLinkedToInForm() { return this.requestsLinkedToInForm; } - + public Set<ControllerRequestArtifactInfo> getRequestsTargetedByForm() { return this.requestsTargetedByInForm; } Modified: 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=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -45,15 +45,15 @@ public static final String module = ScreenWidgetArtifactInfo.class.getName(); protected ModelScreen modelScreen; - + protected String screenName; protected String screenLocation; - + protected Set<EntityArtifactInfo> entitiesUsedInThisScreen = new TreeSet<EntityArtifactInfo>(); protected Set<ServiceArtifactInfo> servicesUsedInThisScreen = new TreeSet<ServiceArtifactInfo>(); protected Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = new TreeSet<FormWidgetArtifactInfo>(); protected Set<ControllerRequestArtifactInfo> requestsLinkedToInScreen = new TreeSet<ControllerRequestArtifactInfo>(); - + public ScreenWidgetArtifactInfo(String screenName, String screenLocation, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.screenName = screenName; @@ -69,7 +69,7 @@ } catch (IOException e) { throw new GeneralException(e); } - + } public void populateAll() throws GeneralException { @@ -94,7 +94,7 @@ Debug.logWarning("Service [" + serviceName + "] reference in screen [" + this.screenName + "] in resource [" + this.screenLocation + "] does not exist!", module); continue; } - + // the forward reference this.servicesUsedInThisScreen.add(aif.getServiceArtifactInfo(serviceName)); // the reverse reference @@ -117,7 +117,7 @@ Debug.logWarning("Entity [" + entityName + "] reference in screen [" + this.screenName + "] in resource [" + this.screenLocation + "] does not exist!", module); continue; } - + // the forward reference this.entitiesUsedInThisScreen.add(aif.getEntityArtifactInfo(entityName)); // the reverse reference @@ -141,22 +141,22 @@ Debug.logWarning("Form [" + formName + "] reference in screen [" + this.screenName + "] in resource [" + this.screenLocation + "] does not exist!", module); continue; } - + // the forward reference this.formsIncludedInThisScreen.add(aif.getFormWidgetArtifactInfo(formName)); // the reverse reference UtilMisc.addToSortedSetInMap(this, aif.allScreenInfosReferringToForm, formName); } } - + protected void populateLinkedRequests() throws GeneralException{ Set<String> allRequestUniqueId = this.modelScreen.getAllRequestsLocationAndUri(); - + for (String requestUniqueId: allRequestUniqueId) { if (requestUniqueId.contains("${")) { continue; } - + if (requestUniqueId.indexOf("#") > -1) { String controllerXmlUrl = requestUniqueId.substring(0, requestUniqueId.indexOf("#")); String requestUri = requestUniqueId.substring(requestUniqueId.indexOf("#") + 1); @@ -172,23 +172,23 @@ // remove the component:// from the location return this.screenName + " (" + this.screenLocation.substring(12) + ")"; } - + public String getDisplayType() { return "Screen Widget"; } - + public String getType() { return ArtifactInfoFactory.ScreenWidgetInfoTypeId; } - + public String getUniqueId() { return this.screenLocation + "#" + this.screenName; } - + public URL getLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.screenLocation, null); } - + public boolean equals(Object obj) { if (obj instanceof ScreenWidgetArtifactInfo) { return (this.modelScreen.getName().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getName()) && @@ -197,32 +197,32 @@ return false; } } - + public Set<ControllerViewArtifactInfo> getViewsReferringToScreen() { return this.aif.allViewInfosReferringToScreen.get(this.getUniqueId()); } - + public Set<EntityArtifactInfo> getEntitiesUsedInScreen() { return this.entitiesUsedInThisScreen; } - + public Set<ServiceArtifactInfo> getServicesUsedInScreen() { return this.servicesUsedInThisScreen; } - + public Set<FormWidgetArtifactInfo> getFormsIncludedInScreen() { return this.formsIncludedInThisScreen; } - + public Set<ScreenWidgetArtifactInfo> getScreensIncludedInScreen() { // TODO: implement this return FastSet.newInstance(); } - + public Set<ScreenWidgetArtifactInfo> getScreensIncludingThisScreen() { return this.aif.allScreenInfosReferringToScreen.get(this.getUniqueId()); } - + public Set<ControllerRequestArtifactInfo> getRequestsLinkedToInScreen() { return this.requestsLinkedToInScreen; } Modified: 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=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -54,19 +54,19 @@ */ public class ServiceArtifactInfo extends ArtifactInfoBase { public static final String module = ServiceArtifactInfo.class.getName(); - + protected ModelService modelService; protected String displayPrefix = null; - + Set<EntityArtifactInfo> entitiesUsedByThisService = new TreeSet<EntityArtifactInfo>(); Set<ServiceArtifactInfo> servicesCalledByThisService = new TreeSet<ServiceArtifactInfo>(); Set<ServiceEcaArtifactInfo> serviceEcasTriggeredByThisService = new TreeSet<ServiceEcaArtifactInfo>(); - + public ServiceArtifactInfo(String serviceName, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.modelService = this.aif.getModelService(serviceName); } - + /** * This must be called after creation from the ArtifactInfoFactory after this class has been put into the global Map in order to avoid recursive initialization * @@ -77,7 +77,7 @@ this.populateCalledServices(); this.populateTriggeredServiceEcas(); } - + protected void populateUsedEntities() throws GeneralException { // populate entitiesUsedByThisService and for each the reverse-associate cache in the aif if ("simple".equals(this.modelService.engineName)) { @@ -93,7 +93,7 @@ Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module); return; } - + Set<String> allEntityNameSet = simpleMethodToCall.getAllEntityNamesUsed(); populateEntitiesFromNameSet(allEntityNameSet); } else if ("java".equals(this.modelService.engineName)) { @@ -131,14 +131,14 @@ Debug.logWarning("Entity [" + entityName + "] reference in service [" + this.modelService.name + "] does not exist!", module); continue; } - + // the forward reference this.entitiesUsedByThisService.add(aif.getEntityArtifactInfo(validEntityName)); // the reverse reference UtilMisc.addToSortedSetInMap(this, aif.allServiceInfosReferringToEntityName, validEntityName); } } - + protected void populateCalledServices() throws GeneralException { // populate servicesCalledByThisService and for each the reverse-associate cache in the aif if ("simple".equals(this.modelService.engineName)) { @@ -154,7 +154,7 @@ Debug.logWarning("Simple-method [" + this.modelService.invoke + "] in [" + this.modelService.location + "] referenced in service [" + this.modelService.name + "] not found", module); return; } - + Set<String> allServiceNameSet = simpleMethodToCall.getAllServiceNamesCalled(); populateServicesFromNameSet(allServiceNameSet); } else if ("java".equals(this.modelService.engineName)) { @@ -175,7 +175,7 @@ int methodBlockStart = UtilJavaParse.findServiceMethodBlockStart(this.modelService.invoke, javaFile); int methodBlockEnd = UtilJavaParse.findEndOfBlock(methodBlockStart, javaFile); Set<String> allServiceNameSet = UtilJavaParse.findServiceCallsInBlock(methodBlockStart, methodBlockEnd, javaFile); - + populateServicesFromNameSet(allServiceNameSet); } } else if ("group".equals(this.modelService.engineName)) { @@ -184,18 +184,18 @@ if (groupModel == null) { groupModel = ServiceGroupReader.getGroupModel(this.modelService.location); } - + if (groupModel != null) { List<GroupServiceModel> groupServiceModels = groupModel.getServices(); for (GroupServiceModel groupServiceModel: groupServiceModels) { allServiceNameSet.add(groupServiceModel.getName()); } } - + populateServicesFromNameSet(allServiceNameSet); } } - + protected void populateServicesFromNameSet(Set<String> allServiceNameSet) throws GeneralException { for (String serviceName: allServiceNameSet) { if (serviceName.contains("${")) { @@ -205,14 +205,14 @@ Debug.logWarning("Service [" + serviceName + "] reference in service [" + this.modelService.name + "] does not exist!", module); continue; } - + // the forward reference this.servicesCalledByThisService.add(aif.getServiceArtifactInfo(serviceName)); // the reverse reference UtilMisc.addToSortedSetInMap(this, aif.allServiceInfosReferringToServiceName, serviceName); } } - + protected void populateTriggeredServiceEcas() throws GeneralException { // populate serviceEcasTriggeredByThisService and for each the reverse-associate cache in the aif Map<String, List<ServiceEcaRule>> serviceEventMap = ServiceEcaUtil.getServiceEventMap(this.modelService.name); @@ -225,103 +225,103 @@ } } } - + public ModelService getModelService() { return this.modelService; } - + public void setDisplayPrefix(String displayPrefix) { this.displayPrefix = displayPrefix; } - + public String getDisplayName() { return this.getDisplayPrefixedName(); } public String getDisplayPrefixedName() { return (this.displayPrefix != null ? this.displayPrefix : "") + this.modelService.name; } - + public String getDisplayType() { return "Service"; } - + public String getType() { return ArtifactInfoFactory.ServiceInfoTypeId; } - + public String getUniqueId() { return this.modelService.name; } - + public URL getLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.modelService.definitionLocation, null); } - + public URL getImplementationLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.modelService.location, null); } - + public Set<EntityArtifactInfo> getEntitiesUsedByService() { return this.entitiesUsedByThisService; } - + public Set<ServiceArtifactInfo> getServicesCallingService() { return aif.allServiceInfosReferringToServiceName.get(this.modelService.name); } - + public Set<ServiceArtifactInfo> getServicesCalledByService() { return this.servicesCalledByThisService; } - + public Set<ServiceArtifactInfo> getServicesCalledByServiceEcas() { // TODO: implement this sometime, not really necessary return FastSet.newInstance(); } - + public Set<ServiceEcaArtifactInfo> getServiceEcaRulesTriggeredByService() { return this.serviceEcasTriggeredByThisService; } - + public Set<ServiceArtifactInfo> getServicesCallingServiceByEcas() { // TODO: implement this sometime, not really necessary return FastSet.newInstance(); } - + public Set<ServiceEcaArtifactInfo> getServiceEcaRulesCallingService() { return this.aif.allServiceEcaInfosReferringToServiceName.get(this.modelService.name); } - + public Set<FormWidgetArtifactInfo> getFormsCallingService() { return this.aif.allFormInfosReferringToServiceName.get(this.modelService.name); } - + public Set<FormWidgetArtifactInfo> getFormsBasedOnService() { return this.aif.allFormInfosBasedOnServiceName.get(this.modelService.name); } - + public Set<ScreenWidgetArtifactInfo> getScreensCallingService() { return this.aif.allScreenInfosReferringToServiceName.get(this.modelService.name); } - + public Set<ControllerRequestArtifactInfo> getRequestsWithEventCallingService() { return this.aif.allRequestInfosReferringToServiceName.get(this.modelService.name); } - + public void writeServiceCallGraphEoModel(String eomodeldFullPath) throws GeneralException, FileNotFoundException, UnsupportedEncodingException { boolean useMoreDetailedNames = true; - + Debug.logInfo("Writing Service Call Graph EO Model for service [" + this.modelService.name + "] to [" + eomodeldFullPath + "]", module); - + Set<String> allDiagramEntitiesWithPrefixes = FastSet.newInstance(); List<ServiceArtifactInfo> allServiceList = FastList.newInstance(); List<ServiceEcaArtifactInfo> allServiceEcaList = FastList.newInstance(); - + // make sure that any prefix that might have been set on this is cleared this.setDisplayPrefix(""); - + // put this service in the master list allDiagramEntitiesWithPrefixes.add(this.modelService.name); - + // all services that call this service Set<ServiceArtifactInfo> callingServiceSet = this.getServicesCallingService(); if (callingServiceSet != null) { @@ -332,7 +332,7 @@ allServiceList.add(callingService); } } - + // all services this service calls Set<ServiceArtifactInfo> calledServiceSet = this.getServicesCalledByService(); for (ServiceArtifactInfo calledService: calledServiceSet) { @@ -340,15 +340,15 @@ allDiagramEntitiesWithPrefixes.add(calledService.getDisplayPrefixedName()); allServiceList.add(calledService); } - + Map<String, Integer> displaySuffixNumByEcaName = FastMap.newInstance(); - + // all SECAs and triggering services that call this service as an action Set<ServiceEcaArtifactInfo> callingServiceEcaSet = this.getServiceEcaRulesCallingService(); if (callingServiceEcaSet != null) { for (ServiceEcaArtifactInfo callingServiceEca: callingServiceEcaSet) { callingServiceEca.setDisplayPrefix("Triggering_"); - + Integer displaySuffix = displaySuffixNumByEcaName.get(callingServiceEca.getDisplayPrefixedName()); if (displaySuffix == null) { displaySuffix = 1; @@ -357,7 +357,7 @@ } displaySuffixNumByEcaName.put(callingServiceEca.getDisplayPrefixedName(), displaySuffix); callingServiceEca.setDisplaySuffixNum(displaySuffix); - + allDiagramEntitiesWithPrefixes.add(callingServiceEca.getDisplayPrefixedName()); allServiceEcaList.add(callingServiceEca); } @@ -367,7 +367,7 @@ Set<ServiceEcaArtifactInfo> calledServiceEcaSet = this.getServiceEcaRulesTriggeredByService(); for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaSet) { calledServiceEca.setDisplayPrefix("Triggered_"); - + Integer displaySuffix = displaySuffixNumByEcaName.get(calledServiceEca.getDisplayPrefixedName()); if (displaySuffix == null) { displaySuffix = 1; @@ -376,7 +376,7 @@ } displaySuffixNumByEcaName.put(calledServiceEca.getDisplayPrefixedName(), displaySuffix); calledServiceEca.setDisplaySuffixNum(displaySuffix); - + allDiagramEntitiesWithPrefixes.add(calledServiceEca.getDisplayPrefixedName()); allServiceEcaList.add(calledServiceEca); } @@ -393,7 +393,7 @@ entitiesMap.put("name", entityName); } UtilPlist.writePlistFile(indexEoModelMap, eomodeldFullPath, "index.eomodeld", true); - + // write this service description file Map<String, Object> thisServiceEoModelMap = createEoModelMap(callingServiceSet, calledServiceSet, callingServiceEcaSet, calledServiceEcaSet, useMoreDetailedNames); UtilPlist.writePlistFile(thisServiceEoModelMap, eomodeldFullPath, this.modelService.name + ".plist", true); @@ -411,7 +411,7 @@ UtilPlist.writePlistFile(serviceEoModelMap, eomodeldFullPath, calledService.getDisplayPrefixedName() + ".plist", true); } } - + // write SECA description files if (callingServiceEcaSet != null) { for (ServiceEcaArtifactInfo callingServiceEca: callingServiceEcaSet) { @@ -421,7 +421,7 @@ ecaCallingService.setDisplayPrefix("Triggering_"); } ecaCallingServiceSet.add(this); - + Map<String, Object> serviceEcaEoModelMap = callingServiceEca.createEoModelMap(ecaCallingServiceSet, null, useMoreDetailedNames); UtilPlist.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, callingServiceEca.getDisplayPrefixedName() + ".plist", true); } @@ -434,7 +434,7 @@ ecaCalledService.setDisplayPrefix("Triggered_"); } ecaCalledServiceSet.add(this); - + Map<String, Object> serviceEcaEoModelMap = calledServiceEca.createEoModelMap(null, ecaCalledServiceSet, useMoreDetailedNames); UtilPlist.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, calledServiceEca.getDisplayPrefixedName() + ".plist", true); } @@ -457,7 +457,7 @@ for (ModelParam param: this.modelService.getModelParamList()) { // skip the internal parameters, very redundant in the diagrams if (param.internal) continue; - + if (useMoreDetailedNames) { classPropertiesList.add(param.getShortDisplayDescription()); } else { @@ -476,14 +476,14 @@ for (ServiceEcaArtifactInfo seai: calledServiceEcaSet) { 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 { @@ -492,19 +492,19 @@ attributeMap.put("valueClassName", param.type); attributeMap.put("externalType", param.type); } - + // relationships List<Map<String, Object>> relationshipsMapList = FastList.newInstance(); - + for (ServiceArtifactInfo sai: callingServiceSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", sai.getDisplayPrefixedName()); relationshipMap.put("destination", sai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "N"); relationshipMap.put("isMandatory", "Y"); - + // not sure if we can use these, or need them, for this type of diagram //relationshipMap.put("joinSemantic", "EOInnerJoin"); //relationshipMap.put("joins", joinsMapList); @@ -514,23 +514,23 @@ for (ServiceArtifactInfo sai: calledServiceSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", sai.getDisplayPrefixedName()); relationshipMap.put("destination", sai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "Y"); relationshipMap.put("isMandatory", "Y"); - + // not sure if we can use these, or need them, for this type of diagram //relationshipMap.put("joinSemantic", "EOInnerJoin"); //relationshipMap.put("joins", joinsMapList); //joinsMap.put("sourceAttribute", keyMap.getFieldName()); //joinsMap.put("destinationAttribute", keyMap.getRelFieldName()); } - + for (ServiceEcaArtifactInfo seai: callingServiceEcaSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", seai.getDisplayPrefixedName()); relationshipMap.put("destination", seai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "N"); @@ -539,20 +539,20 @@ for (ServiceEcaArtifactInfo seai: calledServiceEcaSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", seai.getDisplayPrefixedName()); relationshipMap.put("destination", seai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "Y"); relationshipMap.put("isMandatory", "Y"); } - + if (relationshipsMapList.size() > 0) { topLevelMap.put("relationships", relationshipsMapList); } - + return topLevelMap; } - + public boolean equals(Object obj) { if (obj instanceof ServiceArtifactInfo) { return this.modelService.name.equals(((ServiceArtifactInfo) obj).modelService.name); Modified: 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=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java Fri Mar 27 16:59:04 2009 @@ -43,14 +43,14 @@ protected ServiceEcaRule serviceEcaRule; protected String displayPrefix = null; protected int displaySuffixNum = 0; - + protected Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = new TreeSet<ServiceArtifactInfo>(); - + public ServiceEcaArtifactInfo(ServiceEcaRule serviceEcaRule, ArtifactInfoFactory aif) throws GeneralException { super(aif); this.serviceEcaRule = serviceEcaRule; } - + /** * This must be called after creation from the ArtifactInfoFactory after this class has been put into the global Map in order to avoid recursive initialization * @@ -63,47 +63,47 @@ UtilMisc.addToSortedSetInMap(this, aif.allServiceEcaInfosReferringToServiceName, ecaAction.getServiceName()); } } - + public String getDisplayName() { return this.getDisplayPrefixedName(); } - + public String getDisplayType() { return "Service ECA"; } - + public String getType() { return ArtifactInfoFactory.ServiceEcaInfoTypeId; } - + public String getUniqueId() { return this.serviceEcaRule.toString(); } - + public URL getLocationURL() throws MalformedURLException { return FlexibleLocation.resolveLocation(this.serviceEcaRule.getDefinitionLocation(), null); } - + public ServiceEcaRule getServiceEcaRule() { return this.serviceEcaRule; } - + public void setDisplayPrefix(String displayPrefix) { this.displayPrefix = displayPrefix; } - + public void setDisplaySuffixNum(int displaySuffixNum) { this.displaySuffixNum = displaySuffixNum; } - + public String getDisplayPrefixedName() { return (this.displayPrefix != null ? this.displayPrefix : "") + this.serviceEcaRule.getServiceName() + "_" + this.serviceEcaRule.getEventName() + "_" + displaySuffixNum; } - + public Set<ServiceArtifactInfo> getServicesCalledByServiceEcaActions() { return this.servicesCalledByThisServiceEca; } - + public Set<ServiceArtifactInfo> getServicesTriggeringServiceEca() { return aif.allServiceInfosReferringToServiceEcaRule.get(this.serviceEcaRule); } @@ -131,7 +131,7 @@ classPropertiesList.add(ecaAction.getServiceName()); } } - + /* going to try this without any attributes... // attributes List<Map<String, Object>> attributesList = FastList.newInstance(); @@ -139,7 +139,7 @@ for (ModelParam param: this.modelService.getModelParamList()) { Map<String, Object> attributeMap = FastMap.newInstance(); attributesList.add(attributeMap); - + if (useMoreDetailedNames) { attributeMap.put("name", param.getShortDisplayDescription()); } else { @@ -149,14 +149,14 @@ attributeMap.put("externalType", param.type); } */ - + // relationships List<Map<String, Object>> relationshipsMapList = FastList.newInstance(); - + for (ServiceArtifactInfo sai: triggeringServiceSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", sai.getDisplayPrefixedName()); relationshipMap.put("destination", sai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "N"); @@ -165,20 +165,20 @@ for (ServiceArtifactInfo sai: triggeredServiceSet) { Map<String, Object> relationshipMap = FastMap.newInstance(); relationshipsMapList.add(relationshipMap); - + relationshipMap.put("name", sai.getDisplayPrefixedName()); relationshipMap.put("destination", sai.getDisplayPrefixedName()); relationshipMap.put("isToMany", "Y"); relationshipMap.put("isMandatory", "Y"); } - + if (relationshipsMapList.size() > 0) { topLevelMap.put("relationships", relationshipsMapList); } - + return topLevelMap; } - + public boolean equals(Object obj) { if (obj instanceof ServiceEcaArtifactInfo) { ServiceEcaArtifactInfo that = (ServiceEcaArtifactInfo) obj; Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java Fri Mar 27 16:59:04 2009 @@ -27,15 +27,15 @@ import org.ofbiz.base.util.UtilValidate; public class LabelInfo { - + public static final String module = LabelInfo.class.getName(); - + protected String labelKey = ""; protected String labelKeyComment = ""; protected String fileName = ""; protected String componentName = ""; protected Map<String, LabelValue> labelValues = FastMap.newInstance(); - + public LabelInfo(String labelKey, String labelKeyComment, String fileName, String componentName, String localeStr, String labelValue, String labelComment) throws GeneralException { this.labelKey = labelKey; this.labelKeyComment = labelKeyComment; @@ -43,31 +43,31 @@ this.componentName = componentName; setLabelValue(localeStr, labelValue, labelComment, false); } - + public String getLabelKey() { return labelKey; } - + public String getLabelKeyComment() { return labelKeyComment; } - + public void setLabelKeyComment(String labelKeyComment) { this.labelKeyComment = labelKeyComment; } - + public String getFileName() { return fileName; } - + public String getComponentName() { return componentName; } - + public LabelValue getLabelValue(String localeStr) { return (LabelValue)labelValues.get(localeStr); } - + public int getLabelValueSize() { return labelValues.size(); } @@ -75,7 +75,7 @@ public boolean setLabelValue(String localeStr, String labelValue, String labelComment, boolean update) { LabelValue localeFound = getLabelValue(localeStr); boolean isDuplicatedLocales = false; - + if (UtilValidate.isEmpty(localeFound)) { if (UtilValidate.isNotEmpty(labelValue)) { localeFound = new LabelValue(labelValue, labelComment); Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=759244&r1=759243&r2=759244&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java Fri Mar 27 16:59:04 2009 @@ -53,14 +53,14 @@ import org.w3c.dom.Node; public class LabelManagerFactory { - + public static final String module = LabelManagerFactory.class.getName(); public static final String resource = "WebtoolsUiLabels"; - + public static final String keySeparator = "#"; - + protected static UtilCache<String, LabelManagerFactory> labelManagerFactoryCache = new UtilCache<String, LabelManagerFactory>("LabelManagerFactory"); - + protected static Map<String, LabelInfo> labels = null; protected static Map<String, String> fileNamesFound = null; protected static Map<String, String> fileComponent = null; @@ -69,32 +69,32 @@ protected static Map<String, Map<String, Integer>> references = null; protected static List<LabelInfo> duplicatedLocalesLabelsList = null; protected static int duplicatedLocalesLabels = 0; - + protected static GenericDelegator delegator; protected static ModelReader entityModelReader; protected static DispatchContext dispatchContext; - + public static LabelManagerFactory getLabelManagerFactory(String delegatorName) throws GeneralException { if (UtilValidate.isEmpty(delegatorName)) { delegatorName = "default"; } - + LabelManagerFactory lmf = labelManagerFactoryCache.get(delegatorName); - + if (lmf == null) { lmf = new LabelManagerFactory(delegatorName); labelManagerFactoryCache.put(delegatorName, lmf); } return lmf; } - + protected LabelManagerFactory(String delegatorName) throws GeneralException { delegator = GenericDelegator.getGenericDelegator(delegatorName); entityModelReader = ModelReader.getModelReader(delegatorName); dispatchContext = new DispatchContext("LabelManagerFactoryDispCtx", null, this.getClass().getClassLoader(), null); prepareAll(); } - + private static void prepareAll() throws GeneralException { labels = new TreeMap<String, LabelInfo>(); fileNamesFound = new TreeMap<String, String>(); @@ -104,11 +104,11 @@ duplicatedLocalesLabelsList = FastList.newInstance(); references = null; int duplicatedLocales = 0; - + try { boolean sharkComponent = false; Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents(); - + for (ComponentConfig componentConfig : componentConfigs) { String componentName = componentConfig.getComponentName(); List<File> resourceFiles = FileUtil.findXmlFiles(componentConfig.getRootLocation(), null, "resource", null); @@ -119,20 +119,20 @@ Document resourceDocument = UtilXml.readXmlDocument(resourceFile.toURI().toURL()); Element resourceElem = resourceDocument.getDocumentElement(); String labelKeyComment = ""; - + for (Node propertyNode : UtilXml.childNodeList(resourceElem.getFirstChild())) { if (propertyNode instanceof Element) { Element propertyElem = (Element) propertyNode; String labelKey = StringUtil.defaultWebEncoder.canonicalize(propertyElem.getAttribute("key")); String labelComment = ""; - + for (Node valueNode : UtilXml.childNodeList(propertyElem.getFirstChild())) { if (valueNode instanceof Element) { Element valueElem = (Element) valueNode; String localeName = valueElem.getAttribute("xml:lang"); String labelValue = StringUtil.defaultWebEncoder.canonicalize(UtilXml.nodeValue(valueElem.getFirstChild())); LabelInfo label = labels.get(labelKey + keySeparator + fileName); - + if (UtilValidate.isEmpty(label)) { label = new LabelInfo(labelKey, labelKeyComment, fileName, componentName, localeName, labelValue, labelComment); labels.put(labelKey + keySeparator + fileName, label); @@ -166,7 +166,7 @@ } } } - + // get labels references from sources references = LabelReferences.getLabelReferences(); } catch (IOException ioe) { @@ -176,31 +176,31 @@ } duplicatedLocalesLabels = duplicatedLocales; } - + public static GenericDelegator getDelegator() { return delegator; } - + public static ModelReader getModelReader() { return entityModelReader; } - + public static DispatchContext getDispatchContext() { return dispatchContext; } - + public static Map<String, LabelInfo> getLabels() { return labels; } - + public static Set<String> getLocalesFound() { return localesFound; } - + public static Map<String, String> getFileNamesFound() { return fileNamesFound; } - + public static String getFileComponent(String fileName) { String componentName = null; if (UtilValidate.isNotEmpty(fileName)) { @@ -208,59 +208,59 @@ } return componentName; } - + public static Set<String> getComponentNamesFound() { return componentNamesFound; } - + public static Map<String, Map<String, Integer>> getReferences() { return references; } - + public static Set<String> getLabelsList() { return labels.keySet(); } - + public static Set<String> getReferencesList() { return references.keySet(); } - + public static int getLabelReferenceFile(String key) { int refFile = 0; boolean keyFound = false; - + if (key == null) { key = ""; } - + for (Map.Entry<String, String> e : fileNamesFound.entrySet()) { String keyToSearch = key + keySeparator + e.getKey(); - + if (labels.containsKey(keyToSearch)) { keyFound = true; break; } } - + if (!keyFound) { Map<String, Integer> reference = references.get(key); - + if (UtilValidate.isNotEmpty(reference)) { refFile = reference.size(); } } - + return refFile; } - + public static int getDuplicatedLocalesLabels() { return duplicatedLocalesLabels; } - + public static List<LabelInfo> getDuplicatedLocalesLabelsList() { return duplicatedLocalesLabelsList; } - + public static Map<String, Object> updateLabelKey(DispatchContext dctx, Map<String, ? extends Object> context) { String key = (String) context.get("key"); String keyComment = (String) context.get("keyComment"); @@ -272,13 +272,13 @@ List<String> localeValues = UtilGenerics.cast(context.get("localeValues")); List<String> localeComments = UtilGenerics.cast(context.get("localeComments")); Locale locale = (Locale) context.get("locale"); - + // Remove a Label if (UtilValidate.isNotEmpty(removeLabel)) { labels.remove(key + keySeparator + fileName); } else if (UtilValidate.isNotEmpty(confirm)) { LabelInfo label = labels.get(key + keySeparator + fileName); - + // Update a Label if (update_label.equalsIgnoreCase("Y")) { if (UtilValidate.isNotEmpty(label)) { @@ -300,10 +300,10 @@ } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> updateAndSaveLabelKey(DispatchContext dctx, Map<String, ? extends Object> context) { String key = (String) context.get("key"); String keyComment = (String) context.get("keyComment"); @@ -316,12 +316,12 @@ List<String> localeComments = UtilGenerics.cast(context.get("localeComments")); GenericValue userLogin = (GenericValue) context.get("userLogin"); LocalDispatcher dispatcher = dctx.getDispatcher(); - + Map<String, Object> contextInput = UtilMisc.toMap("key", key, "keyComment", keyComment, "update_label", update_label, "fileName", fileName, "confirm", confirm, "removeLabel", removeLabel, "localeNames", localeNames, "localeValues", localeValues, "localeComments", localeComments, "userLogin", userLogin); try { Map<String, Object> updatedKey = dispatcher.runSync("updateLabelKey", contextInput); - + if (ServiceUtil.isError(updatedKey)) { return updatedKey; } else { @@ -331,7 +331,7 @@ return ServiceUtil.returnError("error on saving label key :" + key); } } - + private static int updateLabelValue(List<String> localeNames, List<String> localeValues, List<String> localeComments, LabelInfo label, String key, String keyComment, String fileName) { int notEmptyLabels = 0; int i = 0; @@ -339,7 +339,7 @@ String localeName = localeNames.get(i); String localeValue = localeValues.get(i); String localeComment = localeComments.get(i); - + if (UtilValidate.isNotEmpty(localeValue) || UtilValidate.isNotEmpty(localeComment)) { if (label == null) { try { @@ -357,7 +357,7 @@ } i++; } - + return notEmptyLabels; } } |
Free forum by Nabble | Edit this page |