Package org.infoglue.cms.entities.content

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


        try
        {
          db = CastorDatabaseService.getDatabase();
          db.begin();
 
          Content content = ContentController.getContentController().getContentWithId(contentId, db);
          ImportController.getController().updateContentVersions(content, contentIdMap, siteNodeIdMap, onlyLatestVersions, new HashMap());
          //updateContentVersions(content, contentIdMap, siteNodeIdMap);
 
          db.commit();
        }
View Full Code Here


        //END TEST
     
      String names = "";
      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));

        interceptionPointVO = InterceptionPointController.getController().getInterceptionPointVOWithName("Repository.Write", db);
        if(interceptionPointVO != null)
          allAccessRights.addAll(AccessRightController.getController().getAccessRightListOnlyReadOnly(interceptionPointVO.getId(), repository.getId().toString(), db));

        interceptionPointVO = InterceptionPointController.getController().getInterceptionPointVOWithName("Repository.ReadForBinding", db);
        if(interceptionPointVO != null)
          allAccessRights.addAll(AccessRightController.getController().getAccessRightListOnlyReadOnly(interceptionPointVO.getId(), repository.getId().toString(), db));

        ExportRepositoryAction.getContentPropertiesAndAccessRights(ps, allContentProperties, allAccessRights, content, db);
        ExportRepositoryAction.getSiteNodePropertiesAndAccessRights(ps, allSiteNodeProperties, allAccessRights, siteNode, db);
     
      siteNodes.add(siteNode);
      contents.add(content);
      names = names + "_" + repository.getName();
      allRepositoryProperties.putAll(OptimizedExportController.getRepositoryProperties(ps, repositoryId));
     
      List contentTypeDefinitions = ContentTypeDefinitionController.getController().getContentTypeDefinitionList(db);
      List categories = CategoryController.getController().getAllActiveCategories();
     
      InfoGlueExportImpl infoGlueExportImpl = new InfoGlueExportImpl();
     
      VisualFormatter visualFormatter = new VisualFormatter();
      names = new VisualFormatter().replaceNonAscii(names, '_');

      String fileName = "RepositoryCopy_" + names + "_" + visualFormatter.formatDate(new Date(), "yyyy-MM-dd_HHmm") + ".xml";
     
      String filePath = CmsPropertyHandler.getDigitalAssetPath();
      String fileSystemName =  filePath + File.separator + fileName;
     
      String encoding = "UTF-8";
      file = new File(fileSystemName);
            FileOutputStream fos = new FileOutputStream(file);
            BufferedOutputStream bos = new BufferedOutputStream(fos);
            OutputStreamWriter osw = new OutputStreamWriter(bos, encoding);
            Marshaller marshaller = new Marshaller(osw);
            marshaller.setMapping(map);
      marshaller.setEncoding(encoding);
      DigitalAssetBytesHandler.setMaxSize(-1);

      infoGlueExportImpl.getRootContent().addAll(contents);
      infoGlueExportImpl.getRootSiteNode().addAll(siteNodes);
     
      infoGlueExportImpl.setContentTypeDefinitions(new ArrayList());
      infoGlueExportImpl.setCategories(new ArrayList());
     
      infoGlueExportImpl.setRepositoryProperties(allRepositoryProperties);
      infoGlueExportImpl.setContentProperties(allContentProperties);
      infoGlueExportImpl.setSiteNodeProperties(allSiteNodeProperties);
      infoGlueExportImpl.setAccessRights(allAccessRights);
     
      marshaller.marshal(infoGlueExportImpl);
     
      osw.flush();
      osw.close();
     
      db.commit();
      db.close();
     
      db = CastorDatabaseService.getDatabase();
      db.begin();
     
      Map contentIdMap = new HashMap();
      Map siteNodeIdMap = new HashMap();
      List allContentIds = new ArrayList();

      Map<String,String> replaceMap = new HashMap<String,String>();
      Properties properties = new Properties();
      try
      {
        properties.load(new ByteArrayInputStream(replacements.getBytes("ISO-8859-1")));
        Iterator propertySetIterator = properties.keySet().iterator();
        while(propertySetIterator.hasNext())
        {
          String key = (String)propertySetIterator.next();
          String value = properties.getProperty(key);
          replaceMap.put(key, value);
        }
      } 
      catch(Exception e)
      {
          logger.error("Error loading properties from string. Reason:" + e.getMessage());
        e.printStackTrace();
      }
     
      ImportController.getController().importRepository(db, map, file, encoding, 2, onlyLatestVersions, true, contentIdMap, siteNodeIdMap, allContentIds, replaceMap, false);

      db.commit();
      db.close();

      Iterator allContentIdsIterator = allContentIds.iterator();
      while(allContentIdsIterator.hasNext())
      {
        Integer contentId = (Integer)allContentIdsIterator.next();
        try
        {
          db = CastorDatabaseService.getDatabase();
          db.begin();
 
          Content createdContent = ContentController.getContentController().getContentWithId(contentId, db);
          ImportController.getController().updateContentVersions(createdContent, contentIdMap, siteNodeIdMap, onlyLatestVersions, replaceMap);
 
          db.commit();
        }
        catch(Exception e)
View Full Code Here

      List contents = ContentController.getContentController().getRepositoryContents(this.repositoryId, db);
     
      Iterator iterator = contents.iterator();
      while(iterator.hasNext())
      {
          Content content = (Content)iterator.next();
          logger.info("Going to index all version of " + content.getName());
         
          Iterator versionsIterator = content.getContentVersions().iterator();
        while(versionsIterator.hasNext())
        {
            ContentVersion contentVersion = (ContentVersion)versionsIterator.next();
            registryController.updateContentVersion(contentVersion.getValueObject(), db);
        }
View Full Code Here

    List<ContentVersionVO> resultList = new ArrayList<ContentVersionVO>();
      Map lastLanguageVersions = new HashMap();
      Map languageVersions = new HashMap();
     
      //TODO - fix
      Content content = ContentController.getContentController().getContentWithId(contentId, db);
      Collection contentVersions = content.getContentVersions();
   
    Iterator versionIterator = contentVersions.iterator();
    while(versionIterator.hasNext())
    {
        ContentVersion contentVersionCandidate = (ContentVersion)versionIterator.next()
     
        ContentVersion lastVersionInThatLanguage = (ContentVersion)lastLanguageVersions.get(contentVersionCandidate.getLanguage().getId());
      if(lastVersionInThatLanguage == null || (lastVersionInThatLanguage.getId().intValue() < contentVersionCandidate.getId().intValue() && contentVersionCandidate.getIsActive().booleanValue()))
          lastLanguageVersions.put(contentVersionCandidate.getLanguage().getId(), contentVersionCandidate);
     
      if(contentVersionCandidate.getIsActive().booleanValue() && contentVersionCandidate.getStateId().intValue() == stateId.intValue())
      {
        if(contentVersionCandidate.getOwningContent().getContentId().intValue() == content.getId().intValue())
        {
            ContentVersion versionInThatLanguage = (ContentVersion)languageVersions.get(contentVersionCandidate.getLanguage().getId());
          if(versionInThatLanguage == null || versionInThatLanguage.getContentVersionId().intValue() < contentVersionCandidate.getId().intValue())
          {
              languageVersions.put(contentVersionCandidate.getLanguage().getId(), contentVersionCandidate);
View Full Code Here

   
  public ContentVersion getLatestActiveContentVersion(Integer contentId, Integer languageId, Database db) throws SystemException, Bug, Exception
  {
    ContentVersion contentVersion = null;
   
    Content content = ContentController.getContentController().getReadOnlyContentWithId(contentId, db);
    Collection contentVersions = content.getContentVersions();
    if(logger.isInfoEnabled())
      {
        logger.info("contentId:" + contentId);
        logger.info("languageId:" + languageId);
        logger.info("content:" + content.getName());
      logger.info("contentVersions:" + contentVersions.size());
      }
     
    Iterator i = contentVersions.iterator();
        while(i.hasNext())
View Full Code Here

   
  public ContentVersion getLatestActiveMediumContentVersion(Integer contentId, Integer languageId, Database db) throws SystemException, Bug, Exception
  {
    ContentVersion contentVersion = null;
   
    Content content = ContentController.getContentController().getMediumContentWithId(contentId, db);
    Collection contentVersions = content.getContentVersions();
    if(logger.isInfoEnabled())
      {
        logger.info("contentId:" + contentId);
        logger.info("languageId:" + languageId);
        logger.info("content:" + content.getName());
      logger.info("contentVersions:" + contentVersions.size());
      }
     
    Iterator i = contentVersions.iterator();
        while(i.hasNext())
View Full Code Here

   
  public ContentVersion getLatestActiveContentVersionReadOnly(Integer contentId, Integer languageId, Database db) throws SystemException, Bug
  {
    ContentVersion contentVersion = null;
     
    Content content = ContentController.getContentController().getReadOnlyMediumContentWithId(contentId, db);
    Collection contentVersions = content.getContentVersions();
    if(logger.isInfoEnabled())
    {
      logger.info("contentId:" + contentId);
        logger.info("languageId:" + languageId);
        logger.info("content:" + content.getName());
      logger.info("contentVersions:" + contentVersions.size());
    }
       
    Iterator i = contentVersions.iterator();
        while(i.hasNext())
View Full Code Here

  {
    Timer t = new Timer();
   
    ContentVersion contentVersion = null;
     
    Content content = ContentController.getContentController().getReadOnlyMediumContentWithId(contentId, db);
    Collection contentVersions = content.getContentVersions();
    if(logger.isInfoEnabled())
    {
      logger.info("contentId:" + contentId);
        logger.info("languageId:" + languageId);
        logger.info("content:" + content.getName());
      logger.info("contentVersions:" + contentVersions.size());
    }
       
    Iterator i = contentVersions.iterator();
        while(i.hasNext())
View Full Code Here

    }
   
    contentCategoryController.deleteByContentVersion(contentVersion, db);
    DigitalAssetController.getController().deleteByContentVersion(contentVersion, db);
   
    Content content = contentVersion.getOwningContent();

    if(content != null)
        content.getContentVersions().remove(contentVersion);

    db.remove(contentVersion);
  }
View Full Code Here

    Integer language = contentVersion.getValueObject().getLanguageId();
   
    boolean isOldVersion = false;
    int numberOfNewerVersions = 0;
   
    Content content = contentVersion.getOwningContent();
    Collection contentVersions = content.getContentVersions();
    Iterator contentVersionsIterator = contentVersions.iterator();
    while(contentVersionsIterator.hasNext())
    {
      ContentVersion currentContentVersion = (ContentVersion)contentVersionsIterator.next();
      if(currentContentVersion.getValueObject().getLanguageId().intValue() == language.intValue())
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.