Package org.infoglue.cms.entities.structure

Examples of org.infoglue.cms.entities.structure.SiteNode


      String groupKey1 = null;
      String groupKey2 = null;
     
      while (results.hasMore())
          {
            SiteNode siteNode = (SiteNode)results.next();
           
        String siteNodeCacheKey = "" + siteNode.getValueObject().getId();
        CacheController.cacheObjectInAdvancedCache("siteNodeCache", siteNodeCacheKey, siteNode.getValueObject());

            String versionValue = siteNode.getValueObject().getAttributes();
            Integer contentId = siteNode.getValueObject().getMetaInfoContentId();
            Integer languageId = siteNode.getValueObject().getLanguageId();
            Integer contentVersionId = siteNode.getValueObject().getContentVersionId();
            if(versionValue == null)
            {
              logger.info("Null version for " + siteNode.getSiteNodeId() + ":" + siteNode.getValueObject().getSiteNodeVersionId());
            }
            else
            {
              groupKey1 = CacheController.getPooledString(2, contentVersionId);
              groupKey2 = CacheController.getPooledString(1, contentId);
             
              for(ContentTypeAttribute attribute : attributes)
          {
                if(!attribute.getName().equals("ComponentStructure"))
                {
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
                  //System.out.println("Caching empty on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, "", new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, "", new String[]{groupKey1, groupKey2}, true);
                  }
          }
         
              for(ContentTypeAttribute attribute : attributes)
              {
                //if(!attribute.getName().equals("ComponentStructure"))
                //{
                  String value = ContentDeliveryController.getContentDeliveryController().getAttributeValue(versionValue, attribute.getName(), false);
   
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
                  //System.out.println("Caching " + value + " on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
                    //}
              }   
            }
            /*
            if(attributesString != null)
            {
              String[] attributesArray = attributesString.split("igcomma");
              for(String attr : attributesArray)
              {
                if(attr != null && !attr.equals(""))
                {
                  String name = attr.substring(0, attr.indexOf("="));
                  String value = attr.substring(attr.indexOf("=") + 1);
   
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + name;
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + name;
                  //System.out.println("Caching " + name + "=" + value + " on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
                }
              }           
            }
            else
              System.out.println("Error null on " + siteNode.getId());
            */
            //if(allSiteNodeVOMap.get(siteNode.getId()) != null)
            //{
            //  allSiteNodeVOMap.get(siteNode.getId()).addAttributes(siteNode.getValueObject().getLanguageId(), siteNode.getValueObject().getAttributes());
            //  continue;
            //}
           
            allSiteNodeVOMap.put(siteNode.getId(), siteNode.getValueObject());
            //System.out.println("siteNode:" + siteNode.getName());
        if(isValidSiteNode(siteNode, db))
            {
          //System.out.println("Caching empty list initially on " + siteNode.getId());
          //CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+siteNode.getId(), new ArrayList<SiteNodeVO>(), new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, siteNode.getId())}, true);
          //populatedSiteNodeVOList.put(siteNode.getId(), new ArrayList<SiteNodeVO>());
          if(parentSiteNodeId != null && !siteNode.getValueObject().getParentSiteNodeId().equals(parentSiteNodeId))
          {
            //System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
            CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+parentSiteNodeId, siteNodeVOList, new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, parentSiteNodeId)}, true);
            //populatedSiteNodeVOList.put(parentSiteNodeId, siteNodeVOList);
            siteNodeVOList = new ArrayList<SiteNodeVO>();
          }
          parentSiteNodeId = siteNode.getValueObject().getParentSiteNodeId();
          siteNodeVOList.add(siteNode.getValueObject());
        }
        }
      //System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
      if(groupKey1 == null) groupKey1 = "";
      if(groupKey2 == null) groupKey2 = "";
