Skip to content
Permalink
Browse files

TAB-6802 Upgrade dependencies and improve exam grid performance.

I am so sorry.

- Minor upgrade of Scala 2.12.7 -> 2.12.8
- Upgrade from Spring 4.3 to 5.1.3
- Upgrade from Hibernate 4.3 to 5.4.0
- Upgrade Jackson from 2.6 to 2.9
- Upgrade ElasticSearch to 6.5.1 and elastic4s to 6.5.0
- Use latest jclouds and WarwickUtils
- Upgrade ID7 to v2.2.1 and latest FontAwesome 5
- Fixes a minor bug when rendering an exam grid where it tries to use $
  before it's defined
- Upgrades FreeMarker from 2.3.21 to 2.3.28, which brings huge
  performance improvements because it no longer uses SimpleHash and
  therefore doesn't copy every single Map that gets put into the model
- Upgrade Gradle Wrapper to 4.10.2 because why the fuck not
- Re-work GrantedPermission, GrantedRole and EntityReference to no
  longer use a subclass single table inheritence model, but instead use
  @Any on a single entity
- Wraps a bunch of repeated calls for exam grids in request-level
  caching
- Reduces the number of queries run
  • Loading branch information...
matmannion committed Dec 21, 2018
1 parent d5b0eac commit c92d96024785fbde970cb04dec66fcf04f805cb0
Showing with 2,287 additions and 2,058 deletions.
  1. +7 −11 README.markdown
  2. +3 −3 bamboo-specs/src/main/java/uk/ac/warwick/tabula/TabulaPlanSpec.java
  3. +11 −12 build.gradle
  4. +15 −17 common/build.gradle
  5. +3 −5 common/src/main/resources/default.properties
  6. +0 −1 common/src/main/resources/messages.properties
  7. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/commands/Command.scala
  8. +1 −1 ...rc/main/scala/uk/ac/warwick/tabula/commands/coursework/assignments/ArchiveAssignmentCommand.scala
  9. +7 −6 ...scala/uk/ac/warwick/tabula/commands/exams/grids/GenerateExamGridCheckAndApplyOvercatCommand.scala
  10. +14 −10 common/src/main/scala/uk/ac/warwick/tabula/commands/exams/grids/UploadYearMarksCommand.scala
  11. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/commands/groups/admin/CopySmallGroupSetsCommand.scala
  12. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/commands/groups/admin/DeleteSmallGroupSetCommand.scala
  13. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/commands/groups/admin/ModifySmallGroupEventCommand.scala
  14. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/commands/groups/admin/ModifySmallGroupSetCommand.scala
  15. +1 −1 ...warwick/tabula/commands/profiles/relationships/meetings/ScheduledMeetingRecordMissedCommand.scala
  16. +1 −1 ...n/scala/uk/ac/warwick/tabula/commands/reports/attendancemonitoring/AttendanceReportExporter.scala
  17. +23 −14 common/src/main/scala/uk/ac/warwick/tabula/data/AssessmentMembershipDao.scala
  18. +8 −5 common/src/main/scala/uk/ac/warwick/tabula/data/Daoisms.scala
  19. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/data/FileDao.scala
  20. +3 −3 common/src/main/scala/uk/ac/warwick/tabula/data/MemberDao.scala
  21. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/data/ModuleDao.scala
  22. +76 −62 common/src/main/scala/uk/ac/warwick/tabula/data/PermissionsDao.scala
  23. +6 −4 common/src/main/scala/uk/ac/warwick/tabula/data/RelationshipDao.scala
  24. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/data/RouteDao.scala
  25. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/data/ScalaCriteria.scala
  26. +29 −22 common/src/main/scala/uk/ac/warwick/tabula/data/ScalaQuery.scala
  27. +11 −18 common/src/main/scala/uk/ac/warwick/tabula/data/ScheduledNotificationDao.scala
  28. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/data/StudentCourseDetailsDao.scala
  29. +49 −21 common/src/main/scala/uk/ac/warwick/tabula/data/StudentCourseYearDetailsDao.scala
  30. +5 −10 common/src/main/scala/uk/ac/warwick/tabula/data/Transactions.scala
  31. +3 −0 common/src/main/scala/uk/ac/warwick/tabula/data/UpstreamRouteRuleDao.scala
  32. +3 −4 common/src/main/scala/uk/ac/warwick/tabula/data/model/AbstractBasicUserType.scala
  33. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/AbstractMeetingRecord.scala
  34. +1 −11 common/src/main/scala/uk/ac/warwick/tabula/data/model/Assignment.scala
  35. +2 −11 common/src/main/scala/uk/ac/warwick/tabula/data/model/Department.scala
  36. +67 −144 common/src/main/scala/uk/ac/warwick/tabula/data/model/EntityReference.scala
  37. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/Exam.scala
  38. +0 −4 common/src/main/scala/uk/ac/warwick/tabula/data/model/Feedback.scala
  39. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/MarkerFeedback.scala
  40. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/MeetingRecordApproval.scala
  41. +33 −39 common/src/main/scala/uk/ac/warwick/tabula/data/model/Member.scala
  42. +0 −7 common/src/main/scala/uk/ac/warwick/tabula/data/model/Module.scala
  43. +10 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/ModuleRegistration.scala
  44. +3 −3 common/src/main/scala/uk/ac/warwick/tabula/data/model/Notification.scala
  45. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/OriginalityReport.scala
  46. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/data/model/ScheduledNotification.scala
  47. +50 −40 common/src/main/scala/uk/ac/warwick/tabula/data/model/StudentCourseYearDetails.scala
  48. +0 −4 common/src/main/scala/uk/ac/warwick/tabula/data/model/StudentRelationship.scala
  49. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/Submission.scala
  50. +2 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/ToEntityReference.scala
  51. +1 −3 common/src/main/scala/uk/ac/warwick/tabula/data/model/UpstreamRouteRule.scala
  52. +0 −2 ...c/main/scala/uk/ac/warwick/tabula/data/model/attendance/AttendanceMonitoringCheckpointTotal.scala
  53. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/attendance/AttendanceMonitoringScheme.scala
  54. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/attendance/MonitoringPointReport.scala
  55. +0 −3 common/src/main/scala/uk/ac/warwick/tabula/data/model/forms/Extension.scala
  56. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/groups/DepartmentSmallGroup.scala
  57. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/groups/DepartmentSmallGroupSet.scala
  58. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/groups/SmallGroup.scala
  59. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/groups/SmallGroupEventOccurrence.scala
  60. +0 −2 common/src/main/scala/uk/ac/warwick/tabula/data/model/groups/SmallGroupSet.scala
  61. +47 −169 common/src/main/scala/uk/ac/warwick/tabula/data/model/permissions/GrantedPermission.scala
  62. +66 −192 common/src/main/scala/uk/ac/warwick/tabula/data/model/permissions/GrantedRole.scala
  63. +1 −1 ...src/main/scala/uk/ac/warwick/tabula/data/oracle/{Oracle10gDialect.scala → Oracle12cDialect.scala}
  64. +4 −4 common/src/main/scala/uk/ac/warwick/tabula/events/NotificationHandling.scala
  65. +85 −80 common/src/main/scala/uk/ac/warwick/tabula/exams/grids/columns/modules/ModulesExamGridColumns.scala
  66. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/helpers/AttendanceMonitoringCheckpointFormatter.scala
  67. +54 −18 common/src/main/scala/uk/ac/warwick/tabula/helpers/FreemarkerMapHelper.scala
  68. +24 −25 common/src/main/scala/uk/ac/warwick/tabula/helpers/RequestLevelCaching.scala
  69. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/helpers/SessionAwareExecutionContext.scala
  70. +3 −5 common/src/main/scala/uk/ac/warwick/tabula/services/AssessmentMembershipService.scala
  71. +4 −1 common/src/main/scala/uk/ac/warwick/tabula/services/CourseAndRouteService.scala
  72. +4 −6 common/src/main/scala/uk/ac/warwick/tabula/services/ScheduledNotificationService.scala
  73. +37 −22 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/AbstractIndexService.scala
  74. +4 −3 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/AbstractQueryService.scala
  75. +13 −11 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/AuditEventIndexService.scala
  76. +50 −39 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/AuditEventQueryService.scala
  77. +4 −31 ...n/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/ElasticsearchClientFactoryBean.scala
  78. +9 −8 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/NotificationIndexService.scala
  79. +18 −13 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/NotificationQueryService.scala
  80. +17 −15 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/ProfileIndexService.scala
  81. +15 −17 common/src/main/scala/uk/ac/warwick/tabula/services/elasticsearch/ProfileQueryService.scala
  82. +5 −2 common/src/main/scala/uk/ac/warwick/tabula/services/objectstore/ObjectStorageService.scala
  83. +2 −2 .../src/main/scala/uk/ac/warwick/tabula/services/permissions/DatabaseBackedPermissionsProvider.scala
  84. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/services/scheduling/ProfileImporter.scala
  85. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/services/scheduling/SchedulingConfiguration.scala
  86. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/system/RenderableFileReturnValueHandler.scala
  87. +4 −3 common/src/main/scala/uk/ac/warwick/tabula/web/controllers/AcademicYearScopedController.scala
  88. +3 −2 common/src/main/scala/uk/ac/warwick/tabula/web/controllers/DepartmentScopedController.scala
  89. +5 −5 common/src/main/scala/uk/ac/warwick/tabula/web/views/ScalaBeansWrapper.scala
  90. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/web/views/ScalaFreemarkerConfiguration.scala
  91. +1 −1 common/src/main/scala/uk/ac/warwick/tabula/web/views/XmlView.scala
  92. +1 −1 common/src/main/webapp/WEB-INF/applicationContext.xml
  93. +4 −4 common/src/main/webapp/WEB-INF/persistence-context.xml
  94. +107 −55 common/src/main/webapp/WEB-INF/tld/spring-form.tld
  95. +61 −76 common/src/main/webapp/WEB-INF/tld/spring.tld
  96. +1 −0 common/src/test/resources/logback-test.xml
  97. +0 −2 common/src/test/resources/tabula.properties
  98. +180 −26 common/src/test/scala/uk/ac/warwick/tabula/ElasticsearchTestBase.scala
  99. +10 −2 common/src/test/scala/uk/ac/warwick/tabula/Fixtures.scala
  100. +7 −7 .../scala/uk/ac/warwick/tabula/commands/admin/department/DeleteCustomRoleDefinitionCommandTest.scala
  101. +6 −6 ...on/src/test/scala/uk/ac/warwick/tabula/commands/admin/department/ListCustomRolesCommandTest.scala
  102. +0 −1 ...t/scala/uk/ac/warwick/tabula/commands/attendance/view/ReportStudentsChoosePeriodCommandTest.scala
  103. +1 −0 ...a/uk/ac/warwick/tabula/commands/exams/grids/GenerateExamGridCheckAndApplyOvercatCommandTest.scala
  104. +5 −1 common/src/test/scala/uk/ac/warwick/tabula/commands/exams/grids/UploadYearMarksCommandTest.scala
  105. +0 −3 common/src/test/scala/uk/ac/warwick/tabula/data/MeetingRecordDaoTest.scala
  106. +53 −44 common/src/test/scala/uk/ac/warwick/tabula/data/NotificationDaoTest.scala
  107. +7 −12 common/src/test/scala/uk/ac/warwick/tabula/data/PermissionsDaoTest.scala
  108. +1 −1 common/src/test/scala/uk/ac/warwick/tabula/data/RelationshipDaoTest.scala
  109. +49 −32 common/src/test/scala/uk/ac/warwick/tabula/data/ScheduledNotificationDaoTest.scala
  110. +6 −26 common/src/test/scala/uk/ac/warwick/tabula/data/model/HeronWarningNotification.scala
  111. +0 −2 ...cala/uk/ac/warwick/tabula/data/model/notifications/coursework/SubmissionDueNotificationTest.scala
  112. +6 −6 ...uk/ac/warwick/tabula/data/model/notifications/coursework/SubmissionReceivedNotificationTest.scala
  113. +11 −6 common/src/test/scala/uk/ac/warwick/tabula/data/model/permissions/GrantedPermissionTest.scala
  114. +5 −5 common/src/test/scala/uk/ac/warwick/tabula/data/model/permissions/GrantedRoleTest.scala
  115. +13 −19 common/src/test/scala/uk/ac/warwick/tabula/services/PermissionsServiceTest.scala
  116. +1 −0 common/src/test/scala/uk/ac/warwick/tabula/services/ProgressionServiceTest.scala
  117. +1 −1 common/src/test/scala/uk/ac/warwick/tabula/services/RedirectingMailSenderTest.scala
  118. +22 −18 common/src/test/scala/uk/ac/warwick/tabula/services/ScheduledNotificationServiceTest.scala
  119. +33 −31 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/AuditEventIndexServiceTest.scala
  120. +18 −17 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/AuditEventQueryServiceTest.scala
  121. +8 −7 ...test/scala/uk/ac/warwick/tabula/services/elasticsearch/ElasticsearchIndexInitialisationTest.scala
  122. +20 −18 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/ElasticsearchIndexingTest.scala
  123. +24 −16 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/NotificationIndexServiceTest.scala
  124. +25 −15 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/NotificationQueryServiceTest.scala
  125. +27 −24 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/ProfileIndexServiceTest.scala
  126. +24 −23 common/src/test/scala/uk/ac/warwick/tabula/services/elasticsearch/ProfileQueryServiceTest.scala
  127. +4 −15 .../test/scala/uk/ac/warwick/tabula/services/permissions/DatabaseBackedPermissionsProviderTest.scala
  128. +5 −17 common/src/test/scala/uk/ac/warwick/tabula/services/permissions/DatabaseBackedRoleProviderTest.scala
  129. +4 −4 common/src/test/scala/uk/ac/warwick/tabula/system/MavReturnValueHandlerTest.scala
  130. +3 −3 common/src/test/scala/uk/ac/warwick/tabula/system/XmlReturnValueHandlerTest.scala
  131. +5 −5 common/src/test/scala/uk/ac/warwick/tabula/web/views/ScalaBeansWrapperTest.scala
  132. +2 −2 config/servers/augustus/bin/setenv.sh
  133. +3 −2 config/servers/augustus/lib/logback.xml
  134. BIN gradle/wrapper/gradle-wrapper.jar
  135. +1 −1 gradle/wrapper/gradle-wrapper.properties
  136. +489 −193 web/package-lock.json
  137. +2 −2 web/package.json
  138. +3 −3 web/src/main/assets/static/css/id7/embeddable.less
  139. +1 −1 web/src/main/assets/static/css/id7/groups.less
  140. +2 −2 web/src/main/assets/static/css/id7/id7-theme.less
  141. +4 −4 web/src/main/assets/static/css/id7/profiles.less
  142. +10 −10 web/src/main/scala/uk/ac/warwick/tabula/dev/web/commands/FixturesCommand.scala
  143. +20 −14 .../scala/uk/ac/warwick/tabula/web/controllers/exams/grids/generate/GenerateExamGridController.scala
  144. +1 −1 ...wick/tabula/web/controllers/reports/attendancemonitoring/AbstractAttendanceReportController.scala
  145. +1 −1 web/src/main/webapp/WEB-INF/freemarker/exams/grids/generate/_full_grid.ftl
  146. +1 −1 web/src/main/webapp/WEB-INF/freemarker/exams/grids/generate/_short_form_grid.ftl
  147. +1 −1 web/src/main/webapp/WEB-INF/freemarker/profiles/profile/search/form.ftl
  148. +13 −14 ...la/uk/ac/warwick/tabula/web/controllers/admin/department/DepartmentPermissionControllerTest.scala
  149. +13 −13 ...est/scala/uk/ac/warwick/tabula/web/controllers/admin/modules/ModulePermissionControllerTest.scala
  150. +13 −13 .../test/scala/uk/ac/warwick/tabula/web/controllers/admin/routes/RoutePermissionControllerTest.scala
