Package org.infoglue.cms.applications.databeans

Examples of org.infoglue.cms.applications.databeans.ComponentPropertyDefinition


  {
    List componentPropertyDefinitions = ComponentPropertyDefinitionController.getController().getComponentPropertyDefinitions(db, componentContentId, masterLanguageId);
    Iterator componentPropertyDefinitionsIterator = componentPropertyDefinitions.iterator();
    while(componentPropertyDefinitionsIterator.hasNext())
    {
      ComponentPropertyDefinition componentPropertyDefinition = (ComponentPropertyDefinition)componentPropertyDefinitionsIterator.next();
      logger.info("componentPropertyDefinition:" + componentPropertyDefinition);
      if(componentPropertyDefinition.getAutoCreateContent())
      {
        logger.info("componentPropertyDefinition vill ha en auto create:" + componentPropertyDefinition);
        String method = componentPropertyDefinition.getAutoCreateContentMethod();
        String path = componentPropertyDefinition.getAutoCreateContentPath();
        String allowedContentTypeNames = componentPropertyDefinition.getAllowedContentTypeNames();
        String allowedContentTypeName = allowedContentTypeNames.split(",")[0];
        ContentTypeDefinitionVO createContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(allowedContentTypeName, db);
        logger.info("method:" + method);
        logger.info("path:" + path);
        logger.info("createContentTypeDefinitionVO:" + createContentTypeDefinitionVO);
       
        if(createContentTypeDefinitionVO == null || method == null)
          continue;
         
        if(path.indexOf("/") == 0)
          path = path.substring(1);
       
        SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
        ContentVO parentContentVO = ContentController.getContentController().getRootContent(db, siteNodeVO.getRepositoryId(), principal.getName(), true).getValueObject();
        if(method.equals("siteStructure"))
        {
          String siteNodePath = SiteNodeController.getController().getSiteNodePath(siteNodeVO.getId(), db);
          logger.info("siteNodePath:" + siteNodePath);
          parentContentVO = ContentController.getContentController().getContentVOWithPath(siteNodeVO.getRepositoryId(), path + siteNodePath, true, principal, db);
        }
        else if(method.equals("fixedPath"))
        {
          parentContentVO = ContentController.getContentController().getContentVOWithPath(siteNodeVO.getRepositoryId(), path, true, principal, db);
        }
       
        ContentVO autoContentVO = new ContentVO();
        autoContentVO.setName(siteNodeVO.getName() + " - " + componentPropertyDefinition.getName());
        autoContentVO.setCreatorName(principal.getName());
        autoContentVO.setIsBranch(false);

        StringBuffer sb = new StringBuffer();
        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><article xmlns=\"x-schema:ArticleSchema.xml\"><attributes>");
        List contentTypeAttributes = ContentTypeDefinitionController.getController().getContentTypeAttributes(createContentTypeDefinitionVO, true);
        Iterator contentTypeAttributesIterator = contentTypeAttributes.iterator();
        while(contentTypeAttributesIterator.hasNext())
        {
          ContentTypeAttribute contentTypeAttribute = (ContentTypeAttribute)contentTypeAttributesIterator.next();
          String initialValue = null;
          if(contentTypeAttribute.getContentTypeAttribute("initialData") != null && contentTypeAttribute.getContentTypeAttribute("initialData").getContentTypeAttributeParameterValue() != null)
          {
            initialValue = contentTypeAttribute.getContentTypeAttribute("initialData").getContentTypeAttributeParameterValue().getValue("label");
          }
         
          boolean skip = false;
          if(contentTypeAttribute.getContentTypeAttribute("enableRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(!skip)
          {
            if(initialValue == null || initialValue.trim().equals(""))
              initialValue = "State " + contentTypeAttribute.getName();
            sb.append("<" + contentTypeAttribute.getName() + "><![CDATA[" + initialValue + "]]></" + contentTypeAttribute.getName() + ">");
          }
          else
            logger.info("Skipping:" + contentTypeAttribute.getName());
        }
        sb.append("</attributes></article>");
       
        String defaultValue = sb.toString();

        ContentVersionVO autoContentVersionVO = new ContentVersionVO();
        autoContentVersionVO.setVersionComment("Automatically created");
        autoContentVersionVO.setVersionModifier(principal.getName());
        autoContentVersionVO.setVersionValue(defaultValue);
       
        autoContentVO = ContentController.getContentController().create(db, parentContentVO.getId(), createContentTypeDefinitionVO.getId(), siteNodeVO.getRepositoryId(), autoContentVO).getValueObject();
        ContentVersionController.getContentVersionController().create(autoContentVO.getId(), languageId, autoContentVersionVO, null, db);
       
        Locale locale = LanguageController.getController().getLocaleWithId(languageId, db);
        LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(siteNodeVO.getRepositoryId(), db);   

        String entity = "Content";
        Integer entityId  = new Integer(autoContentVO.getId());
        String propertyName = "" + componentPropertyDefinition.getName();
       
        ComponentController.getController().addComponentPropertyBinding(document, locale, siteNodeId, languageId, masterLanguageVO.getId(), entity, entityId, propertyName, newComponentId, path, assetKey, principal);
      }
    }
  }
View Full Code Here


            List componentPropertiesList = ComponentPropertyDefinitionController.getController().parseComponentPropertyDefinitions(componentProperties);
            Iterator componentPropertiesListIterator = componentPropertiesList.iterator();
            boolean allowLanguageVariations = true;
            while(componentPropertiesListIterator.hasNext())
            {
              ComponentPropertyDefinition componentPropertyDefinition = (ComponentPropertyDefinition)componentPropertiesListIterator.next();
              if(componentPropertyDefinition.getName().equalsIgnoreCase(propertyName))
              {
                allowLanguageVariations = componentPropertyDefinition.getAllowLanguageVariations();
                break;
              }
            }
           
            if(allowLanguageVariations)
View Full Code Here

            List componentPropertiesList = ComponentPropertyDefinitionController.getController().parseComponentPropertyDefinitions(componentProperties);
            Iterator componentPropertiesListIterator = componentPropertiesList.iterator();
            boolean allowLanguageVariations = true;
            while(componentPropertiesListIterator.hasNext())
            {
              ComponentPropertyDefinition componentPropertyDefinition = (ComponentPropertyDefinition)componentPropertiesListIterator.next();
              if(componentPropertyDefinition.getName().equalsIgnoreCase(propertyName))
              {
                allowLanguageVariations = componentPropertyDefinition.getAllowLanguageVariations();
                break;
              }
            }
           
            if(allowLanguageVariations)
View Full Code Here

            String supplementingEntityType  = propertyElement.getAttribute("supplementingEntityType");
            String externalBindingConfig  = propertyElement.getAttribute("externalBindingConfig");
            if(allowLanguageVariations == null || allowLanguageVariations.equals(""))
              allowLanguageVariations = "true";
             
            ComponentPropertyDefinition cpd = new ComponentPropertyDefinition(name, displayName, type, entity, new Boolean(multiple), new Boolean(assetBinding), assetMask, new Boolean(isPuffContentForPage), allowedContentTypeNames, description, defaultValue, new Boolean(allowLanguageVariations), new Boolean(WYSIWYGEnabled), WYSIWYGToolbar, dataProvider, dataProviderParameters, new Boolean(autoCreateContent), autoCreateContentMethod, autoCreateContentPath, customMarkup, new Boolean(allowMultipleSelections), supplementingEntityType, externalBindingConfig);
           
          NodeList optionsNodeList = propertyElement.getElementsByTagName("option");
          for(int k=0; k<optionsNodeList.getLength(); k++)
          {
              Node optionNode = optionsNodeList.item(k);
              Element optionElement = (Element)optionNode;
             
              String optionName   = optionElement.getAttribute("name");
              String optionValue   = optionElement.getAttribute("value");
                         
              ComponentPropertyOptionDefinition cpod = new ComponentPropertyOptionDefinition(optionName, optionValue);
             
              cpd.getOptions().add(cpod);
          }

         
            componentPropertyDefinitions.add(cpd);
        }
