Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
80cfe28
corrects typo and displays right logo in header
qtamu Mar 28, 2025
2278d28
Removes extra space
qtamu Mar 28, 2025
cf443f1
Uses a ternary operator for right logo image function
qtamu Mar 31, 2025
bd11c2f
Removes right logo from header
qtamu Mar 31, 2025
744d745
Removes Right logo configuration.
qtamu Mar 31, 2025
b94f61a
Removes right logo logic
qtamu Mar 31, 2025
73101a8
Removes right logo from look and feel
qtamu Mar 31, 2025
84602d7
removes right logo option
qtamu Mar 31, 2025
da0b174
Remove remaining right logo references
tamu-sad-iii Apr 1, 2025
c3aa759
Merge pull request #2027 from TAMULib/origin/sprint-8-2013-display-ri…
tamu-sad-iii Apr 1, 2025
7ead765
Refactor Left Logo to Header Logo
tamu-sad-iii Apr 2, 2025
c606f4f
remove references to right logo in tooltip
cstarcher Apr 2, 2025
85bd9cf
Prevent multiple get all configuration async requests
tamu-sad-iii Apr 7, 2025
b321a88
Remove console log added to debug
tamu-sad-iii Apr 7, 2025
a5b70ac
Default dedicated document type field predicates documentTypePredicat…
tamu-sad-iii Apr 7, 2025
529264f
Check length of documentTypes for feedback to add new file type
tamu-sad-iii Apr 7, 2025
3c0efa4
Have tests injecting data system loader cleanup after
tamu-sad-iii Apr 8, 2025
4cbdcb4
Fix submission remove field value test
tamu-sad-iii Apr 8, 2025
0f5d115
Cleanup submission removeFieldValue test
tamu-sad-iii Apr 8, 2025
9a32358
Add exclusive alert to remove existing filter modal
tamu-sad-iii Apr 8, 2025
829a057
Remove broadcast all users on update
tamu-sad-iii Apr 8, 2025
00ec5f4
Reload user tables on success update
tamu-sad-iii Apr 8, 2025
7bfd6bf
Add alert in add member modal for invalid and error responses
tamu-sad-iii Apr 8, 2025
98f8f19
Update user controller test update test
tamu-sad-iii Apr 8, 2025
07a46b3
Consolidate file upload get pattern and always return .pdf for `_doct…
tamu-sad-iii Apr 9, 2025
e32ac9c
adds events for windows and mac when using ctrl / cmd keys
qtamu Apr 9, 2025
a10f7b0
adds the event scope to the ng clicl
qtamu Apr 9, 2025
467ecec
Add unique constraint to action log
tamu-sad-iii Apr 9, 2025
313880c
Remove duplicate assignment of table
tamu-sad-iii Apr 10, 2025
209f346
Move default order by id after request sorting
tamu-sad-iii Apr 10, 2025
f9ecf21
Format annotation
tamu-sad-iii Apr 11, 2025
3ebfdc7
Check email workflows on publish success
tamu-sad-iii Apr 15, 2025
27a1ac9
Check email workflow rules on submission create to status In Progress
tamu-sad-iii Apr 15, 2025
1730593
Check email workflow rules for each submission published in batch pub…
tamu-sad-iii Apr 15, 2025
52aa8f8
Check email workflow rules on needs corrections
tamu-sad-iii Apr 15, 2025
0c20fa0
Fix focus on admin edit repeatable fields
tamu-sad-iii Apr 17, 2025
d9d72a1
Update submission helper utility exception logging
tamu-sad-iii Apr 17, 2025
0c0f154
Informs the screen reader that the clicked link is visited.
qtamu Apr 17, 2025
e264105
Annouces new submission modal warning modal when a submission is in p…
qtamu Apr 21, 2025
88a16fa
Upgrade @wvr/core to 2.3.0-rc4
tamu-sad-iii Apr 22, 2025
451531a
Update ProQuest file naming
tamu-sad-iii Apr 22, 2025
f742642
Add application constants file with unknown constant
tamu-sad-iii Apr 22, 2025
ba367f6
Merge pull request #2050 from TAMULib/sprint-9-2048-phone-number-pars…
tamu-sad-iii Apr 22, 2025
dc1fffc
Merge pull request #2053 from TAMULib/sprint-9-2048-empty-name
tamu-sad-iii Apr 22, 2025
835342e
Append submission id to zip entries and increment duplicate license f…
tamu-sad-iii Apr 22, 2025
25a70fb
Null check primary doc field value
tamu-sad-iii Apr 22, 2025
575e320
Merge pull request #2056 from TAMULib/sprint-9-2048-duplicate-zip-ent…
tamu-sad-iii Apr 22, 2025
62343c0
Merge pull request #2057 from TAMULib/sprint-9-2048-empty-primary-doc
tamu-sad-iii Apr 22, 2025
54dbd76
Null check primary doc field value
tamu-sad-iii Apr 22, 2025
89c9638
Merge branch 'sprint-9-2048-empty-primary-doc' of github.com:TAMULib/…
tamu-sad-iii Apr 22, 2025
26e4b42
Null check primary doc field value
tamu-sad-iii Apr 22, 2025
3d802cb
Merge pull request #2058 from TAMULib/sprint-9-2048-empty-primary-doc
tamu-sad-iii Apr 22, 2025
848467a
Delete ControlledVocabularyIntegrationTest.java
tamu-sad-iii Apr 24, 2025
b63a850
Quote reserved h2 keyword column names
tamu-sad-iii Apr 28, 2025
89de53d
Fix version of ubuntu runner to last working version
tamu-sad-iii Apr 28, 2025
997debb
First pass at incorporating temp file streaming response
tamu-sad-iii Apr 29, 2025
8e034fc
Correct variable name typo
tamu-sad-iii Apr 29, 2025
927170d
Delete path export temporary file if exits
tamu-sad-iii Apr 29, 2025
fa47d3d
Only attempt to stream response when no exception occur
tamu-sad-iii Apr 29, 2025
a046bc4
Refactor as not exception thrown condition
tamu-sad-iii Apr 29, 2025
0ec318a
Upgrade to latest @wvr/core release candidate
tamu-sad-iii Apr 29, 2025
f032ed2
Use try-with-resource for each submission zip entry for ProQuest export
tamu-sad-iii Apr 29, 2025
4b183de
Update submission batch export exception handling
tamu-sad-iii Apr 30, 2025
ed90f1b
Remove unused arguments from submission batch exception handler method
tamu-sad-iii Apr 30, 2025
2fe94db
Move private method and handle when no bytes written to temp file
tamu-sad-iii Apr 30, 2025
4f03727
Set aside file bytes
tamu-sad-iii Apr 30, 2025
70c86c9
Set aside more file bytes
tamu-sad-iii Apr 30, 2025
6711c24
Catch and elevate runtime exceptions to avoid going to the incorrect …
tamu-sad-iii Apr 30, 2025
fda66f8
Remove unused imports
tamu-sad-iii Apr 30, 2025
35da66a
Update src/main/java/org/tdl/vireo/controller/SubmissionController.java
tamu-sad-iii Apr 30, 2025
d4dc7f5
Update src/main/java/org/tdl/vireo/controller/advice/CustomResponseEn…
tamu-sad-iii Apr 30, 2025
2baf16d
Update submission controller test batch export
tamu-sad-iii May 1, 2025
9c96c80
Add some logging
tamu-sad-iii May 1, 2025
1c465e3
Catch number format exceptions while parsing dates in submission help…
tamu-sad-iii May 1, 2025
1ede55b
Add tabbed panels for email workflow rules by status and action
tamu-sad-iii May 2, 2025
7439f06
Finish and flush inner zip output stream before writing backing strea…
tamu-sad-iii May 5, 2025
c145217
Initial abstraction of email workflow rule
tamu-sad-iii May 5, 2025
92d4564
Add action enum for delineating action logs
tamu-sad-iii May 5, 2025
e48cb2f
Add action logs created from submission email service and submission …
tamu-sad-iii May 5, 2025
f390dd7
Merge pull request #2061 from TAMULib/sprint-9-2048-temp-file-streaming
tamu-sad-iii May 6, 2025
ad41a86
Add action enumerated column to action log
tamu-sad-iii May 6, 2025
448221b
Initial pass at email workflow rule by action
tamu-sad-iii May 6, 2025
9dfe9e2
Restore existing API and add new endpoints for action email workflow …
tamu-sad-iii May 6, 2025
81aa520
Remove unused imports and pass up expected payload
tamu-sad-iii May 6, 2025
1772b36
Fix odd copy and paste
tamu-sad-iii May 6, 2025
e012e04
Fix indentation
tamu-sad-iii May 6, 2025
5350f62
Update change email workflow rule activation
tamu-sad-iii May 6, 2025
fdeff73
Add initial email for system defined email workflow rules by action
tamu-sad-iii May 7, 2025
2801bda
Add submission action log listener, add process flag and require acti…
tamu-sad-iii May 7, 2025
66d80f8
Merge pull request #2036 from TAMULib/sprint-9-1639
tamu-sad-iii May 9, 2025
f4d9058
Merge pull request #2037 from TAMULib/sprint-9-1891
tamu-sad-iii May 9, 2025
9613c8b
Merge pull request #2038 from TAMULib/sprint-9-tests
tamu-sad-iii May 9, 2025
c361350
Merge pull request #2039 from TAMULib/sprint-9-1742
tamu-sad-iii May 9, 2025
acfdddd
Merge pull request #2040 from TAMULib/sprint-9-1562
tamu-sad-iii May 9, 2025
b784777
Merge pull request #2041 from TAMULib/sprint-9-2032
tamu-sad-iii May 9, 2025
9fdc290
Merge pull request #2042 from TexasDigitalLibrary/vireo-sprint9-1948
tamu-sad-iii May 9, 2025
c630bef
Merge pull request #2043 from TAMULib/sprint-9-2024
tamu-sad-iii May 9, 2025
2c916f4
Merge pull request #2044 from TAMULib/sprint-9-1967
tamu-sad-iii May 9, 2025
a7d75b7
Merge pull request #2046 from TAMULib/sprint-9-2045
tamu-sad-iii May 9, 2025
182e3ab
Merge pull request #2049 from TAMULib/sprint-9-2011
tamu-sad-iii May 9, 2025
423f6bf
Merge pull request #2051 from TexasDigitalLibrary/vireo-1707-accessib…
qtamu May 9, 2025
d1e65d1
Merge pull request #2052 from TAMULib/sprint-9-wvr-2.3.0-rc4
tamu-sad-iii May 9, 2025
57fee78
Fix and add tests handling navigation to view submission
tamu-sad-iii May 9, 2025
bae9fe2
Merge pull request #2063 from TAMULib/sprint-9-tests
tamu-sad-iii May 9, 2025
72fca0f
Explicitly define table name for email_workflow_rules
tamu-sad-iii May 9, 2025
c92b43e
Merge branch 'sprint-9-staging' into sprint-9-1926
tamu-sad-iii May 9, 2025
283e3aa
Move setting action log processed true after sending email workflow r…
tamu-sad-iii May 9, 2025
68e5abc
Merge branch 'sprint-9-staging' into sprint-9-2048
tamu-sad-iii May 9, 2025
055eee4
Update SystemDataLoaderTest.java
tamu-sad-iii May 9, 2025
4929f3d
Update SystemDataLoaderTest.java
tamu-sad-iii May 10, 2025
f05949d
Update webapp tests
tamu-sad-iii May 10, 2025
93e3d04
Correctly match previous table name for email workflow rules
tamu-sad-iii May 12, 2025
765ec7f
modify templates for notify emails
cstarcher May 13, 2025
6c3754c
Simplify sending emails for action
tamu-sad-iii May 13, 2025
b562e1d
Fix comment
tamu-sad-iii May 13, 2025
45d2200
Add parameterized unit tests for SubmissionEmailService#sendActionEmails
tamu-sad-iii May 13, 2025
2ccd46f
Copy and past email workflow rule unit tests
tamu-sad-iii May 13, 2025
af24f89
Merge branch 'sprint-9-notify-emails' of github.com:TexasDigitalLibra…
tamu-sad-iii May 13, 2025
f4adce4
Fix issue 2065
jameswsullivan May 14, 2025
2a604cd
Configuration: Add local authentication interpolation in build-config.js
tamu-sad-iii May 15, 2025
e93fb48
Configuration: Add variable substitution for local authentication in …
tamu-sad-iii May 15, 2025
f039865
Environment: Add default local authentication true in example
tamu-sad-iii May 15, 2025
33eea05
Merge pull request #2071 from TexasDigitalLibrary/wwtamu-patch-1
tamu-sad-iii May 16, 2025
76d1496
Merge pull request #2066 from jameswsullivan/sprint-9-2065
tamu-sad-iii May 16, 2025
b9f5df7
refactor: inputtype accessibility improvements
jaredgalanis May 16, 2025
a69a4cf
Fix change activation of email workflow rules
tamu-sad-iii May 18, 2025
c0d49c9
refactor: misc accessibility improvements
jaredgalanis May 18, 2025
51e4f48
Merge pull request #2054 from TexasDigitalLibrary/sprint-9-2048
cstarcher May 20, 2025
90ddc4e
added logo to footer
cstarcher May 22, 2025
09292a6
added UTC to the submission data
twyezak May 28, 2025
edfaa4d
Merge branch 'sprint-9-staging' into sprint-9-1926
tamu-sad-iii Jun 9, 2025
c8ccbc5
Merge pull request #2062 from TAMULib/sprint-9-1926
tamu-sad-iii Jun 12, 2025
14b4fa6
Merge pull request #2072 from jhu-sheridan-libraries/refactor-inputty…
cstarcher Jun 13, 2025
6617420
Merge pull request #2074 from TexasDigitalLibrary/sprint-9-2020
cstarcher Jun 13, 2025
da704cf
Merge pull request #2078 from twyezak/submission-history-date-fix
cstarcher Jun 13, 2025
408353f
Merge branch 'sprint-9-staging' into refactor-misc-accessibility-impr…
jaredgalanis Jun 23, 2025
4b04a60
Merge pull request #2073 from jhu-sheridan-libraries/refactor-misc-ac…
cstarcher Jun 23, 2025
c655e9b
add selected header background color for transparent logos
cstarcher Jun 24, 2025
7c97b1e
fix test error after removing right_logo from system defaults
cstarcher Jun 24, 2025
54b41a0
Merge pull request #2085 from TexasDigitalLibrary/sprint-8-2013-displ…
cstarcher Jun 24, 2025
93996f1
replace admin logo with higher resolution image
cstarcher Jun 24, 2025
7b29b67
Merge pull request #2086 from TexasDigitalLibrary/sprint-9-admin-logo
cstarcher Jun 24, 2025
50d6166
update version
cstarcher Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request, workflow_dispatch ]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion .wvr/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const config = {
return content
.toString()
.replace('${AUTH_SERVICE_URL}', 'window.location.protocol + \'//\' + window.location.host + window.location.base + \'/mock/auth\'')
.replace('${STOMP_DEBUG}', 'false');
.replace('${STOMP_DEBUG}', 'false')
.replace('${LOCAL_AUTHENTICATION}', 'true');
},
},
],
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $ mvn clean spring-boot:run -Dproduction
$ mvn clean package -DskipTests -Dproduction -Dassets.uri=file:/opt/vireo/ -Dconfig.uri=file:/opt/vireo/config/
```

