Package com.app55.domain

Examples of com.app55.domain.User


    return request;
  }

  public UserUpdateRequest updateUser(User user)
  {
    UserUpdateRequest request = new UserUpdateRequest(user);
    request.setGateway(this);
    return request;
  }
View Full Code Here


  private String    apiKey;
  private String    apiSecret;

  public Gateway(Environment environment, String apiKey, String apiSecret)
  {
    this(environment, apiKey, apiSecret, new DefaultHttpAdapter());
  }
View Full Code Here

  private String    apiKey;
  private String    apiSecret;

  public Gateway(Environment environment, String apiKey, String apiSecret)
  {
    this(environment, apiKey, apiSecret, new DefaultHttpAdapter());
  }
View Full Code Here

      String qs = fetchQueryString();
      byte[] data = fetchData(qs);
      String url = fetchUrl(qs);
      String authString = fetchAuthString();
     
      getGateway().getHttpAdapter().onSendRequest(data, url, getHttpMethod(), authString, new HttpListener() {

        @Override
        public void onResponse(HttpResponse response)
        {
          T r = processRequest(response);
View Full Code Here

      String qs = fetchQueryString();
      byte[] data = fetchData(qs);
      String url = fetchUrl(qs);
      String authString = fetchAuthString();

      getGateway().getHttpAdapter().onSendRequest(data, url, getHttpMethod(), authString, new HttpListener() {

        @Override
        public void onResponse(HttpResponse response)
        {
          T r = processRequest(response);
View Full Code Here

      String qs = fetchQueryString();
      byte[] data = fetchData(qs);
      String url = fetchUrl(qs);
      String authString = fetchAuthString();
     
      HttpResponse response = getGateway().getHttpAdapter().onSendRequest(data, url, getHttpMethod(), authString);
      return processRequest(response);
    }
    catch (ApiException a)
    {
      // This just gets rethrown
View Full Code Here

      String qs = fetchQueryString();
      byte[] data = fetchData(qs);
      String url = fetchUrl("");
      String authString = fetchAuthString();
     
      HttpResponse response = getGateway().getHttpAdapter().onSendRequest(data, url, getHttpMethod(), authString, headers);
      return processRequest(response);
    }
    catch (ApiException a)
    {
      // This just gets rethrown
View Full Code Here

      String qs = fetchQueryString();
      byte[] data = fetchData(qs);
      String url = fetchUrl(qs);
      String authString = fetchAuthString();

      HttpResponse response = getGateway().getHttpAdapter().onSendRequest(data, url, getHttpMethod(), authString);
      return processRequest(response);
    }
    catch (ApiException a)
    {
      // This just gets rethrown
View Full Code Here

   */
  @Override
  protected Response internalExecute(HttpServletRequest request, Session databaseSession) {
 
    Response response = null;
    User oldUser = null;
    HttpSession httpSession = request.getSession();
   
    // if user is not a manager, he can't continue
    if( ! ((Boolean) httpSession.getAttribute("manager")) ) {
     
      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
    try
     
      Role newRoleObject = (Role) databaseSession.createCriteria(Role.class).add(Restrictions.eq("id", this.role)).uniqueResult();
     
      if (null == newRoleObject) {
       
        return new Response(ResponseStatus.FAIL, "User role does not exist, database failure.");
      }
     
      oldUser = (User) databaseSession.createCriteria(User.class)
                  .add(Restrictions.eq("id", id))
                  .uniqueResult();
     
      if (null == oldUser) {
        throw new IllegalArgumentException("The user you are editing was not found.");
      }
     
      Transaction transaction = databaseSession.beginTransaction();     
 
      oldUser.setUsername(this.username);
      oldUser.setPassword(this.password);
      oldUser.setFullname(this.fullname);
      oldUser.setRole(newRoleObject);
      databaseSession.update(oldUser);
   
      transaction.commit();
      response = new Response(ResponseStatus.OK);
    }
View Full Code Here

   * if not - login the user.
   */
  @Override
  protected Response internalExecute(HttpServletRequest request, Session databaseSession) {
    Response response = null;
    User user = null;
   
    HttpSession httpSession = request.getSession();
    // Checks if some user is already logged-in to the system
    if( null != httpSession.getAttribute("currentUser") ) {
      return new Response(ResponseStatus.FAIL, "You are already logged-in");
    }
   
    try {
      user = (User) databaseSession.createCriteria(User.class).add(Restrictions.eq("username", this.username)).uniqueResult();

      if (null != user && user.getUsername().equals(this.username) && user.getPassword().equals(this.password)) { // user exists and password match
        // "LogIn" the user to the session
        httpSession.setAttribute("currentUser", user);
        response = new Response(ResponseStatus.OK);
      } else { // user does not exists
        response = new Response(ResponseStatus.FAIL, "Bad user password combination!");
View Full Code Here

TOP

Related Classes of com.app55.domain.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.