View Full Code Here

      logger.info("property:" + property);
    if(property != null)
    { 
      try
      {
        ComponentPropertyDefinition propertyDefinition = null;
        if(property.get("componentContentId") != null)
          propertyDefinition = getComponentPropertyDefinition(new Integer((String)property.get("componentContentId")), propertyName, templateController.getSiteNodeId(), templateController.getLanguageId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        else
          propertyDefinition = getComponentPropertyDefinition(this.infoGlueComponent.getContentId(), propertyName, templateController.getSiteNodeId(), templateController.getLanguageId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
       
        if(propertyDefinition != null)
          {
          boolean languageVariationAllowed = propertyDefinition.getAllowLanguageVariations();
          if(languageVariationAllowed)
          {
            propertyValue = (String)property.get("path_" + this.templateController.getLocale().getLanguage());
            if((propertyValue == null || propertyValue.equals("")) && useLanguageFallback)
              propertyValue = (String)property.get("path");
          }
          else
          {
            propertyValue = (String)property.get("path_" + this.templateController.getLocale().getLanguage());
            if(propertyValue == null)
              propertyValue = (String)property.get("path");
          }
          }
        else
        {
          propertyValue = (String)property.get("path_" + this.templateController.getLocale().getLanguage());
          if((propertyValue == null || propertyValue.equals("")) && useLanguageFallback)
            propertyValue = (String)property.get("path");
        }
      }
      catch (Exception e)
      {
        logger.error("Infoglue reported a problem reading component property values: " + e.getMessage());
        logger.warn("Infoglue reported a problem reading component property values: " + e.getMessage(), e);
      }
    }
   
    if(propertyValue == null || propertyValue.equals(""))
    {
      try
      {
        ContentVO contentVO = templateController.getContent(this.infoGlueComponent.getContentId());
        LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(templateController.getDatabase(), contentVO.getRepositoryId());
 
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(this.infoGlueComponent.getContentId(), propertyName, templateController.getSiteNodeId(), masterLanguage.getId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null && propertyDefinition.getDefaultValue() != null)
          propertyValue = propertyDefinition.getDefaultValue();
      }
      catch (Exception e)
      {
        logger.error("Error getting propertyValue on " + propertyName + ":" + e.getMessage());
        logger.warn("Error getting propertyValue on " + propertyName + ":" + e.getMessage(), e);
View Full Code Here

      try
      {
        ContentVO contentVO = templateController.getContent(component.getContentId());
        LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(templateController.getDatabase(), contentVO.getRepositoryId());
 
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(component.getContentId(), propertyName, templateController.getSiteNodeId(), masterLanguage.getId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null && propertyDefinition.getDefaultValue() != null)
          propertyValue = propertyDefinition.getDefaultValue();
      }
      catch (Exception e)
      {
        logger.error("Error getting propertyValue on " + propertyName + ":" + e.getMessage(), e);
      }
View Full Code Here

      try
      {
        ContentVO contentVO = templateController.getContent(this.infoGlueComponent.getContentId());
        LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(templateController.getDatabase(), contentVO.getRepositoryId());
 
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(this.infoGlueComponent.getContentId(), propertyName, templateController.getSiteNodeId(), masterLanguage.getId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null && propertyDefinition.getDefaultValue() != null)
          propertyValue = propertyDefinition.getDefaultValue();
      }
      catch (Exception e)
      {
        logger.error("Error getting propertyValue on " + propertyName + ":" + e.getMessage(), e);
      }
View Full Code Here

      try
      {
        ContentVO contentVO = templateController.getContent(component.getContentId());
        LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(templateController.getDatabase(), contentVO.getRepositoryId());
 
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(component.getContentId(), propertyName, templateController.getSiteNodeId(), masterLanguage.getId(), templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null && propertyDefinition.getDefaultValue() != null)
          propertyValue = propertyDefinition.getDefaultValue();
      }
      catch (Exception e)
      {
        logger.error("Error getting propertyValue on " + propertyName + ":" + e.getMessage(), e);
      }
View Full Code Here

     
      value = path;
     
      if(value == null)
      {
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(new Integer(componentContentId), name, siteNodeId, languageId, contentId, templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null)
          value = propertyDefinition.getDefaultValue();
      }
    }

    if(value != null)
      value = value.replaceAll("igbr", separator);
View Full Code Here

     
      value = path;
     
      if(value == null)
      {
        ComponentPropertyDefinition propertyDefinition = getComponentPropertyDefinition(new Integer(componentContentId), name, templateController.getSiteNodeId(), languageId, templateController.getContentId(), templateController.getDatabase(), templateController.getPrincipal());
        if(propertyDefinition != null)
          value = propertyDefinition.getDefaultValue();
      }
    }

    if(value != null)
      value = value.replaceAll("igbr", separator);
View Full Code Here

TOP

Related Classes of org.infoglue.cms.applications.databeans.ComponentPropertyDefinition

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.