View Full Code Here


          {
              DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
              logger.info("digitalAsset:" + digitalAsset.getAssetKey());
              if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
              {
                  SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                  assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                  logger.info("assetUrl:" + assetUrl);
                  break;
              }
          }
      }
    }
   
    if(assetUrl.equals(""))
    { 
      List roles = infoGluePrincipal.getRoles();
      Iterator rolesIterator = roles.iterator();
      while(rolesIterator.hasNext())
      {
        InfoGlueRole role = (InfoGlueRole)rolesIterator.next();
       
        Collection rolePropertiesList = RolePropertiesController.getController().getRolePropertiesList(role.getName(), languageId, db, true);
        Iterator rolePropertiesListIterator = rolePropertiesList.iterator();
        while(rolePropertiesListIterator.hasNext())
        {
          RoleProperties roleProperties = (RoleProperties)rolePropertiesListIterator.next();
         
          if(roleProperties != null && roleProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = roleProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                      break;
                  }
              }
          }
        }
                 
      }
     
      if(assetUrl.equals("") && useLanguageFallback)
      {
        LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
        if(!masterLanguageVO.getLanguageId().equals(languageId))
          return getPrincipalAssetUrl(db, infoGluePrincipal, assetKey, masterLanguageVO.getLanguageId(), siteNodeId, useLanguageFallback, deliveryContext);
      }
    }

    if(assetUrl.equals(""))
    { 
      List groups = infoGluePrincipal.getGroups();
      Iterator groupsIterator = groups.iterator();
      while(groupsIterator.hasNext())
      {
        InfoGlueGroup group = (InfoGlueGroup)groupsIterator.next();
       
        Collection groupPropertiesList = GroupPropertiesController.getController().getGroupPropertiesList(group.getName(), languageId, db, true);
        Iterator groupPropertiesListIterator = groupPropertiesList.iterator();
        while(groupPropertiesListIterator.hasNext())
        {
          GroupProperties groupProperties = (GroupProperties)groupPropertiesListIterator.next();
         
          if(groupProperties != null && groupProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = groupProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                      break;
                  }
              }
          }
        }
View Full Code Here

          while(assetsIterator.hasNext())
          {
              DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
              if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
              {
                  SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                  assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                  break;
              }
          }
      }
    }
   
    if(assetUrl.equals(""))
    { 
      List roles = infoGluePrincipal.getRoles();
      Iterator rolesIterator = roles.iterator();
      while(rolesIterator.hasNext())
      {
        InfoGlueRole role = (InfoGlueRole)rolesIterator.next();
       
        Collection rolePropertiesList = RolePropertiesController.getController().getRolePropertiesList(role.getName(), languageId, db, true);
        Iterator rolePropertiesListIterator = rolePropertiesList.iterator();
        while(rolePropertiesListIterator.hasNext())
        {
          RoleProperties roleProperties = (RoleProperties)rolePropertiesListIterator.next();
         
          if(roleProperties != null && roleProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = roleProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                      break;
                  }
              }
          }
        }
                 
      }
     
      if(assetUrl.equals("") && useLanguageFallback)
      {
        LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
        if(!masterLanguageVO.getLanguageId().equals(languageId))
          return getPrincipalThumbnailAssetUrl(db, infoGluePrincipal, assetKey, masterLanguageVO.getLanguageId(), siteNodeId, useLanguageFallback, width, height, deliveryContext);
      }
    }
 
    if(assetUrl.equals(""))
    { 
      List groups = infoGluePrincipal.getGroups();
      Iterator groupsIterator = groups.iterator();
      while(groupsIterator.hasNext())
      {
        InfoGlueGroup group = (InfoGlueGroup)groupsIterator.next();
       
        Collection groupPropertiesList = GroupPropertiesController.getController().getGroupPropertiesList(group.getName(), languageId, db, true);
        Iterator groupPropertiesListIterator = groupPropertiesList.iterator();
        while(groupPropertiesListIterator.hasNext())
        {
          GroupProperties groupProperties = (GroupProperties)groupPropertiesListIterator.next();
         
          if(groupProperties != null && groupProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = groupProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                      break;
                  }
              }
          }
        }
