Package es.udc.tfg.journals.model.exceptions

Examples of es.udc.tfg.journals.model.exceptions.DuplicateInstanceException


        if (kw.getUsers().contains(user)) {
          // TODO: Sumar siempre? (si aparece en domain y en subdomain
          // serian 50.000
          if (!user.admin()) {
            throw new DuplicateInstanceException(key,
                KeywordWeight.class.getName());
          }
        }
        weight += kw.getWeight();
        kw.setWeight(weight);
View Full Code Here


          throw new InstanceNotFoundException("", null);
        }

        if (kw.getUsers().contains(user)) {
          if (!user.admin()) {
            throw new DuplicateInstanceException(key,
                KeywordWeight.class.getName());
          }
        }
        weight = entry.getValue();
        weight += kw.getWeight();
View Full Code Here

  public Journal createJournal(Journal journal)
      throws DuplicateInstanceException {
    try {
      journalDao.findByName(journal.getName());
      throw new DuplicateInstanceException(journal.getName(),
          Journal.class.getName());
    } catch (InstanceNotFoundException e) {
      journalDao.save(journal);
      return journal;
    }
View Full Code Here

  public ReviewType createReviewType(String reviewTypeName)
      throws DuplicateInstanceException {
    try {
      reviewTypeDao.findByName(reviewTypeName);
      throw new DuplicateInstanceException(reviewTypeName,
          ReviewType.class.getName());
    } catch (InstanceNotFoundException e) {
      ReviewType reviewType = new ReviewType(reviewTypeName);
      reviewTypeDao.save(reviewType);
      return reviewType;
View Full Code Here

  @Override
  public Review createReview(String comment, long userId, long journalId,
      List<ReviewRatingDto> reviewRatingsDto)
      throws InstanceNotFoundException, DuplicateInstanceException {
    if (reviewDao.existDuplicateReview(userId, journalId)) {
      throw new DuplicateInstanceException(comment,
          Review.class.getName());
    }
    Review review = new Review(comment);
    review.setUser(userDao.find(userId));
    review.setJournal(journalDao.find(journalId));
View Full Code Here

    try {
      aux = journalDao.findByName(editedJournal.getName());
    } catch (InstanceNotFoundException e) {
    }
    if (aux != null && journalId != aux.getJournalId()) {
      throw new DuplicateInstanceException(editedJournal.getName(),
          Journal.class.getName());
    }

    Journal journal = journalDao.find(journalId);
    journal.setName(editedJournal.getName());
View Full Code Here

  public User registerUser(String clearPassword, UserDetails userDetails)
      throws DuplicateInstanceException {
    try {
      userDao.findByEmail(userDetails.getEmail());
      throw new DuplicateInstanceException(userDetails.getEmail(),
          User.class.getName());
    } catch (InstanceNotFoundException e) {
      try {
        userDao.findByLogin(userDetails.getLogin());
        throw new DuplicateInstanceException(userDetails.getLogin(),
            User.class.getName());
      } catch (InstanceNotFoundException e1) {
        String encryptedPassword = null;
        if (clearPassword != null) {
          encryptedPassword = PasswordEncrypter.crypt(clearPassword);
View Full Code Here

    try {
      if (user.getEmail().equals(userDetails.getEmail())) {
        throw new InstanceNotFoundException(null, null);
      }
      userDao.findByEmail(userDetails.getEmail());
      throw new DuplicateInstanceException(userDetails.getEmail(),
          User.class.getName());
    } catch (InstanceNotFoundException e) {
      try {
        if (user.getLogin().equals(userDetails.getLogin())) {
          throw new InstanceNotFoundException(null, null);
        }
        userDao.findByLogin(userDetails.getLogin());
        throw new DuplicateInstanceException(userDetails.getLogin(),
            User.class.getName());
      } catch (InstanceNotFoundException e1) {
        user.setFirstName(userDetails.getFirstName());
        user.setLastName(userDetails.getLastName());
        user.setEmail(userDetails.getEmail());
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.exceptions.DuplicateInstanceException

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.