Package org.infoglue.cms.exception

Examples of org.infoglue.cms.exception.ConstraintException


    {
        if(!skipRelationCheck && !content.getIsDeleted())
        {
          List referenceBeanList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), -1, true, false, db);
      if(referenceBeanList != null && referenceBeanList.size() > 0 && !forceDelete)
        throw new ConstraintException("ContentVersion.stateId", "3305", "<br/><br/>" + content.getName() + " (" + content.getId() + ")");
        }
       
        Collection children = content.getChildren();
    Iterator childrenIterator = children.iterator();
    while(childrenIterator.hasNext())
    {
      Content childContent = (Content)childrenIterator.next();
      markForDeletionRecursive(childContent, childrenIterator, db, skipRelationCheck, skipServiceBindings, forceDelete, infogluePrincipal, contactPersons, notifyResponsibleOnReferenceChange);        
       }
   
    boolean isDeletable = getIsDeletable(content, infogluePrincipal, db);
       if(forceDelete || isDeletable)
      {
         List<ReferenceBean> contactList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), 100, true, true);
         //List<ReferenceBean> contactList = RegistryController.getController().deleteAllForContent(content.getId(), infoGluePrincipal, clean, CmsPropertyHandler.getOnlyShowReferenceIfLatestVersion(), db);
      if (notifyResponsibleOnReferenceChange)
      {
        if (contactList != null)
        {
          contactPersons.put(content.getValueObject(), contactList);
        }
      }
      //ContentVersionController.getContentVersionController().deleteVersionsForContent(content, db, forceDelete, infogluePrincipal);     
     
      //if(!skipServiceBindings)
         //    ServiceBindingController.deleteServiceBindingsReferencingContent(content, db);
     
         //if(parentIterator != null)
      //    parentIterator.remove();
       
        content.setIsDeleted(true);
      }
      else
      {
        throw new ConstraintException("ContentVersion.stateId", "3300", content.getName());
      }     
    }       
View Full Code Here


 
    private static void deleteRecursive(SiteNode siteNode, Iterator parentIterator, Database db, boolean forceDelete, InfoGluePrincipal infoGluePrincipal) throws ConstraintException, SystemException, Exception
    {
        List referenceBeanList = RegistryController.getController().getReferencingObjectsForSiteNode(siteNode.getId(), -1, false, db);
    if(referenceBeanList != null && referenceBeanList.size() > 0 && !forceDelete)
      throw new ConstraintException("SiteNode.stateId", "3405");

        Collection children = siteNode.getChildSiteNodes();
    Iterator i = children.iterator();
    while(i.hasNext())
    {
      SiteNode childSiteNode = (SiteNode)i.next();
      deleteRecursive(childSiteNode, i, db, forceDelete, infoGluePrincipal);
       }
    siteNode.setChildSiteNodes(new ArrayList());
   
    if(forceDelete || getIsDeletable(siteNode, infoGluePrincipal, db))
      {    
      SiteNodeVersionController.deleteVersionsForSiteNode(siteNode, db, infoGluePrincipal);
     
      ServiceBindingController.deleteServiceBindingsReferencingSiteNode(siteNode, db);

      if(parentIterator != null)
          parentIterator.remove();
     
      db.remove(siteNode);
      }
      else
      {
        throw new ConstraintException("SiteNodeVersion.stateId", "3400");
      }     
    }       
View Full Code Here

      siteNodeVO.validate();

      if(newParentSiteNodeId == null)
      {
        logger.warn("You must specify the new parent-siteNode......");
        throw new ConstraintException("SiteNode.parentSiteNodeId", "3403");
      }

      if(siteNodeVO.getId().intValue() == newParentSiteNodeId.intValue())
      {
        logger.warn("You cannot have the siteNode as it's own parent......");
        throw new ConstraintException("SiteNode.parentSiteNodeId", "3401");
      }
     
      siteNode          = getSiteNodeWithId(siteNodeVO.getSiteNodeId(), db);
      oldParentSiteNode = siteNode.getParentSiteNode();
      newParentSiteNode = getSiteNodeWithId(newParentSiteNodeId, db);

      if(oldParentSiteNode.getId().intValue() == newParentSiteNodeId.intValue())
      {
        logger.warn("You cannot specify the same node as it originally was located in......");
        throw new ConstraintException("SiteNode.parentSiteNodeId", "3404");
      }

      SiteNode tempSiteNode = newParentSiteNode.getParentSiteNode();
      while(tempSiteNode != null)
      {
        if(tempSiteNode.getId().intValue() == siteNode.getId().intValue())
        {
          logger.warn("You cannot move the node to a child under it......");
          throw new ConstraintException("SiteNode.parentSiteNodeId", "3402");
        }
        tempSiteNode = tempSiteNode.getParentSiteNode();
      }

      pageUrls = RedirectController.getController().getNiceURIMapBeforeMove(db, siteNodeVO.getRepositoryId(), siteNodeVO.getSiteNodeId(), principal);
