2020-04-30 11:05:17 +02:00
|
|
|
|
2020-05-11 17:32:06 +02:00
|
|
|
package eu.dnetlib.dhp.bulktag.community;
|
|
|
|
|
2020-03-03 16:38:50 +01:00
|
|
|
import java.io.Serializable;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
2023-10-09 14:52:17 +02:00
|
|
|
import org.apache.htrace.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
|
|
2020-05-11 17:38:08 +02:00
|
|
|
import eu.dnetlib.dhp.bulktag.criteria.Selection;
|
|
|
|
import eu.dnetlib.dhp.bulktag.criteria.VerbResolver;
|
|
|
|
|
2020-03-03 16:38:50 +01:00
|
|
|
public class Constraint implements Serializable {
|
2020-04-30 11:05:17 +02:00
|
|
|
private String verb;
|
|
|
|
private String field;
|
|
|
|
private String value;
|
2022-09-23 16:02:19 +02:00
|
|
|
// private String element;
|
2023-10-09 14:26:33 +02:00
|
|
|
@JsonIgnore
|
2020-04-30 11:05:17 +02:00
|
|
|
private Selection selection;
|
|
|
|
|
|
|
|
public String getVerb() {
|
|
|
|
return verb;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setVerb(String verb) {
|
|
|
|
this.verb = verb;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getField() {
|
|
|
|
return field;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setField(String field) {
|
|
|
|
this.field = field;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setValue(String value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
2023-10-09 14:52:17 +02:00
|
|
|
|
2023-10-09 14:26:33 +02:00
|
|
|
//@JsonIgnore
|
2023-10-09 14:52:17 +02:00
|
|
|
// public void setSelection(Selection sel) {
|
2023-10-09 14:26:33 +02:00
|
|
|
// selection = sel;
|
|
|
|
// }
|
2023-10-09 14:52:17 +02:00
|
|
|
@JsonIgnore
|
2020-04-30 11:05:17 +02:00
|
|
|
public void setSelection(VerbResolver resolver)
|
|
|
|
throws InvocationTargetException, NoSuchMethodException, InstantiationException,
|
|
|
|
IllegalAccessException {
|
|
|
|
selection = resolver.getSelectionCriteria(verb, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean verifyCriteria(String metadata) {
|
|
|
|
return selection.apply(metadata);
|
|
|
|
}
|
2022-09-23 16:02:19 +02:00
|
|
|
|
2020-04-23 11:48:47 +02:00
|
|
|
}
|