If build succeeds, you should have both a `vireo-4.2.11.war` and a `vireo-4.2.11-install.zip` in the `target/` directory. When building for production required static assets are copied into the packaged war file and the index.html template is optimized for production. For development a symlink is used to allow the application to access required static assets.
If build succeeds, you should have both a `vireo-4.3.0.war` and a `vireo-4.3.0-install.zip` in the `target/` directory. When building for production required static assets are copied into the packaged war file and the index.html template is optimized for production. For development a symlink is used to allow the application to access required static assets.

#### Apache Reverse Proxy Config

Expand Down Expand Up @@ -117,7 +117,7 @@ Unzip package into preferred directory (or any directory you choose):

```bash
$ cd /opt/vireo
$ unzip vireo-4.2.11-install.zip
$ unzip vireo-4.3.0-install.zip
```

### Directory Structure of installed package
Expand Down Expand Up @@ -190,13 +190,13 @@ ln -s /opt/vireo/webapp /opt/tomcat/webapps/ROOT
Copy war file into Tomcat webapps directory (your location may vary -- this is an example):

```bash
$ cp ~/vireo-4.2.11.war /usr/local/tomcat/webapps/vireo.war
$ cp ~/vireo-4.3.0.war /usr/local/tomcat/webapps/vireo.war
```

