Package gwtappcontainer.shared.apis

Examples of gwtappcontainer.shared.apis.APIResponse


    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.cloneUser(newEmail, existingEmail, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "User [" + newEmail + "] added. [" + newEmail +
          "] has the same roles and privileges as [" + existingEmail + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here


  public APIResponse getUser(@Named("email") String email) {
     
    try {     
      UserProp prop = UserRepository.getUser(email);
           
      APIResponse response = new APIResponse(Status.SUCCESS, prop);
         
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

  public APIResponse getAllUsers() {
   
    try {     
      TreeSet<UserProp> props = UserRepository.getAllUsers();
           
      APIResponse response = new APIResponse(Status.SUCCESS, props);
         
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

   
    try {
      RoleRepository repository = new RoleRepository();
      List<RoleProp> allProps = repository.getAllRoles();
     
      APIResponse resp = new APIResponse();
     
      resp.object = allProps;
      resp.statusCode = Status.SUCCESS;
     
      if (0 == allProps.size())
        resp.userFriendlyMessage = "No roles available";
           
      return resp;
     
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

                                 
      RoleRepository repository = new RoleRepository();
     
      RoleProp prop = repository.addRole(role);
     
      APIResponse resp = new APIResponse();
      resp.statusCode = Status.SUCCESS;
      resp.object = prop;     
      return resp;
   
    } catch(Exception ex)  {
      return new APIResponse(ex);
    }
  }
View Full Code Here

      ensureRole(user, Role.DEVELOPER);     
                     
      RoleRepository repository = new RoleRepository();
      RoleProp prop = repository.updateRole(existingName, newName);
     
      APIResponse resp = new APIResponse();
      resp.statusCode = Status.SUCCESS;
      resp.object = prop;
      return resp;
   
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  } 
View Full Code Here

      ensureRole(user, Role.DEVELOPER);
                     
      RoleRepository repository = new RoleRepository();
      repository.deleteRole(role);
     
      APIResponse resp = new APIResponse();
      resp.statusCode = Status.SUCCESS;
     
      return resp;
   
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

  }
 
  @ApiMethod(path = "getloggedinemail", httpMethod = HttpMethod.GET)
  public APIResponse getLoggedInEmail(User user) {   
    try {
      APIResponse resp = new APIResponse();
     
      resp.object = "not logged in";   
      if (null != user)
        resp.object = user.getEmail();
     
      return resp;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

     
      UserRepository repository = new UserRepository();
      email = email.toLowerCase();
      UserProp prop = repository.getUserByEmail(email);
     
      APIResponse resp = new APIResponse();
     
      if (null == prop) {
        resp.statusCode = Status.ERROR_INVALID_USER;
        resp.object = "[" + email + "] is not set up as a user";
        return resp;
      }
           
      resp.statusCode = Status.SUCCESS;
      resp.object = prop;
     
      return resp;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

      if (user == null) {
        throw new APIException(Status.ERROR_LOGIN_REQUIRED, "Login required");
      }
     
      String email = user.getEmail();
      APIResponse resp = getRolesForUser(email);
             
      return resp;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

TOP

Related Classes of gwtappcontainer.shared.apis.APIResponse

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.