Examples of StructureParameter


Examples of org.jasig.portal.layout.StructureParameter

   * with the dlm namespace Constants.NS are added as attributes to the Element.
   * Others are added as child parameter Elements.
   */
  if (ls.getParameters() != null) {
    for (Iterator itr = ls.getParameters().iterator(); itr.hasNext();) {
      StructureParameter sp = (StructureParameter) itr.next();
      String pName = sp.getName();

      // handle migration of legacy namespace
      if (pName.startsWith(Constants.LEGACY_NS))
          pName = Constants.NS + sp.getName().substring(Constants.LEGACY_NS.length());

      if (!ls.isChannel())
      { // Folder
          if (pName.startsWith(Constants.NS))
              structure.setAttributeNS(Constants.NS_URI, pName, sp.getValue());
          else
              structure.setAttribute(pName, sp.getValue());
      }
      else // Channel
      {
          // if dealing with a dlm namespace param add as attribute
          if (pName.startsWith(Constants.NS))
          {
              structure.setAttributeNS(Constants.NS_URI, pName, sp.getValue());
              itr.remove();
          }
          else
          {
              /*
               * do traditional override processing. some explanation is in
               * order. The structure element was created by the
               * ChannelDefinition and only contains parameter children if the
               * definition had defined parameters. These are checked for each
               * layout loaded parameter as found in LayoutStructure.parameters.
               * If a name match is found then we need to see if overriding is
               * allowed and if so we set the value on the child parameter
               * element. At that point we are done with that version loaded
               * from the layout so we remove it from the in-memory set of
               * parameters that are being merged-in. Then, after all such have
               * been checked against those added by the channel definition we
               * add in any remaining as adhoc, unregulated parameters.
               */
              NodeList nodeListParameters =
                  structure.getElementsByTagName("parameter");
              for (int j = 0; j < nodeListParameters.getLength(); j++)
              {
                  Element parmElement = (Element)nodeListParameters.item(j);
                  NamedNodeMap nm = parmElement.getAttributes();

                  String nodeName = nm.getNamedItem("name").getNodeValue();
                  if (nodeName.equals(pName))
                  {
                      Node override = nm.getNamedItem("override");
                      if (override != null && override.getNodeValue().equals("yes"))
                      {
                          Node valueNode = nm.getNamedItem("value");
                          valueNode.setNodeValue(sp.getValue());
                      }
                      itr.remove();
                      break; // found the corresponding one so skip the rest
                  }
              }
          }
      }
    }
    // For channels, add any remaining parameter elements loaded with the
    // layout as adhoc, unregulated, parameter children that can be overridden.
    if (ls.isChannel())
    {
        for (Iterator itr = ls.getParameters().iterator(); itr.hasNext();)
        {
            StructureParameter sp = (StructureParameter) itr.next();
            Element parameter = doc.createElement("parameter");
            parameter.setAttribute("name", sp.getName());
            parameter.setAttribute("value", sp.getValue());
            parameter.setAttribute("override", "yes");
            structure.appendChild(parameter);
        }
    }
  }
View Full Code Here

