Skip to content

Commit

Permalink
Online Student Scheduling: Banner XE Interface
Browse files Browse the repository at this point in the history
- first attempt on using the admin feature (introduced in Banner XE API 9.3)
- when banner.xe.admin is set to true (default is false), users with StudentSchedulingAdvisor permission have the systemIn parameter set to SB
  (this means that no PIN is required; to fix the issue with GET request not having the admin capabilities -- an empty POST request is used to check the current registration instead)
  • Loading branch information
tomas-muller committed Sep 30, 2015
1 parent 3346fba commit 38fa5bd
Show file tree
Hide file tree
Showing 2 changed files with 222 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ public boolean canDrop() {
}

public boolean canAdd() {
return !"DD".equals(courseRegistrationStatus);
// return !"DD".equals(courseRegistrationStatus);
if (registrationActions != null)
for (RegistrationAction action: registrationActions) {
if ("RW".equals(action.courseRegistrationStatus))
return true;
}
return false;
}

public boolean isRegistered() {
Expand Down Expand Up @@ -155,11 +161,16 @@ public static class RegisterResponse {

public static class CourseReferenceNumber {
public String courseReferenceNumber;
public String courseRegistrationStatus;

public CourseReferenceNumber() {}
public CourseReferenceNumber(String crn) {
this.courseReferenceNumber = crn;
}
public CourseReferenceNumber(String crn, String status) {
this.courseReferenceNumber = crn;
this.courseRegistrationStatus = status;
}
}

public static class RegisterAction {
Expand All @@ -180,11 +191,12 @@ public static class RegisterRequest {
public String bannerId;
public String term;
public String altPin;
public String systemIn;
public List<CourseReferenceNumber> courseReferenceNumbers;
public List<RegisterAction> actionsAndOptions;

public RegisterRequest(String term, String bannerId, String pin) {
this.term = term; this.bannerId = bannerId; this.altPin = pin;
public RegisterRequest(String term, String bannerId, String pin, boolean admin) {
this.term = term; this.bannerId = bannerId; this.altPin = pin; this.systemIn = (admin ? "SB" : "WA");
}

public RegisterRequest drop(String crn) {
Expand All @@ -193,13 +205,35 @@ public RegisterRequest drop(String crn) {
return this;
}

public RegisterRequest add(String crn) {
public RegisterRequest keep(String crn) {
if (courseReferenceNumbers == null)
courseReferenceNumbers = new ArrayList<XEInterface.CourseReferenceNumber>();
courseReferenceNumbers.add(new CourseReferenceNumber(crn));
return this;
}

public RegisterRequest add(String crn, boolean changeStatus) {
if (changeStatus) {
if (actionsAndOptions == null) actionsAndOptions = new ArrayList<RegisterAction>();
actionsAndOptions.add(new RegisterAction("RW", crn));
} else {
if (courseReferenceNumbers == null)
courseReferenceNumbers = new ArrayList<XEInterface.CourseReferenceNumber>();
if ("SB".equals(systemIn))
courseReferenceNumbers.add(new CourseReferenceNumber(crn, "RW"));
else
courseReferenceNumbers.add(new CourseReferenceNumber(crn));
}
return this;
}

public RegisterRequest empty() {
if (courseReferenceNumbers == null)
courseReferenceNumbers = new ArrayList<XEInterface.CourseReferenceNumber>();
courseReferenceNumbers.add(new CourseReferenceNumber());
return this;
}

public boolean isEmpty() {
return (actionsAndOptions == null || actionsAndOptions.isEmpty()) && (courseReferenceNumbers == null || courseReferenceNumbers.isEmpty());
}
Expand Down
Loading

0 comments on commit 38fa5bd

Please sign in to comment.