Skip to content

Commit

Permalink
Merge pull request #18 from protegeproject/sharing_settings_fix
Browse files Browse the repository at this point in the history
Fixed some serialization issues for GetProjectSharingSettingsResult a…
  • Loading branch information
alexsilaghi committed Jul 30, 2024
2 parents 3547751 + 2d6798f commit ebd91db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package edu.stanford.protege.webprotege.sharing;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.*;
import edu.stanford.protege.webprotege.dispatch.Result;

import static com.google.common.base.Preconditions.checkNotNull;
Expand All @@ -11,7 +11,7 @@
* 07/02/15
*/
@JsonTypeName("webprotege.projects.GetProjectSharingSettings")
public record GetProjectSharingSettingsResult(ProjectSharingSettings settings) implements Result {
public record GetProjectSharingSettingsResult(@JsonProperty("settings") ProjectSharingSettings settings) implements Result {

public GetProjectSharingSettingsResult(ProjectSharingSettings settings) {
this.settings = checkNotNull(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ProjectSharingSettings implements Serializable {
private final List<SharingSetting> sharingSettings = new ArrayList<>();

@Nullable
private SharingPermission linkSharingPermission = null;
private final SharingPermission linkSharingPermission;

@JsonCreator
public ProjectSharingSettings(@JsonProperty("projectId") ProjectId projectId,
Expand All @@ -38,14 +38,17 @@ public ProjectSharingSettings(@JsonProperty("projectId") ProjectId projectId,
this.linkSharingPermission = checkNotNull(linkSharingPermission).orElse(null);
}

@JsonProperty("projectId")
public ProjectId getProjectId() {
return projectId;
}

@JsonProperty("sharingSettings")
public List<SharingSetting> getSharingSettings() {
return new ArrayList<>(sharingSettings);
}

@JsonProperty("linkSharingPermission")
public Optional<SharingPermission> getLinkSharingPermission() {
return Optional.ofNullable(linkSharingPermission);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public enum SharingPermission implements Serializable {
*/
EDIT,

ICD_EDIT,

/**
* A user can manage a project
*/
Expand Down

0 comments on commit ebd91db

Please sign in to comment.