コード例 #1
0
  @Override
  public SharingPolicyEntry addSharingPolicy(
      User currUser,
      User sharingWith,
      SharingPolicyTypeEntry policy,
      String sharedElementID,
      String name,
      String description,
      Date lifespanstart,
      Date lifespanend) {
    try {
      URI url =
          this.urlsForSharing.forAdd(
              currUser,
              sharingWith,
              policy,
              sharedElementID,
              name,
              description,
              lifespanstart,
              lifespanend);
      String body = this.http.post(url, "", 200);
      return Json.deserialize(body, SharingPolicyEntry.class);

    } catch (IOException | URISyntaxException e) {
      throw failedToContactServer(e);
    }
  }
コード例 #2
0
  @Override
  public Set<SharingPolicyEntry> getAllIncomingSharingPolicies(User currUser) {
    try {
      URI url = this.urlsForSharing.forGetAllIncoming(currUser);
      String body = this.http.get(url, 200);
      return Json.deserializeSetOfSharingPolicyEntries(body);

    } catch (IOException | URISyntaxException e) {
      throw failedToContactServer(e);
    }
  }
コード例 #3
0
  @Override
  public SharingPolicyEntry updateSharingPolicy(
      User currUser,
      Long policyID,
      String name,
      String description,
      Date lifespanstart,
      Date lifespanend) {
    try {
      URI url =
          this.urlsForSharing.forUpdate(
              currUser, policyID, name, description, lifespanstart, lifespanend);
      String body = this.http.post(url, "", 200);
      return Json.deserialize(body, SharingPolicyEntry.class);

    } catch (IOException | URISyntaxException e) {
      throw failedToContactServer(e);
    }
  }