Examples of InfoGlueComponent


Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

        {
          //logger.info("infoGlueComponent:" + infoGlueComponent);
          Iterator inheritedComponentsIterator = subComponents.iterator();
          while(inheritedComponentsIterator.hasNext())
          {
            InfoGlueComponent infoGlueComponent = (InfoGlueComponent)inheritedComponentsIterator.next();
            infoGlueComponent.setIsInherited(true);
          }
        }
       
        parentSiteNodeVO = nodeDeliveryController.getParentSiteNode(db, parentSiteNodeVO.getId());
        //logger.info("parentSiteNodeVO:" + parentSiteNodeVO); 
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

            ContentVO contentVO = ContentDeliveryController.getContentDeliveryController().getContentVO(db, contentId, templateController.getDeliveryContext());
            //logger.info("slotName:" + slotName + " should get connected with content_" + contentVO.getId());
           
            groups = new String[]{CacheController.getPooledString(1, contentVO.getId())};
           
          InfoGlueComponent component = new InfoGlueComponent();
          component.setPositionInSlot(new Integer(slotPosition));
          component.setId(id);
          component.setContentId(contentId);
          component.setName(contentVO.getName());
          component.setSlotName(name);
          component.setParentComponent(parentComponent);
          if(isInherited != null && isInherited.equals("true"))
            component.setIsInherited(true);
          else if(parentComponent != null)
            component.setIsInherited(parentComponent.getIsInherited());

          if(pagePartTemplateContentId != null && !pagePartTemplateContentId.equals("") && !pagePartTemplateContentId.equals("-1"))
          {
            Integer pptContentId = new Integer(pagePartTemplateContentId);
              ContentVO pptContentIdContentVO = ContentDeliveryController.getContentDeliveryController().getContentVO(db, pptContentId, templateController.getDeliveryContext());

            InfoGlueComponent partTemplateReferenceComponent = new InfoGlueComponent();
            partTemplateReferenceComponent.setPositionInSlot(new Integer(slotPosition));
            partTemplateReferenceComponent.setId(id);
            partTemplateReferenceComponent.setContentId(pptContentId);
            partTemplateReferenceComponent.setName(pptContentIdContentVO.getName());
            partTemplateReferenceComponent.setSlotName(name);
            partTemplateReferenceComponent.setParentComponent(parentComponent);
            partTemplateReferenceComponent.setIsInherited(true);
           
            component.setPagePartTemplateContentId(pptContentId);
            component.setPagePartTemplateComponent(partTemplateReferenceComponent);
          }
     
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

    Integer repositoryId = nodeDeliveryController.getSiteNodeVO(getDatabase(), this.getDeliveryContext().getSiteNodeId()).getRepositoryId();

    String componentXML = getPageComponentsString(getDatabase(), this.getTemplateController(), this.getDeliveryContext().getSiteNodeId(), this.getDeliveryContext().getLanguageId(), this.getDeliveryContext().getContentId());
    componentXML = appendPagePartTemplates(componentXML, this.getDeliveryContext().getSiteNodeId());
   
    InfoGlueComponent baseComponent = null;
   
       if(componentXML != null && componentXML.length() != 0)
    {
         Timer t = new Timer();
     
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

  {
    List sortedPageComponents = new ArrayList();
    Iterator unsortedPageComponentsIterator = unsortedPageComponents.iterator();
    while(unsortedPageComponentsIterator.hasNext())
    {
      InfoGlueComponent component = (InfoGlueComponent)unsortedPageComponentsIterator.next();

      //this.getTemplateController().setComponentLogic(new ComponentLogic(this.getTemplateController(), component));
      //this.getTemplateController().getDeliveryContext().getUsageListeners().add(this.getTemplateController().getComponentLogic().getComponentDeliveryContext());
     
      int index = 0;
      Iterator sortedPageComponentsIterator = sortedPageComponents.iterator();
      while(sortedPageComponentsIterator.hasNext())
      {
        InfoGlueComponent sortedComponent = (InfoGlueComponent)sortedPageComponentsIterator.next();

        //this.getTemplateController().setComponentLogic(new ComponentLogic(this.getTemplateController(), sortedComponent));
        //this.getTemplateController().getDeliveryContext().getUsageListeners().add(this.getTemplateController().getComponentLogic().getComponentDeliveryContext());

        if(sortedComponent.getPreProcessingOrder().compareTo(component.getPreProcessingOrder()) < 0)
          break;

        index++;
      }
     
      sortedPageComponents.add(index, component);
    }

    Iterator sortedPageComponentsIterator = sortedPageComponents.iterator();
    while(sortedPageComponentsIterator.hasNext())
    {
      InfoGlueComponent component = (InfoGlueComponent)sortedPageComponentsIterator.next();
      this.getTemplateController().setComponentLogic(new ComponentLogic(this.getTemplateController(), component));
      //this.getTemplateController().getDeliveryContext().getUsageListeners().add(this.getTemplateController().getComponentLogic().getComponentDeliveryContext());
     
      ContentVO metaInfoContentVO = nodeDeliveryController.getBoundContent(getDatabase(), this.getTemplateController().getPrincipal(), this.getDeliveryContext().getSiteNodeId(), this.getDeliveryContext().getLanguageId(), true, "Meta information", this.getDeliveryContext());
      if(!component.getIsInherited()) //Wrong maybe?
        preProcessComponent(component, this.getTemplateController(), repositoryId, this.getDeliveryContext().getSiteNodeId(), this.getDeliveryContext().getLanguageId(), this.getDeliveryContext().getContentId(), metaInfoContentVO.getId(), sortedPageComponents);
    }

  }
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

 
  protected Map getComponentsWithXPP3(Database db, XmlElement element, TemplateController templateController, InfoGlueComponent parentComponent) throws Exception
  {
    //logger.info("Getting components");

    InfoGlueComponent component = null;

    Locale locale = LanguageDeliveryController.getLanguageDeliveryController().getLocaleWithId(db, templateController.getLanguageId());
   
    Map components = new HashMap();
   
    String componentXPath = "component";

    Xb1XPath xpathObject = (Xb1XPath)cachedXPathObjects.get(componentXPath);
        if(xpathObject == null)
        {
          xpathObject = new Xb1XPath(componentXPath);
          cachedXPathObjects.put(componentXPath, xpathObject);
        }

        List componentNodeList = xpathObject.selectNodes( element );
    Iterator componentNodeListIterator = componentNodeList.iterator();
    while(componentNodeListIterator.hasNext())
    {
      XmlElement child   = (XmlElement)componentNodeListIterator.next();
      Integer id       = new Integer(child.getAttributeValue(child.getNamespaceName(), "id"));
      Integer contentId   = new Integer(child.getAttributeValue(child.getNamespaceName(), "contentId"));
      String name       = child.getAttributeValue(child.getNamespaceName(), "name");
      String isPagePartRef  = child.getAttributeValue(child.getNamespaceName(), "isPagePartReference");
     
      //logger.info("id 2:" + id);
      //logger.info("contentId 2:" + contentId);
      //logger.info("name 2:" + name);
     
      ContentVO contentVO = ContentDeliveryController.getContentDeliveryController().getContentVO(db, contentId, templateController.getDeliveryContext());
     
      component = new InfoGlueComponent();
      component.setId(id);
      component.setContentId(contentId);
      component.setName(contentVO.getName());
      //component.setName(name);
      component.setSlotName(name);
      component.setParentComponent(parentComponent);
      if(parentComponent != null)
        component.setIsInherited(parentComponent.getIsInherited());
       
      Xb1XPath xpathObject2 = (Xb1XPath)cachedXPathObjects.get("properties");
          if(xpathObject2 == null)
          {
            xpathObject2 = new Xb1XPath("properties");
            cachedXPathObjects.put("properties", xpathObject2);
          }

          List propertiesNodeList = xpathObject2.selectNodes( child );
      if(propertiesNodeList.size() > 0)
      {
        XmlElement propertiesElement = (XmlElement)propertiesNodeList.get(0);
       
        Xb1XPath xpathObject3 = (Xb1XPath)cachedXPathObjects.get("property");
            if(xpathObject3 == null)
            {
              xpathObject3 = new Xb1XPath("property");
              cachedXPathObjects.put("property", xpathObject3);
            }

            List propertyNodeList = xpathObject3.selectNodes(propertiesElement);
        //logger.info("propertyNodeList:" + propertyNodeList.getLength());
        Iterator propertyNodeListIterator = propertyNodeList.iterator();
        while(propertyNodeListIterator.hasNext())
        {
          XmlElement propertyElement = (XmlElement)propertyNodeListIterator.next();
         
          String propertyName = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "name");
          String type = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "type");
          String path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path");

          if(path == null)
          {
            LanguageVO langaugeVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(getDatabase(), templateController.getSiteNodeId());
            if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + langaugeVO.getLanguageCode()) != null)
              path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + langaugeVO.getLanguageCode());
          }

          //logger.info("path:" + "path_" + locale.getLanguage() + ":" + propertyElement.attributeValue("path_" + locale.getLanguage()));
          if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + locale.getLanguage()) != null)
            path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + locale.getLanguage());

          if(path == null || path.equals(""))
          {
            logger.info("Falling back to content master language 1 for property:" + propertyName);
            LanguageVO contentMasterLangaugeVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(getDatabase(), contentVO.getRepositoryId());
            if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + contentMasterLangaugeVO.getLanguageCode()) != null)
              path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + contentMasterLangaugeVO.getLanguageCode())
          }
         
          Map property = new HashMap();
          property.put("name", propertyName);
          property.put("path", path);
          property.put("type", type);
          property.put("isPagePartReference", (isPagePartRef == null ? "false" : isPagePartRef));
         
          Iterator attributesIterator = propertyElement.attributes();
          while(attributesIterator.hasNext())
          {
            XmlAttribute attribute = (XmlAttribute)attributesIterator.next();
            if(attribute.getName().startsWith("path_"))
              property.put(attribute.getName(), attribute.getValue());
          }
         
          if(path != null)
          {
            if(propertyName.equals(InfoGlueComponent.CACHE_RESULT_PROPERTYNAME) && (path.equalsIgnoreCase("true") || path.equalsIgnoreCase("yes")))
            {
              component.setCacheResult(true);
            }
            if(propertyName.equals(InfoGlueComponent.UPDATE_INTERVAL_PROPERTYNAME) && !path.equals(""))
            {
              try { component.setUpdateInterval(Integer.parseInt(path)); } catch (Exception e) { logger.warn("The component " + component.getName() + " " + InfoGlueComponent.UPDATE_INTERVAL_PROPERTYNAME + " with a faulty value on page " + this.getTemplateController().getOriginalFullURL() + ":" + e.getMessage()); }
            }
            if(propertyName.equals(InfoGlueComponent.CACHE_KEY_PROPERTYNAME) && !path.equals(""))
            {
              component.setCacheKey(path);
            }
            if(propertyName.equals(InfoGlueComponent.PREPROCESSING_ORDER_PROPERTYNAME) && !path.equals(""))
            {
              component.setPreProcessingOrder(path);
            }
          }
         
          List bindings = new ArrayList();
         
          Xb1XPath xpathObject4 = (Xb1XPath)cachedXPathObjects.get("binding");
              if(xpathObject4 == null)
              {
                xpathObject4 = new Xb1XPath("binding");
                cachedXPathObjects.put("binding", xpathObject4);
              }

              List bindingNodeList = xpathObject4.selectNodes(propertyElement);
          //logger.info("bindingNodeList:" + bindingNodeList.getLength());
          Iterator bindingNodeListIterator = bindingNodeList.iterator();
          while(bindingNodeListIterator.hasNext())
          {
            XmlElement bindingElement = (XmlElement)bindingNodeListIterator.next();
            String entity = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "entity");
            String entityId = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "entityId");
            String assetKey = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "assetKey");
            //logger.info("Binding found:" + entity + ":" + entityId);

            ComponentBinding componentBinding = new ComponentBinding();
            //componentBinding.setId(new Integer(id));
            //componentBinding.setComponentId(componentId);
            componentBinding.setEntityClass(entity);
            componentBinding.setEntityId(new Integer(entityId));
            componentBinding.setAssetKey(assetKey);
            componentBinding.setBindingPath(path);
           
            bindings.add(componentBinding);
          }
 
          property.put("bindings", bindings);
         
          component.getProperties().put(propertyName, property);

          //TEST
          //component.getProperties().put(propertyName, property);

        }
      }
     
     
      getComponentRestrictionsWithXPP3(child, component, locale, templateController);

     
      //Getting slots for the component
      String componentString = this.getComponentString(templateController, contentId, component);
      //logger.info("Getting the slots for component.......");
      //logger.info("componentString:" + componentString);
      int offset = 0;
      int slotStartIndex = componentString.indexOf("<ig:slot", offset);
      while(slotStartIndex > -1)
      {
        int slotStopIndex = componentString.indexOf("</ig:slot>", slotStartIndex);
        String slotString = componentString.substring(slotStartIndex, slotStopIndex + 10);
        String slotId = slotString.substring(slotString.indexOf("id") + 4, slotString.indexOf("\"", slotString.indexOf("id") + 4));

        boolean inherit = true;
        int inheritIndex = slotString.indexOf("inherit");
        if(inheritIndex > -1)
        {   
            String inheritString = slotString.substring(inheritIndex + 9, slotString.indexOf("\"", inheritIndex + 9));
            inherit = Boolean.parseBoolean(inheritString);
        }

        boolean disableAccessControl = false;
        int disableAccessControlIndex = slotString.indexOf("disableAccessControl");
        if(disableAccessControlIndex > -1)
        {   
            String disableAccessControlString = slotString.substring(disableAccessControlIndex + "disableAccessControl".length() + 2, slotString.indexOf("\"", disableAccessControlIndex + "disableAccessControl".length() + 2));
            disableAccessControl = Boolean.parseBoolean(disableAccessControlString);
        }

        String[] allowedComponentNamesArray = null;
        int allowedComponentNamesIndex = slotString.indexOf(" allowedComponentNames");
        if(allowedComponentNamesIndex > -1)
        {   
            String allowedComponentNames = slotString.substring(allowedComponentNamesIndex + 24, slotString.indexOf("\"", allowedComponentNamesIndex + 24));
            allowedComponentNamesArray = allowedComponentNames.split(",");
        }

        String[] disallowedComponentNamesArray = null;
        int disallowedComponentNamesIndex = slotString.indexOf(" disallowedComponentNames");
        if(disallowedComponentNamesIndex > -1)
        {   
            String disallowedComponentNames = slotString.substring(disallowedComponentNamesIndex + 27, slotString.indexOf("\"", disallowedComponentNamesIndex + 27));
            disallowedComponentNamesArray = disallowedComponentNames.split(",");
        }

        String[] allowedComponentGroupNamesArray = null;
        int allowedComponentGroupNamesIndex = slotString.indexOf(" allowedComponentGroupNames");
        if(allowedComponentGroupNamesIndex > -1)
        {   
            String allowedComponentGroupNames = slotString.substring(allowedComponentGroupNamesIndex + 29, slotString.indexOf("\"", allowedComponentGroupNamesIndex + 29));
            allowedComponentGroupNamesArray = allowedComponentGroupNames.split(",");
        }

        String addComponentText = null;
        int addComponentTextIndex = slotString.indexOf("addComponentText");
        if(addComponentTextIndex > -1)
        {   
            addComponentText = slotString.substring(addComponentTextIndex + "addComponentText".length() + 2, slotString.indexOf("\"", addComponentTextIndex + "addComponentText".length() + 2));
        }

        String addComponentLinkHTML = null;
        int addComponentLinkHTMLIndex = slotString.indexOf("addComponentLinkHTML");
        if(addComponentLinkHTMLIndex > -1)
        {   
            addComponentLinkHTML = slotString.substring(addComponentLinkHTMLIndex + "addComponentLinkHTML".length() + 2, slotString.indexOf("\"", addComponentLinkHTMLIndex + "addComponentLinkHTML".length() + 2));
        }

        int allowedNumberOfComponentsInt = -1;
        int allowedNumberOfComponentsIndex = slotString.indexOf("allowedNumberOfComponents");
        if(allowedNumberOfComponentsIndex > -1)
        {   
          String allowedNumberOfComponents = slotString.substring(allowedNumberOfComponentsIndex + "allowedNumberOfComponents".length() + 2, slotString.indexOf("\"", allowedNumberOfComponentsIndex + "allowedNumberOfComponents".length() + 2));
          try
          {
            allowedNumberOfComponentsInt = new Integer(allowedNumberOfComponents);
          }
          catch (Exception e)
          {
            allowedNumberOfComponentsInt = -1;
          }
        }

          Slot slot = new Slot();
          slot.setId(slotId);
          slot.setInherit(inherit);
          slot.setDisableAccessControl(disableAccessControl);
          slot.setAllowedComponentsArray(allowedComponentNamesArray);
          slot.setDisallowedComponentsArray(disallowedComponentNamesArray);
          slot.setAllowedComponentGroupsArray(allowedComponentGroupNamesArray);
          slot.setAddComponentLinkHTML(addComponentLinkHTML);
          slot.setAddComponentText(addComponentText);
          slot.setAllowedNumberOfComponents(new Integer(allowedNumberOfComponentsInt));
         
          List subComponents = getComponentsWithXPP3(db, templateController, component, templateController.getSiteNodeId(), slotId);
          slot.setComponents(subComponents);
         
          component.getSlotList().add(slot);

          offset = slotStopIndex; // + 10;
        slotStartIndex = componentString.indexOf("<ig:slot", offset);
      }
     
     
      Xb1XPath xpathObject5 = (Xb1XPath)cachedXPathObjects.get("components");
          if(xpathObject5 == null)
          {
            xpathObject5 = new Xb1XPath("components");
            cachedXPathObjects.put("components", xpathObject5);
          }

      List anl = xpathObject5.selectNodes(child);
      if(anl.size() > 0)
      {
        XmlElement componentsElement = (XmlElement)anl.get(0);
        component.setComponents(getComponentsWithXPP3(db, componentsElement, templateController, component));
      }
     
      components.put(name, component);
    }
   
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

  }
  */
 
  protected Map getComponentWithXPP3(Database db, XmlInfosetBuilder builder, XmlElement element, String componentName, TemplateController templateController, InfoGlueComponent parentComponent) throws Exception
  {
    InfoGlueComponent component = null;

    Locale locale = LanguageDeliveryController.getLanguageDeliveryController().getLocaleWithId(db, templateController.getLanguageId());

    Map components = new HashMap();
   
    String componentXPath = getComponentXPath(parentComponent) + "/components/component[@name='" + componentName + "']";
    //logger.info("componentXPath:" + componentXPath);
   
    Xb1XPath xpathObject = (Xb1XPath)cachedXPathObjects.get(componentXPath);
        if(xpathObject == null)
        {
          xpathObject = new Xb1XPath( componentXPath );
          cachedXPathObjects.put(componentXPath, xpathObject);
        }

        //This keeps track of the cached inherited components.
        StringBuilder sb = new StringBuilder();
       
        List componentNodeList = xpathObject.selectNodes( element );
    Iterator componentNodeListIterator = componentNodeList.iterator();
    while(componentNodeListIterator.hasNext())
    {
      XmlElement child   = (XmlElement)componentNodeListIterator.next();
     
      String componentString = builder.serializeToString(child).trim();
      sb.append(componentString);
      //System.out.println("AAAAAAAAA" + componentString);
     
      Integer id       = new Integer(child.getAttributeValue(child.getNamespaceName(), "id"));
      Integer contentId   = new Integer(child.getAttributeValue(child.getNamespaceName(), "contentId"));
      String name       = child.getAttributeValue(child.getNamespaceName(), "name");
      String isPagePartRef  = child.getAttributeValue(child.getNamespaceName(), "isPagePartReference");
 
      ContentVO contentVO = ContentDeliveryController.getContentDeliveryController().getContentVO(db, contentId, templateController.getDeliveryContext());
     
      component = new InfoGlueComponent();
      component.setId(id);
      component.setContentId(contentId);
      component.setName(contentVO.getName());
      //component.setName(name);
      component.setSlotName(name);
      component.setParentComponent(parentComponent);
      if(parentComponent != null)
        component.setIsInherited(parentComponent.getIsInherited());

      Xb1XPath xpathObject2 = (Xb1XPath)cachedXPathObjects.get("properties");
          if(xpathObject2 == null)
          {
            xpathObject2 = new Xb1XPath( "properties" );
            cachedXPathObjects.put("properties", xpathObject2);
          }

      List propertiesNodeList = xpathObject2.selectNodes(child);
      ////logger.info("propertiesNodeList:" + propertiesNodeList.getLength());
      if(propertiesNodeList.size() > 0)
      {
        XmlElement propertiesElement = (XmlElement)propertiesNodeList.get(0);

        Xb1XPath xpathObject3 = (Xb1XPath)cachedXPathObjects.get("property");
            if(xpathObject3 == null)
            {
              xpathObject3 = new Xb1XPath( "property" );
              cachedXPathObjects.put("property", xpathObject3);
            }

        List propertyNodeList = xpathObject3.selectNodes(propertiesElement);
        Iterator propertyNodeListIterator = propertyNodeList.iterator();
        while(propertyNodeListIterator.hasNext())
        {
          XmlElement propertyElement = (XmlElement)propertyNodeListIterator.next();
         
          String propertyName = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "name");
          String type = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "type");
          String path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path");

          if(path == null)
          {
            LanguageVO langaugeVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(getDatabase(), templateController.getSiteNodeId());
            if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + langaugeVO.getLanguageCode()) != null)
              path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + langaugeVO.getLanguageCode());
          }

          //logger.info("path:" + "path_" + locale.getLanguage() + ":" + propertyElement.attributeValue("path_" + locale.getLanguage()));
          if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + locale.getLanguage()) != null)
            path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + locale.getLanguage());
          //logger.info("path:" + path);

          if(path == null || path.equals(""))
          {
            logger.info("Falling back to content master language 2 for property:" + propertyName);
            LanguageVO contentMasterLangaugeVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(getDatabase(), contentVO.getRepositoryId());
            if(propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + contentMasterLangaugeVO.getLanguageCode()) != null)
              path = propertyElement.getAttributeValue(propertyElement.getNamespaceName(), "path_" + contentMasterLangaugeVO.getLanguageCode())
          }

          Map property = new HashMap();
          property.put("name", propertyName);
          property.put("path", path);
          property.put("type", type);
          property.put("isPagePartReference", (isPagePartRef == null ? "false" : isPagePartRef));
         
          Iterator attributesIterator = propertyElement.attributes();
          while(attributesIterator.hasNext())
          {
            XmlAttribute attribute = (XmlAttribute)attributesIterator.next();
            if(attribute.getName().startsWith("path_"))
              property.put(attribute.getName(), attribute.getValue());
          }
         
          if(path != null)
          {
            if(propertyName.equals(InfoGlueComponent.CACHE_RESULT_PROPERTYNAME) && (path.equalsIgnoreCase("true") || path.equalsIgnoreCase("yes")))
            {
              component.setCacheResult(true);
            }
            if(propertyName.equals(InfoGlueComponent.UPDATE_INTERVAL_PROPERTYNAME) && !path.equals(""))
            {
              try { component.setUpdateInterval(Integer.parseInt(path)); } catch (Exception e) { logger.warn("The component " + component.getName() + " " + InfoGlueComponent.UPDATE_INTERVAL_PROPERTYNAME + " with a faulty value on page " + this.getTemplateController().getOriginalFullURL() + ":" + e.getMessage()); }
            }
            if(propertyName.equals(InfoGlueComponent.CACHE_KEY_PROPERTYNAME) && !path.equals(""))
            {
              component.setCacheKey(path);
            }
            if(propertyName.equals(InfoGlueComponent.PREPROCESSING_ORDER_PROPERTYNAME) && !path.equals(""))
            {
              component.setPreProcessingOrder(path);
            }
          }
         
          List bindings = new ArrayList();

          Xb1XPath xpathObject4 = (Xb1XPath)cachedXPathObjects.get("binding");
              if(xpathObject4 == null)
              {
                xpathObject4 = new Xb1XPath( "binding" );
                cachedXPathObjects.put("binding", xpathObject4);
              }

          List bindingNodeList = xpathObject4.selectNodes(propertyElement);
          Iterator bindingNodeListIterator = bindingNodeList.iterator();
          while(bindingNodeListIterator.hasNext())
          {
            XmlElement bindingElement = (XmlElement)bindingNodeListIterator.next();
            String entity = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "entity");
            String entityId = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "entityId");
            String assetKey = bindingElement.getAttributeValue(bindingElement.getNamespaceName(), "assetKey");
            ////logger.info("Binding found:" + entity + ":" + entityId);
           
            ComponentBinding componentBinding = new ComponentBinding();
            //componentBinding.setId(new Integer(id));
            //componentBinding.setComponentId(componentId);
            componentBinding.setEntityClass(entity);
            componentBinding.setEntityId(new Integer(entityId));
            componentBinding.setAssetKey(assetKey);
            componentBinding.setBindingPath(path);
           
            bindings.add(componentBinding);
          }
 
          property.put("bindings", bindings);
         
          component.getProperties().put(propertyName, property);
        }
      }
     
      getComponentRestrictionsWithXPP3(child, component, locale, templateController);
     
      Xb1XPath xpathObject5 = (Xb1XPath)cachedXPathObjects.get("components");
          if(xpathObject5 == null)
          {
            xpathObject5 = new Xb1XPath( "components" );
            cachedXPathObjects.put("components", xpathObject5);
          }

      List anl = xpathObject5.selectNodes(child);
      if(anl.size() > 0)
      {
        XmlElement componentsElement = (XmlElement)anl.get(0);
        component.setComponents(getComponentsWithXPP3(db, componentsElement, templateController, component));
      }
     
      List componentList = new ArrayList();
      if(components.containsKey(name))
        componentList = (List)components.get(name);
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

          List subComponents = getInheritedComponents(templateController.getDatabase(), templateController, component, templateController.getSiteNodeId(), id, inherit);
          List<Integer> handledComponents = new ArrayList<Integer>();
          Iterator subComponentsIterator = subComponents.iterator();
          while(subComponentsIterator.hasNext())
          {
            InfoGlueComponent subComponent = (InfoGlueComponent)subComponentsIterator.next();
            if(handledComponents.contains(subComponent.getId()))
              continue;

            handledComponents.add(subComponent.getId());
           
            if(logger.isInfoEnabled())
              logger.info(component.getName() + " had subcomponent " + subComponent.getName() + ":" + subComponent.getId());
           
            String subComponentString = "";
            if(subComponent != null)
            {
              subComponentString = renderComponent(subComponent, templateController, repositoryId, siteNodeId, languageId, contentId, metainfoContentId, maxDepth, currentDepth + 1);
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

        List subComponents = getInheritedComponents(templateController.getDatabase(), templateController, component, templateController.getSiteNodeId(), id, inherit);
        Iterator subComponentsIterator = subComponents.iterator();
        while(subComponentsIterator.hasNext())
        {
          InfoGlueComponent subComponent = (InfoGlueComponent)subComponentsIterator.next();
          if(subComponent.getIsInherited())
          {
            String subComponentString = preProcessComponent(subComponent, templateController, repositoryId, siteNodeId, languageId, contentId, metainfoContentId, sortedPageComponents);
          }
        }
       
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

      if(slot.getId().equalsIgnoreCase(id))
      {
        Iterator subComponentIterator = slot.getComponents().iterator();
        while(subComponentIterator.hasNext())
        {
          InfoGlueComponent infoGlueComponent = (InfoGlueComponent)subComponentIterator.next();
          //logger.info("Adding not inherited component " + infoGlueComponent.getName() + " to list...");
          inheritedComponents.add(infoGlueComponent);
        }
      }
    }
   
    SiteNodeVO parentSiteNodeVO = nodeDeliveryController.getParentSiteNode(db, siteNodeId);
   
    boolean restrictAll = false;
    Iterator restrictionsIterator = component.getRestrictions().iterator();
    while(restrictionsIterator.hasNext())
    {
        ComponentRestriction restriction = (ComponentRestriction)restrictionsIterator.next();
        if(restriction.getType().equalsIgnoreCase("blockComponents"))
        {
            if(restriction.getSlotId().equalsIgnoreCase(id) && restriction.getArguments().equalsIgnoreCase("*"))
            {
                restrictAll = true;
            }
        }
    }
    while(inheritedComponents.size() == 0 && parentSiteNodeVO != null && inherit && !restrictAll)
    {
      //logger.info("INHERITING COMPONENTS");
      String componentXML = this.getPageComponentsString(db, templateController, parentSiteNodeVO.getId(), templateController.getLanguageId(), component.getContentId());
      //logger.info("componentXML:" + componentXML);
      //logger.info("id:" + id);
     
      String key = "" + parentSiteNodeVO.getId() + "_" + componentXML.hashCode();
      //String mapKey = "" + parentSiteNodeVO.getId() + "_" + componentXML.hashCode() + "_" + id + "_components"; //
      String mapKey = "" + parentSiteNodeVO.getId() + "_" + componentXML.hashCode() + "_" + id + "_"  + siteNodeId + "_" + component.getId() + "_components";
     
      Map components = (Map)CacheController.getCachedObjectFromAdvancedCache("componentPropertyCache", mapKey);
      if(components == null)
      {
        Timer t = new Timer();
       
        //DOM4j
        /*
        Document document = domBuilder.getDocument(componentXML);
        components = getComponentWithDOM4j(db, document.getRootElement(), id, templateController, component);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("INHERITING COMPONENTS WITH DOM4J", t.getElapsedTime());
        */
       
           //XPP3
            XmlInfosetBuilder builder = XmlInfosetBuilder.newInstance();
            XmlDocument doc = builder.parseReader(new StringReader( componentXML ) );
        components = getComponentWithXPP3(db, builder, doc.getDocumentElement(), id, templateController, component);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("INHERITING COMPONENTS WITH XPP3", t.getElapsedTime());
       
        //System.out.println("components:" + components);
        String hashCode = "" + components.get(id + "_hashCode");
        String path = "" + components.get(id + "_xpath");
        templateController.getDeliveryContext().addUsedContent("content_" + parentSiteNodeVO.getMetaInfoContentId() + "_ComponentStructureDependency");
        templateController.getDeliveryContext().addUsedContent("content_" + parentSiteNodeVO.getMetaInfoContentId() + "_ComponentStructure:" + path + "=" + hashCode);

        //logger.info("components:" + components);

        if(components != null)
          CacheController.cacheObjectInAdvancedCache("componentPropertyCache", mapKey, components, null, false);
      }
     
      //logger.info("components:" + components.size());
      //logger.info("id:" + id);
      if(components.containsKey(id))
      {
        inheritedComponents = (List)components.get(id);
        //logger.info("inheritedComponents:" + inheritedComponents);
        Iterator inheritedComponentIterator = inheritedComponents.iterator();
        while(inheritedComponentIterator.hasNext())
        {
          InfoGlueComponent infoGlueComponent = (InfoGlueComponent)inheritedComponentIterator.next();
            infoGlueComponent.setIsInherited(true);
        }
      }
           
      parentSiteNodeVO = nodeDeliveryController.getParentSiteNode(db, parentSiteNodeVO.getId());
    }
View Full Code Here

Examples of org.infoglue.deliver.applications.actions.InfoGlueComponent

  private String getComponentXPath(InfoGlueComponent infoGlueComponent)
  {     
      String path = "";
      String parentPath = "";
     
      InfoGlueComponent parentInfoGlueComponent = infoGlueComponent.getParentComponent();
      //logger.info("infoGlueComponent.getParentComponent():" + parentInfoGlueComponent);
      if(parentInfoGlueComponent != null && parentInfoGlueComponent.getId().intValue() != infoGlueComponent.getId().intValue())
      {
          //logger.info("Had parent component...:" + parentInfoGlueComponent.getId() + ":" + parentInfoGlueComponent.getName());
          parentPath = getComponentXPath(parentInfoGlueComponent);
          //logger.info("parentPath:" + parentPath);
      }
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.