mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
fix bug
This commit is contained in:
@@ -463,7 +463,7 @@ public final class ChoiceAuthorityServiceImpl implements ChoiceAuthorityService
|
||||
try {
|
||||
configReader = new SubmissionConfigReader();
|
||||
SubmissionConfig submissionName = configReader.getSubmissionConfigByCollection(collection.getHandle());
|
||||
ma = controllerFormDefinitions.get(submissionName.getSubmissionName()).get(fieldKey);
|
||||
ma = controllerFormDefinitions.get(fieldKey).get(submissionName.getSubmissionName());
|
||||
} catch (SubmissionConfigReaderException e) {
|
||||
// the system is in an illegal state as the submission definition is not valid
|
||||
throw new IllegalStateException(e);
|
||||
|
@@ -13,6 +13,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.DCInputsReader;
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
@@ -107,14 +108,18 @@ public class DCInputAuthority extends SelfNamedPlugin implements ChoiceAuthority
|
||||
init();
|
||||
|
||||
int dflt = -1;
|
||||
int index = 0;
|
||||
Choice v[] = new Choice[values.length];
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
v[i] = new Choice(values[i], values[i], labels[i]);
|
||||
if (query == null || StringUtils.containsIgnoreCase(values[i], query)) {
|
||||
v[index] = new Choice(values[i], values[i], labels[i]);
|
||||
index++;
|
||||
}
|
||||
if (values[i].equalsIgnoreCase(query)) {
|
||||
dflt = i;
|
||||
}
|
||||
}
|
||||
return new Choices(v, 0, v.length, Choices.CF_AMBIGUOUS, false, dflt);
|
||||
return new Choices(v, 0, index, Choices.CF_AMBIGUOUS, false, dflt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -86,7 +86,9 @@ public class VocabularyEntryLinkRepository extends AbstractDSpaceRestRepository
|
||||
Choices choices = cas.getMatches(fieldKey, filter, collection, Math.toIntExact(pageable.getOffset()),
|
||||
pageable.getPageSize(), context.getCurrentLocale().toString());
|
||||
for (Choice value : choices.values) {
|
||||
results.add(authorityUtils.convertEntry(value, name, projection));
|
||||
if (value != null) {
|
||||
results.add(authorityUtils.convertEntry(value, name, projection));
|
||||
}
|
||||
}
|
||||
return new PageImpl<>(results, pageable, results.size());
|
||||
}
|
||||
|
Reference in New Issue
Block a user