@@ -37,7 +37,7 @@ tabula/
├── lib/
│ ├── jtds-1.3.1.jar
│ ├── logback.xml
│ ├── ojdbc7.jar
│ ├── ojdbc8.jar
│ ├── tabula.properties
│ ├── tabula-sso-config.xml
│ └── warwick-logging-1.0-all.xml
@@ -83,9 +83,9 @@ Note that this dependency replaces previous dependencies on logback, logstash-lo

You can get this from http://pkg.elab.warwick.ac.uk/net.sourceforge.jtds/jtds-1.3.1.jar

### `lib/ojdbc7.jar`
### `lib/ojdbc8.jar`

You can get this from http://pkg.elab.warwick.ac.uk/oracle.com/ojdbc7.jar
You can get this from http://pkg.elab.warwick.ac.uk/oracle.com/ojdbc8.jar

### `lib/logback.xml`

@@ -131,23 +131,19 @@ activemq.broker=tcp://localhost:61616

To run this locally, you have a few options:

#### Run an ElasticSearch cluster in the JVM

You should be able to set `elasticsearch.cluster.local_jvm=true` in your `tabula.properties` and just start the app as normal, it'll store in whatever you have `filesystem.index.dir` set as (you'll already have this set as this is where it stores the fs indexes at the moment)

