svn commit: r641730 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/ base/src/base/org/ofbiz/base/util/string/ webapp/src/org/ofbiz/webapp/control/ webtools/src/org/ofbiz/webtools/artifactinfo/ widget/src/org/ofbiz/widget/screen/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r641730 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/ base/src/base/org/ofbiz/base/util/string/ webapp/src/org/ofbiz/webapp/control/ webtools/src/org/ofbiz/webtools/artifactinfo/ widget/src/org/ofbiz/widget/screen/

jonesde
Author: jonesde
Date: Thu Mar 27 00:53:39 2008
New Revision: 641730

URL: http://svn.apache.org/viewvc?rev=641730&view=rev
Log:
Refactored xml file searching to make more general, now used to search for controller xml files for requests referred to in screen linktroller xml files for requests used in screen defs, code for forms soon to come

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/string/FlexibleStringExpander.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java?rev=641730&r1=641729&r2=641730&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java Thu Mar 27 00:53:39 2008
@@ -18,8 +18,23 @@
  *******************************************************************************/
 package org.ofbiz.base.util;
 
-import java.io.*;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
 import java.util.List;
+import java.util.Set;
+
+import javolution.util.FastList;
+import javolution.util.FastSet;
 
 /**
  * File Utilities
@@ -144,6 +159,83 @@
                 // add the filtered file to the list
                 fileList.add(files[i]);
             }
+        }
+    }
+    public static List<File> findXmlFiles(String basePath, String partialPath, String rootElementName, String xsdOrDtdName) throws IOException {
+        if (basePath == null) {
+            basePath = System.getProperty("ofbiz.home");
+        }
+        
+        Set<String> stringsToFindInPath = FastSet.newInstance();
+        Set<String> stringsToFindInFile = FastSet.newInstance();
+        
+        if (partialPath != null) stringsToFindInPath.add(partialPath);
+        if (rootElementName != null) stringsToFindInFile.add("<" + rootElementName + " ");
+        if (xsdOrDtdName != null) stringsToFindInFile.add(xsdOrDtdName);
+        
+        List<File> fileList = FastList.newInstance();
+        FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter("xml", stringsToFindInPath, stringsToFindInFile), true);
+        return fileList;
+    }
+    
+    public static class SearchTextFilesFilter implements FilenameFilter {
+        String fileExtension;
+        Set<String> stringsToFindInFile = FastSet.newInstance();
+        Set<String> stringsToFindInPath = FastSet.newInstance();
+        
+        public SearchTextFilesFilter(String fileExtension, Set<String> stringsToFindInPath, Set<String> stringsToFindInFile) {
+            this.fileExtension = fileExtension;
+            if (stringsToFindInPath != null) {
+                this.stringsToFindInPath.addAll(stringsToFindInPath);
+            }
+            if (stringsToFindInFile != null) {
+                this.stringsToFindInFile.addAll(stringsToFindInFile);
+            }
+        }
+        
+        public boolean accept(File dir, String name) {
+            File file = new File(dir, name);
+            if (file.getName().startsWith(".")) {
+                return false;
+            }
+            if (file.isDirectory()) {
+                return true;
+            }
+            
+            boolean hasAllPathStrings = true;
+            String fullPath = dir.getPath().replace('\\', '/');
+            for (String pathString: stringsToFindInPath) {
+                if (fullPath.indexOf(pathString) < 0) {
+                    hasAllPathStrings = false;
+                    break;
+                }
+            }
+            
+            if (hasAllPathStrings && name.endsWith("." + fileExtension)) {
+                StringBuffer xmlFileBuffer = null;
+                try {
+                    xmlFileBuffer = FileUtil.readTextFile(file, true);
+                } catch (FileNotFoundException e) {
+                    Debug.logWarning("Error reading xml file [" + file + "] for file search: " + e.toString(), module);
+                    return false;
+                } catch (IOException e) {
+                    Debug.logWarning("Error reading xml file [" + file + "] for file search: " + e.toString(), module);
+                    return false;
+                }
+                if (UtilValidate.isNotEmpty(xmlFileBuffer)) {
+                    boolean hasAllStrings = true;
+                    for (String stringToFile: stringsToFindInFile) {
+                        if (xmlFileBuffer.indexOf(stringToFile) < 0) {
+                            hasAllStrings = false;
+                            break;
+                        }
+                    }
+                    return hasAllStrings;
+                }
+            } else {
+                return false;
+            }
+            return false;
         }
     }
 }

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=641730&r1=641729&r2=641730&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/string/FlexibleStringExpander.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/string/FlexibleStringExpander.java Thu Mar 27 00:53:39 2008
@@ -162,6 +162,10 @@
      * @return The original String expanded by replacing varaible place holders.
      */
     public static String expandString(String original, Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
+        if (context == null) {
+            return original;
+        }
+        
         // if null or less than 3 return original; 3 chars because that is the minimum necessary for a ${}
         if (original == null || original.length() < 3) {
             return original;
@@ -175,7 +179,7 @@
         } else {
             if (original.indexOf("}", start) == -1) {
                 //no ending for the start, so we also have a stop condition
-                Debug.logWarning("Found a ${ without a closing } (curly-brace) in the String: " + original, module);
+                Debug.logWarning("Found a \"${\" without a closing \"}\" (curly-brace) in the String: " + original, module);
                 return original;  
             }
         }

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=641730&r1=641729&r2=641730&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Thu Mar 27 00:53:39 2008
@@ -18,6 +18,8 @@
  *******************************************************************************/
 package org.ofbiz.webapp.control;
 
+import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Iterator;
@@ -27,9 +29,12 @@
 
 import javolution.util.FastList;
 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;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
@@ -42,6 +47,8 @@
 public class ConfigXMLReader {
 
     public static final String module = ConfigXMLReader.class.getName();
+    public static UtilCache controllerCache = new UtilCache("webapp.ControllerConfig");
+    public static UtilCache<String, List<ControllerConfig>> controllerSearchResultsCache = new UtilCache("webapp.ControllerSearchResults");
 
     public static ControllerConfig getControllerConfig(URL url) {
         ControllerConfig controllerConfig = (ControllerConfig) controllerCache.get(url);
@@ -58,8 +65,6 @@
         return controllerConfig;
     }
     
-    public static UtilCache controllerCache = new UtilCache("webapp.ControllerConfig");
-    
     public static class ControllerConfig {
         public URL url;
         
@@ -81,6 +86,49 @@
                 this.defaultRequest = loadDefaultRequest(rootElement, url);
             }
         }
+    }
+    
+    public static Set<String> findControllerFilesWithRequest(String requestUri, String controllerPartialPath) throws GeneralException {
+        Set<String> allControllerRequestSet = FastSet.newInstance();
+        
+        String cacheId = controllerPartialPath != null ? controllerPartialPath : "NOPARTIALPATH";
+        List<ControllerConfig> controllerConfigs = (List<ControllerConfig>) controllerSearchResultsCache.get(cacheId);
+        
+        if (controllerConfigs == null) {
+            try {
+                // find controller.xml file with webappMountPoint + "/WEB-INF" in the path
+                List<File> controllerFiles = FileUtil.findXmlFiles(null, controllerPartialPath, "site-conf", "site-conf.xsd");
+                
+                controllerConfigs = FastList.newInstance();
+                for (File controllerFile: controllerFiles) {
+                    URL controllerUrl = null;
+                    try {
+                        controllerUrl = controllerFile.toURL();
+                    } catch(MalformedURLException mue) {
+                        throw new GeneralException(mue);
+                    }
+                    ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
+                    controllerConfigs.add(cc);
+                }
+                
+                controllerSearchResultsCache.put(cacheId, controllerConfigs);
+            } catch (IOException e) {
+                throw new GeneralException("Error finding controller XML files to lookup request references: " + e.toString(), e);
+            }
+        }
+        
+        if (controllerConfigs != null) {
+            for (ControllerConfig cc: controllerConfigs) {
+                // make sure it has the named request in it
+                if (cc.requestMap.get(requestUri) != null) {
+                    String requestUniqueId = cc.url.toExternalForm() + "#" + requestUri;
+                    allControllerRequestSet.add(requestUniqueId);
+                    // Debug.logInfo("========== In findControllerFilesWithRequest found controller with request here [" + requestUniqueId + "]", module);
+                }
+            }
+        }
+        
+        return allControllerRequestSet;
     }
 
     /** Site Config Variables */

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=641730&r1=641729&r2=641730&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 Mar 27 00:53:39 2008
@@ -162,9 +162,9 @@
             List<File> formFiles = null;
             List<File> controllerFiles = null;
             try {
-                screenFiles = this.findScreenWidgetDefinitionFiles(rootComponentPath);
-                formFiles = this.findFormWidgetDefinitionFiles(rootComponentPath);
-                controllerFiles = this.findWebappControllerFiles(rootComponentPath);
+                screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
+                formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
+                controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
             } catch(IOException ioe) {
                 throw new GeneralException(ioe.getMessage());
             }
