Package org.damour.base.client.objects

Examples of org.damour.base.client.objects.User


  public UserRating getUserRating(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());
      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
        throw new SimpleMessageException("User is not authorized to get rating on this content.");
      }
View Full Code Here


  public UserRating setUserRating(PermissibleObject permissibleObject, int rating) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    Transaction tx = session.get().beginTransaction();
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());

      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
View Full Code Here

  public UserThumb getUserThumb(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());
      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
        throw new SimpleMessageException("User is not authorized to get thumbs on this content.");
      }
View Full Code Here

  public UserThumb setUserThumb(PermissibleObject permissibleObject, boolean like) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    Transaction tx = session.get().beginTransaction();
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());

      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
View Full Code Here

  public List<PermissibleObject> getMostRated(int maxResults, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get().createQuery("from " + simpleClassName + " where numRatingVotes > 0 order by numRatingVotes desc")
          .setMaxResults(maxResults).setCacheable(true).list();
View Full Code Here

  public List<PermissibleObject> getTopRated(int maxResults, int minNumVotes, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get()
          .createQuery("from " + simpleClassName + " where numRatingVotes >= " + minNumVotes + " order by averageRating desc").setMaxResults(maxResults)
View Full Code Here

  public List<PermissibleObject> getBottomRated(int maxResults, int minNumVotes, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get()
          .createQuery("from " + simpleClassName + " where numRatingVotes >= " + minNumVotes + " order by averageRating asc").setMaxResults(maxResults)
View Full Code Here

  public List<PermissibleObject> getMostLiked(int maxResults, int minNumVotes, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get().createQuery("from " + simpleClassName + " where numUpVotes >= " + minNumVotes + " order by numUpVotes desc")
          .setMaxResults(maxResults).setCacheable(true).list();
View Full Code Here

  public List<PermissibleObject> getMostDisliked(int maxResults, int minNumVotes, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get()
          .createQuery("from " + simpleClassName + " where numDownVotes >= " + minNumVotes + " order by numDownVotes desc").setMaxResults(maxResults)
View Full Code Here

  public List<PermissibleObject> getCreatedSince(int maxResults, long sinceDateMillis, String classType) throws SimpleMessageException {
    if (classType == null) {
      throw new SimpleMessageException("classType not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      List<PermissibleObject> mostRated = new ArrayList<PermissibleObject>();
      String simpleClassName = Class.forName(classType).getSimpleName();
      List<PermissibleObject> list = session.get()
          .createQuery("from " + simpleClassName + " where creationDate >= " + sinceDateMillis + " order by creationDate desc").setMaxResults(maxResults)
View Full Code Here

TOP

Related Classes of org.damour.base.client.objects.User

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.