Package com.dotmarketing.exception

Examples of com.dotmarketing.exception.DotDataException


      TreeFactory.saveTree(tree);
    }
    try {
      catCache.removeParents(child);
    } catch (DotCacheException e) {
      throw new DotDataException(e.getMessage(), e);
    }
  }
View Full Code Here


        }
        if(cat != null)
          try {
            catCache.put(cat);
          } catch (DotCacheException e) {
            throw new DotDataException(e.getMessage(), e);
          }
      }
    } catch (SQLException e) {
      try {
        conn.rollback();
View Full Code Here

        }
        if(cat != null)
          try {
            catCache.put(cat);
          } catch (DotCacheException e) {
            throw new DotDataException(e.getMessage(), e);
          }
      }

    } catch (SQLException e) {
      try {
View Full Code Here

  @Override
  protected Versionable findWorkingVersion(String id) throws DotDataException, DotStateException {

    Identifier identifier = iapi.find(id);
    if(identifier==null || !InodeUtils.isSet(identifier.getInode())){
      throw new DotDataException("identifier:" + id +" not found");
    }
    if(identifier.getAssetType().equals("contentlet"))
        throw new DotDataException("Contentlets could have working versions for each language");

    VersionInfo vinfo = getVersionInfo(identifier.getId());

    Class clazz = InodeUtils.getClassByDBType(identifier.getAssetType());
    HibernateUtil dh = new HibernateUtil(clazz);
View Full Code Here

  @Override
  protected Versionable findLiveVersion(String id) throws DotDataException, DotStateException {
    Identifier identifier = iapi.find(id);
    if(identifier==null || !InodeUtils.isSet(identifier.getInode())){
      throw new DotDataException("identifier:" + id +" not found");
    }
    if(identifier.getAssetType().equals("contentlet"))
            throw new DotDataException("Contentlets could have live versions for each language");

    VersionInfo vinfo = getVersionInfo(identifier.getId());

    Class clazz = InodeUtils.getClassByDBType(identifier.getAssetType());
    if(UtilMethods.isSet(vinfo)) {
View Full Code Here

  }
  @Override
  protected Versionable findDeletedVersion(String id) throws DotDataException, DotStateException {
    Identifier identifier = iapi.find(id);
    if(identifier ==null){
      throw new DotDataException("identifier:" + id +" not found");
    }
    Class clazz = InodeUtils.getClassByDBType(identifier.getAssetType());
    HibernateUtil dh = new HibernateUtil(clazz);
    dh.setQuery("from inode in class " + clazz.getName() + " where identifier = ? and inode.type='" + identifier.getAssetType() + "' and deleted="
        + DbConnectionFactory.getDBTrue());
View Full Code Here

  }
  @Override
  protected List<Versionable> findAllVersions(String id) throws DotDataException, DotStateException {
    Identifier identifier = iapi.find(id);
    if(identifier ==null){
      throw new DotDataException("identifier:" + id +" not found");
    }
    Class clazz = InodeUtils.getClassByDBType(identifier.getAssetType());
    if(clazz.equals(Inode.class))
        return new ArrayList<Versionable>(1);
    HibernateUtil dh = new HibernateUtil(clazz);
View Full Code Here

        VersionInfo vi=(VersionInfo) findVersionInfoFromDb(ident);
        boolean isNew = vi==null || !InodeUtils.isSet(vi.getIdentifier());
        try {
      BeanUtils.copyProperties(vi, info);
    } catch (Exception e) {
      throw new DotDataException(e.getMessage());
    }

        if(updateVersionTS) {
          vi.setVersionTs(new Date());
        }
View Full Code Here

      }
      boolean isNew = vi==null || !InodeUtils.isSet(vi.getIdentifier());
        try {
      BeanUtils.copyProperties(vi, cvInfo);
    } catch (Exception e) {
      throw new DotDataException(e.getMessage());
    }
        if(updateVersionTS){
          vi.setVersionTs(new Date());
        }
      if(isNew) {
View Full Code Here

    boolean pageExists = (existingHTMLPage != null) && InodeUtils.isSet(existingHTMLPage.getInode());

    if (pageExists) {

            if ( newHtmlPage.getIdentifier() != null && !newHtmlPage.getIdentifier().equals( existingHTMLPage.getIdentifier() ) ) {
                throw new DotDataException( "You are trying to save a page with the same name and location but a different identifier. " +
                        "If you are trying to push Publish you may have to rename the folder [" + parentFolder.getPath() + "]. " +
                        "HTMLPage trying to save [" + newHtmlPage.getIdentifier() + "], found HTMLPage [" + existingHTMLPage.getIdentifier() + "]" );
            }

      if (!permissionAPI.doesUserHavePermission(existingHTMLPage, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)) {
        throw new DotSecurityException("You don't have permission to read the HTML page.");
      }
    }

    if (!permissionAPI.doesUserHavePermission(template, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to read the template or the template is not published.");
    }

    if (!permissionAPI.doesUserHavePermission(parentFolder, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to write in the destination folder.");
    }

    try {
        newHtmlPage.setModUser(user.getUserId());
        newHtmlPage.setModDate(new Date());
       
      boolean previousShowMenu = false;

      // parent identifier for this file
      Identifier identifier = null;

      if (pageExists) {
        previousShowMenu = existingHTMLPage.isShowOnMenu();
        identifier = (Identifier) APILocator.getIdentifierAPI().find(existingHTMLPage);
      }

      // Some checks

      // Get asset host based on the parentFolder of the asset
      Host host = hostAPI.findParentHost(parentFolder, user, false);

      // get an identifier based on this new uri
      Identifier testIdentifier = (Identifier) APILocator.getIdentifierAPI().find(host, newHtmlPage.getURI(parentFolder));
     
      // if this is a new htmlpage and there is already an identifier with
      // this uri, return
      if ((existingHTMLPage != null) && !InodeUtils.isSet(existingHTMLPage.getInode()) && InodeUtils.isSet(testIdentifier.getInode())) {
        existingHTMLPage.setParent(parentFolder.getInode());
        throw new DotDataException("Another page with the same page url exists in this folder");
      }
      // if this is an existing htmlpage and there is already an
      // identifier
      // with this uri, return
      else if (pageExists
          && (!testIdentifier.getInode().equalsIgnoreCase(identifier.getInode()))
          && InodeUtils.isSet(testIdentifier.getInode())) {
        // when there is an error saving should unlock working asset
        unLockAsset(existingHTMLPage);
        throw new DotDataException("Another page with the same page url exists in this folder");
      }
      if (template != null) {
        // Adds template children from selected box
        Identifier templateIdentifier = APILocator.getIdentifierAPI().find(template);
View Full Code Here

TOP

Related Classes of com.dotmarketing.exception.DotDataException

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.