Package org.infoglue.cms.entities.content.impl.simple

Examples of org.infoglue.cms.entities.content.impl.simple.MediumContentImpl


   * As castor is lousy at this in my opinion we also add the new entity to the surrounding entities.
   */
     
    public /*synchronized*/ MediumContentImpl create(Database db, Integer parentContentId, Integer contentTypeDefinitionId, Integer repositoryId, ContentVO contentVO) throws ConstraintException, SystemException, Exception
    {
      MediumContentImpl content = null;
   
        try
        {           
            ContentVO parentContentVO = null;

            if(parentContentId != null)
            {
              parentContentVO = getContentVOWithId(parentContentId, db);
             
              if(repositoryId == null)
          repositoryId = parentContentVO.getRepositoryId()
             
              if(parentContentVO.getIsBranch() == false)
              {
                Content parentContent = getMediumContentWithId(parentContentVO.getId(), db);
                parentContent.setIsBranch(new Boolean(true));
              }
            }
           
            //RepositoryVO repository = RepositoryController.getController().getRepositoryVOWithId(repositoryId, db);

      /*
          synchronized (controller)
      {
            //db.lock(parentContent);
      */
              content = new MediumContentImpl();
              content.setValueObject(contentVO);
              content.setParentContentId(parentContentId);
              content.setRepositoryId(repositoryId);
              content.setContentTypeDefinitionId(contentTypeDefinitionId);
             
        db.create(content);
       
        //Now we add the content to the knowledge of the related entities.
        /*
 
View Full Code Here


        oql.bind(0);

        QueryResults results = oql.execute(Database.READONLY);
        while(results.hasMore())
        {
          MediumContentImpl content = (MediumContentImpl)results.next();
          contents.add(content.getValueObject());
        }
        results.close();
        oql.close();
      }
      commitTransaction(db);
View Full Code Here

     
      QueryResults results = oql.execute(Database.READONLY);
   
    while(results.hasMore())
        {
          MediumContentImpl content = (MediumContentImpl)results.next();
      contents.add(content);
        }

    results.close();
    oql.close();
View Full Code Here

        clearCache(ContentImpl.class);

        //CacheController.clearCache("childContentCache");
        try
        {
          MediumContentImpl content = (MediumContentImpl)object;
          CacheController.clearCacheForGroup("contentCache", "content_" + content.getId());
          CacheController.clearCacheForGroup("contentVersionCache", "content_" + content.getId());
          CacheController.clearCache("childContentCache");
          if(content.getParentContentId() == null)
            CacheController.clearCache("rootContentCache", "root_" + content.getRepositoryId());
        }
        catch (Exception e)
        {
          logger.warn("Error in JDOCallback:" + e.getMessage(), e);
        }
View Full Code Here

      }
      else if(object.getClass().getName().equals(MediumContentImpl.class.getName()))
      {
        try
        {
          MediumContentImpl content = (MediumContentImpl)object;
          CacheController.clearCacheForGroup("childContentCache", "content_" + content.getId());
          if(content.getValueObject().getParentContentId() != null)
          {
            CacheController.clearCacheForGroup("childContentCache", "content_" + content.getValueObject().getParentContentId());
            ContentVO parentContentVO = ContentController.getContentController().getContentVOWithId(content.getValueObject().getParentContentId(), false);
            if(parentContentVO.getParentContentId() != null)
            {
              CacheController.clearCacheForGroup("childContentCache", "content_" + parentContentVO.getParentContentId());
            }
          }
View Full Code Here

  private void changeRepositoryRecursive(SiteNode siteNode, Repository newRepository, InfoGluePrincipal principal, Database db) throws Exception
  {
      if(siteNode.getRepository().getId().intValue() != newRepository.getId().intValue())
      {
          Integer metaInfoContentId = siteNode.getMetaInfoContentId();
          MediumContentImpl metaInfoContent = (MediumContentImpl)ContentController.getContentController().getMediumContentWithId(metaInfoContentId, db);
          //String previousPath = ContentController.getContentController().getContentPath(metaInfoContentId, db);
         
          String siteNodePath = SiteNodeController.getController().getSiteNodePath(siteNode.getId(), db);
          logger.info("siteNodePath:" + siteNodePath);
          if(siteNodePath.indexOf("/", 2) > -1)
            siteNodePath = siteNodePath.substring(siteNodePath.indexOf("/", 2));
          logger.info("siteNodePath:" + siteNodePath);
         
          ContentVO newParentContent = ContentController.getContentController().getContentVOWithPath(newRepository.getId(), "Meta info folder" + siteNodePath, true, principal, db);
          if(metaInfoContent != null && newParentContent != null)
          {
            logger.info("Moving:" + metaInfoContent.getName() + " to " + newParentContent.getName());
            //newParentContent.getChildren().add(metaInfoContent);
            //Content previousParentContent = metaInfoContent.getParentContent();
            metaInfoContent.setParentContentId(newParentContent.getId());
            //previousParentContent.getChildren().remove(metaInfoContent);
           
            LanguageVO oldMasterLanguage = LanguageController.getController().getMasterLanguage(metaInfoContent.getRepositoryId(), db);
            LanguageVO newMasterLanguage = LanguageController.getController().getMasterLanguage(newParentContent.getRepositoryId(), db);
           
            ContentVersionVO oldMasterContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(metaInfoContent.getId(), oldMasterLanguage.getId(), db);
            ContentVersionVO newMasterContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(metaInfoContent.getId(), newMasterLanguage.getId(), db);
            if(oldMasterContentVersionVO != null && newMasterContentVersionVO == null)
            {
              ContentVersionController.getContentVersionController().create(metaInfoContentId, newMasterLanguage.getId(), oldMasterContentVersionVO, null, db);
            }
            else if(oldMasterContentVersionVO != null && newMasterContentVersionVO != null)
            {
              String oldComponentStructure = ContentVersionController.getContentVersionController().getAttributeValue(oldMasterContentVersionVO, "ComponentStructure", false);
              String newComponentStructure = ContentVersionController.getContentVersionController().getAttributeValue(newMasterContentVersionVO, "ComponentStructure", false);
              if(oldComponentStructure != null && !oldComponentStructure.equals("") && (newComponentStructure == null || newComponentStructure.equals("")))
              {
                ContentVersionController.getContentVersionController().updateAttributeValue(newMasterContentVersionVO.getId(), "ComponentStructure", oldComponentStructure, principal, true);
              }
            }
            metaInfoContent.setRepositoryId(newParentContent.getRepositoryId());
            //changeRepositoryRecursiveForContent(metaInfoContent, newRepository);
          }

          siteNode.setRepository((RepositoryImpl)newRepository);
        Iterator ChildSiteNodesIterator = siteNode.getChildSiteNodes().iterator();
View Full Code Here

  }

    public MediumContentImpl createSiteNodeMetaInfoContent(Database db, SiteNodeVO newSiteNode, Map<String,String> metaAttributes, Integer repositoryId, InfoGluePrincipal principal, Integer pageTemplateContentId, List<ContentVersion> newContentVersions, boolean checkIfMetaInfoIsBroken, ContentVO oldMetaInfoContentVO, String navigationTitleSuffix) throws SystemException, Bug, Exception, ConstraintException
    {
      Timer t = new Timer();
      MediumContentImpl content = null;
       
        String basePath = "Meta info folder";
        String path = "";
       
        //SiteNode parentSiteNode = newSiteNode.getParentSiteNode();
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.impl.simple.MediumContentImpl

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.