Package org.infoglue.cms.entities.structure

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


    public SiteNodeVersionVO createSiteNodeVersion(SiteNodeVersionVO siteNodeVersionVO) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        SiteNodeVersion siteNodeVersion = null;

        beginTransaction(db);

        try
        {
            //Here you might want to add some validate functonality?
            siteNodeVersion = createSiteNodeVersionEntity(db, siteNodeVersionVO);
            
            //If any of the validations or setMethods reported an error, we throw them up now before create.
            ceb.throwIfNotEmpty();
           
            commitTransaction(db);
        }
        catch(ConstraintException ce)
        {
            logger.warn("An error occurred so we should not complete the transaction:" + ce, ce);
            rollbackTransaction(db);
            throw ce;
        }
        catch(Exception e)
        {
            logger.error("An error occurred so we should not complete the transaction:" + e, e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }

        return siteNodeVersion.getValueObject();
    }    
View Full Code Here


     * Creates the entity SiteNodeVersion sent in and references the correct other entities
     */
    
    private SiteNodeVersion createSiteNodeVersionEntity(Database db, SiteNodeVersionVO siteNodeVersionVO) throws SystemException
    {
        SiteNodeVersion siteNodeVersion = null;

        try
        {
            //Fetch related entities here if they should be referenced       
           
            siteNodeVersion = new SiteNodeVersionImpl();
            siteNodeVersion.setValueObject(siteNodeVersionVO);
            //Refrence other entities through setters here
            db.create(siteNodeVersion);
        }
        catch(Exception e)
        {
View Full Code Here

    public void deleteSiteNodeVersion(Integer siteNodeVersionId) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        SiteNodeVersion siteNodeVersion = null;

        beginTransaction(db);

        try
        {
View Full Code Here

  public SiteNodeVersionVO getActiveSiteNodeVersionVO(Database db, Integer siteNodeId) throws Exception
  {
    SiteNodeVersionVO siteNodeVersionVO = null;
   
    SiteNodeVersion siteNodeVersion = getActiveSiteNodeVersion(siteNodeId, db);
    if(siteNodeVersion != null)
      siteNodeVersionVO = siteNodeVersion.getValueObject();
   
    return siteNodeVersionVO;
  }
View Full Code Here

   * This method gets the appropriate siteNodeVersion
   */
 
  public SiteNodeVersion getActiveSiteNodeVersion(Integer siteNodeId, Database db) throws Exception
  {
    SiteNodeVersion siteNodeVersion = null;
   
    SiteNode siteNode = (SiteNode)this.getObjectWithId(SiteNodeImpl.class, siteNodeId, db);
    logger.info("Loaded siteNode " + siteNode.getName());
    Collection siteNodeVersions = siteNode.getSiteNodeVersions();
    logger.info("Loaded versions " + siteNodeVersions.size());
   
    Iterator versionIterator = siteNodeVersions.iterator();
    while(versionIterator.hasNext())
    {
      SiteNodeVersion siteNodeVersionCandidate = (SiteNodeVersion)versionIterator.next()
      logger.info("SiteNodeVersionCandidate " + siteNodeVersionCandidate.getId());
      if(siteNodeVersionCandidate.getIsActive().booleanValue() && siteNodeVersionCandidate.getStateId().intValue() >= getOperatingMode().intValue())
      {
        if(siteNodeVersionCandidate.getOwningSiteNode().getSiteNodeId().intValue() == siteNodeId.intValue())
        {
          if(siteNodeVersion == null || siteNodeVersion.getSiteNodeVersionId().intValue() < siteNodeVersionCandidate.getId().intValue())
          {
            siteNodeVersion = siteNodeVersionCandidate;
          }
        }
      }
View Full Code Here

   * This method returns the latest sitenodeVersion there is for the given siteNode.
   */
 
  public SiteNodeVersion getLatestActiveSiteNodeVersion(Integer siteNodeId, Database db) throws SystemException, Exception
  {
    SiteNodeVersion siteNodeVersion = null;
   
      String versionKey = "" + siteNodeId + "_" + getOperatingMode() + "_siteNodeVersionId";   
     
    //Integer siteNodeVersionId = (Integer)CacheController.getCachedObject("latestSiteNodeVersionCache", versionKey);
    Integer siteNodeVersionId = (Integer)CacheController.getCachedObjectFromAdvancedCache("latestSiteNodeVersionCache", versionKey);
    if(siteNodeVersionId != null)
    {
        logger.info("There was a cached sitenode version id:" + siteNodeVersionId);
        siteNodeVersion = (SiteNodeVersion)getObjectWithId(SiteNodeVersionImpl.class, siteNodeVersionId, db);
    }
    else
    {
      OQLQuery oql = db.getOQLQuery( "SELECT cv FROM org.infoglue.cms.entities.structure.impl.simple.SiteNodeVersionImpl cv WHERE cv.owningSiteNode.siteNodeId = $1 AND cv.stateId >= $2 AND cv.isActive = $3 ORDER BY cv.siteNodeVersionId desc");
      oql.bind(siteNodeId);
      oql.bind(getOperatingMode());
      oql.bind(true);
     
      QueryResults results = oql.execute(Database.READONLY);
     
      if (results.hasMore())
        {
          siteNodeVersion = (SiteNodeVersion)results.next();
          //CacheController.cacheObject("latestSiteNodeVersionCache", versionKey, siteNodeVersion.getId());
            String groupKey1 = CacheController.getPooledString(4, siteNodeVersion.getId());
            String groupKey2 = CacheController.getPooledString(3, siteNodeId);

            CacheController.cacheObjectInAdvancedCache("latestSiteNodeVersionCache", versionKey, siteNodeVersion.getId(), new String[]{groupKey1, groupKey2}, true);
         
   
      results.close();
      oql.close();
    }
View Full Code Here

     
      QueryResults results = oql.execute(Database.READONLY);
     
      if (results.hasMore())
        {
          SiteNodeVersion siteNodeVersion = (SiteNodeVersion)results.next();
          siteNodeVersionVO = siteNodeVersion.getValueObject();
         
          //CacheController.cacheObject("latestSiteNodeVersionCache", versionKey, siteNodeVersionVO);
            String groupKey1 = CacheController.getPooledString(4, siteNodeVersion.getId());
            String groupKey2 = CacheController.getPooledString(3, siteNodeId);

            CacheController.cacheObjectInAdvancedCache("latestSiteNodeVersionCache", versionKey, siteNodeVersionVO, new String[]{groupKey1, groupKey2}, true);
          }
   
View Full Code Here

                        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())
View Full Code Here

   
        beginTransaction(db);

        try
        {
          SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
          serviceBinding = new ServiceBindingImpl();
          serviceBinding.setValueObject(serviceBindingVO);
          serviceBinding.setAvailableServiceBinding((AvailableServiceBindingImpl)AvailableServiceBindingController.getController().getAvailableServiceBindingWithId(availableServiceBindingId, db));
          serviceBinding.setServiceDefinition((ServiceDefinitionImpl)ServiceDefinitionController.getController().getServiceDefinitionWithId(serviceDefinitionId, db));
          serviceBinding.setSiteNodeVersion((SiteNodeVersionImpl)siteNodeVersion);
     
      //siteNodeVersion.getServiceBindings().add(serviceBinding);
     
          logger.info("createEntity: " + serviceBinding.getSiteNodeVersion().getSiteNodeVersionId());
                     
            serviceBinding.setBindingQualifyers(QualifyerController.createQualifyers(qualifyerXML, serviceBinding));
          db.create(serviceBinding);
           
      siteNodeVersion.getServiceBindings().add(serviceBinding);

            RegistryController.getController().updateSiteNodeVersionThreaded(siteNodeVersion.getValueObject());

            commitTransaction(db);
        }
        catch(Exception e)
        {
View Full Code Here

   
    ServiceBinding serviceBinding = null;
   
    try
    {
      SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionId, db);
      serviceBinding = new ServiceBindingImpl();
      serviceBinding.setValueObject(serviceBindingVO);
      serviceBinding.setAvailableServiceBinding((AvailableServiceBindingImpl)AvailableServiceBindingController.getController().getAvailableServiceBindingWithId(availableServiceBindingId, db));
      serviceBinding.setServiceDefinition((ServiceDefinitionImpl)ServiceDefinitionController.getController().getServiceDefinitionWithId(serviceDefinitionId, db));
      serviceBinding.setSiteNodeVersion((SiteNodeVersionImpl)siteNodeVersion);
     
      //siteNodeVersion.getServiceBindings().add(serviceBinding);
     
      logger.info("createEntity: " + serviceBinding.getSiteNodeVersion().getSiteNodeVersionId());
                     
      serviceBinding.setBindingQualifyers(QualifyerController.createQualifyers(qualifyerXML, serviceBinding));
      db.create((ServiceBinding)serviceBinding);
     
      siteNodeVersion.getServiceBindings().add(serviceBinding);
     
            RegistryController.getController().updateSiteNodeVersionThreaded(siteNodeVersion.getValueObject());
    }
    catch(Exception e)
    {
      logger.error("An error occurred so we should not complete the transaction:" + e, e);
      e.printStackTrace();
View Full Code Here

TOP

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

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.