Examples of ApiResponse


Examples of gwtappcontainer.shared.apis.APIResponse

           
      ContentRepository repository = new ContentRepository();
     
      ContentProp prop = repository.setContent(html, tag, publish);               
     
      return new APIResponse(Status.SUCCESS, prop);
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

     
      if (content.equals(""))
        throw new APIException(Status.ERROR_RESOURCE_INCORRECTLY_SPECIFIED,
            "content cannot be empty");
     
      APIResponse response = setContent(content, tag, publish, user);
      if (response.statusCode != Status.SUCCESS)
        throw new APIException(response.statusCode, response.userFriendlyMessage);
               
      return response;
     
    } catch (Exception ex) {
      return new APIResponse(ex);
   
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

          Role.PORTAL_ADMIN.toString());       
           
      ContentRepository repository = new ContentRepository();   
      ContentProp prop = repository.setPublishStatus(tag, publish);
     
      return new APIResponse(Status.SUCCESS, prop);
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
   
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

      if (prop.publish == false)
        gateKeeper.ensureValidUser(user);
           
      logger.info("returning content - " + new Gson().toJson(prop));
                       
      return new APIResponse(Status.SUCCESS, prop)
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }   
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

     
    try {
      AdminAPI adminAPI = new AdminAPI();
      String role = getContentAdminRoleForTag(tag);
     
      APIResponse resp = adminAPI.assignRoleToUser(email, role, user);
     
      return resp; 
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

      //only DEVELOPER can add tag
      ensureRole(user, Role.DEVELOPER)
     
      AdminAPI adminAPI = new AdminAPI();
      String role = getContentAdminRoleForTag(tag);
      APIResponse resp = adminAPI.addRole(role, user);
     
      return resp;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

 
  @ApiMethod(path="getalltags", httpMethod = HttpMethod.GET)
  public APIResponse getAllTags() {
    try {
      AdminAPI adminAPI = new AdminAPI();
      APIResponse resp = adminAPI.getAllRoles();
     
      @SuppressWarnings("unchecked")
      List<RoleProp> roles = (List<RoleProp>) resp.object;
     
      List<String> tags = getTagsFromRoles(roles);
     
      resp.statusCode = Status.SUCCESS;
      resp.object = tags;
      resp.userFriendlyMessage = "No of tags = " + tags.size();
     
      return resp;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

    try {
      ContentRepository repository = new ContentRepository();
     
      Map<String, String> published = repository.getAllValidPublishedContents();
     
      APIResponse response = new APIResponse(Status.SUCCESS, published);
     
      return response; 
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

      return new APIResponse(ex);
    }
  }
 
  private boolean isValidTag(String tag) {
    APIResponse resp = getAllTags();
    if (resp.statusCode != Status.SUCCESS)
      return false;
   
    @SuppressWarnings("unchecked")
    List<String> roles = (List<String>) resp.object;
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

                    resp.getWriter().println(errMessage);
                    return;
            }
          
            GeoLocationAPI api = new GeoLocationAPI();
            APIResponse response = api.getLocation(req);
            if (response.statusCode != Status.SUCCESS) {
                    String errMessage = "Unexpected error - Unable to retreive location " +
                                    "<br><br> Error message from GeoLocationAPI <br> - " +
                                    response.userFriendlyMessage;
                  
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.