Examples of DuplicateException


Examples of com.jdkcn.myblog.exception.DuplicateException

      }
      category.setCount(0);
    }
    Category exist = getByName(category.getName(), parentId);
    if (exist != null && !StringUtils.equals(category.getId(), exist.getId())) {
      throw new DuplicateException("category in parentId[" + parentId + "] duplicate with name:" + category.getName());
    }
    Category savedCategory = entityManagerProvider.get().merge(category);
    if (category.getParent() != null) {
      category.getParent().getChildren().add(savedCategory);
    }
View Full Code Here

Examples of com.jdkcn.myblog.exception.DuplicateException

  @Transactional
  public Entry saveOrUpdate(Entry entry) {
    if (StringUtils.isNotBlank(entry.getName())) {
      Entry exist = getByName(entry.getBlog().getId(), entry.getName());
      if (exist != null && !StringUtils.equals(exist.getId(), entry.getId())) {
        throw new DuplicateException("entry in blogId[" + entry.getBlog().getId() + "] duplicate with name:" + entry.getName());
      }
    }
    if (entry.getStatus() == null) {
      entry.setStatus(Status.DRAFT);
    }
View Full Code Here

Examples of com.jdkcn.myblog.exception.DuplicateException

   */
  @Transactional
  public User saveOrUpdate(User user) {
    User exist = getByUsername(user.getUsername());
    if (exist != null && !StringUtils.equals(user.getId(), exist.getId())) {
      throw new DuplicateException(User.class.getName(), "username", user.getUsername());
    }
    exist = getByEmail(user.getEmail());
    if (exist != null && !StringUtils.equals(user.getId(), exist.getId())) {
      throw new DuplicateException(User.class.getName(), "email", user.getEmail());
    }
    return entityManagerProvider.get().merge(user);
  }
View Full Code Here

Examples of hirondelle.web4j.database.DuplicateException

  @Override Id add(Member aMember) throws DAOException, DuplicateException {
    possiblyThrowExceptionFor(DbOperation.Add);
    synchronized (fMembers){
      for(Member existingMember:  fMembers.values()){
        if ( existingMember.getName().equals(aMember.getName())){
          throw new DuplicateException("Duplicate name: " + Util.quote(aMember.getName()), new Throwable());
        }
      }
      Id id = getNewId();
      //need to attach the id to the member in two ways here
      Member member = getMemberWithId(aMember, id);
View Full Code Here

Examples of hirondelle.web4j.database.DuplicateException

  */
  public static void possiblyThrowExceptionFor(DbOperation aOperation) throws DAOException, DuplicateException {
    DbOperationResult opResult = getOperationResult(aOperation);
    if (FakeDAOBehavior.DbOperationResult.Succeed == opResult) return;
    if (FakeDAOBehavior.DbOperationResult.ThrowDAOException == opResult) throw new DAOException(FORCED_FAILURE, FORCED_EXCEPTION);
    if (FakeDAOBehavior.DbOperationResult.ThrowDuplicateException == opResult) throw new DuplicateException(FORCED_FAILURE, FORCED_EXCEPTION);
  }
View Full Code Here

Examples of jnipap.DuplicateException

        case 1200:
          return new InvalidParameterException(e.getMessage());
        case 1300:
          return new NonExistentException(e.getMessage());
        case 1400:
          return new DuplicateException(e.getMessage());
        default:
          return new JnipapException(e);
      }

    }
View Full Code Here

Examples of org.apache.james.managesieve.api.DuplicateException

            DuplicateException, StorageException {
        synchronized (lock) {
            File oldFile = getScriptFile(user, oldName);
            File newFile = new File(getUserDirectory(user), newName);
            if (newFile.exists()) {
                throw new DuplicateException("User: " + user + "Script: " + newName);
            }
            boolean isActive = isActiveFile(user, oldFile);
            try {
                FileUtils.copyFile(oldFile, newFile);
                if (isActive) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.