This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Resolve "Die Statistiken sollten auch in ElasticSearch hinterlegt werden."

Viewing commit ce2eb332
Show latest version
2 files
+ 39
25
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -94,8 +94,8 @@ public class VocabularyService {
setting.getProperty(),
setting.getOEResourceType(),
isTopLevel
? (setting.isRequired() == RequiredEnum.REQUIRED_ON_TOP_LEVEL || setting.isRequired() == RequiredEnum.REQUIRED)
: setting.isRequired() == RequiredEnum.REQUIRED,
? (setting.getRequired() == RequiredEnum.REQUIRED_ON_TOP_LEVEL || setting.getRequired() == RequiredEnum.REQUIRED)
: setting.getRequired() == RequiredEnum.REQUIRED,
setting.getExtraEntries(),
result
);
@@ -148,26 +148,28 @@ public class VocabularyService {
result.errors.add(String.format("The field %s is mandatory", fieldName));
return;
}
final VocabularyItem[] fieldValues = getVocabularyItemsFor(apiFieldName);
final List<String> notFoundValues = new ArrayList<>();
for (String value : values) {
boolean matchFound = Arrays
.stream(fieldValues)
.anyMatch(fValue -> Arrays.stream(fValue.getLanguageItem()).anyMatch(languageItem -> languageItem.getTitle().equals(value))
);
if (!matchFound && (extraEntries == null || Arrays.stream(extraEntries).noneMatch(ev -> ev.equals(value)))) {
notFoundValues.add(value);
if (apiFieldName != null) {
final VocabularyItem[] fieldValues = getVocabularyItemsFor(apiFieldName);
final List<String> notFoundValues = new ArrayList<>();
for (String value : values) {
boolean matchFound = Arrays
.stream(fieldValues)
.anyMatch(fValue ->
Arrays.stream(fValue.getLanguageItem()).anyMatch(languageItem -> languageItem.getTitle().equals(value))
);
if (!matchFound && (extraEntries == null || Arrays.stream(extraEntries).noneMatch(ev -> ev.equals(value)))) {
notFoundValues.add(value);
}
}
notFoundValues
.stream()
.map(v -> new AlternativesProposer(v, apiFieldName))
.forEach(ap ->
result.warnings.add(
String.format("The field %s contains an unknown entry '%s'. %s", fieldName, ap.getTerm(), ap.toString()).trim()
)
);
}
notFoundValues
.stream()
.map(v -> new AlternativesProposer(v, apiFieldName))
.forEach(ap ->
result.warnings.add(
String.format("The field %s contains an unknown entry '%s'. %s", fieldName, ap.getTerm(), ap.toString()).trim()
)
);
}
/**
@@ -198,7 +200,7 @@ public class VocabularyService {
@Override
public String toString() {
String alternative = findAlternative();
return alternative != null ? "Did you mean '" + alternative + "' instead of '" + term + "'?" : "";
return alternative == null ? "" : "Did you mean '" + alternative + "' instead of '" + term + "'?";
}
public String getTerm() {
@@ -305,7 +307,7 @@ public class VocabularyService {
oeResourceType = oEResourceType;
}
public RequiredEnum isRequired() {
public RequiredEnum getRequired() {
return required;
}