コード例 #1
0
  protected void readPortletResource(String servletContextName, Element portletResourceElement) {

    String name = portletResourceElement.elementTextTrim("portlet-name");

    if (servletContextName != null) {
      name = name.concat(PortletConstants.WAR_SEPARATOR).concat(servletContextName);
    }

    name = JS.getSafeName(name);

    List<String> supportsActions =
        readSupportsActions(portletResourceElement, _portletResourceActions, name);

    supportsActions.addAll(getPortletMimeTypeActions(name));

    if (!name.equals(PortletKeys.PORTAL)) {
      checkPortletActions(name, supportsActions);
    }

    supportsActions = setActions(_portletResourceActions, name, supportsActions);

    readGroupDefaultActions(portletResourceElement, _portletResourceGroupDefaultActions, name);

    List<String> guestDefaultActions =
        readGuestDefaultActions(portletResourceElement, _portletResourceGuestDefaultActions, name);

    readGuestUnsupportedActions(
        portletResourceElement, _portletResourceGuestUnsupportedActions,
        name, guestDefaultActions);

    setActions(_portletResourceGuestDefaultActions, name, guestDefaultActions);

    readLayoutManagerActions(
        portletResourceElement, _portletResourceLayoutManagerActions, name, supportsActions);
  }
コード例 #2
0
  protected void readModelResource(String servletContextName, Element modelResourceElement) {

    String name = modelResourceElement.elementTextTrim("model-name");

    Element portletRefElement = modelResourceElement.element("portlet-ref");

    for (Element portletNameElement : portletRefElement.elements("portlet-name")) {

      String portletName = portletNameElement.getTextTrim();

      if (servletContextName != null) {
        portletName = portletName.concat(PortletConstants.WAR_SEPARATOR).concat(servletContextName);
      }

      portletName = JS.getSafeName(portletName);

      // Reference for a portlet to child models

      Set<String> modelResources = _portletModelResources.get(portletName);

      if (modelResources == null) {
        modelResources = new HashSet<String>();

        _portletModelResources.put(portletName, modelResources);
      }

      modelResources.add(name);

      // Reference for a model to parent portlets

      Set<String> portletResources = _modelPortletResources.get(name);

      if (portletResources == null) {
        portletResources = new HashSet<String>();

        _modelPortletResources.put(name, portletResources);
      }

      portletResources.add(portletName);

      // Reference for a model to root portlets

      boolean root = GetterUtil.getBoolean(modelResourceElement.elementText("root"));

      if (root) {
        _portletRootModelResource.put(portletName, name);
      }
    }

    double weight = GetterUtil.getDouble(modelResourceElement.elementTextTrim("weight"), 100);

    _modelResourceWeights.put(name, weight);

    List<String> supportsActions =
        readSupportsActions(modelResourceElement, _modelResourceActions, name);

    checkModelActions(supportsActions);

    setActions(_modelResourceActions, name, supportsActions);

    readGroupDefaultActions(modelResourceElement, _modelResourceGroupDefaultActions, name);

    List<String> guestDefaultActions =
        readGuestDefaultActions(modelResourceElement, _modelResourceGuestDefaultActions, name);

    readGuestUnsupportedActions(
        modelResourceElement, _modelResourceGuestUnsupportedActions, name, guestDefaultActions);

    setActions(_modelResourceGuestDefaultActions, name, guestDefaultActions);

    readOwnerDefaultActions(modelResourceElement, _modelResourceOwnerDefaultActions, name);
  }