Skip to content

Commit 1fef416

Browse files
authored
Merge pull request #144 from ASSISTments/int-to-long-pr
Change Integers to Long since all numbers are defined as 64 bit in Canvas.
2 parents f97da40 + 0333007 commit 1fef416

File tree

95 files changed

+442
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+442
-444
lines changed

src/integration-test/java/edu/ksu/canvas/calendar/CalendarIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void testCreateReadDelete() throws IOException {
8181

8282
assertTrue(writtenCalendarEvent.isPresent());
8383

84-
Integer id = writtenCalendarEvent.get().getId();
84+
Long id = writtenCalendarEvent.get().getId();
8585
Optional<CalendarEvent> readCalendarEvent = reader.getCalendarEvent(id);
8686
assertTrue(readCalendarEvent.isPresent());
8787
assertEquals(writtenCalendarEvent, readCalendarEvent);
@@ -101,9 +101,9 @@ public void testRepeatingEvents() throws IOException {
101101
event.setContextCode("course_" + course);
102102
event.setStartAt(Instant.now());
103103
event.setEndAt(Instant.now().plus(1, ChronoUnit.HOURS));
104-
event.setDuplicateCount(9);
104+
event.setDuplicateCount(9L);
105105
event.setDuplicateFrequency(CalendarEvent.Frequency.DAILY);
106-
event.setDuplicateInterval(1);
106+
event.setDuplicateInterval(1L);
107107
event.setDuplicateAppend(true);
108108
writer.createCalendarEvent(event);
109109
}

src/integration-test/java/edu/ksu/canvas/contentMigration/ContentMigrationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package edu.ksu.canvas.contentmigration;
1+
package edu.ksu.canvas.contentMigration;
22

33
import edu.ksu.canvas.CanvasApiFactory;
44
import edu.ksu.canvas.interfaces.ContentMigrationReader;
@@ -70,7 +70,7 @@ public void testCreateContentMigration() throws IOException, InterruptedExceptio
7070
CreateCourseContentMigrationOptions createCourseContentMigrationOptions = new CreateCourseContentMigrationOptions(destinationCourse, course, MigrationType.course_copy_importer, false);
7171
Optional<ContentMigration> response = writer.createCourseContentMigration(createCourseContentMigrationOptions);
7272
assertNotNull(response.get().getProgressUrl());
73-
Integer migrationId = response.get().getId();
73+
Long migrationId = response.get().getId();
7474
assertNotNull(migrationId);
7575
assertEquals(user, response.get().getUserId().toString());
7676
assertEquals(MigrationType.course_copy_importer.toString(), response.get().getMigrationType());

src/main/java/edu/ksu/canvas/impl/AccountReportImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public List<AccountReport> listReports(String accountId, String report) throws I
3939
}
4040

