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

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


        keyword = keywordDao.findByName(key);
        // If the keyword already exists is modified
        KeywordWeight kw = keywordWeightsMap
            .get(keyword.getKeywordId());
        if (kw == null) {
          throw new InstanceNotFoundException("", null);
        }

        if (kw.getUsers().contains(user)) {
          // TODO: Sumar siempre? (si aparece en domain y en subdomain
          // serian 50.000
View Full Code Here


      key = entry.getKey();
      key = key.toLowerCase().trim();
      try {
        keyword = keywordsMap.get(key);
        if (keyword == null) {
          throw new InstanceNotFoundException("", null);
        }
        // If the keyword already exists is modified
        KeywordWeight kw = keywordWeightsMap
            .get(keyword.getKeywordId());
        if (kw == null) {
          throw new InstanceNotFoundException("", null);
        }

        if (kw.getUsers().contains(user)) {
          if (!user.admin()) {
            throw new DuplicateInstanceException(key,
View Full Code Here

                + "WHERE kwj.journal.journalId = :journalId "
                + "AND kwj.keywordWeight.keyword.keywordId = :keywordId ")
        .setParameter("journalId", journalId)
        .setParameter("keywordId", keywordId).uniqueResult();
    if (result == null) {
      throw new InstanceNotFoundException("",
          KeywordWeightJournal.class.getName());
    } else {
      return result;
    }
  }
View Full Code Here

  public Journal findByName(String name) throws InstanceNotFoundException {
    Journal journal = (Journal) getSession()
        .createQuery("SELECT j FROM Journal j WHERE j.name = :name")
        .setParameter("name", name).uniqueResult();
    if (journal == null) {
      throw new InstanceNotFoundException(name, Journal.class.getName());
    } else {
      return journal;
    }
  }
View Full Code Here

    Keyword keyword = (Keyword) getSession()
        .createQuery(
            "SELECT k FROM Keyword k WHERE LOWER(k.name) = :name")
        .setParameter("name", name.toLowerCase()).uniqueResult();
    if (keyword == null) {
      throw new InstanceNotFoundException(name, Keyword.class.getName());
    } else {
      return keyword;
    }
  }
View Full Code Here

  public User findByLogin(String login) throws InstanceNotFoundException {
    User user = (User) getSession()
        .createQuery("SELECT u FROM User u WHERE u.login = :login")
        .setParameter("login", login).uniqueResult();
    if (user == null) {
      throw new InstanceNotFoundException(login, User.class.getName());
    } else {
      return user;
    }

  }
View Full Code Here

  public User findByEmail(String email) throws InstanceNotFoundException {
    User user = (User) getSession()
        .createQuery("SELECT u FROM User u WHERE u.email = :email")
        .setParameter("email", email).uniqueResult();
    if (user == null) {
      throw new InstanceNotFoundException(email, User.class.getName());
    } else {
      return user;
    }
  }
View Full Code Here

    }
  }

  public void deleteJournal(Long journalId) throws InstanceNotFoundException {
    if (journalId == -1) {
      throw new InstanceNotFoundException(journalId,
          Journal.class.getName());
    } else {
      journalDao.remove(journalId);
    }
  }
View Full Code Here

    ReviewType reviewType = (ReviewType) getSession()
        .createQuery(
            "SELECT rt FROM ReviewType rt WHERE rt.name = :name")
        .setParameter("name", name).uniqueResult();
    if (reviewType == null) {
      throw new InstanceNotFoundException(name,
          ReviewType.class.getName());
    } else {
      return reviewType;
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public E find(PK id) throws InstanceNotFoundException {
    E entity = (E) getSession().get(entityClass, id);
    if (entity == null) {
      throw new InstanceNotFoundException(id, entityClass.getName());
    }
    return entity;
  }
View Full Code Here

TOP

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

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.