Skip to content

Commit

Permalink
Merge pull request #1937 from TAMULib/54-55-configuration_suggestion-…
Browse files Browse the repository at this point in the history
…to_upstream

Make the Embargo Type and Submission Type None values configurable.
  • Loading branch information
cstarcher authored May 30, 2024
2 parents 115f47d + 28661a1 commit 0733851
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
30 changes: 30 additions & 0 deletions src/main/java/org/tdl/vireo/config/AppFilterConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.tdl.vireo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "app.filter")
public class AppFilterConfig {

private String embargoTypeNone;

private String submissionTypeNone;

public String getEmbargoTypeNone() {
return embargoTypeNone;
}

public void setEmbargoTypeNone(String embargoTypeNone) {
this.embargoTypeNone = embargoTypeNone;
}

public String getSubmissionTypeNone() {
return submissionTypeNone;
}

public void setSubmissionTypeNone(String submissionTypeNone) {
this.submissionTypeNone = submissionTypeNone;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.transaction.annotation.Transactional;
import org.tdl.vireo.config.AppFilterConfig;
import org.tdl.vireo.config.VireoDatabaseConfig;
import org.tdl.vireo.exception.OrganizationDoesNotAcceptSubmissionsException;
import org.tdl.vireo.model.Configuration;
Expand Down Expand Up @@ -101,6 +102,9 @@ public class SubmissionRepoImpl extends AbstractWeaverRepoImpl<Submission, Submi
@Autowired
private AssetService assetService;

@Autowired
private AppFilterConfig appFilterConfig;

@Autowired
private VireoDatabaseConfig vireoDatabaseConfig;

Expand Down Expand Up @@ -754,8 +758,10 @@ public int compare(SubmissionListColumn svc1, SubmissionListColumn svc2) {
sqlBuilder.append(" value = '").append(escapeString(filterString, false, true)).append("' OR");
}

if ("None".equals(filterString)) {
hasNone = true;
if (appFilterConfig.getEmbargoTypeNone() != null) {
if (appFilterConfig.getEmbargoTypeNone().equalsIgnoreCase(filterString)) {
hasNone = true;
}
}
}
sqlBuilder.setLength(sqlBuilder.length() - 3);
Expand Down Expand Up @@ -784,8 +790,10 @@ public int compare(SubmissionListColumn svc1, SubmissionListColumn svc2) {
sqlBuilder.append(" value = '").append(escapeString(filterString, false, true)).append("' OR");
}

if ("None".equals(filterString)) {
hasNone = true;
if (appFilterConfig.getSubmissionTypeNone() != null) {
if (appFilterConfig.getSubmissionTypeNone().equalsIgnoreCase(filterString)) {
hasNone = true;
}
}
}
sqlBuilder.setLength(sqlBuilder.length() - 3);
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ app:
# edu.tamu.weaver.utility.HttpUtility
http.timeout: 10000

# org.tdl.vireo.config.AppFilterConfig
filter:
# The "*TypeNone" represent this value and having a NULL value being treated as the same.
# These are often something like "None", "Unassigned", or "Unknown".
embargoTypeNone: None
submissionTypeNone: None

# org.tdl.vireo.service.SystemDataLoader
dataLoader:
initialize: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ vireo.controller("SubmissionListController", function (NgTableParams, $controlle

if (!!allSubmissionListFilters) {
submissionListColumns = allSubmissionListFilters.filter(function excludeCustomFilters(slc) {
return slc.title !== 'Search Box' && slc.title !== "Submission Type (List)";
return slc.title !== 'Search Box' && slc.title !== "Submission Type (List)" && slc.title !== "Embargo Type";
});

submissionListColumnsForManage = allSubmissionListFilters.filter(function excludeSearchBox(slc) {
Expand Down

0 comments on commit 0733851

Please sign in to comment.