#### Install ElasticSearch locally

For Ubuntu:

```
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install elasticsearch -y
```

You'll need to edit `/etc/elasticsearch/elasticsearch.yml` to set `cluster.name: tabula` (or set `elasticsearch.cluster.name=elasticsearch` in `tabula.properties`.

When I ran it locally, it wouldn't start on boot by default, but I could start it with `sudo systemctl start elasticsearch`
When I ran it locally, it wouldn't start on boot by default, but I could start it with `sudo systemctl start elasticsearch`. Run `sudo systemctl enable elasticsearch` for it to run on boot.

#### Connect to the tabula-dev Elasticsearch cluster

@@ -156,7 +152,7 @@ Set the following properties in your `tabula.properties`:
```
elasticsearch.cluster.nodes=lamso-tabula-dev-es.lnx.warwick.ac.uk:9300,lamvi-tabula-dev-es.lnx.warwick.ac.uk:9300,lanlo-tabula-dev-es.lnx.warwick.ac.uk:9300
elasticsearch.cluster.name=tabula-dev
elasticsearch.index.prefix=mmannion
elasticsearch.index.prefix=your-name-goes-here
```

*Please* make sure you change your `elasticsearch.index.prefix` or you might end up overwriting someone else's index. If you run into firewall problems, shout in #ops
@@ -58,7 +58,7 @@ private static Stage buildStage() {
.interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
.location(ScriptTaskProperties.Location.FILE)
.fileFromPath("gradlew")
.argument("clean check war")
.argument("clean check war --no-daemon")
.environmentVariables("JAVA_OPTS=\"-Xmx256m -Xms128m\""),
new ScriptTask()
.description("Touch test files so Bamboo doesn't ignore them")
@@ -119,7 +119,7 @@ private static Stage buildStage() {
"Run functional tests",
"Test",
"TEST",
"clean -PintegrationTest test -Dtoplevel.url=https://${bamboo.functionaltestserver}.warwick.ac.uk --no-build-cache",
"clean -PintegrationTest test -Dtoplevel.url=https://${bamboo.functionaltestserver}.warwick.ac.uk --no-build-cache --no-daemon",
"**/test-results/**/*.xml",
new Artifact()
.name("Failed test screenshots")
@@ -142,7 +142,7 @@ private Plan specsPlan(String key, String name, String environment, String descr
.linkedRepository(LINKED_REPOSITORY).noBranches()
.description(description)
.triggers(new ScheduledTrigger().scheduleOnceDaily(schedule))
.gradle("Run tests", "Cucumber", "SPECS", "cucumber -Dserver.environment=" + environment, "**/build/cucumber/results/*.xml")
.gradle("Run tests", "Cucumber", "SPECS", "cucumber -Dserver.environment=" + environment + " --no-daemon", "**/build/cucumber/results/*.xml")
.build();
}

@@ -19,18 +19,18 @@ plugins {

// Some properties that we use to resolve dependencies etc.
ext {
scalaVersion = "2.12.7"
scalaVersion = "2.12.8"
scalaMajorVersion = "2.12"
springVersion = "4.3.14.RELEASE"
hibernateVersion = "4.3.11.Final"
jacksonVersion = "2.6.7"
jacksonScalaModuleVersion = "2.6.7.1"
elasticsearchVersion = "2.1.2"
elastic4sVersion = "2.1.3-warwick"
poiVersion = "3.17"
springVersion = "5.1.3.RELEASE"
hibernateVersion = "5.4.0.Final"
jacksonVersion = "2.9.8"
jacksonScalaModuleVersion = "2.9.8"
elasticsearchVersion = "6.5.1"
elastic4sVersion = "6.5.0"
poiVersion = "4.0.1"
tilesVersion = "3.0.8"
jcloudsVersion = "2.0.2"
warwickUtilsVersion = "20180430"
jcloudsVersion = "2.1.1"
warwickUtilsVersion = "20181130"
surefireVersion = "2.19.1"
}

@@ -120,7 +120,6 @@ subprojects {
exclude group: 'xerces', module: 'xerces'
exclude group: 'javax.servlet', module: 'servletapi'
exclude group: 'servletapi', module: 'servletapi'
exclude group: 'log4j', module: 'log4j'
exclude group: 'jboss', module: 'javassist'

resolutionStrategy {
@@ -206,6 +205,6 @@ subprojects {
// value then running `./gradlew wrapper`. Next time gradlew
// is run it will fetch and use that version.
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
gradleVersion = '4.10.3'
distributionType = 'ALL'
}
@@ -8,7 +8,6 @@ dependencies {
compile "org.springframework:spring-core:${springVersion}"
compile "org.springframework:spring-expression:${springVersion}"
compile "org.springframework:spring-instrument:${springVersion}"
compile "org.springframework:spring-instrument-tomcat:${springVersion}"
compile "org.springframework:spring-jdbc:${springVersion}"
compile "org.springframework:spring-jms:${springVersion}"
compile "org.springframework:spring-orm:${springVersion}"
@@ -38,27 +37,26 @@ dependencies {

compile "uk.ac.warwick:spring-scala-glue_${scalaMajorVersion}:1.7"

compile 'org.apache.tika:tika-core:1.1'
compile 'org.apache.tika:tika-core:1.19.1'
compile "org.apache.poi:poi:${poiVersion}"
compile "org.apache.poi:poi-ooxml:${poiVersion}"
compile "org.apache.poi:poi-ooxml-schemas:${poiVersion}"
compile 'org.apache.poi:ooxml-schemas:1.1'
compile 'org.apache.poi:ooxml-schemas:1.4'
compile "org.apache.poi:poi-scratchpad:${poiVersion}"

compile 'org.freemarker:freemarker:2.3.21'
compile 'org.freemarker:freemarker:2.3.28'

compile "org.hibernate:hibernate-core:${hibernateVersion}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVersion}"
compile "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final"
compile "org.hibernate.javax.persistence:hibernate-jpa-2.2-api:1.0.0.Beta2"

compile "org.hibernate:hibernate-validator:5.1.3.Final"
annotationProcessor "org.hibernate:hibernate-validator-annotation-processor:5.1.3.Final"
compile "javax.el:javax.el-api:2.2.4"
compile "org.glassfish.web:javax.el:2.2.4"
compile "org.hibernate:hibernate-validator:6.0.13.Final"
annotationProcessor "org.hibernate.validator:hibernate-validator-annotation-processor:6.0.13.Final"
testCompile "org.glassfish:javax.el:3.0.1-b09"

compile "joda-time:joda-time:2.8.2"
compile "joda-time:joda-time-jsptags:1.1.1"
compile "org.jadira.usertype:usertype.core:3.2.0.GA"
compile "org.jadira.usertype:usertype.core:6.0.1.GA"
compile "org.joda:joda-convert:1.1"

compile "com.google.guava:guava:18.0"
@@ -117,6 +115,7 @@ dependencies {

compile "org.elasticsearch:elasticsearch:${elasticsearchVersion}"
compile "com.sksamuel.elastic4s:elastic4s-core_${scalaMajorVersion}:${elastic4sVersion}"
compile "com.sksamuel.elastic4s:elastic4s-http_${scalaMajorVersion}:${elastic4sVersion}"

compile "org.apache.jclouds:jclouds-blobstore:${jcloudsVersion}"
compile "org.apache.jclouds.driver:jclouds-slf4j:${jcloudsVersion}"
@@ -125,8 +124,8 @@ dependencies {

compile 'org.tuckey:urlrewritefilter:4.0.4'

compile 'org.quartz-scheduler:quartz:2.2.1'
compile 'org.quartz-scheduler:quartz-jobs:2.2.1'
compile 'org.quartz-scheduler:quartz:2.2.3'
compile 'org.quartz-scheduler:quartz-jobs:2.2.3'

compile 'com.github.mfornos:humanize-slim:1.2.2'

@@ -136,12 +135,11 @@ dependencies {
testCompile "org.springframework:spring-test:${springVersion}"

// FIXME We need this for the sandbox (because it uses jdbc:embedded-datasource to mock up SITS and FIM databases) but that seems incredibly wasteful
compile 'org.hsqldb:hsqldb:2.2.9'
compile 'org.hsqldb:hsqldb:2.4.1'

testCompile "org.elasticsearch:elasticsearch:${elasticsearchVersion}:tests"
testCompile ("com.sksamuel.elastic4s:elastic4s-testkit_${scalaMajorVersion}:${elastic4sVersion}") {
exclude group: 'org.scalatest'
}
testCompile "com.sksamuel.elastic4s:elastic4s-testkit_${scalaMajorVersion}:${elastic4sVersion}"
testCompile "com.sksamuel.elastic4s:elastic4s-embedded_${scalaMajorVersion}:${elastic4sVersion}"
testCompile "org.apache.logging.log4j:log4j-core:2.11.1" // Thanks, Elasticsearch
}

jar.dependsOn(generateRebel)
@@ -37,10 +37,8 @@ filesystem.attachment.dir=${base.data.dir}/attachments
# This is only used if you set elasticsearch.cluster.local_jvm to true
filesystem.index.dir=${base.data.dir}/index

elasticsearch.cluster.nodes=localhost:9300
elasticsearch.cluster.detect_other_nodes=true
elasticsearch.cluster.nodes=localhost:9200
elasticsearch.cluster.name=tabula
elasticsearch.cluster.local_jvm=false

objectstore.container=tabula
objectstore.provider=filesystem
@@ -131,7 +129,7 @@ cm2.prefix=coursework

scientia.base.url=https://timetablefeed.warwick.ac.uk/xml

academicoffice.notificationrecipient= ao-manual-add-report
academicoffice.notificationrecipient=ao-manual-add-report
permissions.academicoffice.group=in-tabula-manualmembership-notification

sits.notificationrecipient=studentrecords-missed-mp
sits.notificationrecipient=studentrecords-missed-mp
@@ -1,5 +1,4 @@
# NOTE: Remember to escape single quotes as per
# NOTE: Remember to escape single quotes as per
# http://stackoverflow.com/questions/4449639/apostrophe-doesnt-get-translated-properly-when-placed-in-a-resource-bundle


@@ -49,9 +49,9 @@ trait Notifies[A, B] {
}


trait SchedulesNotifications[A, B] {
trait SchedulesNotifications[A, B >: Null <: ToEntityReference] {
def transformResult(commandResult: A): Seq[B]
def scheduledNotifications(notificationTarget: B): Seq[ScheduledNotification[_]]
def scheduledNotifications(notificationTarget: B): Seq[ScheduledNotification[B]]
}

trait CompletesNotifications[A] {
@@ -72,6 +72,6 @@ trait ArchiveAssignmentNotifications extends SchedulesNotifications[Assignment,
override def transformResult(assignment: Assignment): Seq[Assignment] = Seq(assignment)

// Clear all notifications
override def scheduledNotifications(assignment: Assignment): Seq[ScheduledNotification[_]] = Seq()
override def scheduledNotifications(assignment: Assignment): Seq[ScheduledNotification[Assignment]] = Seq()

}
@@ -4,6 +4,7 @@ import org.joda.time.DateTime
import org.springframework.validation.Errors
import uk.ac.warwick.tabula.commands._
import uk.ac.warwick.tabula.commands.exams.grids.GenerateExamGridCheckAndApplyOvercatCommand.{Result, SelectCourseCommand}
import uk.ac.warwick.tabula.data.Transactions.transactional
import uk.ac.warwick.tabula.data.model.StudentCourseYearDetails.YearOfStudy
import uk.ac.warwick.tabula.data.model.{Department, ModuleRegistration, UpstreamRouteRuleLookup}
import uk.ac.warwick.tabula.data.{AutowiringStudentCourseYearDetailsDaoComponent, StudentCourseYearDetailsDaoComponent}
@@ -12,7 +13,7 @@ import uk.ac.warwick.tabula.services._
import uk.ac.warwick.tabula.services.exams.grids._
import uk.ac.warwick.tabula.system.permissions.{PermissionsChecking, PermissionsCheckingMethods, RequiresPermissionsChecking}
import uk.ac.warwick.tabula.{AcademicYear, CurrentUser}
import uk.ac.warwick.tabula.JavaImports._

import scala.collection.JavaConverters._

object GenerateExamGridCheckAndApplyOvercatCommand {
@@ -126,7 +127,7 @@ trait GenerateExamGridCheckAndApplyOvercatCommandState {
var selectCourseCommand: SelectCourseCommand = _

def fetchEntities: Seq[ExamGridEntity] = selectCourseCommand.apply()
lazy val entities: Seq[ExamGridEntity] = {
lazy val entities: Seq[ExamGridEntity] = {
val courseYears = selectCourseCommand.courseYearsToShow
if (courseYears.size == selectCourseCommand.studyYearByLevelOrBlock) {
fetchEntities // all years
@@ -145,15 +146,15 @@ trait GenerateExamGridCheckAndApplyOvercatCommandState {
lazy val overcatSubsets: Map[ExamGridEntity, Map[YearOfStudy, Seq[(BigDecimal, Seq[ModuleRegistration])]]] =
entities.map(entity => {
val subsets = entity.validYears
.filter{case (year, entityYear) => routeRulesLookup(entityYear.route, entityYear.level).nonEmpty}
.mapValues(entityYear => moduleRegistrationService.overcattedModuleSubsets(
.filter { case (year, entityYear) => routeRulesLookup(entityYear.route, entityYear.level).nonEmpty }
.mapValues(entityYear => moduleRegistrationService.overcattedModuleSubsets(
entityYear,
entityYear.markOverrides.getOrElse(Map()),
normalLoadLookup(entityYear.route),
routeRulesLookup(entityYear.route, entityYear.level)
))
.map{case (year, overcattedModuleSubsets) =>
if(overcattedModuleSubsets.size > 1) year -> overcattedModuleSubsets
.map { case (year, overcattedModuleSubsets) =>
if (overcattedModuleSubsets.size > 1) year -> overcattedModuleSubsets
else year -> Seq()
}
entity -> subsets
@@ -13,6 +13,7 @@ import uk.ac.warwick.tabula.helpers.StringUtils._
import uk.ac.warwick.tabula.permissions.Permissions
import uk.ac.warwick.tabula.roles.UserAccessMgrRoleDefinition
import uk.ac.warwick.tabula.services.coursework.docconversion.{AutowiringYearMarksExtractorComponent, YearMarkItem, YearMarksExtractorComponent}
import uk.ac.warwick.tabula.services.permissions.{AutowiringPermissionsServiceComponent, PermissionsServiceComponent}
import uk.ac.warwick.tabula.system.BindListener
import uk.ac.warwick.tabula.system.permissions.{PermissionsChecking, PermissionsCheckingMethods, RequiresPermissionsChecking}
import uk.ac.warwick.tabula.{AcademicYear, CurrentUser, SprCode}
@@ -39,6 +40,7 @@ object UploadYearMarksCommand {
with ComposableCommand[Seq[StudentCourseYearDetails]]
with AutowiringYearMarksExtractorComponent
with AutowiringStudentCourseYearDetailsDaoComponent
with AutowiringPermissionsServiceComponent
with UploadYearMarksCommandBindListener
with UploadYearMarksDescription
with UploadYearMarksPermissions
@@ -69,9 +71,11 @@ class UploadYearMarksCommandInternal(val department: Department, val academicYea
}

trait UploadYearMarksCommandBindListener extends BindListener {

self: UploadYearMarksCommandRequest with UploadYearMarksCommandState with YearMarksExtractorComponent
with StudentCourseYearDetailsDaoComponent =>
self: UploadYearMarksCommandRequest
with UploadYearMarksCommandState
with YearMarksExtractorComponent
with StudentCourseYearDetailsDaoComponent
with PermissionsServiceComponent =>

override def onBind(result: BindingResult) {
val fileNames = file.fileNames.map(_.toLowerCase)
@@ -111,26 +115,26 @@ trait UploadYearMarksCommandBindListener extends BindListener {

private def postProcessYearMarks(): Unit = {
// Deal with rows with invalid academic years
val (validAcademicYearItems, invalidAcademicYearItems) = marks.asScala.partition(item => item.academicYear.maybeText.map(academicYearString => {
val (validAcademicYearItems, invalidAcademicYearItems) = marks.asScala.partition(item => item.academicYear.maybeText.forall(academicYearString => {
try {
AcademicYear.parse(academicYearString)
true
} catch {
case e: Exception =>
case _: Exception =>
false
}
}).getOrElse(true))
}))

// Pair the items with the associated real academic year. If it isn't defined, use the command's
val academicYearItems = validAcademicYearItems.map(item => (item, item.academicYear.maybeText.map(AcademicYear.parse).getOrElse(academicYear)))

// Partition studentIds into Uni IDs and SCJ codes, the query for all of them from the DB
val (lookupByUniID, lookupByScjCode) = academicYearItems.partition(item => SprCode.getUniversityId(item._1.studentId) == item._1.studentId)
val studentsByScjCode = studentCourseYearDetailsDao.findByScjCodeAndAcademicYear(
lookupByScjCode.map(item => (item._1.studentId, item._2)).toSeq
lookupByScjCode.map(item => (item._1.studentId, item._2))
)
val studentsByUniId = studentCourseYearDetailsDao.findByUniversityIdAndAcademicYear(
lookupByUniID.map(item => (item._1.studentId, item._2)).toSeq
lookupByUniID.map(item => (item._1.studentId, item._2))
)

// Translate into ProcessedYearMarks
@@ -177,7 +181,7 @@ trait UploadYearMarksCommandBindListener extends BindListener {
case Some(scyd) if !departmentAndParents(scyd.enrolmentDepartment).contains(department) =>
val enrolmentRootDepartment = scyd.enrolmentDepartment.rootDepartment

val userAccessManagers = enrolmentRootDepartment.grantedRoles.asScala.filter(_.builtInRoleDefinition == UserAccessMgrRoleDefinition).flatMap(_.users.users).map(u => s"${u.getFullName} (${u.getEmail})")
val userAccessManagers = permissionsService.getAllGrantedRolesFor(enrolmentRootDepartment).filter(_.builtInRoleDefinition == UserAccessMgrRoleDefinition).flatMap(_.users.users).map(u => s"${u.getFullName} (${u.getEmail})")

Seq(s"You do not have permission to upload marks for this student. Their enrolment department is ${enrolmentRootDepartment.name}.${if (userAccessManagers.nonEmpty) s" To get permission, contact the Tabula User Access Manager for ${enrolmentRootDepartment.name}, ${userAccessManagers.mkString(" or ")}." else ""}")
case _ =>
@@ -212,7 +216,7 @@ trait UploadYearMarksDescription extends Describable[Seq[StudentCourseYearDetail
trait UploadYearMarksCommandState {
def department: Department
def academicYear: AcademicYear
val validAttachmentStrings = Seq(".xlsx")
val validAttachmentStrings: Seq[String] = Seq(".xlsx")
var processedYearMarks: collection.mutable.ArrayBuffer[ProcessedYearMark] = collection.mutable.ArrayBuffer()
}

@@ -203,7 +203,7 @@ trait CopySmallGroupSetsScheduledNotifications
// get all the occurrences (even the ones in invalid weeks) so they can be cleared
sets.flatMap(_.groups.asScala.flatMap(_.events.flatMap(smallGroupService.getOrCreateSmallGroupEventOccurrences)))

override def scheduledNotifications(occurrence: SmallGroupEventOccurrence): Seq[ScheduledNotification[_]] = {
override def scheduledNotifications(occurrence: SmallGroupEventOccurrence): Seq[ScheduledNotification[SmallGroupEventOccurrence]] = {
generateNotifications(occurrence)
}
}
Oops, something went wrong.

0 comments on commit c92d960

Please sign in to comment.
You can’t perform that action at this time.