Revision 45407
Added by Michele Artini over 6 years ago
modules/dnet-simple-aggregation-worker/trunk/src/main/java/eu/dnetlib/msro/workers/aggregation/collect/plugins/ProtocolDescriptor.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workers.aggregation.collect.plugins; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
import javax.xml.bind.annotation.XmlRootElement; |
|
6 |
|
|
7 |
import org.springframework.beans.factory.annotation.Required; |
|
8 |
|
|
9 |
@XmlRootElement |
|
10 |
public class ProtocolDescriptor { |
|
11 |
|
|
12 |
private String name; |
|
13 |
private List<ProtocolParameter> params = new ArrayList<ProtocolParameter>(); |
|
14 |
|
|
15 |
public ProtocolDescriptor() { |
|
16 |
} |
|
17 |
|
|
18 |
public ProtocolDescriptor(final String name, final List<ProtocolParameter> params) { |
|
19 |
this.name = name; |
|
20 |
this.params = params; |
|
21 |
} |
|
22 |
|
|
23 |
public String getName() { |
|
24 |
return name; |
|
25 |
} |
|
26 |
|
|
27 |
@Required |
|
28 |
public void setName(final String name) { |
|
29 |
this.name = name; |
|
30 |
} |
|
31 |
|
|
32 |
public List<ProtocolParameter> getParams() { |
|
33 |
return params; |
|
34 |
} |
|
35 |
|
|
36 |
public void setParams(final List<ProtocolParameter> params) { |
|
37 |
this.params = params; |
|
38 |
} |
|
39 |
} |
modules/dnet-simple-aggregation-worker/trunk/src/main/java/eu/dnetlib/msro/workers/aggregation/collect/plugins/ProtocolParameter.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workers.aggregation.collect.plugins; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Required; |
|
4 |
|
|
5 |
import eu.dnetlib.msro.workers.aggregation.collect.functions.NullFunction; |
|
6 |
import eu.dnetlib.rmi.data.ProtocolParameterType; |
|
7 |
import eu.dnetlib.rmi.data.functions.ParamValuesFunction; |
|
8 |
|
|
9 |
public class ProtocolParameter { |
|
10 |
|
|
11 |
private String name; |
|
12 |
private boolean optional = false; |
|
13 |
private ProtocolParameterType type = ProtocolParameterType.TEXT; |
|
14 |
private String regex = null; |
|
15 |
private Class<? extends ParamValuesFunction> populateFunction = NullFunction.class; |
|
16 |
private boolean functionPopulated = false; |
|
17 |
|
|
18 |
public ProtocolParameter() {} |
|
19 |
|
|
20 |
public ProtocolParameter(final String name, final boolean optional, final ProtocolParameterType type, final String regex) { |
|
21 |
this(name, optional, type, regex, null); |
|
22 |
} |
|
23 |
|
|
24 |
public ProtocolParameter(final String name, final boolean optional, final ProtocolParameterType type, final String regex, |
|
25 |
final Class<? extends ParamValuesFunction> populateFunction) { |
|
26 |
this.name = name; |
|
27 |
this.optional = optional; |
|
28 |
this.type = type; |
|
29 |
this.regex = regex; |
|
30 |
this.populateFunction = populateFunction; |
|
31 |
functionPopulated = this.populateFunction != null; |
|
32 |
} |
|
33 |
|
|
34 |
public String getName() { |
|
35 |
return name; |
|
36 |
} |
|
37 |
|
|
38 |
@Required |
|
39 |
public void setName(final String name) { |
|
40 |
this.name = name; |
|
41 |
} |
|
42 |
|
|
43 |
public boolean isOptional() { |
|
44 |
return optional; |
|
45 |
} |
|
46 |
|
|
47 |
public void setOptional(final boolean optional) { |
|
48 |
this.optional = optional; |
|
49 |
} |
|
50 |
|
|
51 |
public ProtocolParameterType getType() { |
|
52 |
return type; |
|
53 |
} |
|
54 |
|
|
55 |
public void setType(final ProtocolParameterType type) { |
|
56 |
this.type = type; |
|
57 |
} |
|
58 |
|
|
59 |
public String getRegex() { |
|
60 |
return regex; |
|
61 |
} |
|
62 |
|
|
63 |
public void setRegex(final String regex) { |
|
64 |
this.regex = regex; |
|
65 |
} |
|
66 |
|
|
67 |
public Class<? extends ParamValuesFunction> getPopulateFunction() { |
|
68 |
return populateFunction; |
|
69 |
} |
|
70 |
|
|
71 |
public void setPopulateFunction(final Class<? extends ParamValuesFunction> populateFunction) { |
|
72 |
this.populateFunction = populateFunction; |
|
73 |
functionPopulated = this.populateFunction != null; |
|
74 |
} |
|
75 |
|
|
76 |
public boolean isFunctionPopulated() { |
|
77 |
return functionPopulated; |
|
78 |
} |
|
79 |
|
|
80 |
public void setFunctionPopulated(final boolean functionPopulated) { |
|
81 |
this.functionPopulated = functionPopulated; |
|
82 |
} |
|
83 |
|
|
84 |
} |
modules/dnet-simple-aggregation-worker/trunk/src/main/java/eu/dnetlib/msro/workers/aggregation/collect/functions/NullFunction.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workers.aggregation.collect.functions; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Map; |
|
6 |
|
|
7 |
import eu.dnetlib.rmi.data.ProtocolParameterValue; |
|
8 |
import eu.dnetlib.rmi.data.functions.ParamValuesFunction; |
|
9 |
|
|
10 |
public class NullFunction implements ParamValuesFunction { |
|
11 |
|
|
12 |
@Override |
|
13 |
public List<ProtocolParameterValue> findValues(final String baseUrl, final Map<String, String> params) { |
|
14 |
return new ArrayList<>(); |
|
15 |
} |
|
16 |
|
|
17 |
} |
Also available in: Unified diff