Example #1
0
  @Override
  public LRSResponse updateAgentProfile(AgentProfileDocument profile) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", profile.getId());
    queryParams.put("agent", profile.getAgent().toJSON(this.getVersion(), this.usePrettyJSON()));

    return updateDocument("agents/profile", queryParams, profile);
  }
Example #2
0
  @Override
  public LRSResponse deleteAgentProfile(AgentProfileDocument profile) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", profile.getId());
    queryParams.put("agent", profile.getAgent().toJSON(this.getVersion(), this.usePrettyJSON()));
    // TODO: need to pass Etag?

    return deleteDocument("agents/profile", queryParams);
  }
Example #3
0
  @Override
  public AgentProfileLRSResponse retrieveAgentProfile(String id, Agent agent) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", id);
    queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON()));

    AgentProfileDocument profileDocument = new AgentProfileDocument();
    profileDocument.setId(id);
    profileDocument.setAgent(agent);

    LRSResponse lrsResp = getDocument("agents/profile", queryParams, profileDocument);

    AgentProfileLRSResponse lrsResponse =
        new AgentProfileLRSResponse(lrsResp.getRequest(), lrsResp.getResponse());
    lrsResponse.setSuccess(lrsResp.getSuccess());

    if (lrsResponse.getResponse().getStatus() == 200) {
      lrsResponse.setContent(profileDocument);
    }

    return lrsResponse;
  }