@@ -421,116 +421,4 @@
         
         return aiBaseSet;
     }
-    
-    public static List<File> findFormWidgetDefinitionFiles(String basePath) throws IOException {
-        if (basePath == null) {
-            basePath = System.getProperty("ofbiz.home");
-        }
-        List<File> fileList = FastList.newInstance();
-        FileUtil.searchFiles(fileList, new File(basePath), new FilenameFilter() {
-            public boolean accept(File dir, String name) {
-                File file = new File(dir, name);
-                if (file.getName().startsWith(".")) {
-                    return false;
-                }
-                if (file.isDirectory()) {
-                    return true;
-                }
-                if (name.endsWith(".xml")) {
-                    String xmlFile = null;
-                    try {
-                        xmlFile = FileUtil.readTextFile(file, true).toString();
-                    } catch (FileNotFoundException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    } catch (IOException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    }
-                    if (UtilValidate.isNotEmpty(xmlFile)) {
-                        return xmlFile.indexOf("<forms ") > 0 && xmlFile.indexOf("widget-form.xsd") > 0;
-                    }
-                } else {
-                    return false;
-                }
-                return false;
-            }
-        }, true);
-        return fileList;
-    }
-
-    public static List<File> findScreenWidgetDefinitionFiles(String basePath) throws IOException {
-        if (basePath == null) {
-            basePath = System.getProperty("ofbiz.home");
-        }
-        List<File> fileList = FastList.newInstance();
-        FileUtil.searchFiles(fileList, new File(basePath), new FilenameFilter() {
-            public boolean accept(File dir, String name) {
-                File file = new File(dir, name);
-                if (file.getName().startsWith(".")) {
-                    return false;
-                }
-                if (file.isDirectory()) {
-                    return true;
-                }
-                if (name.endsWith(".xml")) {
-                    String xmlFile = null;
-                    try {
-                        xmlFile = FileUtil.readTextFile(file, true).toString();
-                    } catch (FileNotFoundException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    } catch (IOException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    }
-                    if (UtilValidate.isNotEmpty(xmlFile)) {
-                        return xmlFile.indexOf("<screens ") > 0 && xmlFile.indexOf("widget-screen.xsd") > 0;
-                    }
-                } else {
-                    return false;
-                }
-                return false;
-            }
-        }, true);
-        return fileList;
-    }
-
-    public static List<File> findWebappControllerFiles(String basePath) throws IOException {
-        if (basePath == null) {
-            basePath = System.getProperty("ofbiz.home");
-        }
-        List<File> fileList = FastList.newInstance();
-        FileUtil.searchFiles(fileList, new File(basePath), new FilenameFilter() {
-            public boolean accept(File dir, String name) {
-                File file = new File(dir, name);
-                if (file.getName().startsWith(".")) {
-                    return false;
-                }
-                if (file.isDirectory()) {
-                    return true;
-                }
-                if (name.endsWith(".xml")) {
-                    String xmlFile = null;
-                    try {
-                        xmlFile = FileUtil.readTextFile(file, true).toString();
-                    } catch (FileNotFoundException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    } catch (IOException e) {
-                        Debug.logWarning("Error reading xml file [" + file + "] for service implementation: " + e.toString(), module);
-                        return false;
-                    }
-                    if (UtilValidate.isNotEmpty(xmlFile)) {
-                        return xmlFile.indexOf("<site-conf ") > 0 && xmlFile.indexOf("site-conf.xsd") > 0;
-                    }
-                } else {
-                    return false;
-                }
-                return false;
-            }
-        }, true);
-        return fileList;
-    }
-
 }

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=641730&r1=641729&r2=641730&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 Mar 27 00:53:39 2008
@@ -28,6 +28,7 @@
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.widget.form.ModelForm;
 import org.ofbiz.widget.screen.ModelScreen;
