Ejemplo n.º 1
0
  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);
      String urlMode = link.getUrlMode();
      // Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "]
      // with target [" + target + "]", module);

      Set<String> controllerLocAndRequestSet =
          ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
      if (controllerLocAndRequestSet == null) return;
      allRequestNamesIncluded.addAll(controllerLocAndRequestSet);
    } 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);
        }
      }
    }
  }
Ejemplo n.º 2
0
 public EventFactory(ServletContext context, URL controllerConfigURL) {
   // load all the event handlers
   try {
     Set<Map.Entry<String, String>> handlerEntries =
         ConfigXMLReader.getControllerConfig(controllerConfigURL).getEventHandlerMap().entrySet();
     if (handlerEntries != null) {
       for (Map.Entry<String, String> handlerEntry : handlerEntries) {
         EventHandler handler = (EventHandler) ObjectType.getInstance(handlerEntry.getValue());
         handler.init(context);
         this.handlers.put(handlerEntry.getKey(), handler);
       }
     }
   } catch (Exception e) {
     Debug.logError(e, module);
     throw new GeneralRuntimeException(e);
   }
 }