View Full Code Here

          QueryResults results = oql.execute(Database.READONLY);
          //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 1", t.getElapsedTime());
         
        while (results.hasMore())
            {
              SiteNode siteNode = (SiteNode)results.next();
              t.getElapsedTime();
             
              if(isValidSiteNode(siteNode, db))
              {
                if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties() && languageId != null && deliveryContext != null)
                {
                  Boolean isLanguageAvailable = true;
                  if(!showLanguageDisabled)
                    isLanguageAvailable = SiteNodeController.getController().getIsLanguageAvailable(siteNode.getId(), languageId, db, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()));

                  if(!isLanguageAvailable)
              {
                continue;
              }
              else
              {
                String localizedIsHidden = ContentDeliveryController.getContentDeliveryController().getContentAttribute(db, siteNode.getMetaInfoContentId(), languageId, "HideInNavigation", siteNode.getId(), true, deliveryContext, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), false, true);
                String localizedSortOrder = ContentDeliveryController.getContentDeliveryController().getContentAttribute(db, siteNode.getMetaInfoContentId(), languageId, "SortOrder", siteNode.getId(), true, deliveryContext, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), false, true);

                    if(localizedIsHidden != null/* && !localizedIsHidden.equals("")*/)
                {
                  if(localizedIsHidden.equals("true"))
                    siteNode.getValueObject().setLocalizedIsHidden(true);
                  else
                    siteNode.getValueObject().setLocalizedIsHidden(false);
                }
               
                if(localizedSortOrder != null && !localizedSortOrder.equals(""))
                {
                  siteNode.getValueObject().setLocalizedSortOrder(new Integer(localizedSortOrder));
                }
              }
            }
           
            if(siteNode.getValueObject().getIsHidden() == null || (siteNode.getValueObject().getIsHidden().booleanValue() == false || showHidden))
              siteNodeVOList.add(siteNode.getValueObject());
          }
          }
          //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 2", t.getElapsedTime());
 
        results.close();
View Full Code Here

        QueryResults results = oql.execute(Database.READONLY);
        //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 1", t.getElapsedTime());
       
      while (results.hasMore())
          {
            SiteNode siteNode = (SiteNode)results.next();
        if(isValidSiteNode(siteNode, db))
            {
              siteNodeVOList.add(siteNode.getValueObject());
        }
        }
        //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 2", t.getElapsedTime());

      results.close();
View Full Code Here

 
  public boolean isValidSiteNode(Database db, Integer siteNodeId) throws Exception
  {
    boolean isValidSiteNode = false;
   
    SiteNode siteNode = (SiteNode)getObjectWithId(SiteNodeImpl.class, siteNodeId, db);
    isValidSiteNode = isValidSiteNode(siteNode, db);
         
    return isValidSiteNode;         
  }
View Full Code Here

  }
 
 
  private void recurseSiteNodeTree(Integer siteNodeId, Integer languageId, TemplateController templateController, Principal principal/*, DatabaseWrapper dbWrapper*/, int maxLevel, int currentLevel) throws Exception
  {   
      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, templateController.getDatabase(), true);
      SiteNodeVO siteNodeVO = templateController.getSiteNode(siteNodeId);

        templateController.getContentAttribute(siteNodeVO.getMetaInfoContentId(), languageId, "Title", true);
        templateController.getContentAttribute(siteNodeVO.getMetaInfoContentId(), languageId, "NavigationTitle", true);
        templateController.getContentAttribute(siteNodeVO.getMetaInfoContentId(), languageId, "NiceURIName", true);
        templateController.getContentAttribute(siteNodeVO.getMetaInfoContentId(), languageId, "Description", true);
        templateController.getContentAttribute(siteNodeVO.getMetaInfoContentId(), languageId, "ComponentStructure", true);

        List childPages = templateController.getChildPages(siteNodeId);
       
        templateController.getRepositoryRootSiteNode(siteNodeVO.getRepositoryId());
        templateController.getParentSiteNode(siteNodeVO.getId());
       
        Collection childSiteNodes = siteNode.getChildSiteNodes();
     
        /*
        List childSiteNodeIds = new ArrayList();
        Iterator childSiteNodesIterator = childSiteNodes.iterator();
      while(childSiteNodesIterator.hasNext())
        {
          SiteNode childSiteNode = (SiteNode)childSiteNodesIterator.next();
          childSiteNodeIds.add(childSiteNode.getSiteNodeId());
        }

        templateController.commitDatabase();

      Iterator childSiteNodeIdsIterator = childSiteNodeIds.iterator();
      while(childSiteNodeIdsIterator.hasNext())
        {
          Integer childSiteNodeId = (Integer)childSiteNodeIdsIterator.next();
          recurseSiteNodeTree(childSiteNodeId, languageId, templateController, principal);
        }

        */

        Iterator childSiteNodesIterator = childSiteNodes.iterator();
      while(childSiteNodesIterator.hasNext())
        {
          SiteNode childSiteNode = (SiteNode)childSiteNodesIterator.next();
          if(maxLevel > currentLevel)
            recurseSiteNodeTree(childSiteNode.getId(), languageId, templateController, principal, maxLevel, currentLevel + 1);
        }

  
    Repository repository = RepositoryController.getController().getRepositoryWithId(siteNodeVO.getRepositoryId(), templateController.getDatabase());
    Collection languages = repository.getRepositoryLanguages();
