- Refactor the "XMLApplicationProfile.ValidationResult" and "Guideline.Result" to provide only getter and setter methods.

- Use the Guava's "Lists.newArrayList()" when converting an "Iterable" to a List.
This commit is contained in:
Lampros Smyrnaios 2024-01-15 14:30:44 +02:00
parent 5d0ff918cf
commit 43de723494
8 changed files with 99 additions and 162 deletions

View File

@ -21,20 +21,6 @@ public class StandardValidationResult implements XMLApplicationProfile.Validatio
this.results = results;
}
@Override
public String id() {
return id;
}
@Override
public double score() {
return score;
}
@Override
public Map<String, Guideline.Result> results() {
return results;
}
@Override
public String getId() {

View File

@ -22,15 +22,9 @@ public interface XMLApplicationProfile {
int maxScore();
interface ValidationResult extends Serializable {
String id();
double score();
Map<String, Guideline.Result> results();
// Follow the bean conventions.
String getId();
@ -44,4 +38,5 @@ public interface XMLApplicationProfile {
void setResults(Map<String, Guideline.Result> results);
}
}

View File

@ -25,32 +25,28 @@ public interface Guideline<T> {
Result validate(String id, T t);
interface Result extends Serializable {
int score();
Status status();
// When status == SUCCESS, potential warnings are held here
// This may also contain messages when status == FAILURE
Iterable<String> warnings();
// When status == FAILURE, the errors are held here
// We currently hold a single error (and fail fast)
Iterable<String> errors();
// When status == ERROR, the internal error is held here
String internalError();
// Follow the bean conventions.
int getScore();
void setScore(int score);
Status getStatus();
void setStatus(Status status);
// When status == SUCCESS, potential warnings are held here
// This may also contain messages when status == FAILURE
Iterable<String> getWarnings();
void setWarnings(Iterable<String> warnings);
// When status == FAILURE, the errors are held here
// We currently hold a single error (and fail fast)
Iterable<String> getErrors();
void setErrors(Iterable<String> errors);
// When status == ERROR, the internal error is held here
String getInternalError();
void setInternalError(String internalError);
}

View File

@ -1,5 +1,6 @@
package eu.dnetlib.validator2.validation.guideline;
import com.google.common.collect.Lists;
import eu.dnetlib.validator2.engine.Status;
import java.io.Serializable;
@ -24,30 +25,6 @@ public final class StandardResult implements Guideline.Result, Serializable {
this.internalError = internalError;
}
@Override
public int score() {
return score;
}
@Override
public Status status() {
return status;
}
@Override
public Iterable<String> warnings() {
return warnings;
}
@Override
public Iterable<String> errors() {
return errors;
}
@Override
public String internalError() {
return internalError;
}
@Override
public int getScore() {
@ -76,7 +53,7 @@ public final class StandardResult implements Guideline.Result, Serializable {
@Override
public void setWarnings(Iterable<String> warnings) {
this.warnings = (List<String>) warnings;
this.warnings = Lists.newArrayList(warnings);
}
@Override
@ -86,7 +63,7 @@ public final class StandardResult implements Guideline.Result, Serializable {
@Override
public void setErrors(Iterable<String> errors) {
this.errors = (List<String>) errors;
this.errors = Lists.newArrayList(errors);
}
@Override

View File

@ -51,7 +51,7 @@ public abstract class AbstractOpenAireProfile implements XMLApplicationProfile,
Guideline.Result result = guidelineElement.validate(document);
results.put(guidelineElementName, result);
score += (result.status() == Status.SUCCESS ? result.score() : 0);
score += (result.getStatus() == Status.SUCCESS ? result.getScore() : 0);
logger.debug("Score after validating \"" + guidelineElementName + "\" = " + score);
}

View File

@ -2,7 +2,6 @@ package eu.dnetlib.validator2.validation.guideline.openaire;
//import com.google.gson.Gson;
import eu.dnetlib.validator2.engine.Status;
import eu.dnetlib.validator2.validation.XMLApplicationProfile;
import eu.dnetlib.validator2.validation.guideline.*;
import eu.dnetlib.validator2.validation.utils.ResultUtils;
@ -405,12 +404,12 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
// TODO: iterate over results and build one Guideline.Result
try {
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// Get actual score and not (%) to incorporate to FAIR score
final int MaxScoreF2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
final int MaxScoreF2_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
logger.debug("Max score DataValidator(%): " + res_F.score());
logger.debug("Max score DataValidator(%): " + res_F.getScore());
logger.debug("Weight FAIRG: " + getWeight());
logger.debug("Max score F2_01M_SPEC: " + MaxScoreF2_01M_SPEC);
@ -419,8 +418,8 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -431,7 +430,7 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
score += 2;
}
if ( logger.isTraceEnabled() ) {
logger.trace(String.valueOf(results.get(key).warnings().getClass()));
logger.trace(String.valueOf(results.get(key).getWarnings().getClass()));
logger.trace(String.valueOf(warnings2.getClass()));
}
}
@ -439,7 +438,7 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), (List<String>) ress.getWarnings(), (List<String>) ress.getErrors(), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -469,23 +468,23 @@ class F3_01M_SPEC extends AbstractGuideline<Document> {
try {
// System.out.println("\nMetadata includes the identifier for the data");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// int MaxScoreF3_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
int MaxScoreF3_01M_SPEC;
if ((int) res_F.score() == 50 ) {
MaxScoreF3_01M_SPEC = (int) (((2*res_F.score())*getWeight())/100);
if ((int) res_F.getScore() == 50 ) {
MaxScoreF3_01M_SPEC = (int) (((2*res_F.getScore()) * getWeight())/100);
}
else {
MaxScoreF3_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
MaxScoreF3_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
}
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -496,7 +495,7 @@ class F3_01M_SPEC extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, MaxScoreF3_01M_SPEC);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), (List<String>) ress.getWarnings(), (List<String>) ress.getErrors(), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -523,23 +522,23 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
try {
logger.debug("Metadata uses FAIR-compliant vocabularies");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// int MaxScoreI2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
int MaxScoreI2_01M_SPEC;
if ((int) res_F.score() == 50 ) {
MaxScoreI2_01M_SPEC = (int) (((2*res_F.score())*getWeight())/100);
if ((int) res_F.getScore() == 50 ) {
MaxScoreI2_01M_SPEC = (int) (((2*res_F.getScore()) * getWeight())/100);
}
else {
MaxScoreI2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
MaxScoreI2_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
}
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -550,7 +549,7 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, MaxScoreI2_01M_SPEC);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), (List<String>) ress.getWarnings(), (List<String>) ress.getErrors(), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -579,16 +578,16 @@ class R1_01M_SPEC extends AbstractGuideline<Document> {
try {
// System.out.println("\nPlurality of accurate and relevant attributes are provided to allow reuse");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
int MaxScoreR1_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
Map<String, Guideline.Result> results = res_F.getResults();
int MaxScoreR1_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -602,7 +601,7 @@ class R1_01M_SPEC extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), (List<String>) ress.getWarnings(), (List<String>) ress.getErrors(), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -631,16 +630,16 @@ class R1_2_01M_SPEC extends AbstractGuideline<Document> {
try {
// System.out.println("\nMetadata includes provenance information according to a cross-community language");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
int MaxScoreR1_2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
Map<String, Guideline.Result> results = res_F.getResults();
int MaxScoreR1_2_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -654,7 +653,7 @@ class R1_2_01M_SPEC extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), (List<String>) ress.getWarnings(), (List<String>) ress.getErrors(), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);

View File

@ -2,7 +2,7 @@ package eu.dnetlib.validator2.validation.guideline.openaire;
//import com.google.gson.Gson;
import eu.dnetlib.validator2.engine.Status;
import com.google.common.collect.Lists;
import eu.dnetlib.validator2.validation.XMLApplicationProfile;
import eu.dnetlib.validator2.validation.guideline.*;
import eu.dnetlib.validator2.validation.utils.ResultUtils;
@ -363,12 +363,12 @@ class F2_01M_SPEC_LIT extends AbstractGuideline<Document> {
// TODO: iterate over results and build one Guideline.Result
try {
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// Get actual score and not (%) to incorporate to FAIR score
final int MaxScoreF2_01M_LIT_SPEC = (int) ((res_F.score()*getWeight())/100);
final int MaxScoreF2_01M_LIT_SPEC = (int) ((res_F.getScore() * getWeight())/100);
logger.debug("Max score DataValidator(%): " + res_F.score());
logger.debug("Max score DataValidator(%): " + res_F.getScore());
logger.debug("Weight FAIRG: " + getWeight());
logger.debug("Max score F2_01M_SPEC: " + MaxScoreF2_01M_LIT_SPEC);
@ -377,8 +377,8 @@ class F2_01M_SPEC_LIT extends AbstractGuideline<Document> {
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -389,7 +389,7 @@ class F2_01M_SPEC_LIT extends AbstractGuideline<Document> {
score += 2;
}
if ( logger.isTraceEnabled() ) {
logger.trace(String.valueOf(results.get(key).warnings().getClass()));
logger.trace(String.valueOf(results.get(key).getWarnings().getClass()));
logger.trace(String.valueOf(warnings2.getClass()));
}
}
@ -397,7 +397,7 @@ class F2_01M_SPEC_LIT extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -427,23 +427,23 @@ class F3_01M_SPEC_LIT extends AbstractGuideline<Document> {
try {
// System.out.println("\nMetadata includes the identifier for the data");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// int MaxScoreF3_01M_LIT_SPEC = (int) ((res_F.score()*getWeight())/100);
int MaxScoreF3_01M_LIT_SPEC;
if ((int) res_F.score() == 50 ) {
MaxScoreF3_01M_LIT_SPEC = (int) (((2*res_F.score())*getWeight())/100);
if ((int) res_F.getScore() == 50 ) {
MaxScoreF3_01M_LIT_SPEC = (int) (((2*res_F.getScore()) * getWeight())/100);
}
else {
MaxScoreF3_01M_LIT_SPEC = (int) ((res_F.score()*getWeight())/100);
MaxScoreF3_01M_LIT_SPEC = (int) ((res_F.getScore() * getWeight())/100);
}
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -454,7 +454,7 @@ class F3_01M_SPEC_LIT extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, MaxScoreF3_01M_LIT_SPEC);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -482,23 +482,23 @@ class I2_01M_SPEC_LIT extends AbstractGuideline<Document> {
try {
logger.debug("Metadata uses FAIR-compliant vocabularies");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
Map<String, Guideline.Result> results = res_F.getResults();
// int MaxScoreI2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
int MaxScoreI2_01M_LIT_SPEC;
if ((int) res_F.score() == 50 ) {
MaxScoreI2_01M_LIT_SPEC = (int) (((2*res_F.score())*getWeight())/100);
if ((int) res_F.getScore() == 50 ) {
MaxScoreI2_01M_LIT_SPEC = (int) (((2*res_F.getScore()) * getWeight())/100);
}
else {
MaxScoreI2_01M_LIT_SPEC = (int) ((res_F.score()*getWeight())/100);
MaxScoreI2_01M_LIT_SPEC = (int) ((res_F.getScore() * getWeight())/100);
}
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -509,7 +509,7 @@ class I2_01M_SPEC_LIT extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, MaxScoreI2_01M_LIT_SPEC);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -538,16 +538,16 @@ class R1_01M_SPEC_LIT extends AbstractGuideline<Document> {
try {
// System.out.println("\nPlurality of accurate and relevant attributes are provided to allow reuse");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
int MaxScoreR1_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
Map<String, Guideline.Result> results = res_F.getResults();
int MaxScoreR1_01M_SPEC = (int) ((res_F.getScore() * getWeight())/100);
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -561,7 +561,7 @@ class R1_01M_SPEC_LIT extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);
@ -590,16 +590,16 @@ class R1_2_01M_SPEC_LIT extends AbstractGuideline<Document> {
try {
// System.out.println("\nMetadata includes provenance information according to a cross-community language");
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
Map<String, Guideline.Result> results = res_F.results();
int MaxScoreR1_2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
Map<String, Guideline.Result> results = res_F.getResults();
int MaxScoreR1_2_01M_SPEC = (int) ((res_F.getScore()*getWeight())/100);
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
int score = 0;
for (Map.Entry<String, Guideline.Result> entry : results.entrySet()) {
String key = entry.getKey();
String warningsStr = results.get(key).warnings().toString();
String errorsStr = results.get(key).errors().toString();
String warningsStr = results.get(key).getWarnings().toString();
String errorsStr = results.get(key).getErrors().toString();
if ( warningsStr.length() > 2 ) {
warnings2.add(warningsStr);
}
@ -613,7 +613,7 @@ class R1_2_01M_SPEC_LIT extends AbstractGuideline<Document> {
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
} catch (Exception e) {
logger.error("", e);

View File

@ -9,42 +9,19 @@ public class ResultUtils {
public static Guideline.Result getNewResult(List<String> warnings2, List<String> errors2, int score2) {
return new Guideline.Result() {
int score;
Status status;
Iterable<String> warnings;
Iterable<String> errors;
String internalError;
final Guideline.Result result = new Guideline.Result() {
@Override
public int score() {
return score2;
}
private int score;
private Status status;
private Iterable<String> warnings;
private Iterable<String> errors;
private String internalError;
@Override
public Status status() {
return Status.valueOf((score2 > 0) ? "SUCCESS" : "FAILURE");
}
@Override
public Iterable<String> warnings() {
return warnings2;
}
@Override
public Iterable<String> errors() {
return errors2;
}
@Override
public String internalError() {
return internalError;
}
@Override
public int getScore() {
return score();
return this.score;
}
@Override
@ -54,7 +31,7 @@ public class ResultUtils {
@Override
public Status getStatus() {
return status();
return this.status;
}
@Override
@ -64,7 +41,7 @@ public class ResultUtils {
@Override
public Iterable<String> getWarnings() {
return warnings();
return this.warnings;
}
@Override
@ -74,7 +51,7 @@ public class ResultUtils {
@Override
public Iterable<String> getErrors() {
return errors();
return this.errors;
}
@Override
@ -84,7 +61,7 @@ public class ResultUtils {
@Override
public String getInternalError() {
return internalError();
return this.internalError;
}
@Override
@ -92,6 +69,13 @@ public class ResultUtils {
this.internalError = internalError;
}
};
result.setScore(score2);
result.setStatus(Status.valueOf((score2 > 0) ? "SUCCESS" : "FAILURE"));
result.setWarnings(warnings2);
result.setErrors(errors2);
return result;
}
}