Package org.infoglue.cms.exception

Examples of org.infoglue.cms.exception.ConstraintException


        try
        {
          ServiceDefinition serviceDefinition = getServiceDefinitionWithId(vo.getServiceDefinitionId(), db);
        if(serviceDefinition.getName().equalsIgnoreCase("Core content service") || serviceDefinition.getName().equalsIgnoreCase("Core structure service"))
        {
          throw new ConstraintException("ServiceDefinition.deleteAction", "3200");
       
        }
        catch(ConstraintException ce)
        {
          throw ce;
View Full Code Here


  {
      if(userName.equals(CmsPropertyHandler.getAnonymousUser()))
          throw new SystemException("You must not change password on this user as it's needed by the system.");

      if(!newPassword.equals(verifiedNewPassword))
          throw new ConstraintException("SystemUser.newPassword", "309");
     
      UserControllerProxy.getController().updateUserPassword(this.userName, this.oldPassword, this.newPassword);
   
      if(this.returnAddress != null && !this.returnAddress.equalsIgnoreCase(""))
      {
View Full Code Here

    {
      if(userName.equals(CmsPropertyHandler.getAnonymousUser()))
            throw new SystemException("You must not change password on this user as it's needed by the system.");

        if(!newPassword.equals(verifiedNewPassword))
            throw new ConstraintException("SystemUser.newPassword", "309");
       
        UserControllerProxy.getController().updateUserPassword(this.userName, this.oldPassword, this.newPassword);
    }
    catch(ConstraintException e)
        {
View Full Code Here

    }
    catch(ConstraintException ce)
    {
      returnAddress = "ViewRepository.action?repositoryId=" + this.repositoryVO.getId();
      if(ce.getErrorCode().equals("3300") && ce.getFieldName().equals("ContentVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3307", ce.getExtraInformation());
      else if(ce.getErrorCode().equals("3400") && ce.getFieldName().equals("SiteNodeVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3406", ce.getExtraInformation());
      else
        throw ce;
    }
  }
View Full Code Here

    }
    catch(ConstraintException ce)
    {
      returnAddress = "ViewRepository.action?repositoryId=" + this.repositoryVO.getId();
      if(ce.getErrorCode().equals("3300") && ce.getFieldName().equals("ContentVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3307", ce.getExtraInformation());
      else if(ce.getErrorCode().equals("3400") && ce.getFieldName().equals("SiteNodeVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3406", ce.getExtraInformation());
      else
        throw ce;
    }
  }
View Full Code Here

    }
    catch(ConstraintException ce)
    {
      returnAddress = "ViewRepository.action?repositoryId=" + this.repositoryVO.getId();
      if(ce.getErrorCode().equals("3300") && ce.getFieldName().equals("ContentVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3307", ce.getExtraInformation());
      else if(ce.getErrorCode().equals("3400") && ce.getFieldName().equals("SiteNodeVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3406", ce.getExtraInformation());
      else
        throw ce;
    }
  }
View Full Code Here

    }
    catch(ConstraintException ce)
    {
      returnAddress = "ViewRepository.action?repositoryId=" + this.repositoryVO.getId();
      if(ce.getErrorCode().equals("3300") && ce.getFieldName().equals("ContentVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3307", ce.getExtraInformation());
      else if(ce.getErrorCode().equals("3400") && ce.getFieldName().equals("SiteNodeVersion.stateId")) 
        throw new ConstraintException("ContentVersion.stateId", "3406", ce.getExtraInformation());
      else
        throw ce;
    }
  }
View Full Code Here

    {
        if(!skipRelationCheck)
        {
          List referenceBeanList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), -1, false, false, db);
      if(referenceBeanList != null && referenceBeanList.size() > 0)
        throw new ConstraintException("ContentVersion.stateId", "3305");
        }
       
        Collection children = content.getChildren();
    Iterator childrenIterator = children.iterator();
    while(childrenIterator.hasNext())
    {
      Content childContent = (Content)childrenIterator.next();
      deleteRecursive(childContent, childrenIterator, db, skipRelationCheck, skipServiceBindings, forceDelete, infogluePrincipal);        
       }
    content.setChildren(new ArrayList());
   
    boolean isDeletable = getIsDeletable(content, infogluePrincipal, db);
       if(forceDelete || isDeletable)
      {
      ContentVersionController.getContentVersionController().deleteVersionsForContent(content, db, forceDelete, infogluePrincipal);     
     
      if(!skipServiceBindings)
          ServiceBindingController.deleteServiceBindingsReferencingContent(content, db);
     
      if(parentIterator != null)
          parentIterator.remove();
       
        db.remove(content);
           
            Map args = new HashMap();
            args.put("globalKey", "infoglue");
            PropertySet ps = PropertySetManager.getInstance("jdbc", args);

            ps.remove( "content_" + content.getContentId() + "_allowedContentTypeNames");
            ps.remove( "content_" + content.getContentId() + "_defaultContentTypeName");
            ps.remove( "content_" + content.getContentId() + "_initialLanguageId");

      }
      else
      {
        throw new ConstraintException("ContentVersion.stateId", "3300", content.getName());
      }     
    }       
View Full Code Here

        contentVO.validate();
   
    if(newParentContentId == null)
        {
          logger.warn("You must specify the new parent-content......");
          throw new ConstraintException("Content.parentContentId", "3303");
        }

        if(contentVO.getId().intValue() == newParentContentId.intValue())
        {
          logger.warn("You cannot have the content as it's own parent......");
          throw new ConstraintException("Content.parentContentId", "3301");
        }
   
    Content content          = getMediumContentWithId(contentVO.getContentId(), db);
        //oldParentContent = content.getParentContent();
        //newParentContent = getContentWithId(newParentContentId, db);
                   
        if(content.getValueObject().getParentContentId() == null || content.getValueObject().getParentContentId().intValue() == newParentContentId.intValue())
        {
          logger.warn("You cannot specify the same folder as it originally was located in......");
          throw new ConstraintException("Content.parentContentId", "3304");
        }

    //ContentVO tempContent = newParentContent.getParentContent();
    ContentVO newParentContentVO = getContentVOWithId(newParentContentId, db);
   
    Integer parentContentId = newParentContentVO.getParentContentId();
    while(parentContentId != null)
    {
      ContentVO tempContent = getContentVOWithId(parentContentId, db);
      if(tempContent.getId().intValue() == content.getId().intValue())
      {
        logger.warn("You cannot move the content to a child under it......");
            throw new ConstraintException("Content.parentContentId", "3302");
      }
      parentContentId = tempContent.getParentContentId();
    }                   
       
        //oldParentContent.getChildren().remove(content);
View Full Code Here

  public void moveDigitalAsset(InfoGluePrincipal principal, Integer digitalAssetId, Integer contentId, Boolean fixReferences, Database db) throws ConstraintException, SystemException, Exception
    {
    if(contentId == null)
        {
          logger.warn("You must specify the new content......");
      throw new ConstraintException("Content.parentContentId", "3303");
        }
   
    List<SmallestContentVersionVO> versions = DigitalAssetController.getController().getContentVersionVOListConnectedToAssetWithId(digitalAssetId);
    Integer languageId = null;
    for(SmallestContentVersionVO version : versions)
    {
      languageId = version.getLanguageId();
    }
   
    if(languageId == null)
    {
      logger.warn("You must specify the new content......");
      throw new ConstraintException("Content.mustHaveSameLanguage", "3309");
    }
   
    MediumContentVersionImpl selfNewVersion = null;
    ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentId, languageId, db);

    if(contentVersionVO == null)
    {
      logger.warn("There must be a version....");
      throw new ConstraintException("Content.mustHaveSameLanguage", "3309");
    }
 
    MediumContentVersionImpl contentVersion = ContentVersionController.getContentVersionController().checkStateAndChangeIfNeeded(contentVersionVO.getId(), principal, db);
    if(contentVersion.getId() > contentVersionVO.getId())
    {
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.