View Full Code Here

    {
        logger.info("There was an cached master language:" + languageVO.getName());
    }
    else
    {
      SiteNode siteNode = (SiteNode)getObjectWithId(SiteNodeImpl.class, siteNodeId, db);
      Integer repositoryId = siteNode.getRepository().getRepositoryId();
          
      OQLQuery oql = db.getOQLQuery( "SELECT l FROM org.infoglue.cms.entities.management.impl.simple.LanguageImpl l WHERE l.repositoryLanguages.repository.repositoryId = $1 ORDER BY l.repositoryLanguages.sortOrder, l.languageId");
      oql.bind(repositoryId);
     
          QueryResults results = oql.execute(Database.READONLY);
View Full Code Here

    int currentIndex = 0;
    logger.info("Coming in with languageCodes:" + languageCodes);
   
        Language language = null;

      SiteNode siteNode = (SiteNode)getObjectWithId(SiteNodeImpl.class, siteNodeId, db);
    Repository repository = siteNode.getRepository();
    if(repository != null)
    {
      Collection languages = repository.getRepositoryLanguages();
      Iterator languageIterator = languages.iterator();
      while(languageIterator.hasNext())
View Full Code Here

          if(availableServiceBinding != null)
              metaInfoAvailableServiceBindingId = availableServiceBinding.getAvailableServiceBindingId();
             
              while(siteNodesIterator.hasNext())
              {
                  SiteNode siteNode = (SiteNode)siteNodesIterator.next();

                  if(siteNode.getSiteNodeVersions() == null || siteNode.getSiteNodeVersions().size() == 0)
                  {
                    //No siteNode is an island (humhum) so we also have to create an siteNodeVersion for it.
                    SiteNodeVersionController.createInitialSiteNodeVersion(db, siteNode, this.getInfoGluePrincipal());
                  }
                  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());
               
                boolean hasMetaInfo = false;
               
                if(siteNodeVersion == null)
                {
                  logger.error("Error:" + siteNode.getName() + "(" + siteNode.getId() + ") had no siteNodeVersions");
                }
                else
                {
                  Collection serviceBindings = siteNodeVersion.getServiceBindings();
                  Iterator serviceBindingIterator = serviceBindings.iterator();
                  while(serviceBindingIterator.hasNext())
                  {
                    ServiceBinding serviceBinding = (ServiceBinding)serviceBindingIterator.next();
                    if(serviceBinding.getAvailableServiceBinding().getId().intValue() == metaInfoAvailableServiceBindingId.intValue())
                    {
                      List boundContents = ContentController.getInTransactionBoundContents(db, serviceBinding.getServiceBindingId());      
                      if(boundContents.size() > 0)
                        {
                          ContentVO content = (ContentVO)boundContents.get(0);
                          metaInfoContentId = content.getId();
   
                          hasMetaInfo = true;
                         
                          break;
                         }                         
                    }
                  }
               
                  if(!hasMetaInfo)
                  {
                        ContentVO contentVO = SiteNodeController.getController().createSiteNodeMetaInfoContent(db, siteNode.getValueObject(), siteNode.getRepository().getId(), this.getInfoGluePrincipal(), null, new ArrayList()).getValueObject();
                        metaInfoContentId = contentVO.getId();
                  }
                     
                    siteNode.setMetaInfoContentId(metaInfoContentId);
                }
                    }
                  }
              }
             
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.structure.SiteNode

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.