Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue 1883,1879,1878,1877,1876,1766,1682] 1878 continued - System data loader refactor, cleanup, and additional patches #1887

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6adbcab
Fix email workflow rules resetting on restart
wwtamu Dec 23, 2023
95ce645
Switch application initialization to initializing bean
wwtamu Dec 23, 2023
9425e6b
Have abstract email recipient implement email recipient
wwtamu Dec 23, 2023
bf2b392
Make default collections class members final and remove unused methods
wwtamu Dec 28, 2023
8974332
Minor cleanup of integration tests
wwtamu Dec 28, 2023
30fa312
Remove unused imports
wwtamu Dec 28, 2023
f1bf6f9
More cleanup
wwtamu Dec 28, 2023
5c6c0c4
Organize imports and return rule id in payload of create new email wo…
wwtamu Dec 28, 2023
e54aedb
Use mock mvc to call controller in email workflow rule integration tests
wwtamu Dec 28, 2023
0217b72
Initial breaking system data loader test
wwtamu Dec 28, 2023
78309e3
Decouple submission list column default services
wwtamu Dec 28, 2023
2caff3e
Fix broken test due to immutable in memory defaults
wwtamu Dec 28, 2023
55439e4
Decouple system default settings from system data loader
wwtamu Dec 28, 2023
01c8da4
Decouple loading in memory proquest codes from persisting controlled …
wwtamu Dec 28, 2023
319fd14
Decouple initializing depositor services from system data loader
wwtamu Dec 28, 2023
4276717
Reorder system data loader methods according to use in class
wwtamu Dec 28, 2023
47035da
Directly use resource pattern resolver during system data loading
wwtamu Dec 28, 2023
c9f320a
Fix submission controller indentation
wwtamu Dec 28, 2023
0494d5f
Add private constructor for ORCID utility
wwtamu Dec 28, 2023
5d93951
Correct registration error response message
wwtamu Dec 28, 2023
3daa5ae
Only set default columns on user before create/persist
wwtamu Dec 28, 2023
522b885
Fix ORCiD authentication - issue 1877
wwtamu Dec 28, 2023
bcace83
Avoid null pointer exception
wwtamu Dec 28, 2023
c2e8212
Remove redundant superinterface
wwtamu Dec 28, 2023
042395c
Consistently format system default JSON
wwtamu Dec 29, 2023
4ec8d06
Simplify system submission status loading
wwtamu Dec 29, 2023
3abc1d0
Use field profile heritable repo delete and remove orphaned submissio…
wwtamu Dec 29, 2023
635cca0
Keyboard accessible organization triptych
wwtamu Dec 29, 2023
bfa6f92
Use test resources and ignore environment specific config files
wwtamu Dec 29, 2023
a51c6de
Print internal server error stack trace in debug
wwtamu Dec 29, 2023
37e9fd3
Switch to release of weaver and and compiler release property
wwtamu Dec 29, 2023
d1a6ac1
Remove overriding exception handlers causing all exceptions to be 500…
wwtamu Dec 29, 2023
c9a24a7
Move modal service to app to fix close modal - issue 1682
wwtamu Dec 29, 2023
56672ca
Remove unused dependency injection and scope variable
wwtamu Dec 29, 2023
4fc58eb
Close modal and wait before location change on submission delete
wwtamu Dec 29, 2023
086d593
Remove modal backdrop manually - issue 1879
wwtamu Dec 29, 2023
5d03e49
Update file upload to large message with max file size - issue 1883
wwtamu Dec 29, 2023
07e1d7a
Adjust line height of drop zone message
wwtamu Dec 29, 2023
33a88f7
Fix student submission select icon vertical centering
wwtamu Dec 29, 2023
2452c21
Fix conditional textarea input template
wwtamu Dec 29, 2023
fc8c0b0
Refactor test and test entity controlled vocabulary
wwtamu Dec 29, 2023
78d4559
Remove empty tests
wwtamu Dec 29, 2023
3aeea30
Add test messages to application initialization tests
wwtamu Dec 29, 2023
16e320d
Cleanup system data loader and rollback on IOException
wwtamu Dec 29, 2023
1c576cf
Add system data loader test
wwtamu Dec 29, 2023
a4f2f70
Update submission list column when field profile gloss updated
wwtamu Dec 30, 2023
ab9375a
Add data integrity violation exception handler
wwtamu Dec 30, 2023
b440656
Have data integrity violation exception return conflict status
wwtamu Dec 30, 2023
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@ dist/
!**/src/test/**

*.mv.db

### Environment Specific ###
application-*.yml
logback-*.yml
2 changes: 1 addition & 1 deletion .wvr/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const config = {
'./node_modules/@wvr/core/app/services/alertService.js',
'./node_modules/@wvr/core/app/services/validationStore.js',
'./node_modules/@wvr/core/app/services/userService.js',
'./node_modules/@wvr/core/app/services/modalService.js',
// './node_modules/@wvr/core/app/services/modalService.js',
'./node_modules/@wvr/core/app/services/modelCache.js',
'./node_modules/@wvr/core/app/services/modelUpdateService.js',
'./node_modules/@wvr/core/app/repo/abstractRepo.js',
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
<parent>
<groupId>edu.tamu.weaver</groupId>
<artifactId>webservice-parent</artifactId>
<version>2.1.1-RC19</version>
<version>2.1.1</version>
<relativePath/>
</parent>

<properties>
<java.version>11</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -222,6 +223,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
27 changes: 16 additions & 11 deletions src/main/java/org/tdl/vireo/ApplicationInitialization.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package org.tdl.vireo;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import org.springframework.stereotype.Component;
import org.tdl.vireo.service.EntityControlledVocabularyService;
import org.tdl.vireo.service.SystemDataLoader;

@Order(Ordered.HIGHEST_PRECEDENCE)
@Component
@Profile("!test")
public class ApplicationInitialization implements CommandLineRunner {
@Component("ApplicationInitialization")
public class ApplicationInitialization implements InitializingBean {

@Autowired
private Environment env;

@Lazy
@Autowired
Expand All @@ -24,11 +27,13 @@ public class ApplicationInitialization implements CommandLineRunner {
private EntityControlledVocabularyService entityControlledVocabularyService;

@Override
public void run(String... args) throws Exception {
// load defaults first
systemDataLoader.loadSystemData();
// assumes one language defined in defaults
entityControlledVocabularyService.scanForEntityControlledVocabularies();
public void afterPropertiesSet() throws Exception {
if (env.acceptsProfiles(Profiles.of("!isolated-test"))) {
// load defaults first
systemDataLoader.loadSystemData();
// assumes one language defined in defaults
entityControlledVocabularyService.scanForEntityControlledVocabularies();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public ApiResponse registration(@RequestBody(required = false) Map<String, Strin
content = cryptoService.validateGenericToken(token, EMAIL_VERIFICATION_TYPE);
} catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) {
logger.debug("Unable to validate token!");
return new ApiResponse(ERROR, "Unable to generate token!");
return new ApiResponse(ERROR, "Unable to validate token!");
}

String tokenCreateTime = content[0];
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tdl/vireo/config/AppEmailConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import edu.tamu.weaver.email.service.EmailSender;

@Configuration
@Profile(value = { "!test" })
@Profile(value = { "!test", "!isolated-test" })
public class AppEmailConfig extends WeaverEmailConfig {

@Bean
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/org/tdl/vireo/controller/OrganizationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
import static org.springframework.beans.BeanUtils.copyProperties;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

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;
import edu.tamu.weaver.validation.aspect.annotation.WeaverValidation;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -47,6 +42,15 @@
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;
import edu.tamu.weaver.validation.aspect.annotation.WeaverValidation;

@RestController
@RequestMapping("/organization")
public class OrganizationController {
Expand Down Expand Up @@ -253,6 +257,10 @@ public ApiResponse addEmailWorkflowRule(@PathVariable Long requestingOrgId, @Req
EmailWorkflowRule newEmailWorkflowRule = emailWorkflowRuleRepo.create(submissionStatus, emailRecipient, emailTemplate);
org.addEmailWorkflowRule(newEmailWorkflowRule);
organizationRepo.update(org);

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

return response;
Expand Down
Loading
Loading