Package org.infoglue.cms.util.dom

Examples of org.infoglue.cms.util.dom.DOMBuilder


        String xml = getDataPropertyValue(propertySet, "serverNode_-1_shortcuts");
        logger.info("xml:" + xml);
       
      if(xml != null)
      { 
        DOMBuilder domBuilder = new DOMBuilder();
       
        Document document = domBuilder.getDocument(xml);
       
        List nodes = document.getRootElement().selectNodes("shortcut");
        logger.info("nodes:" + nodes.size());
       
        Iterator nodesIterator = nodes.iterator();
View Full Code Here


    if(qualifyerXML == null || qualifyerXML.length() == 0)
      return qualifyers;
   
    try
    {
      Document document = new DOMBuilder().getDocument(qualifyerXML);
     
      String entity = document.getRootElement().attributeValue("entity");
     
      List children = document.getRootElement().elements();
      Iterator i = children.iterator();
View Full Code Here

        transformationsXML = CmsPropertyHandler.getAssetUploadTransformationsSettings();

      if(transformationsXML == null || transformationsXML.equals("") || transformationsXML.equals("none"))
        return keepOriginal;
     
      DOMBuilder domBuilder = new DOMBuilder();
      Document document = domBuilder.getDocument(transformationsXML);
        Element rootElement = document.getRootElement();
       
      String transformationXPath = "//transformation";
      List transformationElements = rootElement.selectNodes(transformationXPath);
      logger.info("transformationElements:" + transformationElements.size());
View Full Code Here

      UserProperties userProperties = (UserProperties)userPropertiesListIterator.next();

      if(userProperties != null && userProperties.getLanguage().getLanguageId().equals(languageId) && userProperties.getValue() != null && propertyName != null)
      {
        String propertyXML = userProperties.getValue();
        DOMBuilder domBuilder = new DOMBuilder();
        Document document = domBuilder.getDocument(propertyXML);
 
        Node node = document.getRootElement().selectSingleNode("attributes/" + propertyName);
        if(node != null)
        {
          value = node.getStringValue();
          logger.info("Getting value: " + value);
          if(value != null && escapeSpecialCharacters)
            value = new VisualFormatter().escapeHTML(value);
          break;
        }
      }
    }
   
    if(value.equals(""))
    { 
      List roles = infoGluePrincipal.getRoles();
      String largestValue = "-1";
      String prioValue = null;
      int latestPriority = 0;
      Iterator rolesIterator = roles.iterator();
      while(rolesIterator.hasNext())
      {
        InfoGlueRole role = (InfoGlueRole)rolesIterator.next();
       
        Collection rolePropertiesList = RolePropertiesController.getController().getRolePropertiesList(role.getName(), languageId, db, true);

        Iterator rolePropertiesListIterator = rolePropertiesList.iterator();
        while(rolePropertiesListIterator.hasNext())
        {
          RoleProperties roleProperties = (RoleProperties)rolePropertiesListIterator.next();
         
          if(roleProperties != null && roleProperties.getLanguage().getLanguageId().equals(languageId) && roleProperties.getValue() != null && propertyName != null)
          {
            String propertyXML = roleProperties.getValue();
            DOMBuilder domBuilder = new DOMBuilder();
            Document document = domBuilder.getDocument(propertyXML);
           
            Node propertyPriorityNode = document.getRootElement().selectSingleNode("attributes/PropertyPriority");
            int currentPriority = 0;
            if(propertyPriorityNode != null)
            {
              try
              {
                String propertyPriorityValue = propertyPriorityNode.getStringValue();
                logger.info("propertyPriorityValue:" + propertyPriorityValue);

                if(propertyPriorityValue != null && !propertyPriorityValue.equals(""))
                  currentPriority = new Integer(propertyPriorityValue);
              }
              catch (Exception e)
              {
                e.printStackTrace();
              }
            }
           
            Node node = document.getRootElement().selectSingleNode("attributes/" + propertyName);
            if(node != null)
            {
              value = node.getStringValue();
              logger.info("Getting value: " + value);
              if(value != null && escapeSpecialCharacters)
                value = new VisualFormatter().escapeHTML(value);
             
              if(value != null && !value.equals("") && findLargestValue && new Integer(largestValue).intValue() < new Integer(value).intValue())
                  largestValue = value;

              logger.info("" + findLargestValue + ":" + findPrioValue + ":" + currentPriority + "=" + latestPriority);
              if(value != null && !value.equals("") && !findLargestValue && findPrioValue && currentPriority > latestPriority)
              {
                logger.info("Using other value..");
                prioValue = value;
                latestPriority = currentPriority;
              }

              break;
            }
          }
        }
      }
     
      if(findLargestValue)
          value = largestValue;
     
      if(findPrioValue && prioValue != null)
      {
          value = prioValue;
          logger.info("Using prio value");
      }
     
      if(value.equals("") && useLanguageFallback)
      {
        LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
        if(!masterLanguageVO.getLanguageId().equals(languageId))
          value = getPrincipalPropertyValue(infoGluePrincipal, propertyName, masterLanguageVO.getLanguageId(), siteNodeId, useLanguageFallback, escapeSpecialCharacters, findLargestValue);
      }
    }
   
    if(value.equals(""))
    { 
      List groups = infoGluePrincipal.getGroups();
      String largestValue = "-1";
      String prioValue = null;
      int latestPriority = 0;
      Iterator groupsIterator = groups.iterator();
      while(groupsIterator.hasNext())
      {
        InfoGlueGroup group = (InfoGlueGroup)groupsIterator.next();
       
        Collection groupPropertiesList = GroupPropertiesController.getController().getGroupPropertiesList(group.getName(), languageId, db, true);

        Iterator groupPropertiesListIterator = groupPropertiesList.iterator();
        while(groupPropertiesListIterator.hasNext())
        {
          GroupProperties groupProperties = (GroupProperties)groupPropertiesListIterator.next();
         
          if(groupProperties != null && groupProperties.getLanguage().getLanguageId().equals(languageId) && groupProperties.getValue() != null && propertyName != null)
          {
            String propertyXML = groupProperties.getValue();
            DOMBuilder domBuilder = new DOMBuilder();
            Document document = domBuilder.getDocument(propertyXML);
           
            Node propertyPriorityNode = document.getRootElement().selectSingleNode("attributes/PropertyPriority");
            int currentPriority = 0;
            if(propertyPriorityNode != null)
            {
View Full Code Here

      if(xml != null)
      { 
        logger.info("key:" + key);
        logger.info("XML:" + this.getXML());
       
        DOMBuilder domBuilder = new DOMBuilder();
       
        Document document = domBuilder.getDocument(this.getXML());
        logger.info("rootElement:" + document.getRootElement().asXML());
       
        Node node = document.getRootElement().selectSingleNode("attributes/" + key);
        if(node != null)
        {
View Full Code Here

   *
   * @return the document.
   */
  private Document buildContentVersionDocument()
  {
    final DOMBuilder builder  = new DOMBuilder();
    final Document document   = builder.createDocument();
    final Element rootElement = builder.addElement(document, "root");
    builder.addAttribute(rootElement, "xmlns", "x-schema:Schema.xml");
    final Element attributesRoot =  builder.addElement(rootElement, "attributes");
   
    buildAttributes(builder, attributesRoot);
   
    return document;
  }
View Full Code Here

    {
      //logger.warn("Reloading configuration...");
      String oldGlobalKey = this.globalKey;
      //logger.warn("oldGlobalKey:" + oldGlobalKey);
     
      DOMBuilder domBuilder = new DOMBuilder();
      String propertySetXMLPath = CastorDatabaseService.class.getResource("/propertyset.xml").getPath();
      String content = FileHelper.getFileAsString(new File(propertySetXMLPath));
      //logger.info("propertyset.xml:\n" + content);
      Document doc = domBuilder.getDocument(content);
     
      Element propertySet = (Element)doc.selectSingleNode("//propertyset[@name='jdbc']");
     
        String name = propertySet.attributeValue("name");
        String clazz = propertySet.attributeValue("class");
View Full Code Here

    try
    {
      String xml = this.getXML();
      if(xml != null)
      { 
        DOMBuilder domBuilder = new DOMBuilder();
       
        Document document = domBuilder.getDocument(xml);
       
        Node node = document.getRootElement().selectSingleNode("attributes/" + key);
        if(node != null)
        {
          value = node.getStringValue();
View Full Code Here

    if(qualifyerXML == null || qualifyerXML.length() == 0)
      return qualifyers;
   
    try
    {
      Document document = new DOMBuilder().getDocument(qualifyerXML);
     
      String entity = document.getRootElement().attributeValue("entity");
     
      List children = document.getRootElement().elements();
      Iterator i = children.iterator();
View Full Code Here

        transformationsXML = CmsPropertyHandler.getAssetUploadTransformationsSettings();

      if(transformationsXML == null || transformationsXML.equals("") || transformationsXML.equals("none"))
        return keepOriginal;
     
      DOMBuilder domBuilder = new DOMBuilder();
      Document document = domBuilder.getDocument(transformationsXML);
        Element rootElement = document.getRootElement();
       
      String transformationXPath = "//transformation";
      List transformationElements = rootElement.selectNodes(transformationXPath);
      logger.info("transformationElements:" + transformationElements.size());
View Full Code Here

TOP

Related Classes of org.infoglue.cms.util.dom.DOMBuilder

Copyright © 2018 www.massapicom. 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.