예제 #1
0
  @Override
  public StateLRSResponse retrieveState(
      String id, Activity activity, Agent agent, UUID registration) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("stateId", id);
    queryParams.put("activityId", activity.getId().toString());
    queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON()));

    StateDocument stateDocument = new StateDocument();
    stateDocument.setId(id);
    stateDocument.setActivity(activity);
    stateDocument.setAgent(agent);

    LRSResponse lrsResp = getDocument("activities/state", queryParams, stateDocument);

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

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

    return lrsResponse;
  }
예제 #2
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);
  }
예제 #3
0
  @Override
  public LRSResponse updateActivityProfile(ActivityProfileDocument profile) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", profile.getId());
    queryParams.put("activityId", profile.getActivity().getId().toString());

    return updateDocument("activities/profile", queryParams, profile);
  }
예제 #4
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);
  }
예제 #5
0
  @Override
  public LRSResponse deleteActivityProfile(ActivityProfileDocument profile) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", profile.getId());
    queryParams.put("activityId", profile.getActivity().getId().toString());
    // TODO: need to pass Etag?

    return deleteDocument("activities/profile", queryParams);
  }
예제 #6
0
  @Override
  public LRSResponse updateState(StateDocument state) {
    HashMap<String, String> queryParams = new HashMap<String, String>();

    queryParams.put("stateId", state.getId());
    queryParams.put("activityId", state.getActivity().getId().toString());
    queryParams.put("agent", state.getAgent().toJSON(this.getVersion(), this.usePrettyJSON()));

    return updateDocument("activities/state", queryParams, state);
  }
예제 #7
0
  @Override
  public LRSResponse clearState(Activity activity, Agent agent, UUID registration) {
    HashMap<String, String> queryParams = new HashMap<String, String>();

    queryParams.put("activityId", activity.getId().toString());
    queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON()));
    if (registration != null) {
      queryParams.put("registration", registration.toString());
    }
    return deleteDocument("activities/state", queryParams);
  }
예제 #8
0
  @Override
  public ProfileKeysLRSResponse retrieveStateIds(
      Activity activity, Agent agent, UUID registration) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("activityId", activity.getId().toString());
    queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON()));
    if (registration != null) {
      queryParams.put("registration", registration.toString());
    }

    return getProfileKeys("activities/state", queryParams);
  }
예제 #9
0
  @Override
  public ProfileKeysLRSResponse retrieveAgentProfileIds(Agent agent) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON()));

    return getProfileKeys("agents/profile", queryParams);
  }
예제 #10
0
  @Override
  public ProfileKeysLRSResponse retrieveActivityProfileIds(Activity activity) {
    HashMap<String, String> queryParams = new HashMap<String, String>();

    queryParams.put("activityId", activity.getId().toString());

    return getProfileKeys("activities/profile", queryParams);
  }
예제 #11
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;
  }
예제 #12
0
  @Override
  public ActivityProfileLRSResponse retrieveActivityProfile(String id, Activity activity) {
    HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("profileId", id);
    queryParams.put("activityId", activity.getId().toString());

    ActivityProfileDocument profileDocument = new ActivityProfileDocument();
    profileDocument.setId(id);
    profileDocument.setActivity(activity);

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

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

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

    return lrsResponse;
  }