View Full Code Here

 
   public void delete(SiteNodeVersion siteNodeVersion, Database db, boolean forceDelete) throws ConstraintException, SystemException, Exception
  {
    if (!forceDelete && siteNodeVersion.getStateId().intValue() == ContentVersionVO.PUBLISHED_STATE.intValue() && siteNodeVersion.getIsActive().booleanValue() == true)
    {
      throw new ConstraintException("SiteNodeVersion.stateId", "3300", siteNodeVersion.getOwningSiteNode().getName());
    }
   
    ServiceBindingController.deleteServiceBindingsReferencingSiteNodeVersion(siteNodeVersion, db);
      SiteNodeStateController.getController().deleteAccessRights("SiteNodeVersion", siteNodeVersion.getId(), db);
     
View Full Code Here

   public void delete(MediumSiteNodeVersionImpl siteNodeVersion, Database db, boolean forceDelete) throws ConstraintException, SystemException, Exception
  {
    if (!forceDelete && siteNodeVersion.getStateId().intValue() == ContentVersionVO.PUBLISHED_STATE.intValue() && siteNodeVersion.getIsActive().booleanValue() == true)
    {
      SiteNodeVO snVO = getSiteNodeVOWithId(siteNodeVersion.getSiteNodeId(), db);
      throw new ConstraintException("SiteNodeVersion.stateId", "3300", snVO.getName());
    }
   
    Collection serviceBindnings = siteNodeVersion.getServiceBindings();
    Iterator serviceBindningsIterator = serviceBindnings.iterator();
    while(serviceBindningsIterator.hasNext())
View Full Code Here

            siteNodeVO.validate();
           
            if(newParentSiteNodeId == null)
            {
              logger.warn("You must specify the new parent-siteNode......");
              throw new ConstraintException("SiteNode.parentSiteNodeId", "3403");
            }
            /*
            if(siteNodeVO.getId().intValue() == newParentSiteNodeId.intValue())
            {
              logger.warn("You cannot have the siteNode as it's own parent......");
              throw new ConstraintException("SiteNode.parentSiteNodeId", "3401");
            }
            */

            SiteNodeVO siteNode = getSiteNodeVOWithId(siteNodeVO.getSiteNodeId(), db);
            SiteNodeVO oldParentSiteNode = getSiteNodeVOWithId(siteNodeVO.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
            SiteNodeVO newParentSiteNode = getSiteNodeVOWithId(newParentSiteNodeId, db);

            SiteNodeVO tempSiteNode = getSiteNodeVOWithId(newParentSiteNode.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
            //SiteNode tempSiteNode = newParentSiteNode.getParentSiteNode();
      while(tempSiteNode != null)
      {
        if(tempSiteNode.getId().intValue() == siteNode.getId().intValue())
        {
          logger.warn("You cannot move the node to a child under it......");
                throw new ConstraintException("SiteNode.parentSiteNodeId", "3402");
        }
        tempSiteNode = getSiteNodeVOWithId(tempSiteNode.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
        //tempSiteNode = tempSiteNode.getParentSiteNode();
     
     
View Full Code Here

    private static void markForDeletionRecursive(SiteNode siteNode, Database db, boolean forceDelete, InfoGluePrincipal infoGluePrincipal, Map<SiteNodeVO, List<ReferenceBean>> contactPersons, boolean notifyContactPersons) throws ConstraintException, SystemException, Exception
    {
        List<ReferenceBean> referenceBeanList = RegistryController.getController().getReferencingObjectsForSiteNode(siteNode.getId(), -1, false, db);
    if(referenceBeanList != null && referenceBeanList.size() > 0 && !forceDelete)
      throw new ConstraintException("SiteNode.stateId", "3405", "<br/><br/>" + siteNode.getName() + " (" + siteNode.getId() + ")");

        @SuppressWarnings("unchecked")
    Collection<SiteNode> children = siteNode.getChildSiteNodes();
    Iterator<SiteNode> i = children.iterator();
    while(i.hasNext())
    {
      SiteNode childSiteNode = i.next();
      markForDeletionRecursive(childSiteNode, db, forceDelete, infoGluePrincipal, contactPersons, notifyContactPersons);
       }

    if(forceDelete || getIsDeletable(siteNode, infoGluePrincipal, db))
      {
      siteNode.setIsDeleted(true);
      boolean clean = true;
      if (notifyContactPersons)
      {
        clean = false;
      }
      List<ReferenceBean> contactList = RegistryController.getController().deleteAllForSiteNode(siteNode.getSiteNodeId(), infoGluePrincipal, clean, CmsPropertyHandler.getOnlyShowReferenceIfLatestVersion(), db);
      if (notifyContactPersons)
      {
        if (contactList != null)
        {
          logger.info("Found " + contactList.size() + " people to notify about SiteNode removal. SiteNode.id: " + siteNode.getSiteNodeId());
          contactPersons.put(siteNode.getValueObject(), contactList);
        }
      }
      }
      else
      {
        throw new ConstraintException("SiteNodeVersion.stateId", "3400");
      }
    }
View Full Code Here

        try
        {
            if(beforeSiteNodeId == null && direction == null)
            {
              logger.warn("You must specify the either new location with beforeSiteNodeId or sortDirection");
              throw new ConstraintException("SiteNode.parentSiteNodeId", "3403"); //TODO
            }
           
            //logger.info("siteNodeId:" + siteNodeId);
            //logger.info("beforeSiteNodeId:" + beforeSiteNodeId);
            //logger.info("direction:" + direction);
View Full Code Here

    }
  }

  private static final ConstraintException createConstraintException(String fieldName, String errorCode)
  {
    return new ConstraintException(fieldName, errorCode);
  }
View Full Code Here

  public String doUpdateAttribute() throws Exception
  {
    ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();
    if(this.newAttributeName.indexOf(" ") > -1 || this.newAttributeName.indexOf(".") > -1 || this.newAttributeName.indexOf("'") > -|| this.newAttributeName.indexOf("\"") > -1)
    {
      ceb.add(new ConstraintException("ContentTypeAttribute.updateAction", "3500"));
    }

    ceb.throwIfNotEmpty();

View Full Code Here

TOP

Related Classes of org.infoglue.cms.exception.ConstraintException

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.