Skip to content

Commit

Permalink
Merged in DSC-1124-inline-group-fields-should-be-indexed (pull request
Browse files Browse the repository at this point in the history
…DSpace#872)

DSC-1124 - inline-group fields should be indexed

Approved-by: Vincenzo Mecca
  • Loading branch information
Micheleboychuk authored and vins01-4science committed Oct 12, 2023
2 parents e20c3ef + a35679c commit 0de462f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ public List<DCInputSet> getInputsByGroup(String formName)

// cache miss - construct new DCInputSet
List<List<Map<String, String>>> pages = formDefns.get(formName);
if (pages == null) {
return results;
}

Iterator<List<Map<String, String>>> iterator = pages.iterator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.dspace.content.authority;

import static java.lang.Integer.MAX_VALUE;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

import java.util.ArrayList;
Expand All @@ -21,6 +22,7 @@
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.util.DCInput;
import org.dspace.app.util.DCInputSet;
Expand Down Expand Up @@ -64,7 +66,7 @@
* @see ChoiceAuthority
*/
public final class ChoiceAuthorityServiceImpl implements ChoiceAuthorityService {
private Logger log = org.apache.logging.log4j.LogManager.getLogger(ChoiceAuthorityServiceImpl.class);
private Logger log = LogManager.getLogger(ChoiceAuthorityServiceImpl.class);

// map of field key to authority plugin
protected Map<String, ChoiceAuthority> controller = new HashMap<String, ChoiceAuthority>();
Expand Down Expand Up @@ -343,16 +345,26 @@ private void loadChoiceAuthorityConfigurations() {
*/
private void autoRegisterChoiceAuthorityFromInputReader() {
try {
List<SubmissionConfig> submissionConfigs = itemSubmissionConfigReader
.getAllSubmissionConfigs(Integer.MAX_VALUE, 0);
List<SubmissionConfig> submissionConfigs = itemSubmissionConfigReader.getAllSubmissionConfigs(MAX_VALUE, 0);
DCInputsReader dcInputsReader = new DCInputsReader();

// loop over all the defined item submission configuration
for (SubmissionConfig subCfg : submissionConfigs) {
String submissionName = subCfg.getSubmissionName();
List<DCInputSet> inputsBySubmissionName = dcInputsReader.getInputsBySubmissionName(submissionName);
autoRegisterChoiceAuthorityFromSubmissionForms(Constants.ITEM, submissionName,
inputsBySubmissionName);
List<DCInputSet> inputsByGroupOfAllSteps = new ArrayList<DCInputSet>();
try {
List<DCInputSet> inputsByGroup = dcInputsReader.getInputsByGroup(submissionName);
inputsByGroupOfAllSteps.addAll(inputsByGroup);
for (DCInputSet step : inputsBySubmissionName) {
List<DCInputSet> inputsByGroupOfStep = dcInputsReader.getInputsByGroup(step.getFormName());
inputsByGroupOfAllSteps.addAll(inputsByGroupOfStep);
}
} catch (DCInputsReaderException e) {
log.warn("Cannot load the groups of the submission: " + submissionName, e);
}
inputsBySubmissionName.addAll(inputsByGroupOfAllSteps);
autoRegisterChoiceAuthorityFromSubmissionForms(Constants.ITEM, submissionName, inputsBySubmissionName);
}
// loop over all the defined bitstream metadata submission configuration
for (UploadConfiguration uploadCfg : uploadConfigurationService.getMap().values()) {
Expand All @@ -363,8 +375,7 @@ private void autoRegisterChoiceAuthorityFromInputReader() {
}
} catch (DCInputsReaderException e) {
// the system is in an illegal state as the submission definition is not valid
throw new IllegalStateException("Error reading the item submission configuration: " + e.getMessage(),
e);
throw new IllegalStateException("Error reading the item submission configuration: " + e.getMessage(), e);
}
}

Expand Down

0 comments on commit 0de462f

Please sign in to comment.