Author: jonesde
Date: Thu Apr 3 15:10:17 2008 New Revision: 644531 URL: http://svn.apache.org/viewvc?rev=644531&view=rev Log: Small changes to allow search in general or by artifact type Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl 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=644531&r1=644530&r2=644531&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 Thu Apr 3 15:10:17 2008 @@ -379,43 +379,53 @@ return null; } - public Set<ArtifactInfoBase> getAllArtifactInfosByNamePartial(String artifactNamePartial) { + public Set<ArtifactInfoBase> getAllArtifactInfosByNamePartial(String artifactNamePartial, String type) { Set<ArtifactInfoBase> aiBaseSet = FastSet.newInstance(); if (UtilValidate.isEmpty(artifactNamePartial)) { return aiBaseSet; } - for (Map.Entry<String, EntityArtifactInfo> curEntry: allEntityInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "entity".equals(type)) { + for (Map.Entry<String, EntityArtifactInfo> curEntry: allEntityInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } - for (Map.Entry<String, ServiceArtifactInfo> curEntry: allServiceInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "service".equals(type)) { + for (Map.Entry<String, ServiceArtifactInfo> curEntry: allServiceInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } - - for (Map.Entry<String, FormWidgetArtifactInfo> curEntry: allFormInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "form".equals(type)) { + for (Map.Entry<String, FormWidgetArtifactInfo> curEntry: allFormInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } - for (Map.Entry<String, ScreenWidgetArtifactInfo> curEntry: allScreenInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "screen".equals(type)) { + for (Map.Entry<String, ScreenWidgetArtifactInfo> curEntry: allScreenInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } - - for (Map.Entry<String, ControllerRequestArtifactInfo> curEntry: allControllerRequestInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "request".equals(type)) { + for (Map.Entry<String, ControllerRequestArtifactInfo> curEntry: allControllerRequestInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } - for (Map.Entry<String, ControllerViewArtifactInfo> curEntry: allControllerViewInfos.entrySet()) { - if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { - aiBaseSet.add(curEntry.getValue()); + if (UtilValidate.isEmpty(type) || "view".equals(type)) { + for (Map.Entry<String, ControllerViewArtifactInfo> curEntry: allControllerViewInfos.entrySet()) { + if (curEntry.getKey().toUpperCase().contains(artifactNamePartial.toUpperCase())) { + aiBaseSet.add(curEntry.getValue()); + } } } Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh?rev=644531&r1=644530&r2=644531&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh Thu Apr 3 15:10:17 2008 @@ -31,21 +31,21 @@ context.put("aif", aif); artifactInfo = null; -if (UtilValidate.isNotEmpty(type)) { +if ("search".equals(parameters.get("findType"))) { + artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type); + if (artifactInfoSet.size() == 1) { + artifactInfo = artifactInfoSet.iterator().next(); + context.put("artifactInfo", artifactInfo); + } else { + context.put("artifactInfoSet", new TreeSet(artifactInfoSet)); + } +} else { if (UtilValidate.isNotEmpty(name)) { artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type); context.put("artifactInfo", artifactInfo); } else if (UtilValidate.isNotEmpty(uniqueId)) { artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type); context.put("artifactInfo", artifactInfo); - } -} else { - artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name); - if (artifactInfoSet.size() == 1) { - artifactInfo = artifactInfoSet.iterator().next(); - context.put("artifactInfo", artifactInfo); - } else { - context.put("artifactInfoSet", new TreeSet(artifactInfoSet)); } } 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=644531&r1=644530&r2=644531&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Thu Apr 3 15:10:17 2008 @@ -34,6 +34,16 @@ <div> <form name="ArtifactInfoByName" method="post" action="<@ofbizUrl>ArtifactInfo</@ofbizUrl>" class="basic-form"> Search Names/Locations: <input type="text" name="name" value="${parameters.name?if_exists}" size="40"/> + <select name="type"> + <option></option> + <option>entity</option> + <option>service</option> + <option>form</option> + <option>screen</option> + <option>request</option> + <option>view</option> + </select> + <input type="hidden" name="findType" value="search"/> <input type="submit" name="submitButton" value="Find"/> </form> </div> |
Free forum by Nabble | Edit this page |