Package org.infoglue.cms.entities.content

Examples of org.infoglue.cms.entities.content.Content


    return deploymentCompareBeans;
  }
 
  private static void getDeploymentComparisonBeansRecursive(File parentFile, List<DeploymentCompareBean> deploymentCompareBeans, final Content parentContent, Database db, InfoGluePrincipal principal, int cvsFakeContentId, boolean isWebContentLevel, boolean isRepositoryLevel, boolean isComponentLevel) throws Exception
  {
    Content localParentContent = parentContent;
   
    String fileContent = "";
    if(parentFile.isFile())
      fileContent = FileHelper.getFileAsString(parentFile, "iso-8859-1");
   
    RepositoryVO repositoryVO = null;

    if(parentContent != null)
      logger.info("\n\n****************************\nparentContent in top:" + parentContent.getName() + "= File:" + parentFile.getName());


    boolean newIsWebContentLevel = isWebContentLevel;
    boolean newIsRepositoryLevel = isRepositoryLevel;
    boolean newIsComponentLevel = isComponentLevel;
   
    LanguageVO masterLanguageVO = null;

    logger.info("isWebContentLevel:" + isWebContentLevel + "\n" + "isRepositoryLevel:" + isRepositoryLevel + "\n" + "isComponentLevel:" + isComponentLevel);
    if(!isWebContentLevel && parentFile.getName().equalsIgnoreCase("WebContent"))
    {
      logger.info("Reached WebContent... activating");
      newIsWebContentLevel = true;
    }
    else if(isWebContentLevel && !isRepositoryLevel)
    {
      logger.info("Reached Repository level... activating:" + parentFile.getName());
      logger.info("This was a repository:" + parentFile.getPath());
      repositoryVO = RepositoryController.getController().getRepositoryVOWithName(parentFile.getName(), db);
      if(repositoryVO != null)
      {
        localParentContent = ContentController.getContentController().getRootContent(db, repositoryVO.getId(), principal.getName(), false);
        masterLanguageVO = LanguageController.getController().getMasterLanguage(localParentContent.getRepositoryId(), db);
      }
     
      newIsRepositoryLevel = true;
    }
    else if(isWebContentLevel && isRepositoryLevel && !isComponentLevel)
    {
      logger.info("Reached component... activating");
      newIsComponentLevel = true;
    }

    if(isComponentLevel)
    {
      logger.info("This was a component content:" + parentFile.getName());
     
      if(localParentContent != null)
      {
        ContentVO cvsContent = new ContentVO();
        cvsContent.setContentId(cvsFakeContentId);
        cvsContent.setName(localParentContent.getName());
        cvsContent.setFullPath(parentFile.getPath());
       
        cvsContent.setVersions(new String[]{fileContent});

        ContentVersionVO localVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(localParentContent.getId(), masterLanguageVO.getId());

        ContentVO localContentVO = localParentContent.getValueObject();
        logger.info("localContentVO:" + localContentVO.getName());
       
        if(localVersion != null)
        {
          localContentVO.setVersions(new String[]{localVersion.getVersionValue()});
          logger.info("fileContent:" + fileContent.length());
          logger.info("localVersion.getVersionValue():" + localVersion.getVersionValue().length());
        }
       
        DeploymentCompareBean deploymentCompareBean = new DeploymentCompareBean();
        deploymentCompareBean.setRemoteVersion(cvsContent);
        deploymentCompareBean.setLocalVersion(localContentVO);
       
        logger.info("Adding:" + localContentVO.getName() + " = " + cvsContent.getName());
        deploymentCompareBeans.add(deploymentCompareBean);
      }
      else
      {
        logger.info("No local version of " + parentFile.getName());
        ContentVO cvsContent = new ContentVO();
        cvsContent.setContentId(cvsFakeContentId);
        cvsContent.setName(parentFile.getName());
        cvsContent.setFullPath(parentFile.getPath());
       
        cvsContent.setVersions(new String[]{fileContent});
       
        ContentVO localContent = new ContentVO();
       
        DeploymentCompareBean deploymentCompareBean = new DeploymentCompareBean();
        deploymentCompareBean.setRemoteVersion(cvsContent);
        deploymentCompareBean.setLocalVersion(null);
       
        logger.info("Adding:" + null + " = " + cvsContent.getName());
        deploymentCompareBeans.add(deploymentCompareBean);
      }
    }
   
    logger.info("Before children with:" + parentFile.getName() + ":" + newIsWebContentLevel + ":" + newIsRepositoryLevel + ":" + newIsComponentLevel);

    logger.info("Now going through children files to:" + parentFile.getName());
    File[] childFiles = parentFile.listFiles();
    if(childFiles != null)
    {
      for(int i=0; i<childFiles.length; i++)
      {
        File childFile = childFiles[i];
        if(!childFile.getName().equals("CVS"))
        {
          logger.info("childFile:" + childFile.getName());
          Content newParentContent = null;
          if(localParentContent != null)
          {
            List childContents = ContentController.getContentController().getContentChildrenVOList(localParentContent.getId(), new String[]{"HTMLTemplate"});
            logger.info("Looking for children on " + localParentContent.getName() + " - matching " + childFile.getName());
            Iterator childContentsIterator = childContents.iterator();
            while(childContentsIterator.hasNext())
            {
              Content childContent = (Content)childContentsIterator.next();
              logger.info("childContent " + childContent.getName());
             
              if(childFile.getName().equalsIgnoreCase(childContent.getName()) || childFile.getName().equalsIgnoreCase(childContent.getName() + "_" + masterLanguageVO.getId() + ".xml"))
              {
                logger.info("Match " + childContent.getName() + "=" + childFile.getName());
                newParentContent = childContent;
                //getDeploymentComparisonBeansRecursive(childFile, deploymentCompareBeans, childContent, db, principal, cvsFakeContentId+1);

                break;
              }
View Full Code Here


          RegistryVO registryVO = (RegistryVO)i.next();
          if(registryVO.getEntityName().indexOf("Content") > -1)
              {
                  try
                  {
                      Content content = ContentController.getContentController().getContentWithId(new Integer(registryVO.getEntityId()), db);
              logger.info("contentVersion:" + content.getContentId());
              result.add(content.getValueObject());
                  }
                  catch(Exception e)
                  {
                      logger.info("content:" + registryVO.getEntityId() + " did not exist - skipping..");
                  }
View Full Code Here

      if(accessRights > 0)
      {
        if(interceptionPointCategory.equalsIgnoreCase("Content"))
        { 
          Integer contentId = new Integer(parameters);
          Content content = ContentControllerProxy.getController().getContentWithId(contentId, db);
          if(!content.getIsProtected().equals(ContentVO.YES))
            content.setIsProtected(ContentVO.YES);
        }
        else if(interceptionPointCategory.equalsIgnoreCase("SiteNodeVersion"))
        { 
          Integer siteNodeVersionId = new Integer(parameters);
          SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
          if(logger.isDebugEnabled())
            logger.debug("It was a siteNodeVersion and there are access rights - set it to true:" + accessRights);
          if(!siteNodeVersion.getIsProtected().equals(SiteNodeVersionVO.YES) && !siteNodeVersion.getIsProtected().equals(SiteNodeVersionVO.YES_WITH_INHERIT_FALLBACK))
            siteNodeVersion.setIsProtected(SiteNodeVersionVO.YES);
        }
      }
      else
      {
        List accessRightsUsers = getAccessRightsUsers(interceptionPointCategory, parameters, db, true);
        if(logger.isDebugEnabled())
          logger.debug("accessRightsUsers:" + accessRightsUsers.size());
        if(accessRightsUsers == null || accessRightsUsers.size() == 0)
        {
          if(interceptionPointCategory.equalsIgnoreCase("Content"))
          { 
            Integer contentId = new Integer(parameters);
            Content content = ContentControllerProxy.getController().getContentWithId(contentId, db);
            if(content.getIsProtected().equals(ContentVO.YES))
              content.setIsProtected(ContentVO.NO);
          }
          else if(interceptionPointCategory.equalsIgnoreCase("SiteNodeVersion"))
          { 
            Integer siteNodeVersionId = new Integer(parameters);
            SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
View Full Code Here

      }

      if(interceptionPointCategory.equalsIgnoreCase("Content"))
      {
        Integer contentId = new Integer(parameters);
        Content content = ContentControllerProxy.getController().getContentWithId(contentId, db);
        if(!content.getIsProtected().equals(ContentVO.YES))
          content.setIsProtected(ContentVO.YES);
      }
      else if(interceptionPointCategory.equalsIgnoreCase("SiteNodeVersion"))
      {
        Integer siteNodeVersionId = new Integer(parameters);
        SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
View Full Code Here

        if((accessRightsRoles == null || accessRightsRoles.size() == 0) && (accessRightsGroups == null || accessRightsGroups.size() == 0))
        {
          if(interceptionPointCategory.equalsIgnoreCase("Content"))
          { 
            Integer contentId = new Integer(parameters);
            Content content = ContentControllerProxy.getController().getContentWithId(contentId, db);
            if(content.getIsProtected().equals(ContentVO.YES))
              content.setIsProtected(ContentVO.NO);
          }
          else if(interceptionPointCategory.equalsIgnoreCase("SiteNodeVersion"))
          { 
            Integer siteNodeVersionId = new Integer(parameters);
            SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
View Full Code Here

            {
              if(parentContentId != null)
              {
                StringBuffer path = new StringBuffer();
               
                Content parentContent = ContentController.getContentController().getContentWithId(parentContentId, db);
                path.insert(0, parentContent.getName() + "/");
                while(parentContent.getParentContent() != null)
                {
                  parentContent = parentContent.getParentContent();
                  if(parentContent != null && parentContent.getParentContent() != null)
                    path.insert(0, parentContent.getName() + "/");
                }

                contentPath = path.toString() + contentPath;
              }
             
View Full Code Here

                SiteNode newSiteNode = siteNodeControllerProxy.acCreate(this.principal, siteNodeVO.getParentSiteNodeId(), siteNodeVO.getSiteNodeTypeDefinitionId(), siteNodeVO.getRepositoryId(), siteNodeVO, db);
                SiteNodeVO newSiteNodeVO = newSiteNode.getValueObject();
                if(newSiteNode != null)
                  statusBean.getCreatedBeans().add(new CreatedEntityBean(SiteNodeVO.class.getName(), new Long(newSiteNodeVO.getId())));
               
                Content newMetaInfoContent = SiteNodeController.getController().createSiteNodeMetaInfoContent(db, newSiteNodeVO, siteNodeVO.getRepositoryId(), this.principal, pageTemplateContentId, new ArrayList());
                if(newMetaInfoContent != null)
                  statusBean.getCreatedBeans().add(new CreatedEntityBean(ContentVO.class.getName(), new Long(newMetaInfoContent.getId())));
                 
                //Should we also change state on newly created content version?
                /*
                if(stateId != null && !stateId.equals(ContentVersionVO.WORKING_STATE))
                {
View Full Code Here

      for(int i=0; i<repositories.length; i++)
      {
        Integer repositoryId = new Integer(repositories[i]);
        Repository repository   = RepositoryController.getController().getRepositoryWithId(repositoryId, db);
        SiteNode siteNode     = SiteNodeController.getController().getRootSiteNode(repositoryId, db);
        Content content     = ContentController.getContentController().getRootContent(repositoryId, db);
       
          InterceptionPointVO interceptionPointVO = InterceptionPointController.getController().getInterceptionPointVOWithName("Repository.Read", db);
          if(interceptionPointVO != null)
            allAccessRights.addAll(AccessRightController.getController().getAccessRightListOnlyReadOnly(interceptionPointVO.getId(), repository.getId().toString(), db));
View Full Code Here

        allAccessRights.addAll(AccessRightController.getController().getAccessRightListOnlyReadOnly(interceptionPointVO.getId(), content.getId().toString(), db));
       
        Iterator childContents = content.getChildren().iterator();
        while(childContents.hasNext())
        {
          Content childContent = (Content)childContents.next();
          getContentPropertiesAndAccessRights(ps, allContentProperties, allAccessRights, childContent, db);
        }
  }
View Full Code Here

        allContentProperties.put("content_" + content.getId() + "_initialLanguageId", "" + ps.getString("content_" + content.getId() + "_initialLanguageId"));

        Iterator childContents = content.getChildren().iterator();
        while(childContents.hasNext())
        {
          Content childContent = (Content)childContents.next();
          getContentPropertiesAndAccessRights(ps, allContentProperties, allAccessRights, keys, childContent, db);
        }
  }
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.Content

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.