Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.LanguageVO


     * @param db
     * @throws Exception
     */
    private void createAndDeleteLanguage(Database db) throws Exception
    {
        LanguageVO languageVO = new LanguageVO();
        languageVO.setCharset("utf8");
        languageVO.setLanguageCode("test");
        languageVO.setName("test");
        LanguageVO newLanguageVO = LanguageController.getController().create(languageVO);
        LanguageController.getController().delete(db, languageVO);
    }
View Full Code Here


                  }
                  else
                  {
                    if(siteNode.getMetaInfoContentId() == null || siteNode.getMetaInfoContentId().intValue() == -1)
                    {
                        LanguageVO masterLanguage = LanguageController.getController().getMasterLanguage(siteNode.getRepository().getId(), db);
                Integer languageId = masterLanguage.getLanguageId();
               
                Integer metaInfoContentId = null;
               
                SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersionReadOnly(db, siteNode.getId());
               
View Full Code Here

  {
      Vector vector = new Vector();
     
      try
      {
        LanguageVO languageVO = LanguageController.getController().getLanguageVOWithId(new Integer(this.getParameter("languageId")));
        Locale locale = new Locale(languageVO.getLanguageCode());
        vector.add(locale);
      }
      catch(Exception e)
      {
          vector.add(Locale.getDefault());
View Full Code Here

   
    List assignedContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(categoryKey, contentVersion, db);
    //List assignedContentCategories = findContentCategoriesForContentVersionId(db, contentVersionVO.getId(), categoryKey, deliveryContext);
    if((assignedCategoryVOList == null || assignedCategoryVOList.size() == 0) && useLanguageFallback)
    {
      LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
      contentVersion = getContentVersion(siteNodeId, contentId, masterLanguageVO.getLanguageId(), db, useLanguageFallback, deliveryContext, infoGluePrincipal);
      //assignedContentCategories = findContentCategoriesForContentVersionId(db, contentVersionVO.getId(), categoryKey, deliveryContext);
      assignedContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(categoryKey, contentVersion, db);
    }
   
    Iterator assignedContentCategoriesIterator = assignedContentCategories.iterator();
View Full Code Here

    List langs = LanguageDeliveryController.getLanguageDeliveryController().getAvailableLanguages(db, siteNodeId);
    List<Integer> checkedLanguages = new ArrayList<Integer>();
    Iterator lit = langs.iterator();
    while (lit.hasNext())
    {
      LanguageVO langVO = (LanguageVO) lit.next();
      if (langVO.getLanguageId().compareTo(languageId)!=0)
      {
        SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, langVO.getLanguageId(), db, false, deliveryContext, infoGluePrincipal);
        if (contentVersion != null)
        {
          DigitalAssetVO digitalAsset = (assetKey == null) ? DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db) : DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
         
          if(digitalAsset != null)
          {
            asset = digitalAsset;
            break;
          }
        }                 
        checkedLanguages.add(langVO.getLanguageId());
      }
    }

    if(asset == null)
    {
      ContentVO contentVO = getContentVO(db, contentId, deliveryContext);
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);

      if(!contentVO.getRepositoryId().equals(siteNodeVO.getRepositoryId()))
      {
        List contentRepositoryLangs = LanguageDeliveryController.getLanguageDeliveryController().getAvailableLanguagesForRepository(db, contentVO.getRepositoryId());
        Iterator contentRepositoryLangsIterator = contentRepositoryLangs.iterator();
        while (contentRepositoryLangsIterator.hasNext())
        {
          LanguageVO langVO = (LanguageVO) contentRepositoryLangsIterator.next();
          if (langVO.getLanguageId().compareTo(languageId)!=0)
          {
            if(checkedLanguages.contains(langVO.getLanguageId()))
            {
              continue;
            }

            SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, langVO.getLanguageId(), db, false, deliveryContext, infoGluePrincipal);
            if (contentVersion != null)
            {
              DigitalAssetVO digitalAsset = (assetKey == null) ? DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db) : DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
             
              if(digitalAsset != null)
View Full Code Here

    String assetUrl = "";
    assetUrl = urlComposer.composeDigitalAssetUrl("", null, "", deliveryContext);
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    ContentVO contentVO = this.getContentVO(db, contentId, deliveryContext);
    LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(contentVO.getRepositoryId(), db);
    if(logger.isInfoEnabled())
    {
      logger.info("languageId:" + languageId);
      logger.info("masterLanguageVO:" + masterLanguageVO);
    }
    /*
    if(deliveryContext.getUseDownloadAction())
    {
      SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNode(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
        dnsName = siteNode.getRepository().getDnsName();

      return urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext);
    }
    */
   
    boolean isUnprotectedAsset = getHasUserContentAccess(db, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), contentId);
   
    if(!isUnprotectedAsset)
    {
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
          if(digitalAsset == null)
            return "";
         
      //SiteNodeVO siteNodeVO = getSiteNodeVO(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNodeVO != null)
      {
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
        if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
          dnsName = repositoryVO.getDnsName();
      }
      /*
      SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNodeVO(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
        dnsName = siteNode.getRepository().getDnsName();
      */

      return urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext, db);
    }
    else if(contentVersion != null)
        {
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
     
      if(digitalAsset != null)
      {
        //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
        String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, db);
        //String folderName = "" + (digitalAsset.getDigitalAssetId().intValue() / 1000);
        String folderName = DigitalAssetDeliveryController.getAssetFolderName(digitalAsset, contentId, languageId, db);

        int i = 0;
        File masterFile = null;
        String filePath = CmsPropertyHandler.getDigitalAssetPath0() + File.separator + folderName;
        while(filePath != null)
        {
          try
          {
              if(masterFile == null)
                  masterFile = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().dumpDigitalAsset(digitalAsset, fileName, filePath, db)
            else
                DigitalAssetDeliveryController.getDigitalAssetDeliveryController().dumpDigitalAsset(masterFile, fileName, filePath);
          }
          catch(Exception e)
          {
            logger.warn("An file could not be written:" + e.getMessage(), e);
          }
           
            i++;
            filePath = CmsPropertyHandler.getProperty("digitalAssetPath." + i);
            if(filePath != null)
              filePath += File.separator + folderName;
        }

        //SiteNodeVO siteNodeVO = getSiteNodeVO(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNodeVO != null)
        {
          RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
          if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
            dnsName = repositoryVO.getDnsName();
        }

        /*
        SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNode(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
          dnsName = siteNode.getRepository().getDnsName();
        */
         
        if(deliveryContext.getUseDownloadAction())
          assetUrl = urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext, db);
        else
          assetUrl = urlComposer.composeDigitalAssetUrl(dnsName, folderName, fileName, deliveryContext);
      }
      else if(useLanguageFallback)
      {
        assetUrl = getLanguageIndependentAssetUrl(contentId, languageId, siteNodeId, db, assetKey, deliveryContext, infoGluePrincipal);
      }
    }       
    else if(useLanguageFallback && languageId != null && masterLanguageVO != null && languageId.intValue() != masterLanguageVO.getId().intValue())
    {
        contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
       
        logger.info("contentVersion:" + contentVersion);
      if(contentVersion != null)
View Full Code Here

        Integer repositoryId = content.getRepositoryId();
        if(contentVersion == null && useLanguageFallBack && repositoryId != null)
      {
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("Before LanguageFallBack", t.getElapsedTimeNanos() / 1000);
        LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(repositoryId, db);
        //TODO
        if(masterLanguage != null && !masterLanguage.getId().equals(languageId))
        {
          contentVersion = getContentVersionVO(content.getId(), masterLanguage.getId(), getOperatingMode(deliveryContext), deliveryContext, db);
          //contentVersion = getSmallestContentVersionVO(content.getId(), masterLanguage.getId(), getOperatingMode(deliveryContext), deliveryContext, db);
        }
      }

      //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("isValidContentPart5", t.getElapsedTimeNanos() / 1000);
View Full Code Here

 
          Integer repositoryId = content.getRepositoryId();
       
        if(contentVersion == null && useLanguageFallBack && repositoryId != null)
        {
          LanguageVO masterLanguage = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(repositoryId, db);
          //TODO
          if(masterLanguage != null && !masterLanguage.getId().equals(languageId))
          {
            //contentVersion = getContentVersion(content, masterLanguage.getId(), getOperatingMode(), deliveryContext, db);
            //contentVersion = getSmallestContentVersionVO(content.getId(), masterLanguage.getId(), getOperatingMode(deliveryContext), deliveryContext, db);
            contentVersion = getContentVersionVO(content.getId(), masterLanguage.getId(), getOperatingMode(deliveryContext), deliveryContext, db);
          }
        }
 
          if(contentVersion != null)
          isValidContent = true;     
View Full Code Here

            List languages = this.getController().getPageLanguages();
           
            Iterator languagesIterator = languages.iterator();
            while(languagesIterator.hasNext())
            {
              LanguageVO languageVO = (LanguageVO)languagesIterator.next();
              if(!contentVersionVO.getLanguageId().equals(languageVO.getId()))
              {
                String translateUrl = componentEditorUrl + "ViewContentVersion!standalone.action?contentId=" + this.contentId + "&languageId=" + languageVO.getLanguageId() + "&anchorName=contentVersionBlock&translate=true&fromLanguageId=" + contentVersionVO.getLanguageId() + "&toLanguageId=" + languageVO.getId(); // + "&KeepThis=true&TB_iframe=true&height=700&width=1000&modal=true";
             
                sb.append("  <li style='margin: 0px; margin-left: 4px; padding: 2px 0px 2px 2px; list-style-type:none;'>");
                sb.append("      <a href=\"javascript:openInlineDiv('" + translateUrl + "', 700, 1000, true);\" class=\"editOnSightHref linkTranslate\">" + translateContentLabel + " &quot;" + languageVO.getLocalizedDisplayLanguage() + "&quot;</a>");
                sb.append(" </li>");
              }
            }
          }
         
View Full Code Here

 
  public void recache(DatabaseWrapper dbWrapper, Integer siteNodeId) throws SystemException, Exception
  {
        logger.info("recache starting..");

    LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(dbWrapper.getDatabase(), siteNodeId);
    if(masterLanguageVO == null)
      throw new SystemException("There was no master language for the siteNode " + siteNodeId);
 
    Integer languageId = masterLanguageVO.getLanguageId();
    if(languageId == null)
        languageId = masterLanguageVO.getLanguageId();       
       
    Integer contentId = new Integer(-1);
   
    Principal principal = (Principal)CacheController.getCachedObject("userCache", "anonymous");
    if(principal == null)
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.LanguageVO

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.