@@ -71,6 +72,7 @@
         this.populateUsedEntities();
         this.populateUsedServices();
         this.populateIncludedForms();
+        this.populateLinkedRequests();
     }
     protected void populateUsedServices() throws GeneralException {
         // populate servicesUsedInThisScreen and for each the reverse-associate cache in the aif
@@ -140,6 +142,25 @@
             this.formsIncludedInThisScreen.add(aif.getFormWidgetArtifactInfo(formName));
             // the reverse reference
             UtilMisc.addToSetInMap(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);
+                // the forward reference
+                this.requestsLinkedToInScreen.add(aif.getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl), requestUri));
+                // the reverse reference
+                UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToRequest, requestUniqueId);
+            }
         }
     }
 

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=641730&r1=641729&r2=641730&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Thu Mar 27 00:53:39 2008
@@ -18,14 +18,22 @@
  *******************************************************************************/
 package org.ofbiz.widget.screen;
 
+import java.io.File;
+import java.io.IOException;
 import java.io.Serializable;
 import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javolution.util.FastSet;
+
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -34,11 +42,11 @@
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.webapp.control.ConfigXMLReader;
+import org.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig;
 import org.ofbiz.widget.ModelWidget;
 import org.w3c.dom.Element;
 
-import javolution.util.FastSet;
-
 /**
  * Widget Library - Screen model class
  */