4141
@Override
42-
public Optional<AccountReport> reportStatus(String accountId, String report, Integer id) throws IOException {
42+
public Optional<AccountReport> reportStatus(String accountId, String report, Long id) throws IOException {
4343
LOG.debug("Retrieving information about report ID " + id + " of report " + report + " for account " + accountId);
4444
String url = buildCanvasUrl("accounts/" + accountId + "/reports/" + report + "/" + id, Collections.emptyMap());
4545

@@ -55,7 +55,7 @@ public Optional<AccountReport> startReport(AccountReportOptions options) throws
5555
}
5656

5757
@Override
58-
public Optional<AccountReport> deleteReport(String accountId, String report, Integer reportId) throws IOException {
58+
public Optional<AccountReport> deleteReport(String accountId, String report, Long reportId) throws IOException {
5959
LOG.debug("Deleting report ID " + reportId + " for report " + report + " on behalf of account " + accountId);
6060
String url = buildCanvasUrl("accounts/" + accountId + "/reports/" + report + "/" + reportId, Collections.emptyMap());
6161
Response response = canvasMessenger.deleteFromCanvas(oauthToken, url, Collections.emptyMap());

src/main/java/edu/ksu/canvas/impl/AssignmentImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public Optional<Assignment> createAssignment(String courseId, Assignment assignm
6262
}
6363

6464
@Override
65-
public Optional<Assignment> deleteAssignment(String courseId, Integer assignmentId) throws IOException {
65+
public Optional<Assignment> deleteAssignment(String courseId, Long assignmentId) throws IOException {
6666
Map<String, List<String>> postParams = new HashMap<>();
6767
postParams.put("event", Collections.singletonList("delete"));
6868
String createdUrl = buildCanvasUrl("courses/" + courseId + "/assignments/" + assignmentId, Collections.emptyMap());

src/main/java/edu/ksu/canvas/impl/AssignmentOverrideImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ public AssignmentOverrideImpl(String canvasBaseUrl, Integer apiVersion, OauthTok
2929
}
3030

3131
@Override
32-
public List<AssignmentOverride> listAssignmentOverrides(String courseId, Integer assignmentId) throws IOException {
32+
public List<AssignmentOverride> listAssignmentOverrides(String courseId, Long assignmentId) throws IOException {
3333
LOG.debug("Retrieving a list of assignment overrides in course " + courseId + " for assignment " + assignmentId);
3434
String url = buildCanvasUrl("courses/" + courseId + "/assignments/" + assignmentId + "/overrides", Collections.emptyMap());
3535
return getListFromCanvas(url);
3636
}
3737

3838
@Override
39-
public Optional<AssignmentOverride> getAssignmentOverride(String courseId, Integer assignmentId, Integer overrideId) throws IOException {
39+
public Optional<AssignmentOverride> getAssignmentOverride(String courseId, Long assignmentId, Long overrideId) throws IOException {
4040
LOG.debug("Retrieving an assignment override in course " + courseId + " for assignment " + assignmentId);
4141
String url = buildCanvasUrl("courses/" + courseId + "/assignments/" + assignmentId + "/overrides/" + overrideId, Collections.emptyMap());
4242
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);

src/main/java/edu/ksu/canvas/impl/CalendarEventImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public List<CalendarEvent> listCalendarEvents(String userId, ListCalendarEventsO
6565
}
6666

6767
@Override
68-
public Optional<CalendarEvent> getCalendarEvent(Integer id) throws IOException {
68+
public Optional<CalendarEvent> getCalendarEvent(Long id) throws IOException {
6969
LOG.debug("Getting calendar event: "+ id);
7070
String url = buildCanvasUrl("/calendar_events/"+ id.toString(), Collections.emptyMap());
7171
return getFromCanvas(url);

src/main/java/edu/ksu/canvas/impl/ContentMigrationImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public ContentMigrationImpl(String canvasBaseUrl, Integer apiVersion, OauthToken
2929
}
3030

3131
@Override
32-
public Optional<ContentMigration> getCourseContentMigration(String courseId, Integer id) throws IOException {
32+
public Optional<ContentMigration> getCourseContentMigration(String courseId, Long id) throws IOException {
3333
LOG.debug("listing a content migration for the course");
3434
String url = buildCanvasUrl("courses/" + courseId + "/content_migrations/" + id.toString(), Collections.emptyMap());
3535
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
@@ -52,7 +52,7 @@ public Optional<ContentMigration> createCourseContentMigration(CreateCourseConte
5252
}
5353

5454
@Override
55-
public Optional<ContentMigration> updateCourseContentMigration(Integer id, CreateCourseContentMigrationOptions options) throws IOException {
55+
public Optional<ContentMigration> updateCourseContentMigration(Long id, CreateCourseContentMigrationOptions options) throws IOException {
5656
LOG.debug("updating course content migration");
5757
String url = buildCanvasUrl("courses/" + options.getDestinationCourseId() + "/content_migrations/" + id.toString(), Collections.emptyMap());
5858
Response response = canvasMessenger.putToCanvas(oauthToken, url, options.getOptionsMap());
@@ -61,7 +61,7 @@ public Optional<ContentMigration> updateCourseContentMigration(Integer id, Creat
6161

6262
/******************************** USERS ********************************/
6363
@Override
64-
public Optional<ContentMigration> getUserContentMigration(String userId, Integer id) throws IOException {
64+
public Optional<ContentMigration> getUserContentMigration(String userId, Long id) throws IOException {
6565
LOG.debug("listing a content migration for the user");
6666
String url = buildCanvasUrl("users/" + userId + "/content_migrations/" + id.toString(), Collections.emptyMap());
6767
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
@@ -84,7 +84,7 @@ public Optional<ContentMigration> createUserContentMigration(CreateContentMigrat
8484
}
8585

8686
@Override
87-
public Optional<ContentMigration> updateUserContentMigration(Integer id, CreateContentMigrationOptions options) throws IOException {
87+
public Optional<ContentMigration> updateUserContentMigration(Long id, CreateContentMigrationOptions options) throws IOException {
8888
LOG.debug("updating user content migration");
8989
String url = buildCanvasUrl("users/" + options.getSourceCourseId() + "/content_migrations/" + id.toString(), Collections.emptyMap());
9090
Response response = canvasMessenger.putToCanvas(oauthToken, url, options.getOptionsMap());
@@ -93,7 +93,7 @@ public Optional<ContentMigration> updateUserContentMigration(Integer id, CreateC
9393

9494
/******************************** GROUPS ********************************/
9595
@Override
96-
public Optional<ContentMigration> getGroupContentMigration(String groupId, Integer id) throws IOException {
96+
public Optional<ContentMigration> getGroupContentMigration(String groupId, Long id) throws IOException {
9797
LOG.debug("listing a content migration for the group");
9898
String url = buildCanvasUrl("groups/" + groupId + "/content_migrations/" + id.toString(), Collections.emptyMap());
9999
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
@@ -116,7 +116,7 @@ public Optional<ContentMigration> createGroupContentMigration(CreateContentMigra
116116
}
117117

118118
@Override
119-
public Optional<ContentMigration> updateGroupContentMigration(Integer id, CreateContentMigrationOptions options) throws IOException {
119+
public Optional<ContentMigration> updateGroupContentMigration(Long id, CreateContentMigrationOptions options) throws IOException {
120120
LOG.debug("updating group content migration");
121121
String url = buildCanvasUrl("groups/" + options.getSourceCourseId() + "/content_migrations/" + id.toString(), Collections.emptyMap());
122122
Response response = canvasMessenger.putToCanvas(oauthToken, url, options.getOptionsMap());
@@ -125,7 +125,7 @@ public Optional<ContentMigration> updateGroupContentMigration(Integer id, Create
125125

126126
/******************************** ACCOUNTS ********************************/
127127
@Override
128-
public Optional<ContentMigration> getAccountContentMigration(String accountId, Integer id) throws IOException {
128+
public Optional<ContentMigration> getAccountContentMigration(String accountId, Long id) throws IOException {
129129
LOG.debug("listing a content migration for the account");
130130
String url = buildCanvasUrl("accounts/" + accountId + "/content_migrations/" + id.toString(), Collections.emptyMap());
131131
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
@@ -148,7 +148,7 @@ public Optional<ContentMigration> createAccountContentMigration(CreateContentMig
148148
}
149149

150150
@Override
151-
public Optional<ContentMigration> updateAccountContentMigration(Integer id, CreateContentMigrationOptions options) throws IOException {
151+
public Optional<ContentMigration> updateAccountContentMigration(Long id, CreateContentMigrationOptions options) throws IOException {
152152
LOG.debug("updating account content migration");
153153
String url = buildCanvasUrl("accounts/" + options.getSourceCourseId() + "/content_migrations/" + id.toString(), Collections.emptyMap());
154154
Response response = canvasMessenger.putToCanvas(oauthToken, url, options.getOptionsMap());

src/main/java/edu/ksu/canvas/impl/ExternalToolImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ public ExternalToolImpl(String canvasBaseUrl, Integer apiVersion, OauthToken oau
3131
}
3232

3333
@Override
34-
public Optional<ExternalTool> getExternalToolInCourse(String courseId, Integer toolId) throws IOException {
34+
public Optional<ExternalTool> getExternalToolInCourse(String courseId, Long toolId) throws IOException {
3535
return getExternalTool("courses", courseId, toolId);
3636
}
3737

3838
@Override
39-
public Optional<ExternalTool> getExternalToolInAccount(String accountId, Integer toolId) throws IOException {
39+
public Optional<ExternalTool> getExternalToolInAccount(String accountId, Long toolId) throws IOException {
4040
return getExternalTool("accounts", accountId, toolId);
4141
}
4242

43-
private Optional<ExternalTool> getExternalTool(String objectType, String objectId, Integer toolId) throws IOException {
43+
private Optional<ExternalTool> getExternalTool(String objectType, String objectId, Long toolId) throws IOException {
4444
LOG.debug("Getting external tool " + toolId + " from " + objectType + " " + objectId);
4545
if(StringUtils.isBlank(objectId) || toolId == null) {
4646
throw new IllegalArgumentException("course/account ID and tool ID cannot be blank");
@@ -116,14 +116,14 @@ private Optional<ExternalTool> editExternalTool(String url, ExternalTool tool) t
116116
return responseParser.parseToObject(ExternalTool.class, response);
117117
}
118118

119-
public Optional<ExternalTool> deleteExternalToolInCourse(String courseId, Integer toolId) throws IOException {
119+
public Optional<ExternalTool> deleteExternalToolInCourse(String courseId, Long toolId) throws IOException {
120120
LOG.debug("Deleting external tool " + toolId + " from course " + courseId);
121121
String url = buildCanvasUrl("courses/" + courseId + "/external_tools/" + toolId, Collections.emptyMap());
122122
Response response = canvasMessenger.deleteFromCanvas(oauthToken, url, Collections.emptyMap());
123123
return responseParser.parseToObject(ExternalTool.class, response);
124124
}
125125

126-
public Optional<ExternalTool> deleteExternalToolInAccount(String accountId, Integer toolId) throws IOException {
126+
public Optional<ExternalTool> deleteExternalToolInAccount(String accountId, Long toolId) throws IOException {
127127
LOG.debug("Deleting external tool " + toolId + " from account " + accountId);
128128
String url = buildCanvasUrl("accounts/" + accountId + "/external_tools/" + toolId, Collections.emptyMap());
129129
Response response = canvasMessenger.deleteFromCanvas(oauthToken, url, Collections.emptyMap());

src/main/java/edu/ksu/canvas/impl/MigrationIssueImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,59 +27,59 @@ public MigrationIssueImpl(String canvasBaseUrl, Integer apiVersion, OauthToken o
2727
}
2828

2929
@Override
30-
public List<MigrationIssue> getCourseMigrationIssues(String courseId, Integer migrationId) throws IOException {
30+
public List<MigrationIssue> getCourseMigrationIssues(String courseId, Long migrationId) throws IOException {
3131
LOG.debug("listing the migration issues for a content migration for the course");
3232
String url = buildCanvasUrl("courses/" + courseId + "/content_migrations/" + migrationId.toString() + "/migration_issues", Collections.emptyMap());
3333
return getListFromCanvas(url);
3434
}
3535

3636
@Override
37-
public Optional<MigrationIssue> getCourseMigrationIssue(String courseId, Integer migrationId, Integer issueId) throws IOException {
37+
public Optional<MigrationIssue> getCourseMigrationIssue(String courseId, Long migrationId, Long issueId) throws IOException {
3838
LOG.debug("listing a migration issue for a content migration for the course");
3939
String url = buildCanvasUrl("courses/" + courseId + "/content_migrations/" + migrationId.toString() + "/migration_issues/" + issueId.toString(), Collections.emptyMap());
4040
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
4141
return responseParser.parseToObject(MigrationIssue.class, response);
4242
}
4343

4444
@Override
45-
public List<MigrationIssue> getUserMigrationIssues(String userId, Integer migrationId) throws IOException {
45+
public List<MigrationIssue> getUserMigrationIssues(String userId, Long migrationId) throws IOException {
4646
LOG.debug("listing the migration issues for a content migration for the course");
4747
String url = buildCanvasUrl("users/" + userId + "/content_migrations/" + migrationId.toString() + "/migration_issues", Collections.emptyMap());
4848
return getListFromCanvas(url);
4949
}
5050

5151
@Override
52-
public Optional<MigrationIssue> getUserMigrationIssue(String userId, Integer migrationId, Integer issueId) throws IOException {
52+
public Optional<MigrationIssue> getUserMigrationIssue(String userId, Long migrationId, Long issueId) throws IOException {
5353
LOG.debug("listing a migration issue for a content migration for the course");
5454
String url = buildCanvasUrl("users/" + userId + "/content_migrations/" + migrationId.toString() + "/migration_issues/" + issueId.toString(), Collections.emptyMap());
5555
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
5656
return responseParser.parseToObject(MigrationIssue.class, response);
5757
}
5858

5959
@Override
60-
public List<MigrationIssue> getGroupMigrationIssues(String groupId, Integer migrationId) throws IOException {
60+
public List<MigrationIssue> getGroupMigrationIssues(String groupId, Long migrationId) throws IOException {
6161
LOG.debug("listing the migration issues for a content migration for the group");
6262
String url = buildCanvasUrl("groups/" + groupId + "/content_migrations/" + migrationId.toString() + "/migration_issues", Collections.emptyMap());
6363
return getListFromCanvas(url);
6464
}
6565

6666
@Override
67-
public Optional<MigrationIssue> getGroupMigrationIssue(String groupId, Integer migrationId, Integer issueId) throws IOException {
67+
public Optional<MigrationIssue> getGroupMigrationIssue(String groupId, Long migrationId, Long issueId) throws IOException {
6868
LOG.debug("listing a migration issue for a content migration for the group");
6969
String url = buildCanvasUrl("groups/" + groupId + "/content_migrations/" + migrationId.toString() + "/migration_issues/" + issueId.toString(), Collections.emptyMap());
7070
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);
7171
return responseParser.parseToObject(MigrationIssue.class, response);
7272
}
7373

7474
@Override
75-
public List<MigrationIssue> getAccountMigrationIssues(String accountId, Integer migrationId) throws IOException {
75+
public List<MigrationIssue> getAccountMigrationIssues(String accountId, Long migrationId) throws IOException {
7676
LOG.debug("listing the migration issues for a content migration for the account");
7777
String url = buildCanvasUrl("accounts/" + accountId + "/content_migrations/" + migrationId.toString() + "/migration_issues", Collections.emptyMap());
7878
return getListFromCanvas(url);
7979
}
8080

8181
@Override
82-
public Optional<MigrationIssue> getAccountMigrationIssue(String accountId, Integer migrationId, Integer issueId) throws IOException {
82+
public Optional<MigrationIssue> getAccountMigrationIssue(String accountId, Long migrationId, Long issueId) throws IOException {
8383
LOG.debug("listing a migration issue for a content migration for the account");
8484
String url = buildCanvasUrl("accounts/" + accountId + "/content_migrations/" + migrationId.toString() + "/migration_issues/" + issueId.toString(), Collections.emptyMap());
8585
Response response = canvasMessenger.getSingleResponseFromCanvas(oauthToken, url);

src/main/java/edu/ksu/canvas/impl/ProgressImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public Optional<Progress> getProgress(String url) throws IOException {
3434
}
3535

3636
@Override
37-
public Optional<Progress> getProgress(Integer progressId) throws IOException {
37+
public Optional<Progress> getProgress(Long progressId) throws IOException {
3838
LOG.debug("getting the progress of an asynchronous operation by ID: " + progressId);
3939
String url = buildCanvasUrl(String.format("progress/%d", progressId), Collections.emptyMap());
4040
return responseParser.parseToObject(Progress.class, canvasMessenger.getSingleResponseFromCanvas(oauthToken, url));

0 commit comments

Comments
 (0)