Author: jonesde
Date: Thu Apr 3 00:59:52 2008 New Revision: 644206 URL: http://svn.apache.org/viewvc?rev=644206&view=rev Log: Added stuff to get definition location URL for all artifact types Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoBase.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/webapp/webtools/artifactinfo/ArtifactInfo.ftl Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=644206&r1=644205&r2=644206&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Thu Apr 3 00:59:52 2008 @@ -164,13 +164,16 @@ modelEntity = createModelViewEntity(curEntityElement, null, def); } + String resourceLocation = entityResourceHandler.getLocation(); + try { + resourceLocation = entityResourceHandler.getURL().toExternalForm(); + } catch (GenericConfigException e) { + Debug.logError(e, "Could not get resource URL", module); + } + // utilTimer.timerString(" After createModelEntity -- " + i + " --"); if (modelEntity != null) { - try { - modelEntity.setLocation(entityResourceHandler.getFullLocation()); - } catch (GenericConfigException e) { - Debug.logWarning("Error getting ResourceHandler full location: " + e.getMessage(), module); - } + modelEntity.setLocation(resourceLocation); entityCache.put(entityName, modelEntity); // utilTimer.timerString(" After entityCache.put -- " + i + " --"); if (isEntity) { 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=644206&r1=644205&r2=644206&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Thu Apr 3 00:59:52 2008 @@ -96,6 +96,9 @@ /** The name of this service */ public String name; + + /** The location of the definition this service */ + public String definitionLocation; /** The description of this service */ public String description; @@ -188,6 +191,7 @@ public ModelService(ModelService model) { this.name = model.name; + this.definitionLocation = model.definitionLocation; this.description = model.description; this.engineName = model.engineName; this.nameSpace = model.nameSpace; @@ -243,6 +247,7 @@ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(name).append("::"); + buf.append(definitionLocation).append("::"); buf.append(description).append("::"); buf.append(engineName).append("::"); buf.append(nameSpace).append("::"); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=644206&r1=644205&r2=644206&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Thu Apr 3 00:59:52 2008 @@ -141,6 +141,13 @@ docElement.normalize(); + String resourceLocation = handler.getLocation(); + try { + resourceLocation = handler.getURL().toExternalForm(); + } catch (GenericConfigException e) { + Debug.logError(e, "Could not get resource URL", module); + } + int i = 0; Node curChild = docElement.getFirstChild(); if (curChild != null) { @@ -153,8 +160,8 @@ do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "service".equals(curChild.getNodeName())) { i++; - Element curService = (Element) curChild; - String serviceName = UtilXml.checkEmpty(curService.getAttribute("name")); + Element curServiceElement = (Element) curChild; + String serviceName = UtilXml.checkEmpty(curServiceElement.getAttribute("name")); // check to see if service with same name has already been read if (modelServices.containsKey(serviceName)) { @@ -163,7 +170,7 @@ } // utilTimer.timerString(" After serviceName -- " + i + " --"); - ModelService service = createModelService(curService); + ModelService service = createModelService(curServiceElement, resourceLocation); // utilTimer.timerString(" After createModelService -- " + i + " --"); if (service != null) { @@ -198,15 +205,9 @@ Debug.logImportant("Loaded " + i + " Service definitions from " + readerURL, module); } else { utilTimer.timerString("Finished document in " + handler + " - Total Services: " + i + " FINISHED"); - if (Debug.importantOn()) { - String resourceLocation = handler.getLocation(); - try { - resourceLocation = handler.getURL().toExternalForm(); - } catch (GenericConfigException e) { - Debug.logError(e, "Could not get resource URL", module); - } - Debug.logImportant("Loaded " + i + " Service definitions from " + resourceLocation, module); - } + if (Debug.importantOn()) { + Debug.logImportant("Loaded " + i + " Service definitions from " + resourceLocation, module); + } } } } @@ -252,10 +253,11 @@ return ec.keySet(); } - protected ModelService createModelService(Element serviceElement) { + protected ModelService createModelService(Element serviceElement, String resourceLocation) { ModelService service = new ModelService(); service.name = UtilXml.checkEmpty(serviceElement.getAttribute("name")).intern(); + service.definitionLocation = resourceLocation; service.engineName = UtilXml.checkEmpty(serviceElement.getAttribute("engine")).intern(); service.location = UtilXml.checkEmpty(serviceElement.getAttribute("location")).intern(); service.invoke = UtilXml.checkEmpty(serviceElement.getAttribute("invoke")).intern(); @@ -502,7 +504,7 @@ param.type = fieldType.getJavaType(); // this is a special case where we use something different in the service layer than we do in the entity/data layer if ("java.sql.Blob".equals(param.type)) { - param.type = "java.nio.ByteBuffer"; + param.type = "java.nio.ByteBuffer"; } param.mode = UtilXml.checkEmpty(autoElement.getAttribute("mode")).intern(); param.optional = "true".equalsIgnoreCase(autoElement.getAttribute("optional")); // default to true 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -46,10 +46,12 @@ protected List<ServiceEcaCondition> conditions = FastList.newInstance(); protected List<Object> actionsAndSets = FastList.newInstance(); protected boolean enabled = true; + protected String definitionLocation = null; protected ServiceEcaRule() {} - public ServiceEcaRule(Element eca) { + public ServiceEcaRule(Element eca, String definitionLocation) { + this.definitionLocation = definitionLocation; this.serviceName = eca.getAttribute("service"); this.eventName = eca.getAttribute("event"); this.runOnFailure = "true".equals(eca.getAttribute("run-on-failure")); @@ -91,6 +93,10 @@ public String getEventName() { return this.eventName; + } + + public String getDefinitionLocation() { + return this.definitionLocation; } public List<ServiceEcaAction> getEcaActionList() { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java?rev=644206&r1=644205&r2=644206&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java Thu Apr 3 00:59:52 2008 @@ -82,6 +82,13 @@ return; } + String resourceLocation = handler.getLocation(); + try { + resourceLocation = handler.getURL().toExternalForm(); + } catch (GenericConfigException e) { + Debug.logError(e, "Could not get resource URL", module); + } + int numDefs = 0; for (Element e: UtilXml.childElementList(rootElement, "eca")) { String serviceName = e.getAttribute("service"); @@ -101,16 +108,10 @@ eventMap.put(eventName, rules); } } - rules.add(new ServiceEcaRule(e)); + rules.add(new ServiceEcaRule(e, resourceLocation)); numDefs++; } if (Debug.importantOn()) { - String resourceLocation = handler.getLocation(); - try { - resourceLocation = handler.getURL().toExternalForm(); - } catch (GenericConfigException e) { - Debug.logError(e, "Could not get resource URL", module); - } Debug.logImportant("Loaded [" + numDefs + "] Service ECA definitions from " + resourceLocation, module); } } 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -18,6 +18,9 @@ */ package org.ofbiz.webtools.artifactinfo; +import java.net.MalformedURLException; +import java.net.URL; + /** @@ -49,6 +52,8 @@ 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/ControllerRequestArtifactInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -18,6 +18,7 @@ */ package org.ofbiz.webtools.artifactinfo; +import java.net.MalformedURLException; import java.net.URL; import java.util.Map; import java.util.Set; @@ -146,6 +147,10 @@ public String getUniqueId() { return this.controllerXmlUrl.toExternalForm() + "#" + this.requestUri; + } + + public URL getLocationURL() throws MalformedURLException { + return this.controllerXmlUrl; } public boolean equals(Object obj) { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -18,6 +18,7 @@ */ package org.ofbiz.webtools.artifactinfo; +import java.net.MalformedURLException; import java.net.URL; import java.util.Map; import java.util.Set; @@ -104,6 +105,10 @@ public String getUniqueId() { return this.controllerXmlUrl.toExternalForm() + "#" + this.viewUri; + } + + public URL getLocationURL() throws MalformedURLException { + return this.controllerXmlUrl; } public boolean equals(Object obj) { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -18,11 +18,14 @@ */ package org.ofbiz.webtools.artifactinfo; +import java.net.MalformedURLException; +import java.net.URL; import java.util.List; import java.util.Set; import javolution.util.FastSet; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.GeneralException; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.model.ModelEntity; @@ -73,6 +76,10 @@ public String getUniqueId() { return this.modelEntity.getEntityName(); + } + + public URL getLocationURL() throws MalformedURLException { + return FlexibleLocation.resolveLocation(this.modelEntity.getLocation(), null); } public boolean equals(Object obj) { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -19,12 +19,15 @@ package org.ofbiz.webtools.artifactinfo; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Set; import javax.xml.parsers.ParserConfigurationException; import javolution.util.FastSet; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilMisc; @@ -193,6 +196,10 @@ public String getUniqueId() { return this.formLocation + "#" + this.formName; + } + + public URL getLocationURL() throws MalformedURLException { + return FlexibleLocation.resolveLocation(this.formLocation, null); } public boolean equals(Object obj) { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -19,12 +19,15 @@ package org.ofbiz.webtools.artifactinfo; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Set; import javax.xml.parsers.ParserConfigurationException; import javolution.util.FastSet; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilMisc; @@ -179,6 +182,10 @@ public String getUniqueId() { return this.screenLocation + "#" + this.screenName; + } + + public URL getLocationURL() throws MalformedURLException { + return FlexibleLocation.resolveLocation(this.screenLocation, null); } public boolean equals(Object obj) { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -21,6 +21,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.List; import java.util.Map; import java.util.Set; @@ -29,6 +31,7 @@ import javolution.util.FastMap; import javolution.util.FastSet; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.GeneralException; @@ -245,6 +248,14 @@ 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() { 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=644206&r1=644205&r2=644206&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 Thu Apr 3 00:59:52 2008 @@ -18,6 +18,8 @@ */ package org.ofbiz.webtools.artifactinfo; +import java.net.MalformedURLException; +import java.net.URL; import java.util.List; import java.util.Map; import java.util.Set; @@ -26,6 +28,7 @@ import javolution.util.FastMap; import javolution.util.FastSet; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.service.eca.ServiceEcaAction; @@ -74,6 +77,10 @@ public String getUniqueId() { return this.serviceEcaRule.toString(); + } + + public URL getLocationURL() throws MalformedURLException { + return FlexibleLocation.resolveLocation(this.serviceEcaRule.getDefinitionLocation(), null); } public ServiceEcaRule getServiceEcaRule() { Modified: ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl?rev=644206&r1=644205&r2=644206&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Thu Apr 3 00:59:52 2008 @@ -68,10 +68,13 @@ <#else/> <h1>Artifact Info (${artifactInfo.getDisplayType()}): ${artifactInfo.getDisplayName()}</h1> + <#if artifactInfo.getLocationURL()?exists> + <div>Defined in: <a href="${artifactInfo.getLocationURL()}">${artifactInfo.getLocationURL()}</a></div> + </#if> <#if artifactInfo.getType() == "entity"> - <h2>Entity Fields</h2> <div><a href="<@ofbizUrl>FindGeneric?entityName=${artifactInfo.modelEntity.getEntityName()}&find=true&VIEW_SIZE=50&VIEW_INDEX=0</@ofbizUrl>">All Entity Data</a></div> + <h2>Entity Fields</h2> <table> <#list artifactInfo.modelEntity.getFieldsCopy() as modelField> <tr><td>${modelField.getName()}<#if modelField.getIsPk()>*</#if></td><td>${modelField.getType()}</td><td>${modelField.getDescription()?if_exists}</td></tr> @@ -106,6 +109,7 @@ <h2>Service Info</h2> <div> Description: ${artifactInfo.modelService.description}</div> <div> Run (${artifactInfo.modelService.engineName}): ${artifactInfo.modelService.location} :: ${artifactInfo.modelService.invoke}</div> + <div> Impl Location: <a href="${artifactInfo.getImplementationLocationURL()}">${artifactInfo.getImplementationLocationURL()}</a></div> <h2>Service Parameters</h2> <table> <tr><td>Name</td><td>Type</td><td>Optional</td><td>Mode</td></tr> |
Free forum by Nabble | Edit this page |