@@ -216,10 +224,10 @@
     }
     protected static void findFormNamesIncludedInWidget(ModelScreenWidget currentWidget, Set<String> allFormNamesIncluded) {
         if (currentWidget instanceof ModelScreenWidget.Form) {
-            ModelScreenWidget.Form form = (ModelScreenWidget.Form)currentWidget;
+            ModelScreenWidget.Form form = (ModelScreenWidget.Form) currentWidget;
             allFormNamesIncluded.add(form.locationExdr.getOriginal() + "#" + form.nameExdr.getOriginal());
         } else if (currentWidget instanceof ModelScreenWidget.Section) {
-            ModelScreenWidget.Section section = (ModelScreenWidget.Section)currentWidget;
+            ModelScreenWidget.Section section = (ModelScreenWidget.Section) currentWidget;
             if (section.subWidgets != null) {
                 for (ModelScreenWidget widget: section.subWidgets) {
                     findFormNamesIncludedInWidget(widget, allFormNamesIncluded);
@@ -231,14 +239,14 @@
                 }
             }
         } else if (currentWidget instanceof ModelScreenWidget.DecoratorSection) {
-            ModelScreenWidget.DecoratorSection decoratorSection = (ModelScreenWidget.DecoratorSection)currentWidget;
+            ModelScreenWidget.DecoratorSection decoratorSection = (ModelScreenWidget.DecoratorSection) currentWidget;
             if (decoratorSection.subWidgets != null) {
                 for (ModelScreenWidget widget: decoratorSection.subWidgets) {
                     findFormNamesIncludedInWidget(widget, allFormNamesIncluded);
                 }
             }
         } else if (currentWidget instanceof ModelScreenWidget.DecoratorScreen) {
-            ModelScreenWidget.DecoratorScreen decoratorScreen = (ModelScreenWidget.DecoratorScreen)currentWidget;
+            ModelScreenWidget.DecoratorScreen decoratorScreen = (ModelScreenWidget.DecoratorScreen) currentWidget;
             if (decoratorScreen.sectionMap != null) {
                 Collection<ModelScreenWidget.DecoratorSection> sections = decoratorScreen.sectionMap.values();
                 for (ModelScreenWidget section: sections) {
@@ -246,14 +254,14 @@
                 }
             }
         } else if (currentWidget instanceof ModelScreenWidget.Container) {
-            ModelScreenWidget.Container container = (ModelScreenWidget.Container)currentWidget;
+            ModelScreenWidget.Container container = (ModelScreenWidget.Container) currentWidget;
             if (container.subWidgets != null) {
                 for (ModelScreenWidget widget: container.subWidgets) {
                     findFormNamesIncludedInWidget(widget, allFormNamesIncluded);
                 }
             }
         } else if (currentWidget instanceof ModelScreenWidget.Screenlet) {
-            ModelScreenWidget.Screenlet screenlet = (ModelScreenWidget.Screenlet)currentWidget;
+            ModelScreenWidget.Screenlet screenlet = (ModelScreenWidget.Screenlet) currentWidget;
             if (screenlet.subWidgets != null) {
                 for (ModelScreenWidget widget: screenlet.subWidgets) {
                     findFormNamesIncludedInWidget(widget, allFormNamesIncluded);
@@ -261,6 +269,108 @@
             }
         }
     }
+    
+    public Set<String> getAllRequestsLocationAndUri() throws GeneralException {
+        Set<String> allRequestNamesIncluded = FastSet.newInstance();
+        findRequestNamesLinkedtoInWidget(this.section, allRequestNamesIncluded);
+        return allRequestNamesIncluded;
+    }
+    protected static void findRequestNamesLinkedtoInWidget(ModelScreenWidget currentWidget, Set<String> allRequestNamesIncluded) throws GeneralException {
+        if (currentWidget instanceof ModelScreenWidget.Link) {
+            ModelScreenWidget.Link link = (ModelScreenWidget.Link) currentWidget;
+            String target = link.getTarget(null);
+            // Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "] with target [" + target + "]", module);
+            
+            int indexOfDollarSignCurlyBrace = target.indexOf("${");
+            int indexOfQuestionMark = target.indexOf("?");
+            if (indexOfDollarSignCurlyBrace >= 0 && (indexOfQuestionMark < 0 || indexOfQuestionMark > indexOfDollarSignCurlyBrace)) {
+                // we have an expanded string in the requestUri part of the target, not much we can do about that...
+                return;
+            }
+            
+            if ("intra-app".equals(link.getUrlMode())) {
+                // look through all controller.xml files and find those with the request-uri referred to by the target
+                int endOfRequestUri = target.length();
+                if (target.indexOf('?') > 0) {
+                    endOfRequestUri = target.indexOf('?');
+                }
+                String requestUri = target.substring(0, endOfRequestUri);
+                Debug.logInfo("In findRequestNamesLinkedtoInWidget have intra-app link with requestUri [" + requestUri + "]", module);
+                
+                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, null);
+                allRequestNamesIncluded.addAll(controllerLocAndRequestSet);
+                // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module);
+            } else if ("inter-app".equals(link.getUrlMode())) {
+                int firstChar = 0;
+                if (target.charAt(0) == '/') firstChar = 1;
+                int pathSep = target.indexOf('/', 1);
+                String webappMountPoint = null;
+                if (pathSep > 0) {
+                    // if not then no good, supposed to be a inter-app, but there is no path sep! will do general search with null and treat like an intra-app
+                    webappMountPoint = target.substring(firstChar, pathSep) + "/WEB-INF";
+                }
+                
+                int endOfRequestUri = target.length();
+                if (target.indexOf('?') > 0) {
+                    endOfRequestUri = target.indexOf('?');
+                }
+                int slashBeforeRequestUri = target.lastIndexOf('/', endOfRequestUri);
+                String requestUri = null;
+                if (slashBeforeRequestUri < 0) {
+                    requestUri = target.substring(0, endOfRequestUri);
+                } else {
+                    requestUri = target.substring(slashBeforeRequestUri, endOfRequestUri);
+                }
+                Debug.logInfo("In findRequestNamesLinkedtoInWidget have inter-app link with requestUri [" + requestUri + "]", module);
+                
+                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, webappMountPoint);
+                allRequestNamesIncluded.addAll(controllerLocAndRequestSet);
+                // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module);
+            }
+        } else if (currentWidget instanceof ModelScreenWidget.Section) {
+            ModelScreenWidget.Section section = (ModelScreenWidget.Section) currentWidget;
+            if (section.subWidgets != null) {
+                for (ModelScreenWidget widget: section.subWidgets) {
+                    findRequestNamesLinkedtoInWidget(widget, allRequestNamesIncluded);
+                }
+            }
+            if (section.failWidgets != null) {
+                for (ModelScreenWidget widget: section.failWidgets) {
+                    findRequestNamesLinkedtoInWidget(widget, allRequestNamesIncluded);
+                }
+            }
+        } else if (currentWidget instanceof ModelScreenWidget.DecoratorSection) {
+            ModelScreenWidget.DecoratorSection decoratorSection = (ModelScreenWidget.DecoratorSection) currentWidget;
+            if (decoratorSection.subWidgets != null) {
+                for (ModelScreenWidget widget: decoratorSection.subWidgets) {
+                    findRequestNamesLinkedtoInWidget(widget, allRequestNamesIncluded);
+                }
+            }
+        } else if (currentWidget instanceof ModelScreenWidget.DecoratorScreen) {
+            ModelScreenWidget.DecoratorScreen decoratorScreen = (ModelScreenWidget.DecoratorScreen) currentWidget;
+            if (decoratorScreen.sectionMap != null) {
+                Collection<ModelScreenWidget.DecoratorSection> sections = decoratorScreen.sectionMap.values();
+                for (ModelScreenWidget section: sections) {
+                    findRequestNamesLinkedtoInWidget(section, allRequestNamesIncluded);
+                }
+            }
+        } else if (currentWidget instanceof ModelScreenWidget.Container) {
+            ModelScreenWidget.Container container = (ModelScreenWidget.Container) currentWidget;
+            if (container.subWidgets != null) {
+                for (ModelScreenWidget widget: container.subWidgets) {
+                    findRequestNamesLinkedtoInWidget(widget, allRequestNamesIncluded);
+                }
+            }
+        } else if (currentWidget instanceof ModelScreenWidget.Screenlet) {
+            ModelScreenWidget.Screenlet screenlet = (ModelScreenWidget.Screenlet) currentWidget;
+            if (screenlet.subWidgets != null) {
+                for (ModelScreenWidget widget: screenlet.subWidgets) {
+                    findRequestNamesLinkedtoInWidget(widget, allRequestNamesIncluded);
+                }
+            }
+        }
+    }
+    
 
     /**
      * Renders this screen to a String, i.e. in a text format, as defined with the