Package org.infoglue.cms.entities.content

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


            logger.info("missingRemoteComponents:" + missingRemoteComponents);
                   
      Iterator missingRemoteComponentsIterator = missingRemoteComponents.iterator();
      while(missingRemoteComponentsIterator.hasNext())
      {
        ContentVO missingRemoteContentVO = (ContentVO)missingRemoteComponentsIterator.next();
        if(missingRemoteContentVO != null)
          missingRemoteContentVO.setIsBranch(Boolean.FALSE);
       
        logger.info("missingRemoteContentVO:" + missingRemoteContentVO + ":" + missingRemoteContentVO.getFullPath());
        String fullPath = missingRemoteContentVO.getFullPath();
        logger.info("fullPath:" + fullPath);
        int siteNodeEnd = fullPath.indexOf(" - /");
        String repositoryString = fullPath.substring(0, siteNodeEnd);
        String restString = fullPath.substring(siteNodeEnd + 4);
        restString = restString.substring(0, restString.lastIndexOf("/"));
       
        if(restString.indexOf("/") > -1)
            restString = restString.substring(restString.indexOf("/") + 1);
        else
          restString = "";
       
        logger.info("repositoryString:" + repositoryString);
        logger.info("restString:" + restString);
        try
        {
          RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithName(repositoryString);
          logger.info("repositoryVO:" + repositoryVO);
         
          if(repositoryVO == null && components != null && components.size() > 0)
          {
            ContentVO contentVO = (ContentVO)components.get(0);
            repositoryVO = RepositoryController.getController().getRepositoryVOWithId(contentVO.getRepositoryId());
            logger.info("repositoryVO:" + repositoryVO);
          }
         
          if(repositoryVO != null)
          {
            LanguageVO languageVO = LanguageController.getController().getMasterLanguage(repositoryVO.getRepositoryId());
 
            ContentVO parentContent = ContentController.getContentController().getContentVOWithPath(repositoryVO.getId(), restString, true, principal);
            logger.info("parentContent:" + parentContent);
            ContentVO newContentVO = ContentController.getContentController().create(parentContent.getId(), contentTypeDefinitionVO.getContentTypeDefinitionId(), parentContent.getRepositoryId(), missingRemoteContentVO);
            logger.info("Now we want to create the version also on:" + newContentVO.getName());
            ContentVersionVO contentVersionVO = new ContentVersionVO();
            contentVersionVO.setVersionComment("deployment");
            contentVersionVO.setVersionModifier(principal.getName());
            logger.info("missingRemoteContentVO.getVersions():" + missingRemoteContentVO.getVersions());
            if(missingRemoteContentVO.getVersions() != null && missingRemoteContentVO.getVersions().length > 0)
            {
              contentVersionVO.setVersionValue(missingRemoteContentVO.getVersions()[0]);
              logger.info("Creating version on content: " + newContentVO.getId() + " in language: " + languageVO.getId());
              ContentVersionController.getContentVersionController().create(newContentVO.getId(), languageVO.getId(), contentVersionVO, null);
            }
          }
         
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
     
      //Getting ready to handle deviating ones
        List remoteComponents = (List)arguments.get("deviatingComponents");
            logger.info("remoteComponents:" + remoteComponents);
                   
      Iterator remoteComponentsIterator = remoteComponents.iterator();
      while(remoteComponentsIterator.hasNext())
      {
        ContentVO remoteContentVO = (ContentVO)remoteComponentsIterator.next();
        logger.info("remoteContentVO:" + remoteContentVO + ":" + remoteContentVO.getFullPath());

        if(remoteContentVO.getFullPath() != null && remoteContentVO.getFullPath().startsWith("deviatingRemoteVersionId="))
        {
          String remoteVersionId = remoteContentVO.getFullPath().substring(remoteContentVO.getFullPath().indexOf("=") + 1);
          logger.info("Looking for version in remoteVersionId:" + remoteVersionId);
         
            ContentVO contentVO = ContentControllerProxy.getController().getACContentVOWithId(principal, new Integer(remoteVersionId));
          LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
          ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
          if(contentVersionVO != null)
          {
            if(remoteContentVO.getVersions() != null && remoteContentVO.getVersions().length > 0)
            {
              if(!contentVersionVO.getStateId().equals(0))
              {
                contentVersionVO = ContentStateController.changeState(contentVersionVO.getId(), ContentVersionVO.WORKING_STATE, "new working version: " + contentVersionVO.getVersionComment(), false, principal, contentVO.getId(), new ArrayList());
              }
             
              contentVersionVO.setVersionValue(remoteContentVO.getVersions()[0]);
              logger.info("Updating :" + contentVersionVO.getContentName() + " with new latest versionValue:" + remoteContentVO.getVersions()[0].length());
              contentVersionVO.setStateId(0);
              if(remoteContentVO.getVersionComments().length > 0)
                contentVersionVO.setVersionComment(remoteContentVO.getVersionComments()[0]);
             
              ContentVersionController.getContentVersionController().update(contentVersionVO.getId(), contentVersionVO);               
            }
          }
        }
        else
        {
          Iterator componentsIterator = components.iterator();
            while(componentsIterator.hasNext())
            {
              ContentVO contentVO = (ContentVO)componentsIterator.next();
              String fullPath = ContentController.getContentController().getContentPath(contentVO.getId(), true, true);         
              logger.info("fullPath:" + fullPath);
              if(fullPath.equalsIgnoreCase(remoteContentVO.getFullPath()))
              {
              LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
              ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
              if(contentVersionVO != null)
              {
                if(remoteContentVO.getVersions() != null && remoteContentVO.getVersions().length > 0)
                {
                  if(!contentVersionVO.getStateId().equals(0))
                  {
                    contentVersionVO = ContentStateController.changeState(contentVersionVO.getId(), ContentVersionVO.WORKING_STATE, "new working version: " + contentVersionVO.getVersionComment(), false, principal, contentVO.getId(), new ArrayList());
                  }

                  contentVersionVO.setVersionValue(remoteContentVO.getVersions()[0]);
                  logger.info("Updating :" + contentVersionVO.getContentName() + " with new latest versionValue:" + remoteContentVO.getVersions()[0].length());
                  contentVersionVO.setStateId(0);
View Full Code Here


               
      contentVOList = contentControllerProxy.getContentVOWithContentTypeDefinition("HTMLTemplate");
      Iterator contentVOListIterator = contentVOList.iterator();
      while(contentVOListIterator.hasNext())
      {
        ContentVO contentVO = (ContentVO)contentVOListIterator.next();
       
        LanguageVO languageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
       
        String fullPath = ContentController.getContentController().getContentPath(contentVO.getId(), true, true);
       
        ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageVO.getId());
        if(contentVersionVO != null)
        {
          contentVO.setContentVersion(contentVersionVO);
          contentVO.setVersions(new String[]{contentVersionVO.getVersionValue()});
        }
        else
        {
          contentVOListIterator.remove();
        }
       
        //logger.info("Versions on remote:" + contentVO.getContentVersion());
        contentVO.setFullPath(fullPath);
      }
        }
        catch(Throwable t)
        {
            logger.error("En error occurred when we tried to get the contents:" + t.getMessage(), t);
View Full Code Here

    this.sortOrder = sortOrder;
  }

    public int compare(Object o1, Object o2)
  {   
    ContentVO contentVO1 = (ContentVO)o1;
    ContentVO contentVO2 = (ContentVO)o2;

    ContentVersionVO contentVersionVO1 = contentVO1.getContentVersion();
    ContentVersionVO contentVersionVO2 = contentVO2.getContentVersion();

    int result = 0;

    if(contentVersionVO1 != null && contentVersionVO2 != null)
    {
View Full Code Here

   
    List upcomingContents = ContentController.getContentController().getUpcomingExpiringContents(numberOfDays);
    Iterator<ContentVO> upcomingContentIterator = upcomingContents.iterator();
    while(upcomingContentIterator.hasNext())
    {
      ContentVO contentVO = upcomingContentIterator.next();
      logger.info("contentVO:" + contentVO.getName() + " - " + contentVO.getExpireDateTime());
      String key = "content_" + contentVO.getId() + "_" + numberOfDays + "_days_isProcessed";
      logger.info("key:" + key);
      String dateProcessed = ps.getString(key);
        if(dateProcessed == null || dateProcessed.equals(""))
        {
          logger.info("The node " + contentVO.getName() + " has not been processed.");
         
          Map data = new HashMap();
          data.put("contentVO", contentVO);
         
          intercept(data, "Content.ExpireDateComingUp");
View Full Code Here

 
  public String doInput() throws Exception
  {
    if(this.contentId != null)
    {
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
        this.repositoryId = contentVO.getRepositoryId();
       
      AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
   
      Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
      if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString()))
View Full Code Here

    try
    {
      if(this.contentId != null)
      {
          ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
          this.repositoryId = contentVO.getRepositoryId();
         
        AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
     
        Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
        if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString()))
View Full Code Here

           
        EventVO eventVO = new EventVO();
        eventVO.setDescription(this.versionComment);
        eventVO.setEntityClass(ContentVersion.class.getName());
        eventVO.setEntityId(contentVersionVO.getContentVersionId());
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersionVO.getContentId());
        eventVO.setName(contentVO.getName() + "(" + contentVersionVO.getLanguageId() + ")");
        eventVO.setTypeId(EventVO.UNPUBLISH_LATEST);
        eventVO = EventController.create(eventVO, this.repositoryId, this.getInfoGluePrincipal(), db);
        events.add(eventVO);
         
        if(events.size() % 10 == 0)
View Full Code Here

          SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(subscriptionVO.getEntityId()));
          sb.append(getLocalizedString(getLocale(), "tool.common.detailedSubscriptions.onPageLabel") + " <strong>" + siteNodeVO.getName() + "</strong> ");
        }
        if(subscriptionVO.getEntityName().equalsIgnoreCase(Content.class.getName()))
        {
          ContentVO contentVO = ContentController.getContentController().getContentVOWithId(new Integer(subscriptionVO.getEntityId()));
          sb.append(getLocalizedString(getLocale(), "tool.common.detailedSubscriptions.onContentLabel") + " <strong>" + contentVO.getName() + "</strong> ");
        }
       
        InterceptionPointVO interceptionPointVO = InterceptionPointController.getController().getInterceptionPointVOWithId(subscriptionVO.getInterceptionPointId());
        sb.append(getLocalizedString(getLocale(), "tool.common.detailedSubscriptions.subscribedToEventLabel") + " <strong>" + interceptionPointVO.getName().replaceAll(".*?\\.", "") + "</strong>");
      }
View Full Code Here

    this.userSessionKey = userSessionKey;
  }

  public DeleteContentAction()
  {
    this(new ContentVO());
  }
View Full Code Here

    if(this.userSessionKey == null)
      userSessionKey = "" + System.currentTimeMillis();

        try
        {
          ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentVO.getContentId());
          if(ContentController.getContentController().hasPublishedVersion(this.contentVO.getContentId()))
          {
            throw new ConstraintException("ContentVersion.stateId", "3300", contentVO.getName());
          }
         
          String contentName = contentVO.getName();
          parentContentId = new Integer(contentVO.getId());
         
          result = executeAction(forceDelete);
          //result = doExecute();
           
        String deleteContentInlineOperationDoneHeader = getLocalizedString(getLocale(), "tool.contenttool.deleteContentInlineOperationDoneHeader", contentName);
View Full Code Here

TOP

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

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.