Package gwtappcontainer.shared.apis

Examples of gwtappcontainer.shared.apis.APIResponse


        (Map<String, String>) api.getAllValidPublishedContents().object;
     
      //check if tag + "_" + city is present
      String tagForCity = tag + "_" + city;
      if (all.containsKey(tagForCity)) {
        return new APIResponse(Status.SUCCESS, all.get(tagForCity));
      }
     
      //or tag + "_" + default is present
      String defaultTag = tag + "_default";
      if (all.containsKey(defaultTag)) {
        return new APIResponse(Status.SUCCESS, all.get(defaultTag));
      }
     
      //return resource not found error
      APIResponse response = new APIResponse();
      response.statusCode = Status.ERROR_RESOURCE_DOES_NOT_EXIST;
      response.userFriendlyMessage = "Could find neither tag for city [" +
          tagForCity + "] nor default tag [" + defaultTag + "]. " +
          "It could be that tags have empty content or content is not published.";
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
   
  }
View Full Code Here


    try {
      AccessController.ensureLoggedin(user);     
     
      RoleRepository.assignPrivilageToRole(role, privilege,user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "privilege [" + privilege + "] assigned to role [" + role + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

        (Map<String, String>) api.getAllValidPublishedContents().object;
     
      //check if tag + "_" + city is present
      String tagForCity = tag + "_" + city;
      if (all.containsKey(tagForCity)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForCity), "content tag = [" + tagForCity + "]");
      }
     
      //check if tag + "_" + region is present
      String tagForRegion = tag + "_" + region;
      if (all.containsKey(tagForRegion)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForRegion), "content tag = [" + tagForRegion + "]");
      }
     
      //check if tag + "_" + country is present
      String tagForCountry = tag + "_" + country;
      if (all.containsKey(tagForCountry)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForCountry), "content tag = [" + tagForCountry + "]");
      }
         
      //or tag + "_" + default is present
      String defaultTag = tag + "_default";
      if (all.containsKey(defaultTag)) {
        return new APIResponse(Status.SUCCESS, all.get(defaultTag),
            "content tag = [" + defaultTag + "]");
      }
     
      //return resource not found error
      APIResponse response = new APIResponse();
      response.statusCode = Status.ERROR_RESOURCE_DOES_NOT_EXIST;
      response.userFriendlyMessage = "Could find neither tag for city [" +
          tagForCity + "] nor tag for region [" + tagForRegion +
          "] nor tag for country [" + tagForCountry +
          "] nor default tag [" + defaultTag + "]. <br>" +
          "It could be that tags have empty content or content is not published.";
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }   
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      RoleRepository.unassignPrivilageToRole(role, privilege, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "privilege [" + privilege + "] removed from role [" + role + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);     
     
      UserRepository.addUser(email, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "user [" + email + "] has been added")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.deleteUser(email, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "user [" + email + "] has been added")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.assignPrivilegeToUser(email, privilege, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "User [" + email + "] now has privilege [" + privilege + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.unassignPrivilegeToUser(email, privilege, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "User [" + email + "] now does not have privilege [" + privilege + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.assignRoleToUser(email, role, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "User [" + email + "] now has role [" + role + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.unassignRoleToUser(email, role, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "User [" + email + "] now does not have role [" + role + "]")
     
      return response;
    } 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.