diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml
new file mode 100644
index 000000000..62c7d8f54
--- /dev/null
+++ b/.github/workflows/checkstyle.yml
@@ -0,0 +1,20 @@
+name: Checkstyle Action
+on: pull_request
+
+jobs:
+ checkstyle_job:
+ runs-on: ubuntu-latest
+ name: Checkstyle Job
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Run check style
+ uses: nikitasavinov/checkstyle-action@master
+ with:
+ level: 'error'
+ fail_on_error: 'true'
+ github_token: ${{ secrets.GH_PAT }}
+ reporter: 'github-pr-check'
+ filter_mode: 'file'
+ checkstyle_config: checkstyle.xml
+ tool_name: 'reviewdog'
diff --git a/Makefile b/Makefile
index 42b4d77b6..468a22e58 100644
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,9 @@ docker-run:
debug:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5045 -jar target/agr_curation_api-bootable.jar
+checkstyle:
+ mvn checkstyle:check
+
test:
mvn test
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 000000000..f37703c97
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/checkstyle_config.xml b/checkstyle_config.xml
new file mode 100644
index 000000000..189fae825
--- /dev/null
+++ b/checkstyle_config.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index e88791f72..e7de080ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,6 +25,8 @@
0.5.1
3.5.0
3.0.0-M7
+ 3.3.1
+ 10.17.0
@@ -486,7 +488,46 @@
v@{project.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ ${maven-checkstyle-plugin.version}
+
+
+ com.puppycrawl.tools
+ checkstyle
+ ${checkstyle.version}
+
+
+
+
+ validate
+ validate
+
+ UTF-8
+ true
+ true
+ true
+
+
+ check
+
+
+
+
+ config_loc=${basedir}
+ checkstyle.xml
+
+
+
+
+
diff --git a/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationFilter.java b/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationFilter.java
index 41ae0b6fb..7919f6d13 100644
--- a/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationFilter.java
+++ b/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationFilter.java
@@ -41,38 +41,27 @@
public class AuthenticationFilter implements ContainerRequestFilter {
@Inject
- @AuthenticatedUser
- Event userAuthenticatedEvent;
+ @AuthenticatedUser Event userAuthenticatedEvent;
- @Inject
- AuthenticationService authenticationService;
+ @Inject AuthenticationService authenticationService;
- @Inject
- PersonDAO personDAO;
+ @Inject PersonDAO personDAO;
- @Inject
- AllianceMemberDAO allianceMemberDAO;
+ @Inject AllianceMemberDAO allianceMemberDAO;
- @Inject
- PersonService personService;
+ @Inject PersonService personService;
- @Inject
- PersonUniqueIdHelper loggedInPersonUniqueId;
+ @Inject PersonUniqueIdHelper loggedInPersonUniqueId;
- @ConfigProperty(name = "okta.authentication")
- Instance okta_auth;
+ @ConfigProperty(name = "okta.authentication") Instance oktaAuth;
- @ConfigProperty(name = "okta.url")
- Instance okta_url;
+ @ConfigProperty(name = "okta.url") Instance oktaUrl;
- @ConfigProperty(name = "okta.client.id")
- Instance client_id;
+ @ConfigProperty(name = "okta.client.id") Instance clientId;
- @ConfigProperty(name = "okta.client.secret")
- Instance client_secret;
+ @ConfigProperty(name = "okta.client.secret") Instance clientSecret;
- @ConfigProperty(name = "okta.api.token")
- Instance api_token;
+ @ConfigProperty(name = "okta.api.token") Instance apiToken;
// private static final String REALM = "AGR";
private static final String AUTHENTICATION_SCHEME = "Bearer";
@@ -86,8 +75,8 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
// Testing)
// if okta_auth is on and we have okta_creds validate(token), else fail
- if (okta_auth.get()) {
- if (!okta_url.get().equals("\"\"") && !client_id.get().equals("\"\"") && !client_secret.get().equals("\"\"") && !api_token.get().equals("\"\"")) {
+ if (oktaAuth.get()) {
+ if (!oktaUrl.get().equals("\"\"") && !clientId.get().equals("\"\"") && !clientSecret.get().equals("\"\"") && !apiToken.get().equals("\"\"")) {
String authorizationHeader = requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
@@ -97,20 +86,20 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
String token = authorizationHeader.substring(AUTHENTICATION_SCHEME.length()).trim();
Person person = null;
-
+
try {
Jwt jsonWebToken = authenticationService.verifyToken(token);
- if(person == null) {
+ if (person == null) {
person = validateUserToken(jsonWebToken);
}
- if(person == null) {
+ if (person == null) {
person = validateAdminToken(jsonWebToken);
}
} catch (JwtVerificationException e) {
person = personService.findPersonByApiToken(token);
}
-
+
if (person != null) {
userAuthenticatedEvent.fire(person);
} else {
@@ -152,12 +141,12 @@ private void loginDevUser() {
// Check Okta(token), Check DB ApiToken(token), else return null
private Person validateUserToken(Jwt jsonWebToken) {
-
+
String oktaUserId = (String) jsonWebToken.getClaims().get("uid"); // User Id
-
- if(oktaUserId != null && oktaUserId.length() > 0) {
+
+ if (oktaUserId != null && oktaUserId.length() > 0) {
String oktaEmail = (String) jsonWebToken.getClaims().get("sub"); // Subject Id
-
+
Person authenticatedUser = personService.findPersonByOktaEmail(oktaEmail);
if (authenticatedUser != null) {
@@ -186,27 +175,27 @@ private Person validateUserToken(Jwt jsonWebToken) {
return person;
}
}
-
+
return null;
}
-
+
private Person validateAdminToken(Jwt jsonWebToken) {
-
+
String oktaClientId = (String) jsonWebToken.getClaims().get("cid"); // Client Id
-
- if(oktaClientId != null && oktaClientId.length() > 0) {
-
+
+ if (oktaClientId != null && oktaClientId.length() > 0) {
+
Person authenticatedUser = personService.findPersonByOktaId(oktaClientId);
-
+
if (authenticatedUser != null) {
return authenticatedUser;
}
-
+
Log.info("Making OKTA call to get app info: ");
-
+
Application app = getOktaClient(oktaClientId);
-
- if(app != null) {
+
+ if (app != null) {
log.debug("OKTA Authentication for Admin user via token");
String adminEmail = "admin@alliancegenome.org";
Person person = new Person();
@@ -224,14 +213,13 @@ private Person validateAdminToken(Jwt jsonWebToken) {
return null;
}
-
private User getOktaUser(String oktaId) {
- Client client = Clients.builder().setOrgUrl(okta_url.get()).setClientId(client_id.get()).setClientCredentials(new TokenClientCredentials(api_token.get())).build();
+ Client client = Clients.builder().setOrgUrl(oktaUrl.get()).setClientId(clientId.get()).setClientCredentials(new TokenClientCredentials(apiToken.get())).build();
return client.getUser(oktaId);
}
-
+
private Application getOktaClient(String applicationId) {
- Client client = Clients.builder().setOrgUrl(okta_url.get()).setClientId(client_id.get()).setClientCredentials(new TokenClientCredentials(api_token.get())).build();
+ Client client = Clients.builder().setOrgUrl(oktaUrl.get()).setClientId(clientId.get()).setClientCredentials(new TokenClientCredentials(apiToken.get())).build();
return client.getApplication(applicationId);
}
diff --git a/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationService.java b/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationService.java
index ab8cbad5b..d53ee3267 100644
--- a/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationService.java
+++ b/src/main/java/org/alliancegenome/curation_api/auth/AuthenticationService.java
@@ -17,13 +17,13 @@
public class AuthenticationService {
@ConfigProperty(name = "okta.url")
- Instance okta_url;
+ Instance oktaUrl;
private AccessTokenVerifier jwtVerifier;
@PostConstruct
public void init() {
- jwtVerifier = JwtVerifiers.accessTokenVerifierBuilder().setIssuer(okta_url.get() + "/oauth2/default").setAudience("api://default").setConnectionTimeout(Duration.ofSeconds(1))
+ jwtVerifier = JwtVerifiers.accessTokenVerifierBuilder().setIssuer(oktaUrl.get() + "/oauth2/default").setAudience("api://default").setConnectionTimeout(Duration.ofSeconds(1))
// .setReadTimeout(Duration.ofSeconds(1))
.build();
}
diff --git a/src/main/java/org/alliancegenome/curation_api/config/RestApplication.java b/src/main/java/org/alliancegenome/curation_api/config/RestApplication.java
index 897028ed7..6800ed143 100644
--- a/src/main/java/org/alliancegenome/curation_api/config/RestApplication.java
+++ b/src/main/java/org/alliancegenome/curation_api/config/RestApplication.java
@@ -15,9 +15,9 @@
@ApplicationPath("/api")
@OpenAPIDefinition(
info = @Info(
- description = " This is the Alliance Curation Java API
" + //
- " !!! Please note: Some Swagger widgets may crash this page when expanded !!!
" + //
- "For flat file of API documentation click on the link below OpenAPI definition download
",
+ description = " This is the Alliance Curation Java API
"
+ + " !!! Please note: Some Swagger widgets may crash this page when expanded !!!
"
+ + "For flat file of API documentation click on the link below OpenAPI definition download
",
title = "Alliance of Genome Resources Curation API ",
version = "1.0 Alpha"
),
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
index 10197ae87..bda0f4497 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
@@ -1,14 +1,18 @@
package org.alliancegenome.curation_api.constants;
public final class EntityFieldConstants {
+
+ private EntityFieldConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final String TAXON = "taxon.curie";
public static final String DATA_PROVIDER = "dataProvider.sourceOrganization.abbreviation";
public static final String SECONDARY_DATA_PROVIDER = "secondaryDataProvider.sourceOrganization.abbreviation";
public static final String DA_SUBJECT = "diseaseAnnotationSubject";
- public static final String DA_SUBJECT_TAXON = DA_SUBJECT+ "." + TAXON;
+ public static final String DA_SUBJECT_TAXON = DA_SUBJECT + "." + TAXON;
public static final String PA_SUBJECT = "phenotypeAnnotationSubject";
- public static final String PA_SUBJECT_TAXON = PA_SUBJECT+ "." + TAXON;
+ public static final String PA_SUBJECT_TAXON = PA_SUBJECT + "." + TAXON;
public static final String ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "alleleAssociationSubject." + DATA_PROVIDER;
public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "constructAssociationSubject." + DATA_PROVIDER;
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
index b2aba7229..c2126f426 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
@@ -1,7 +1,10 @@
package org.alliancegenome.curation_api.constants;
-public final class LinkMLSchemaConstants {
+public class LinkMLSchemaConstants {
+ private LinkMLSchemaConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final String LATEST_RELEASE = "2.2.3";
public static final String MIN_ONTOLOGY_RELEASE = "1.2.4";
public static final String MAX_ONTOLOGY_RELEASE = LATEST_RELEASE;
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/OntologyConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/OntologyConstants.java
index 229e99247..4967458f9 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/OntologyConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/OntologyConstants.java
@@ -1,7 +1,9 @@
package org.alliancegenome.curation_api.constants;
public final class OntologyConstants {
-
+ private OntologyConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final String ZECO_AGR_SLIM_SUBSET = "ZECO_0000267";
public static final String ECO_TERM_ABBREVIATION_VOCABULARY = VocabularyConstants.ECO_TERM_ABBREVIATION_VOCABULARY;
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/ReferenceConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/ReferenceConstants.java
index eca6e0ce7..c8e794b48 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/ReferenceConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/ReferenceConstants.java
@@ -3,7 +3,9 @@
import java.util.List;
public final class ReferenceConstants {
-
+ private ReferenceConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final List primaryXrefOrder = List.of("PMID", "FB", "MGI", "RGD", "SGD", "WB", "XB", "ZFIN");
public static final String RGD_OMIM_ORPHANET_REFERENCE = "AGRKB:101000000829523";
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
index ea716e1f2..39a44ba41 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
@@ -1,7 +1,9 @@
package org.alliancegenome.curation_api.constants;
public final class ValidationConstants {
-
+ private ValidationConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final String INVALID_MESSAGE = "Not a valid entry";
public static final String INVALID_TYPE_MESSAGE = INVALID_MESSAGE + " - unexpected object type found";
public static final String OBSOLETE_MESSAGE = "Obsolete term specified";
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
index a4622dd4c..c8b4c379a 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
@@ -1,7 +1,9 @@
package org.alliancegenome.curation_api.constants;
public final class VocabularyConstants {
-
+ private VocabularyConstants() {
+ // Hidden from view, as it is a utility class
+ }
public static final String ANNOTATION_TYPE_VOCABULARY = "annotation_type";
public static final String DISEASE_QUALIFIER_VOCABULARY = "disease_qualifier";
public static final String DISEASE_GENETIC_MODIFIER_RELATION_VOCABULARY = "disease_genetic_modifier_relation";
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java b/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
index e0d04b709..3f2d12494 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
@@ -28,7 +28,7 @@ public class APIVersionInfoController implements APIVersionInterface {
String name;
@ConfigProperty(name = "quarkus.hibernate-search-orm.elasticsearch.hosts")
- String es_host;
+ String esHost;
@ConfigProperty(name = "NET")
String env;
@@ -45,11 +45,13 @@ public APIVersionInfo get() {
String minVersion = apiVersionInfoService.getVersionRange(version).get(0);
String maxVersion = apiVersionInfoService.getVersionRange(version).get(1);
String versionRange = minVersion.equals(maxVersion) ? minVersion : minVersion + " - " + maxVersion;
- if (apiVersionInfoService.isPartiallyImplemented(clazz, version))
+ if (apiVersionInfoService.isPartiallyImplemented(clazz, version)) {
versionRange = versionRange + " (partial)";
+ }
linkMLClassVersions.put(clazz.getSimpleName(), versionRange);
- if (version.submitted())
+ if (version.submitted()) {
submittedClassVersions.put(clazz.getSimpleName(), versionRange);
+ }
}
APIVersionInfo info = new APIVersionInfo();
@@ -57,7 +59,7 @@ public APIVersionInfo get() {
info.setName(name);
info.setAgrCurationSchemaVersions(linkMLClassVersions);
info.setSubmittedClassSchemaVersions(submittedClassVersions);
- info.setEsHost(es_host);
+ info.setEsHost(esHost);
info.setEnv(env);
return info;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java
index 7476761e6..17136ef31 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java
@@ -8,18 +8,20 @@
import org.alliancegenome.curation_api.model.ingest.dto.AnnotationDTO;
import org.alliancegenome.curation_api.services.base.BaseAnnotationDTOCrudService;
-public abstract class BaseAnnotationDTOCrudController, E extends Annotation, T extends AnnotationDTO, D extends BaseSQLDAO> extends BaseEntityCrudController
- implements BaseUpsertControllerInterface {
+public abstract class BaseAnnotationDTOCrudController, E extends Annotation, T extends AnnotationDTO, D extends BaseSQLDAO> extends BaseEntityCrudController implements BaseUpsertControllerInterface {
+ @Override
protected abstract void init();
private BaseAnnotationDTOCrudService service;
+ @Override
protected void setService(S service) {
super.setService(service);
this.service = service;
}
-
+
+ @Override
public E upsert(T dto) throws ObjectUpdateException {
return service.upsert(dto);
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseDocumentController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseDocumentController.java
index 233c8b4ac..eec3d957c 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseDocumentController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseDocumentController.java
@@ -19,11 +19,13 @@ protected void setService(S service) {
protected abstract void init();
+ @Override
public SearchResponse search(Integer page, Integer limit, HashMap params) {
- if (params == null)
+ if (params == null) {
params = new HashMap();
+ }
Pagination pagination = new Pagination(page, limit);
return service.searchByParams(pagination, params);
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseEntityCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseEntityCrudController.java
index 0a33a6b99..218b17a4e 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseEntityCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseEntityCrudController.java
@@ -22,22 +22,26 @@ protected void setService(S service) {
protected abstract void init();
+ @Override
public ObjectResponse create(E entity) {
return service.create(entity);
}
+ @Override
public ObjectListResponse create(List entities) {
return service.create(entities);
}
+ @Override
public ObjectResponse getById(Long id) {
return service.getById(id);
}
-
+
public ObjectResponse getByCurie(String curie) {
return service.getByCurie(curie);
}
+ @Override
public ObjectResponse update(E entity) {
return service.update(entity);
}
@@ -45,7 +49,8 @@ public ObjectResponse update(E entity) {
public ObjectResponse deleteByCurie(String curie) {
return service.deleteByCurie(curie);
}
-
+
+ @Override
public ObjectResponse deleteById(Long id) {
return service.deleteById(id);
}
@@ -54,30 +59,35 @@ public SearchResponse findByField(String field, String value) {
return service.findByField(field, value);
}
+ @Override
public SearchResponse find(Integer page, Integer limit, HashMap params) {
- if (params == null)
+ if (params == null) {
params = new HashMap<>();
+ }
Pagination pagination = new Pagination(page, limit);
return service.findByParams(pagination, params);
}
-
+
+ @Override
public SearchResponse findForPublic(Integer page, Integer limit, HashMap params) {
return find(page, limit, params);
}
+ @Override
public SearchResponse search(Integer page, Integer limit, HashMap params) {
- if (params == null)
+ if (params == null) {
params = new HashMap<>();
+ }
Pagination pagination = new Pagination(page, limit);
return service.searchByParams(pagination, params);
}
+ @Override
public void reindex(Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout, Integer typesToIndexInParallel) {
service.reindex(batchSizeToLoadObjects, idFetchSize, limitIndexedObjectsTo, threadsToLoadObjects, transactionTimeout, typesToIndexInParallel);
}
- public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout,
- Integer typesToIndexInParallel) {
+ public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout, Integer typesToIndexInParallel) {
service.reindexEverything(batchSizeToLoadObjects, idFetchSize, limitIndexedObjectsTo, threadsToLoadObjects, transactionTimeout, typesToIndexInParallel);
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java
index c0954cb26..fa5fdc9a5 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java
@@ -10,18 +10,17 @@
import org.alliancegenome.curation_api.response.ObjectResponse;
import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService;
-public abstract class SubmittedObjectCrudController, E extends SubmittedObject, T extends BaseDTO, D extends BaseEntityDAO> extends BaseEntityCrudController implements
- BaseSubmittedObjectCrudInterface,
- BaseUpsertControllerInterface
-{
+public abstract class SubmittedObjectCrudController, E extends SubmittedObject, T extends BaseDTO, D extends BaseEntityDAO> extends BaseEntityCrudController implements BaseSubmittedObjectCrudInterface, BaseUpsertControllerInterface {
protected SubmittedObjectCrudService service;
-
+
+ @Override
protected void setService(S service) {
super.setService(service);
this.service = service;
}
-
+
+ @Override
public E upsert(T dto) throws ObjectUpdateException {
return service.upsert(dto);
}
@@ -30,10 +29,12 @@ public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdate
return service.upsert(dto, dataProvider);
}
+ @Override
public ObjectResponse getByIdentifier(String identifierString) {
return service.getByIdentifier(identifierString);
}
-
+
+ @Override
public ObjectResponse deleteByIdentifier(String identifierString) {
return service.deleteByIdentifier(identifierString);
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/AllelePhenotypeAnnotationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/AllelePhenotypeAnnotationCrudController.java
index 3b44c4914..a2710f7ae 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/AllelePhenotypeAnnotationCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/AllelePhenotypeAnnotationCrudController.java
@@ -12,10 +12,9 @@
import jakarta.inject.Inject;
@RequestScoped
-public class AllelePhenotypeAnnotationCrudController extends BaseEntityCrudControllerimplements AllelePhenotypeAnnotationCrudInterface {
+public class AllelePhenotypeAnnotationCrudController extends BaseEntityCrudController implements AllelePhenotypeAnnotationCrudInterface {
- @Inject
- AllelePhenotypeAnnotationService allelePhenotypeAnnotationService;
+ @Inject AllelePhenotypeAnnotationService allelePhenotypeAnnotationService;
@Override
@PostConstruct
@@ -23,6 +22,7 @@ protected void init() {
setService(allelePhenotypeAnnotationService);
}
+ @Override
public ObjectResponse getByIdentifier(String identifierString) {
return allelePhenotypeAnnotationService.getByIdentifier(identifierString);
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/GenoTermCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/GenoTermCrudController.java
index b7476e7d5..cdab7ab3d 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/GenoTermCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/GenoTermCrudController.java
@@ -9,11 +9,9 @@
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;
-
public class GenoTermCrudController extends BaseOntologyTermController implements GenoTermCrudInterface {
-
- @Inject
- GenoTermService genoTermService;
+
+ @Inject GenoTermService genoTermService;
@Override
@PostConstruct
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/VariantDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/VariantDAO.java
index d86aa2e07..4e6bec7ea 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/VariantDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/VariantDAO.java
@@ -12,8 +12,9 @@
@ApplicationScoped
public class VariantDAO extends BaseSQLDAO {
-
+
@Inject DiseaseAnnotationDAO diseaseAnnotationDAO;
+
protected VariantDAO() {
super(Variant.class);
}
@@ -21,7 +22,7 @@ protected VariantDAO() {
public List findReferencingDiseaseAnnotationIds(Long variantId) {
Map dgmParams = new HashMap<>();
dgmParams.put("diseaseGeneticModifiers.id", variantId);
- Listresults = diseaseAnnotationDAO.findFilteredIds(dgmParams);
+ List results = diseaseAnnotationDAO.findFilteredIds(dgmParams);
return results;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java
index e00dea7cf..83cccb87e 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java
@@ -65,8 +65,8 @@ public class BaseSQLDAO extends BaseEntityDAO {
@Inject protected SearchSession searchSession;
@Inject protected IndexProcessDisplayService indexProcessDisplayService;
- private int outerBoost = 0;
- private int innerBoost = 0;
+ private int outerBoost;
+ private int innerBoost;
protected BaseSQLDAO(Class myClass) {
super(myClass);
@@ -134,7 +134,7 @@ public E find(Long id) {
return null;
}
}
-
+
private List buildRestrictions(Root root, Map params, Logger.Level level) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
List restrictions = new ArrayList<>();
@@ -157,8 +157,9 @@ private List buildRestrictions(Root root, Map para
} else {
Log.log(level, "Looking up via root: " + s);
column = root.get(s);
- if (column.getJavaType().equals(List.class))
+ if (column.getJavaType().equals(List.class)) {
column = root.joinList(s, JoinType.LEFT);
+ }
}
Log.log(level, "Column Alias: " + column.getAlias() + " Column Java Type: " + column.getJavaType() + " Column Model: " + column.getModel() + " Column Parent Path Alias: " + column.getParentPath().getAlias());
@@ -166,19 +167,21 @@ private List buildRestrictions(Root root, Map para
} else {
Log.log(level, "Looking up via root: " + key);
column = root.get(key);
- // Don't need to join to these tables if value is null, the isEmpty will catch the condition later
+ // Don't need to join to these tables if value is null, the isEmpty will catch
+ // the condition later
Object value = params.get(key);
- if(value != null) {
- if (column instanceof SqmPluralValuedSimplePath)
+ if (value != null) {
+ if (column instanceof SqmPluralValuedSimplePath) {
column = root.joinList(key, JoinType.LEFT);
+ }
}
}
Log.log(level, "Column Alias: " + column.getAlias() + " Column Java Type: " + column.getJavaType() + " Column Model: " + column.getModel() + " Column Parent Path Alias: " + column.getParentPath().getAlias());
-
+
Object value = params.get(key);
-
- if(value == null) {
+
+ if (value == null) {
restrictions.add(builder.isEmpty(root.get(key)));
} else if (value instanceof Integer) {
Log.log(level, "Integer Type: " + value);
@@ -204,28 +207,28 @@ private List buildRestrictions(Root root, Map para
Log.info("Unsupprted Value: " + value);
}
}
-
+
return restrictions;
}
-
+
public List findFilteredIds(Map params) {
Logger.Level level = Level.DEBUG;
- if(params.containsKey("debug")) {
+ if (params.containsKey("debug")) {
level = params.remove("debug").equals("true") ? Level.INFO : Level.DEBUG;
}
-
+
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery query = builder.createQuery(Long.class);
Root root = query.from(myClass);
-
+
List restrictions = buildRestrictions(root, params, level);
query.orderBy(builder.asc(root.get("id")));
query.where(builder.and(restrictions.toArray(new Predicate[0])));
query.select(root.get("id"));
-
+
List filteredIds = entityManager.createQuery(query).getResultList();
-
+
return filteredIds;
}
@@ -247,15 +250,16 @@ public SearchResponse findAllIds() {
for (E entity : allQuery.getResultList()) {
Long pk = returnId(entity);
- if (pk != null)
+ if (pk != null) {
primaryKeys.add(pk);
+ }
}
results.setResults(primaryKeys);
results.setTotalResults(totalResults);
return results;
}
-
+
private Long returnId(E entity) {
Long pk = null;
try {
@@ -265,7 +269,7 @@ private Long returnId(E entity) {
}
return pk;
}
-
+
public SearchResponse findAll() {
return findAll(null);
}
@@ -288,8 +292,9 @@ public SearchResponse findAll(Pagination pagination) {
TypedQuery allQuery = entityManager.createQuery(all);
if (pagination != null && pagination.getLimit() != null && pagination.getPage() != null) {
int first = pagination.getPage() * pagination.getLimit();
- if (first < 0)
+ if (first < 0) {
first = 0;
+ }
allQuery.setFirstResult(first);
allQuery.setMaxResults(pagination.getLimit());
}
@@ -302,8 +307,9 @@ public SearchResponse findAll(Pagination pagination) {
private void handlePersistenceException(E entity, Exception e) {
ObjectResponse response = new ObjectResponse(entity);
Throwable rootCause = e.getCause();
- while (rootCause.getCause() != null)
+ while (rootCause.getCause() != null) {
rootCause = rootCause.getCause();
+ }
if (rootCause instanceof ConstraintViolationException) {
ConstraintViolationException cve = (ConstraintViolationException) rootCause;
response.setErrorMessage("Violates database constraint " + cve.getConstraintName());
@@ -349,20 +355,32 @@ public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSiz
ProcessDisplayHelper ph = new ProcessDisplayHelper(2000);
ph.addDisplayHandler(indexProcessDisplayService);
ph.startProcess("Mass Index Everything");
- MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects).monitor(new MassIndexingMonitor() {
+ MassIndexer indexer = searchSession.massIndexer(annotatedClasses)
+ .batchSizeToLoadObjects(batchSizeToLoadObjects)
+ .idFetchSize(idFetchSize)
+ .dropAndCreateSchemaOnStart(true)
+ .mergeSegmentsOnFinish(false)
+ .typesToIndexInParallel(typesToIndexInParallel)
+ .threadsToLoadObjects(threadsToLoadObjects)
+ .monitor(new MassIndexingMonitor() {
+ @Override
public void documentsAdded(long increment) {
}
+ @Override
public void entitiesLoaded(long increment) {
}
+ @Override
public void addToTotalCount(long increment) {
}
+ @Override
public void documentsBuilt(long increment) {
ph.progressProcess();
}
+ @Override
public void indexingCompleted() {
ph.finishProcess();
}
@@ -378,13 +396,16 @@ public void indexingCompleted() {
public void reindex(Class> objectClass, Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout, Integer typesToIndexInParallel) {
Log.debug("Starting Indexing for: " + objectClass);
- MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects).monitor(new MassIndexingMonitor() {
+ MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects)
+ .monitor(new MassIndexingMonitor() {
ProcessDisplayHelper ph = new ProcessDisplayHelper(2000);
+ @Override
public void documentsAdded(long increment) {
}
+ @Override
public void entitiesLoaded(long increment) {
}
@@ -425,10 +446,10 @@ public SearchResponse searchByField(Pagination pagination, String field, Stri
public SearchResponse searchByParams(Pagination pagination, Map params) {
Logger.Level level = Level.DEBUG;
- if(params.containsKey("debug")) {
+ if (params.containsKey("debug")) {
level = params.remove("debug").equals("true") ? Level.INFO : Level.DEBUG;
}
-
+
Log.log(level, "Search: " + pagination + " Params: " + params);
SearchQueryOptionsStep, E, SearchLoadingOptionsStep, ?, ?> step = searchSession.search(myClass).where(p -> {
@@ -442,8 +463,9 @@ public SearchResponse searchByParams(Pagination pagination, Map f.bool().with(q -> {
innerBoost = searchFilters.get(filterName).keySet().size();
for (String field : searchFilters.get(filterName).keySet()) {
- if (field.equals("nonNullFields") || field.equals("nullFields"))
+ if (field.equals("nonNullFields") || field.equals("nullFields")) {
continue;
+ }
float boost = (outerBoost * 10000) + (innerBoost * 1000);
String op = (String) searchFilters.get(filterName).get(field).get("tokenOperator");
@@ -483,14 +505,14 @@ public SearchResponse searchByParams(Pagination pagination, Map searchByParams(Pagination pagination, Map result = query.fetch(pagination.getPage() * pagination.getLimit(), pagination.getLimit());
if (aggKeys.size() > 0) {
@@ -561,25 +582,25 @@ public SearchResponse searchByParams(Pagination pagination, Map findByFields(List fields, String value) {
Log.debug("SqlDAO: findByFields: " + fields + " " + value);
HashMap params = new HashMap<>();
- for(String field: fields) {
+ for (String field : fields) {
params.put(field, value);
}
params.put("query_operator", "or");
SearchResponse results = findByParams(params);
- //Log.debug("Result List: " + results);
+ // Log.debug("Result List: " + results);
if (results.getResults().size() > 0) {
return results;
} else {
return null;
}
}
-
+
public SearchResponse findByField(String field, Object value) {
Log.debug("SqlDAO: findByField: " + field + " " + value);
HashMap params = new HashMap<>();
params.put(field, value);
SearchResponse results = findByParams(params);
- //Log.debug("Result List: " + results);
+ // Log.debug("Result List: " + results);
if (results.getResults().size() > 0) {
return results;
} else {
@@ -597,10 +618,10 @@ public SearchResponse findByParams(Pagination pagination, Map
public SearchResponse findByParams(Pagination pagination, Map params, String orderByField) {
Logger.Level level = Level.DEBUG;
- if(params.containsKey("debug")) {
+ if (params.containsKey("debug")) {
level = params.remove("debug").equals("true") ? Level.INFO : Level.DEBUG;
}
-
+
Log.log(level, "Pagination: " + pagination + " Params: " + params + " Order by: " + orderByField + " Class: " + myClass);
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
@@ -610,25 +631,26 @@ public SearchResponse findByParams(Pagination pagination, Map
Root countRoot = countQuery.from(myClass);
Operator queryOperator = Operator.AND;
- if(params.containsKey("query_operator")) {
+ if (params.containsKey("query_operator")) {
queryOperator = params.remove("query_operator").equals("or") ? Operator.OR : Operator.AND;
}
-
+
// System.out.println("Root: " + root);
List restrictions = buildRestrictions(root, params, level);
List countRestrictions = buildRestrictions(countRoot, params, level);
-
+
countQuery.select(builder.count(countRoot));
if (orderByField != null) {
query.orderBy(builder.asc(root.get(orderByField)));
} else {
- //Metamodel metaModel = entityManager.getMetamodel();
- //IdentifiableType of = (IdentifiableType) metaModel.managedType(myClass);
- //query.orderBy(builder.asc(root.get(of.getId(of.getIdType().getJavaType()).getName())));
+ // Metamodel metaModel = entityManager.getMetamodel();
+ // IdentifiableType of = (IdentifiableType)
+ // metaModel.managedType(myClass);
+ // query.orderBy(builder.asc(root.get(of.getId(of.getIdType().getJavaType()).getName())));
}
- if(queryOperator == Operator.AND) {
+ if (queryOperator == Operator.AND) {
query.where(builder.and(restrictions.toArray(new Predicate[0])));
countQuery.where(builder.and(countRestrictions.toArray(new Predicate[0])));
} else {
@@ -639,29 +661,30 @@ public SearchResponse findByParams(Pagination pagination, Map
TypedQuery allQuery = entityManager.createQuery(query);
if (pagination != null && pagination.getLimit() != null && pagination.getPage() != null) {
int first = pagination.getPage() * pagination.getLimit();
- if (first < 0)
+ if (first < 0) {
first = 0;
+ }
allQuery.setFirstResult(first);
allQuery.setMaxResults(pagination.getLimit());
}
-
+
Log.log(level, query);
Log.log(level, allQuery);
Log.log(level, countQuery);
-
+
List dbResults = allQuery.getResultList();
SearchResponse results = new SearchResponse();
results.setResults(dbResults);
-
+
if (level == Level.INFO) {
results.setDebug("true");
- results.setEsQuery(((QuerySqmImpl)allQuery).getQueryString());
- results.setDbQuery(((SqmSelectStatement)query).toHqlString());
+ results.setEsQuery(((QuerySqmImpl) allQuery).getQueryString());
+ results.setDbQuery(((SqmSelectStatement) query).toHqlString());
}
-
+
Long totalResults = entityManager.createQuery(countQuery).getSingleResult();
results.setTotalResults(totalResults);
-
+
return results;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotationDAO.java
index 79ffd9d14..ee9e62047 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotationDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotationDAO.java
@@ -6,10 +6,10 @@
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
-public class AlleleFunctionalImpactSlotAnnotationDAO extends BaseSQLDAO< AlleleFunctionalImpactSlotAnnotation> {
+public class AlleleFunctionalImpactSlotAnnotationDAO extends BaseSQLDAO {
protected AlleleFunctionalImpactSlotAnnotationDAO() {
- super( AlleleFunctionalImpactSlotAnnotation.class);
+ super(AlleleFunctionalImpactSlotAnnotation.class);
}
}
diff --git a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkDataProvider.java b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkDataProvider.java
index 63971b00c..8efc92aa0 100644
--- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkDataProvider.java
+++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkDataProvider.java
@@ -6,7 +6,7 @@ public enum BackendBulkDataProvider {
RGD("NCBITaxon:10116", "RGD:", 10116, "RGD", "RGD", "Rattus", false, false, false, false),
MGI("NCBITaxon:10090", "MGI:", 10090, "MGI", "MGI", "Mus", true, false, true, false),
- SGD("NCBITaxon:4932", "SGD:", 4932, "SGD", "SGD", "Saccharomyces", true, false, false, false ),
+ SGD("NCBITaxon:4932", "SGD:", 4932, "SGD", "SGD", "Saccharomyces", true, false, false, false),
HUMAN("NCBITaxon:9606", "HGNC:", 9606, "RGD", "RGD", "Rattus", false, false, false, false),
ZFIN("NCBITaxon:7955", "ZFIN:", 7955, "ZFIN", "ZFIN", "Danio", true, false, true, false),
FB("NCBITaxon:7227", "FB:", 7227, "FB", "FB", "Drosophila", true, false, false, false),
@@ -15,22 +15,20 @@ public enum BackendBulkDataProvider {
XBXL("NCBITaxon:8355", "XB:", 8355, "XB", "Xenbase", "Xenopus", true, false, false, false),
XBXT("NCBITaxon:8364", "XB:", 8364, "XB", "Xenbase", "Xenopus", true, false, false, false),
SARSCoV2("NCBITaxon:2697049", "RefSeq", 2697049, "Alliance", "Alliance of Genome Resources", "Severe acute respiratory syndrome", false, false, false, false);
-
+
public String canonicalTaxonCurie;
public String curiePrefix;
public Integer idPart;
- public String sourceOrganization; //The Source Organisation Abbreviation
- public String resourceDescriptor; //The organisation's name in the ResourceDescriptor file
+ public String sourceOrganization; // The Source Organisation Abbreviation
+ public String resourceDescriptor; // The organisation's name in the ResourceDescriptor file
public String coreGenus;
public Boolean hasInferredGenePhenotypeAnnotations;
public Boolean hasAssertedGenePhenotypeAnnotations;
public Boolean hasInferredAllelePhenotypeAnnotations;
public Boolean hasAssertedAllelePhenotypeAnnotations;
- private BackendBulkDataProvider(String canonicalTaxonCurie, String curiePrefix, Integer idPart,
- String sourceOrganization, String resourceDescriptor, String coreGenus,
- Boolean hasInferredGenePhenotypeAnnotations, Boolean hasAssertedGenePhenotypeAnnotations,
- Boolean hasInferredAllelePhenotypeAnnotations, Boolean hasAssertedAllelePhenotypeAnnotations) {
+ private BackendBulkDataProvider(String canonicalTaxonCurie, String curiePrefix, Integer idPart, String sourceOrganization, String resourceDescriptor, String coreGenus, Boolean hasInferredGenePhenotypeAnnotations, Boolean hasAssertedGenePhenotypeAnnotations,
+ Boolean hasInferredAllelePhenotypeAnnotations, Boolean hasAssertedAllelePhenotypeAnnotations) {
this.canonicalTaxonCurie = canonicalTaxonCurie;
this.curiePrefix = curiePrefix;
this.idPart = idPart;
@@ -42,7 +40,7 @@ private BackendBulkDataProvider(String canonicalTaxonCurie, String curiePrefix,
this.hasInferredAllelePhenotypeAnnotations = hasInferredAllelePhenotypeAnnotations;
this.hasAssertedAllelePhenotypeAnnotations = hasAssertedAllelePhenotypeAnnotations;
}
-
+
public static String getCanonicalTaxonCurie(String dataProvider) {
BackendBulkDataProvider result = null;
for (BackendBulkDataProvider provider : values()) {
@@ -51,19 +49,21 @@ public static String getCanonicalTaxonCurie(String dataProvider) {
break;
}
}
- if (result == null)
+ if (result == null) {
return null;
+ }
return result.canonicalTaxonCurie;
}
-
+
public static String getCoreGenus(String dataProvider) {
for (BackendBulkDataProvider provider : values()) {
- if (Objects.equals(provider.name(), dataProvider))
+ if (Objects.equals(provider.name(), dataProvider)) {
return provider.coreGenus;
+ }
}
return null;
}
-
+
public static String getCuriePrefixFromTaxonId(Integer id) {
for (BackendBulkDataProvider provider : values()) {
if (id.equals(provider.idPart)) {
diff --git a/src/main/java/org/alliancegenome/curation_api/enums/ConditionRelationFmsEnum.java b/src/main/java/org/alliancegenome/curation_api/enums/ConditionRelationFmsEnum.java
index a75f8f209..0e997d577 100644
--- a/src/main/java/org/alliancegenome/curation_api/enums/ConditionRelationFmsEnum.java
+++ b/src/main/java/org/alliancegenome/curation_api/enums/ConditionRelationFmsEnum.java
@@ -1,24 +1,26 @@
package org.alliancegenome.curation_api.enums;
public enum ConditionRelationFmsEnum {
+
ameliorates("ameliorated_by"),
exacerbates("exacerbated_by"),
has_condition("has_condition"),
induces("induced_by");
public String agrRelation;
-
+
private ConditionRelationFmsEnum(String agrRelation) {
this.agrRelation = agrRelation;
}
public static ConditionRelationFmsEnum findByName(String name) {
-
+
for (ConditionRelationFmsEnum relation : values()) {
- if (relation.name().equals(name))
+ if (relation.name().equals(name)) {
return relation;
+ }
}
-
+
return null;
}
}
diff --git a/src/main/java/org/alliancegenome/curation_api/enums/JobStatus.java b/src/main/java/org/alliancegenome/curation_api/enums/JobStatus.java
index 284a214b4..52810fb94 100644
--- a/src/main/java/org/alliancegenome/curation_api/enums/JobStatus.java
+++ b/src/main/java/org/alliancegenome/curation_api/enums/JobStatus.java
@@ -29,20 +29,26 @@ public boolean isNotRunning() {
}
public JobStatus getNextStatus() {
- if (this == JobStatus.FORCED_PENDING)
+ if (this == JobStatus.FORCED_PENDING) {
return JobStatus.FORCED_STARTED;
- if (this == JobStatus.FORCED_STARTED)
+ }
+ if (this == JobStatus.FORCED_STARTED) {
return JobStatus.FORCED_RUNNING;
+ }
- if (this == JobStatus.SCHEDULED_PENDING)
+ if (this == JobStatus.SCHEDULED_PENDING) {
return JobStatus.SCHEDULED_STARTED;
- if (this == JobStatus.SCHEDULED_STARTED)
+ }
+ if (this == JobStatus.SCHEDULED_STARTED) {
return JobStatus.SCHEDULED_RUNNING;
+ }
- if (this == JobStatus.MANUAL_PENDING)
+ if (this == JobStatus.MANUAL_PENDING) {
return JobStatus.MANUAL_STARTED;
- if (this == JobStatus.MANUAL_STARTED)
+ }
+ if (this == JobStatus.MANUAL_STARTED) {
return JobStatus.MANUAL_RUNNING;
+ }
return FAILED;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/enums/PsiMiTabPrefixEnum.java b/src/main/java/org/alliancegenome/curation_api/enums/PsiMiTabPrefixEnum.java
index 177c62269..8da611930 100644
--- a/src/main/java/org/alliancegenome/curation_api/enums/PsiMiTabPrefixEnum.java
+++ b/src/main/java/org/alliancegenome/curation_api/enums/PsiMiTabPrefixEnum.java
@@ -27,24 +27,28 @@ public static PsiMiTabPrefixEnum findByPsiMiTabPrefix(String psiMiTabPrefix) {
psiMiTabPrefix = psiMiTabPrefix.replace("/", "_");
for (PsiMiTabPrefixEnum prefix : values()) {
- if (prefix.name().equals(psiMiTabPrefix))
+ if (prefix.name().equals(psiMiTabPrefix)) {
return prefix;
+ }
}
return null;
}
public static String getAllianceIdentifier(String psiMiTabIdentifier) {
- if (StringUtils.isBlank(psiMiTabIdentifier))
+ if (StringUtils.isBlank(psiMiTabIdentifier)) {
return null;
+ }
String[] psiMiTabIdParts = psiMiTabIdentifier.split(":");
- if (psiMiTabIdParts.length != 2)
+ if (psiMiTabIdParts.length != 2) {
return psiMiTabIdentifier;
+ }
PsiMiTabPrefixEnum prefix = findByPsiMiTabPrefix(psiMiTabIdParts[0]);
- if (prefix == null)
+ if (prefix == null) {
return psiMiTabIdentifier;
+ }
return prefix.alliancePrefix + ":" + psiMiTabIdParts[1];
}
diff --git a/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java b/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java
index 7547e1e57..15516e435 100644
--- a/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java
+++ b/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java
@@ -20,11 +20,11 @@ public class ObjectUpdateException extends Exception {
public ObjectUpdateException(Object updateObject, String message) {
data = new ObjectUpdateExceptionData(updateObject, message, null);
}
-
+
public ObjectUpdateException(Object updateObject, Collection messages) {
data = new ObjectUpdateExceptionData(updateObject, messages, null);
}
-
+
public ObjectUpdateException(Object updateObject, String message, StackTraceElement[] stackTraceElements) {
data = new ObjectUpdateExceptionData(updateObject, message, stackTraceElements);
}
@@ -36,13 +36,13 @@ public static class ObjectUpdateExceptionData {
private static ObjectMapper mapper = new RestDefaultObjectMapper().getMapper();
@JsonView({ View.FieldsOnly.class })
- private String jsonObject = null;
+ private String jsonObject;
@JsonView({ View.FieldsOnly.class })
- private String message = null;
+ private String message;
@JsonView({ View.FieldsOnly.class })
- private Collection messages = null;
+ private Collection messages;
@JsonView({ View.FieldsOnly.class })
- private StackTraceElement[] stackTraceElements = null;
+ private StackTraceElement[] stackTraceElements;
public ObjectUpdateExceptionData(Object updateObject, Collection messages, StackTraceElement[] stackTraceElements) {
try {
@@ -54,7 +54,7 @@ public ObjectUpdateExceptionData(Object updateObject, Collection message
this.jsonObject = "{}";
}
}
-
+
public ObjectUpdateExceptionData(Object updateObject, String message, StackTraceElement[] stackTraceElements) {
try {
this.message = message;
diff --git a/src/main/java/org/alliancegenome/curation_api/healthcheck/IndexingHealthCheck.java b/src/main/java/org/alliancegenome/curation_api/healthcheck/IndexingHealthCheck.java
index 1ceb47890..82f388af9 100644
--- a/src/main/java/org/alliancegenome/curation_api/healthcheck/IndexingHealthCheck.java
+++ b/src/main/java/org/alliancegenome/curation_api/healthcheck/IndexingHealthCheck.java
@@ -27,22 +27,22 @@ public class IndexingHealthCheck implements HealthCheck {
public HealthCheckResponse call() {
HealthCheckResponseBuilder resp = null;
-
+
resp = HealthCheckResponse.named("Elasticsearch Indexing health check").up();
-
+
try {
IndexProcessingEvent event = indexProcessingWebsocket.getEvent();
-
- if(event != null) {
+
+ if (event != null) {
resp.withData("json", mapper.writeValueAsString(event));
-
- if(event instanceof StartIndexProcessingEvent) {
+
+ if (event instanceof StartIndexProcessingEvent) {
resp.withData("status", "Start Indexing");
}
- if(event instanceof ProgressIndexProcessingEvent) {
+ if (event instanceof ProgressIndexProcessingEvent) {
resp.withData("status", "Indexing");
}
- if(event instanceof EndIndexProcessingEvent) {
+ if (event instanceof EndIndexProcessingEvent) {
resp.withData("status", "Indexing Finished");
}
}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/APIVersionInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/APIVersionInterface.java
index 62bc0b259..b9558b04d 100644
--- a/src/main/java/org/alliancegenome/curation_api/interfaces/APIVersionInterface.java
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/APIVersionInterface.java
@@ -21,6 +21,6 @@ public interface APIVersionInterface {
@GET
@Path("/")
@JsonView(View.FieldsOnly.class)
- public APIVersionInfo get();
+ APIVersionInfo get();
}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/DQMSubmissionInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/DQMSubmissionInterface.java
index 15480bc09..6754ac277 100644
--- a/src/main/java/org/alliancegenome/curation_api/interfaces/DQMSubmissionInterface.java
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/DQMSubmissionInterface.java
@@ -19,8 +19,6 @@ public interface DQMSubmissionInterface {
@POST
@Path("/submit")
@Consumes(MediaType.MULTIPART_FORM_DATA)
- public String update(MultipartFormDataInput input,
- @DefaultValue("true")
- @QueryParam("cleanUp") Boolean cleanUp);
+ String update(MultipartFormDataInput input, @DefaultValue("true") @QueryParam("cleanUp") Boolean cleanUp);
}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/SystemControllerInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/SystemControllerInterface.java
index b4e95781e..fd3d43dda 100644
--- a/src/main/java/org/alliancegenome/curation_api/interfaces/SystemControllerInterface.java
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/SystemControllerInterface.java
@@ -22,7 +22,7 @@ public interface SystemControllerInterface {
@GET
@Path("/reindexeverything")
- public void reindexEverything(
+ void reindexEverything(
@DefaultValue("1000") @QueryParam("batchSizeToLoadObjects") Integer batchSizeToLoadObjects,
@DefaultValue("0") @QueryParam("idFetchSize") Integer idFetchSize,
@DefaultValue("0") @QueryParam("limitIndexedObjectsTo") Integer limitIndexedObjectsTo,
@@ -32,14 +32,14 @@ public void reindexEverything(
@GET
@Path("/sitesummary")
- public ObjectResponse