Change the type of the "warnings" and "errors" fields of "Guideline.Result" to "List<String>", in order to be encoded by Spark.
This commit is contained in:
parent
156ffbeec4
commit
8d3c8324ae
|
@ -3,6 +3,7 @@ package eu.dnetlib.validator2.validation.guideline;
|
|||
import eu.dnetlib.validator2.engine.Status;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public interface Guideline<T> {
|
||||
|
||||
|
@ -36,14 +37,14 @@ public interface Guideline<T> {
|
|||
|
||||
// When status == SUCCESS, potential warnings are held here
|
||||
// This may also contain messages when status == FAILURE
|
||||
Iterable<String> getWarnings();
|
||||
void setWarnings(Iterable<String> warnings);
|
||||
List<String> getWarnings();
|
||||
void setWarnings(List<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);
|
||||
List<String> getErrors();
|
||||
void setErrors(List<String> errors);
|
||||
|
||||
|
||||
// When status == ERROR, the internal error is held here
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.dnetlib.validator2.validation.guideline;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.dnetlib.validator2.engine.Status;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -50,23 +49,23 @@ public final class StandardResult implements Guideline.Result, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getWarnings() {
|
||||
public List<String> getWarnings() {
|
||||
return warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWarnings(Iterable<String> warnings) {
|
||||
this.warnings = Lists.newArrayList(warnings);
|
||||
public void setWarnings(List<String> warnings) {
|
||||
this.warnings = warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getErrors() {
|
||||
public List<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrors(Iterable<String> errors) {
|
||||
this.errors = Lists.newArrayList(errors);
|
||||
public void setErrors(List<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,6 @@ package eu.dnetlib.validator2.validation.guideline.openaire;
|
|||
|
||||
//import com.google.gson.Gson;
|
||||
|
||||
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;
|
||||
|
@ -397,7 +396,7 @@ class F2_01M_SPEC_LIT extends AbstractGuideline<Document> {
|
|||
|
||||
final Result ress = getResult(warnings2, errors2, score);
|
||||
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), ress.getWarnings(), ress.getErrors(), ress.getInternalError());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
@ -454,7 +453,7 @@ class F3_01M_SPEC_LIT extends AbstractGuideline<Document> {
|
|||
|
||||
final Result ress = getResult(warnings2, errors2, MaxScoreF3_01M_LIT_SPEC);
|
||||
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), ress.getWarnings(), ress.getErrors(), ress.getInternalError());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
@ -509,7 +508,7 @@ class I2_01M_SPEC_LIT extends AbstractGuideline<Document> {
|
|||
|
||||
final Result ress = getResult(warnings2, errors2, MaxScoreI2_01M_LIT_SPEC);
|
||||
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), ress.getWarnings(), ress.getErrors(), ress.getInternalError());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
@ -561,7 +560,7 @@ class R1_01M_SPEC_LIT extends AbstractGuideline<Document> {
|
|||
|
||||
final Result ress = getResult(warnings2, errors2, score);
|
||||
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), ress.getWarnings(), ress.getErrors(), ress.getInternalError());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
@ -613,7 +612,7 @@ class R1_2_01M_SPEC_LIT extends AbstractGuideline<Document> {
|
|||
|
||||
final Result ress = getResult(warnings2, errors2, score);
|
||||
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), Lists.newArrayList(ress.getWarnings()), Lists.newArrayList(ress.getErrors()), ress.getInternalError());
|
||||
return new StandardResult(ress.getScore(), ress.getStatus(), ress.getWarnings(), ress.getErrors(), ress.getInternalError());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
|
|
@ -14,8 +14,8 @@ public class ResultUtils {
|
|||
|
||||
private int score;
|
||||
private Status status;
|
||||
private Iterable<String> warnings;
|
||||
private Iterable<String> errors;
|
||||
private List<String> warnings;
|
||||
private List<String> errors;
|
||||
private String internalError;
|
||||
|
||||
|
||||
|
@ -40,22 +40,22 @@ public class ResultUtils {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getWarnings() {
|
||||
public List<String> getWarnings() {
|
||||
return this.warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWarnings(Iterable<String> warnings) {
|
||||
public void setWarnings(List<String> warnings) {
|
||||
this.warnings = warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getErrors() {
|
||||
public List<String> getErrors() {
|
||||
return this.errors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrors(Iterable<String> errors) {
|
||||
public void setErrors(List<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue