Package com.jdkcn.myblog.exception

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


  @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

   */
  @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

TOP

Related Classes of com.jdkcn.myblog.exception.DuplicateException

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.