Examples of org.jasig.portal.layout.StructureParameter

      structure.setAttribute("locale", ls.getLocale())// for i18n by Shoji
  }

  if (ls.getParameters() != null) {
    for (int i = 0; i < ls.getParameters().size(); i++) {
      StructureParameter sp = (StructureParameter)ls.getParameters().get(i);
      String pName = sp.getName();
     
      // handle migration of legacy namespace
      if (pName.startsWith(Constants.LEGACY_NS))
          pName = Constants.NS + sp.getName().substring(Constants.LEGACY_NS.length());
     
                if (!ls.isChannel())
                { // Folder
                    if (pName.startsWith(Constants.NS))
                        structure.setAttributeNS(
                            Constants.NS_URI,
                            pName,
                            sp.getValue());
                    else
                        structure.setAttribute(pName, sp.getValue());
      } else { // Channel

                    // if dealing with a dlm namespace param add as attribute
                    if (pName.startsWith(Constants.NS))
                        structure.setAttributeNS(
                            Constants.NS_URI,
                            pName,
                            sp.getValue());
                    else // do traditional override processing
                        {
                        NodeList nodeListParameters =
                            structure.getElementsByTagName("parameter");
                        for (int j = 0; j < nodeListParameters.getLength(); j++)
                        {
                            Element parmElement =
                                (Element)nodeListParameters.item(j);
                            NamedNodeMap nm = parmElement.getAttributes();

                            String nodeName = nm.getNamedItem("name").getNodeValue();
                            if (nodeName.equals(pName)) {
                                Node override = nm.getNamedItem("override");
                                if (override != null && override.getNodeValue().equals("yes")) {
                                    Node valueNode = nm.getNamedItem("value");
                                    valueNode.setNodeValue(sp.getValue());
                                }
                            }
                        }
                    }
                }
View Full Code Here

Examples of org.jasig.portal.layout.StructureParameter

      }

        for (Iterator layoutStructureParamIterator = ls.getParameters().iterator();
                layoutStructureParamIterator.hasNext(); ) {
           
          StructureParameter sp = (StructureParameter) layoutStructureParamIterator.next();

          if (!ls.isChannel()) {        // Folder
            structure.setAttribute(sp.getName(), sp.getValue());
          } else {                    // Channel
            NodeList nodeListParameters = structure.getElementsByTagName("parameter");
            for (int j = 0; j < nodeListParameters.getLength(); j++) {
              Element parmElement = (Element)nodeListParameters.item(j);
              NamedNodeMap nm = parmElement.getAttributes();

              String nodeName = nm.getNamedItem("name").getNodeValue();
              if (nodeName.equals(sp.getName())) {
                Node override = nm.getNamedItem("override");
                if (override != null && override.getNodeValue().equals("yes")) {
                  Node valueNode = nm.getNamedItem("value");
                  valueNode.setNodeValue(sp.getValue());
                }
              }
            }
          }
        }
View Full Code Here

Examples of org.jasig.portal.layout.StructureParameter

         * with the dlm namespace Constants.NS are added as attributes to the Element.
         * Others are added as child parameter Elements.
         */
        if (ls.getParameters() != null) {
            for (final Iterator itr = ls.getParameters().iterator(); itr.hasNext();) {
                final StructureParameter sp = (StructureParameter) itr.next();
                String pName = sp.getName();

                // handle migration of legacy namespace
                if (pName.startsWith(Constants.LEGACY_NS)) {
                    pName = Constants.NS + sp.getName().substring(Constants.LEGACY_NS.length());
                }

                if (!ls.isChannel()) { // Folder
                    if (pName.startsWith(Constants.NS)) {
                        structure.setAttributeNS(Constants.NS_URI, pName, sp.getValue());
                    }
                    else {
                        structure.setAttribute(pName, sp.getValue());
                    }
                }
                else // Channel
                {
                    // if dealing with a dlm namespace param add as attribute
                    if (pName.startsWith(Constants.NS)) {
                        structure.setAttributeNS(Constants.NS_URI, pName, sp.getValue());
                        itr.remove();
                    }
                    else {
                        /*
                         * do traditional override processing. some explanation is in
                         * order. The structure element was created by the
                         * ChannelDefinition and only contains parameter children if the
                         * definition had defined parameters. These are checked for each
                         * layout loaded parameter as found in LayoutStructure.parameters.
                         * If a name match is found then we need to see if overriding is
                         * allowed and if so we set the value on the child parameter
                         * element. At that point we are done with that version loaded
                         * from the layout so we remove it from the in-memory set of
                         * parameters that are being merged-in. Then, after all such have
                         * been checked against those added by the channel definition we
                         * add in any remaining as adhoc, unregulated parameters.
                         */
                        final NodeList nodeListParameters = structure.getElementsByTagName("parameter");
                        for (int j = 0; j < nodeListParameters.getLength(); j++) {
                            final Element parmElement = (Element) nodeListParameters.item(j);
                            final NamedNodeMap nm = parmElement.getAttributes();

                            final String nodeName = nm.getNamedItem("name").getNodeValue();
                            if (nodeName.equals(pName)) {
                                final Node override = nm.getNamedItem("override");
                                if (override != null && override.getNodeValue().equals("yes")) {
                                    final Node valueNode = nm.getNamedItem("value");
                                    valueNode.setNodeValue(sp.getValue());
                                }
                                itr.remove();
                                break; // found the corresponding one so skip the rest
                            }
                        }
                    }
                }
            }
            // For channels, add any remaining parameter elements loaded with the
            // layout as adhoc, unregulated, parameter children that can be overridden.
            if (ls.isChannel()) {
                for (final Iterator itr = ls.getParameters().iterator(); itr.hasNext();) {
                    final StructureParameter sp = (StructureParameter) itr.next();
                    final Element parameter = doc.createElement("parameter");
                    parameter.setAttribute("name", sp.getName());
                    parameter.setAttribute("value", sp.getValue());
                    parameter.setAttribute("override", "yes");
                    structure.appendChild(parameter);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.