From 8ecee59da91e8e73949482c45915bd04670a24bc Mon Sep 17 00:00:00 2001 From: NMerz Date: Sun, 29 Nov 2020 15:45:08 -0500 Subject: [PATCH] Make ListShareGET work Fix absolute functionality-breaking bugs. There is still a fair amount of funkiness and lack of polish (such as having other and entried in the Lambda return). In addition, the NULL uiPositions that got put in the database may need cleaning up manually. --- Lambdas/Lists/ListShare/src/ListShare.java | 39 +++++++++++++++++++ .../com/example/listify/data/ListShare.java | 10 ++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Lambdas/Lists/ListShare/src/ListShare.java b/Lambdas/Lists/ListShare/src/ListShare.java index d73368d..60e3fde 100644 --- a/Lambdas/Lists/ListShare/src/ListShare.java +++ b/Lambdas/Lists/ListShare/src/ListShare.java @@ -5,14 +5,53 @@ import java.util.ArrayList; public class ListShare { Integer listID; String shareWithEmail; + Integer permissionLevel; + Integer uiPosition; ArrayList other; public ListShare(ResultSet listRow) throws SQLException { this.listID = listRow.getInt("listID"); this.shareWithEmail = listRow.getString("userID"); + this.permissionLevel = listRow.getInt("permissionLevel"); + this.uiPosition = listRow.getInt("uiPosition"); other = new ArrayList<>(); } + @Override + public String toString() { + return "ListShare{" + + "listID=" + listID + + ", shareWithEmail='" + shareWithEmail + '\'' + + ", permissionLevel=" + permissionLevel + + ", uiPosition=" + uiPosition + + ", other=" + other + + '}'; + } + + public Integer getPermissionLevel() { + return permissionLevel; + } + + public void setPermissionLevel(Integer permissionLevel) { + this.permissionLevel = permissionLevel; + } + + public Integer getUiPosition() { + return uiPosition; + } + + public void setUiPosition(Integer uiPosition) { + this.uiPosition = uiPosition; + } + + public ArrayList getOther() { + return other; + } + + public void setOther(ArrayList other) { + this.other = other; + } + public Integer getListID() { return listID; } diff --git a/Listify/app/src/main/java/com/example/listify/data/ListShare.java b/Listify/app/src/main/java/com/example/listify/data/ListShare.java index 50765cb..3958df8 100644 --- a/Listify/app/src/main/java/com/example/listify/data/ListShare.java +++ b/Listify/app/src/main/java/com/example/listify/data/ListShare.java @@ -11,6 +11,7 @@ public class ListShare { String shareWithEmail; final ListShare[] other; Integer permissionLevel; + Integer uiPosition; private static final Map keysToPerms; static { @@ -24,11 +25,17 @@ public class ListShare { keysToPerms = Collections.unmodifiableMap(keysToPermsTemp); } - public ListShare(Integer listID, String shareWithEmail, Integer permissionLevel, ListShare[] other) { + public ListShare(Integer listID, String shareWithEmail, Integer permissionLevel, Integer uiPosition, ListShare[] other) { this.listID = listID; this.shareWithEmail = shareWithEmail; this.permissionLevel = permissionLevel; this.other = other; + this.uiPosition = uiPosition; + } + + public ListShare(Integer listID, String shareWithEmail, String permissionsRaw, Integer uiPosition, ListShare[] other) { + this(listID, shareWithEmail, permissionsRaw, other); + this.uiPosition = uiPosition; } public ListShare(Integer listID, String shareWithEmail, String permissionsRaw, ListShare[] other) { @@ -42,6 +49,7 @@ public class ListShare { permissionLevel *= keytoPermEntry.getKey(); } } + this.uiPosition = -1; } @Override