or as root:

```bash
$ cp ~/vireo-4.2.11.war /usr/local/tomcat/webapps/ROOT.war
$ cp ~/vireo-4.3.0.war /usr/local/tomcat/webapps/ROOT.war
```

**if not specifying assets.uri during build the assets will be stored under the vireo webapp's classpath, /opt/tomcat/webapps/vireo/WEB-INF/classes**
Expand All @@ -209,7 +209,7 @@ $ cp ~/vireo-4.2.11.war /usr/local/tomcat/webapps/ROOT.war
## Running WAR as a stand-alone Spring Boot application

```bash
java -jar target/vireo-4.2.11.war
java -jar target/vireo-4.3.0.war
```

<div align="right">(<a href="#readme-top">back to top</a>)</div>
Expand Down
4 changes: 2 additions & 2 deletions build/appConfig.js.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var appConfig = {

'version': '4.2.11',
'version': '4.3.0',

'allowAnonymous': true,
'anonymousRole': 'ROLE_ANONYMOUS',
Expand Down Expand Up @@ -40,7 +40,7 @@ var appConfig = {
When set to the boolean false, a modal is not used and Shibboleth login is automatically attempted and no registration link is shown.
When set to the string 'alternate' to hide the local login (and registration) as if localAuthentication is false and provide an alterate (hidden) login page for local authentication.
*/
'localAuthentication': true,
'localAuthentication': ${LOCAL_AUTHENTICATION},

/*
Designate predicates that require date/times value filtering on save.
Expand Down
4 changes: 3 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
##############################

IMAGE_HOST=127.0.0.1
IMAGE_VERSION=4.2.11
IMAGE_VERSION=4.3.0
SERVICE_PROJECT=tdl
SERVICE_PATH=vireo

NODE_ENV=production

STOMP_DEBUG=false

LOCAL_AUTHENTICATION=true

AUTH_STRATEGY=weaverAuth

AUTH_SERVICE_URL="window.location.protocol + '//' + window.location.host + window.location.base + '/mock/auth'"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vireo",
"private": false,
"version": "4.2.11",
"version": "4.3.0",
"description": "Vireo 4",
"homepage": "https://github.com/TexasDigitalLibrary/Vireo",
"repository": {
Expand All @@ -22,7 +22,7 @@
"build": "wvr build --clean"
},
"dependencies": {
"@wvr/core": "2.3.0-rc3",
"@wvr/core": "2.3.0-rc5",
"angular-ui-tinymce": "0.0.19",
"file-saver": "2.0.5",
"ng-csv": "0.3.6",
Expand Down
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.tdl</groupId>
<artifactId>vireo</artifactId>
<version>4.2.11</version>
<version>4.3.0</version>

<name>Vireo</name>
<description>Vireo Thesis and Dissertation Submission System</description>
Expand Down Expand Up @@ -149,6 +149,18 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/tdl/vireo/ApplicationConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.tdl.vireo;

public class ApplicationConstants {

public static final String UNKNOWN = "Unknown";

private ApplicationConstants() {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ public class ConfigurationName {
/** Custom CSS */
public final static String LEFT_LOGO = "left_logo";

/** Custom CSS */
public final static String RIGTH_LOGO = "right_logo";

/** Custom CSS */
public final static String CUSTOM_CSS = "custom_css";

Expand Down
116 changes: 107 additions & 9 deletions src/main/java/org/tdl/vireo/controller/OrganizationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import java.util.Map;
import java.util.Optional;

import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -23,16 +26,19 @@
import org.tdl.vireo.exception.ComponentNotPresentOnOrgException;
import org.tdl.vireo.exception.SystemEmailRuleNotDeleteableException;
import org.tdl.vireo.exception.WorkflowStepNonOverrideableException;
import org.tdl.vireo.model.Action;
import org.tdl.vireo.model.EmailRecipient;
import org.tdl.vireo.model.EmailTemplate;
import org.tdl.vireo.model.EmailWorkflowRule;
import org.tdl.vireo.model.EmailWorkflowRuleByAction;
import org.tdl.vireo.model.EmailWorkflowRuleByStatus;
import org.tdl.vireo.model.FieldPredicate;
import org.tdl.vireo.model.Organization;
import org.tdl.vireo.model.Submission;
import org.tdl.vireo.model.SubmissionStatus;
import org.tdl.vireo.model.WorkflowStep;
import org.tdl.vireo.model.repo.AbstractEmailRecipientRepo;
import org.tdl.vireo.model.repo.EmailTemplateRepo;
import org.tdl.vireo.model.repo.EmailWorkflowRuleByActionRepo;
import org.tdl.vireo.model.repo.EmailWorkflowRuleRepo;
import org.tdl.vireo.model.repo.FieldPredicateRepo;
import org.tdl.vireo.model.repo.OrganizationRepo;
Expand All @@ -42,10 +48,6 @@
import org.tdl.vireo.view.ShallowOrganizationView;
import org.tdl.vireo.view.TreeOrganizationView;

import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import edu.tamu.weaver.response.ApiResponse;
import edu.tamu.weaver.response.ApiView;
import edu.tamu.weaver.validation.aspect.annotation.WeaverValidatedModel;
Expand All @@ -70,6 +72,9 @@ public class OrganizationController {
@Autowired
private EmailWorkflowRuleRepo emailWorkflowRuleRepo;

@Autowired
private EmailWorkflowRuleByActionRepo emailWorkflowRuleByActionRepo;

@Autowired
private SubmissionRepo submissionRepo;

Expand Down Expand Up @@ -254,7 +259,7 @@ public ApiResponse addEmailWorkflowRule(@PathVariable Long requestingOrgId, @Req
if (emailRecipient == null) {
response = new ApiResponse(ERROR, "Could not create recipient.");
} else {
EmailWorkflowRule newEmailWorkflowRule = emailWorkflowRuleRepo.create(submissionStatus, emailRecipient, emailTemplate);
EmailWorkflowRuleByStatus newEmailWorkflowRule = emailWorkflowRuleRepo.create(submissionStatus, emailRecipient, emailTemplate);
org.addEmailWorkflowRule(newEmailWorkflowRule);
organizationRepo.update(org);

Expand All @@ -275,7 +280,7 @@ public ApiResponse editEmailWorkflowRule(@PathVariable Long requestingOrgId, @Pa
JsonNode recipientNode = objectMapper.convertValue(data, JsonNode.class).get("recipient");
EmailTemplate emailTemplate = emailTemplateRepo.findById(Long.valueOf((Integer) data.get("templateId"))).get();

EmailWorkflowRule emailWorkflowRuleToUpdate = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();
EmailWorkflowRuleByStatus emailWorkflowRuleToUpdate = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();

EmailRecipient emailRecipient = buildRecipient(recipientNode);

Expand All @@ -301,7 +306,7 @@ public ApiResponse editEmailWorkflowRule(@PathVariable Long requestingOrgId, @Pa
public ApiResponse removeEmailWorkflowRule(@PathVariable Long requestingOrgId, @PathVariable Long emailWorkflowRuleId) throws SystemEmailRuleNotDeleteableException {

Organization org = organizationRepo.read(requestingOrgId);
EmailWorkflowRule rule = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();
EmailWorkflowRuleByStatus rule = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();

if (rule.isSystem()) {
throw new SystemEmailRuleNotDeleteableException();
Expand All @@ -320,7 +325,7 @@ public ApiResponse removeEmailWorkflowRule(@PathVariable Long requestingOrgId, @
@PreAuthorize("hasRole('MANAGER')")
public ApiResponse changeEmailWorkflowRuleActivation(@PathVariable Long requestingOrgId, @PathVariable Long emailWorkflowRuleId) {

EmailWorkflowRule rule = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();
EmailWorkflowRuleByStatus rule = emailWorkflowRuleRepo.findById(emailWorkflowRuleId).get();

rule.isDisabled(!rule.isDisabled());

Expand All @@ -331,6 +336,99 @@ public ApiResponse changeEmailWorkflowRuleActivation(@PathVariable Long requesti
return new ApiResponse(SUCCESS);
}

@PreAuthorize("hasRole('MANAGER')")
@RequestMapping(value = "/{requestingOrgId}/add-email-workflow-rule-by-action", method = POST)
public ApiResponse addEmailWorkflowRuleByAction(@PathVariable Long requestingOrgId, @RequestBody Map<String, Object> data) {

ApiResponse response = new ApiResponse(SUCCESS);

Organization org = organizationRepo.read(requestingOrgId);
Action action = Action.valueOf((String) data.get("action"));
JsonNode recipientNode = objectMapper.convertValue(data, JsonNode.class).get("recipient");
EmailTemplate emailTemplate = emailTemplateRepo.findById(Long.valueOf((Integer) data.get("templateId"))).get();

EmailRecipient emailRecipient = buildRecipient(recipientNode);

if (emailRecipient == null) {
response = new ApiResponse(ERROR, "Could not create recipient.");
} else {
EmailWorkflowRuleByAction newEmailWorkflowRule = emailWorkflowRuleByActionRepo.create(action, emailRecipient, emailTemplate);
org.addEmailWorkflowRuleByAction(newEmailWorkflowRule);
organizationRepo.update(org);

HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put("id", newEmailWorkflowRule.getId());
response.setPayload(payload);
}

return response;
}

@RequestMapping("/{requestingOrgId}/edit-email-workflow-rule-by-action/{emailWorkflowRuleId}")
@PreAuthorize("hasRole('MANAGER')")
public ApiResponse editEmailWorkflowRuleByAction(@PathVariable Long requestingOrgId, @PathVariable Long emailWorkflowRuleId, @RequestBody Map<String, Object> data) {

ApiResponse response = new ApiResponse(SUCCESS);

JsonNode recipientNode = objectMapper.convertValue(data, JsonNode.class).get("recipient");
EmailTemplate emailTemplate = emailTemplateRepo.findById(Long.valueOf((Integer) data.get("templateId"))).get();

EmailWorkflowRuleByAction emailWorkflowRuleToUpdate = emailWorkflowRuleByActionRepo.findById(emailWorkflowRuleId).get();

EmailRecipient emailRecipient = buildRecipient(recipientNode);

if (emailRecipient == null) {
response = new ApiResponse(ERROR, "Could not create recipient.");
} else {

emailWorkflowRuleToUpdate.setEmailTemplate(emailTemplate);
emailWorkflowRuleToUpdate.setEmailRecipient(emailRecipient);

// TODO emailWorkflowRuleRepo.update(emailWorkflowRuleToUpdate);
emailWorkflowRuleByActionRepo.save(emailWorkflowRuleToUpdate);

// TODO: Is this needed?
organizationRepo.broadcast(requestingOrgId);
}

return response;
}

@RequestMapping("/{requestingOrgId}/remove-email-workflow-rule-by-action/{emailWorkflowRuleId}")
@PreAuthorize("hasRole('MANAGER')")
public ApiResponse removeEmailWorkflowRuleByAction(@PathVariable Long requestingOrgId, @PathVariable Long emailWorkflowRuleId) throws SystemEmailRuleNotDeleteableException {

Organization org = organizationRepo.read(requestingOrgId);
EmailWorkflowRuleByAction rule = emailWorkflowRuleByActionRepo.findById(emailWorkflowRuleId).get();

if (rule.isSystem()) {
throw new SystemEmailRuleNotDeleteableException();
} else {

org.removeEmailWorkflowRuleByAction(rule);
emailWorkflowRuleByActionRepo.delete(rule);

organizationRepo.update(org);

return new ApiResponse(SUCCESS);
}
}

@RequestMapping("/{requestingOrgId}/change-email-workflow-rule-by-action-activation/{emailWorkflowRuleId}")
@PreAuthorize("hasRole('MANAGER')")
public ApiResponse changeEmailWorkflowRuleByActionActivation(@PathVariable Long requestingOrgId, @PathVariable Long emailWorkflowRuleId) {

EmailWorkflowRuleByAction rule = emailWorkflowRuleByActionRepo.findById(emailWorkflowRuleId).get();

rule.isDisabled(!rule.isDisabled());

emailWorkflowRuleByActionRepo.save(rule);

organizationRepo.broadcast(requestingOrgId);

return new ApiResponse(SUCCESS);
}

@RequestMapping("/{requestingOrgId}/count-submissions")
@PreAuthorize("hasRole('MANAGER')")
public ApiResponse countSubmissions(@PathVariable Long requestingOrgId) {
Expand Down
Loading
Loading