Examples of SimpleMessageException


Examples of org.damour.base.client.exceptions.SimpleMessageException

  }

  public FileUploadStatus getFileUploadStatus() throws SimpleMessageException {
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }
    try {
      FileUploadStatus status = fileUploadStatusMap.get(authUser);
      if (status == null) {
        throw new SimpleMessageException("No stats currently available.");
      }
      return status;
    } catch (Throwable t) {
      Logger.log(t);
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

    try {
      Class<?> clazz = Class.forName(searchObjectType);
      return PermissibleObjectHelper.search(session.get(), user, getVoterGUID(), clazz, query, sortField, sortDescending, searchNames, searchDescriptions,
          searchKeywords, useExactPhrase);
    } catch (Throwable t) {
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

  }

  public void createTag(String tagName, String tagDescription, Tag parentTag) throws SimpleMessageException {
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }

    if (StringUtils.isEmpty(tagName)) {
      throw new SimpleMessageException("Tag name not provided.");
    }

    Tag hibParentTag = null;
    if (parentTag != null) {
      hibParentTag = ((Tag) session.get().load(Tag.class, parentTag.getId()));
    }

    Transaction tx = session.get().beginTransaction();
    try {
      Tag tag = new Tag();
      tag.setName(tagName);
      tag.setDescription(tagDescription);
      tag.setParentTag(hibParentTag);
      session.get().save(tag);
      tx.commit();
    } catch (Throwable t) {
      Logger.log(t);
      try {
        tx.rollback();
      } catch (Throwable tt) {
      }
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

  }

  public void deleteTag(final Tag tag) throws SimpleMessageException {
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }

    if (tag == null) {
      throw new SimpleMessageException("Tag not provided.");
    }

    Tag hibTag = ((Tag) session.get().load(Tag.class, tag.getId()));
    if (hibTag == null) {
      throw new SimpleMessageException("Tag not found: " + tag);
    }

    Transaction tx = session.get().beginTransaction();
    try {
      TagHelper.deleteTag(session.get(), hibTag);
      tx.commit();
    } catch (Throwable t) {
      Logger.log(t);
      try {
        tx.rollback();
      } catch (Throwable tt) {
      }
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

    addToTag(tagMembership);
  }

  public void addToTag(final TagMembership tagMembership) throws SimpleMessageException {
    if (tagMembership == null) {
      throw new SimpleMessageException("TagMembership not provided.");
    }

    if (tagMembership.getTag() == null) {
      throw new SimpleMessageException("Tag not provided.");
    }

    if (tagMembership.getPermissibleObject() == null) {
      throw new SimpleMessageException("PermissibleObject not provided.");
    }

    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }

    // assumption is that the membership does not exist but the category / permissible object do
    // they must be loaded
    Tag hibTag = ((Tag) session.get().load(Tag.class, tagMembership.getTag().getId()));
    if (hibTag == null) {
      throw new SimpleMessageException("Tag not found: " + tagMembership.getTag().getId());
    }

    PermissibleObject hibPermissibleObject = ((PermissibleObject) session.get().load(PermissibleObject.class, tagMembership.getPermissibleObject().getId()));
    if (hibPermissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not found: " + tagMembership.getPermissibleObject());
    }

    Transaction tx = session.get().beginTransaction();
    try {
      tagMembership.setTag(hibTag);
      tagMembership.setPermissibleObject(hibPermissibleObject);
      session.get().save(tagMembership);
      tx.commit();
    } catch (Throwable t) {
      Logger.log(t);
      try {
        tx.rollback();
      } catch (Throwable tt) {
      }
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

    }
  }

  public List<Tag> getTags(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not provided.");
    }
    return TagHelper.getTags(session.get(), permissibleObject);
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

  }

  public void removeFromTag(final Tag tag, final PermissibleObject permissibleObject) throws SimpleMessageException {
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }

    if (tag == null) {
      throw new SimpleMessageException("Tag not provided.");
    }

    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not provided.");
    }

    Tag hibTag = ((Tag) session.get().load(Tag.class, tag.getId()));
    if (hibTag == null) {
      throw new SimpleMessageException("Category not found: " + tag);
    }

    PermissibleObject hibPermissibleObject = ((PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId()));
    if (hibPermissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not found: " + permissibleObject);
    }

    Transaction tx = session.get().beginTransaction();
    try {
      TagMembership cm = TagHelper.getTagMembership(session.get(), hibTag, permissibleObject);
      session.get().delete(cm);
      tx.commit();
    } catch (Throwable t) {
      Logger.log(t);
      try {
        tx.rollback();
      } catch (Throwable tt) {
      }
      throw new SimpleMessageException(t.getMessage());
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

          // validation successful
          user.setValidated(true);
          login(session.get(), getThreadLocalRequest(), getThreadLocalResponse(), username, user.getPasswordHash(), true);
          tx.commit();
        } else {
          throw new SimpleMessageException("Account could not be activated, validation code does not match our records.");
        }
      } else {
        throw new SimpleMessageException("Account does not exist or is already validated.");
      }
      return user;
    } catch (Throwable t) {
      Logger.log(t);
      throw new SimpleMessageException(t.getMessage());
    } finally {
      try {
        tx.rollback();
      } catch (Throwable t) {
      }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

  public User login(HttpServletRequest request, HttpServletResponse response, String username, String password) {
    try {
      return login(session.get(), request, response, username, password, false);
    } catch (Throwable t) {
      Logger.log(t);
      throw new SimpleMessageException("Could not login.  Invalid username or password.");
    }
  }
View Full Code Here

Examples of org.damour.base.client.exceptions.SimpleMessageException

  public User login(String username, String password) throws SimpleMessageException {
    try {
      return login(session.get(), getThreadLocalRequest(), getThreadLocalResponse(), username, password, false);
    } catch (Throwable t) {
      Logger.log(t);
      throw new SimpleMessageException(t.getMessage());
    }
  }
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.