Revision 56371
Added by Miriam Baglioni over 5 years ago
modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/bulktag/CommunityConfigurationFactoryTest.java | ||
---|---|---|
87 | 87 |
|
88 | 88 |
} |
89 | 89 |
|
90 |
@Test |
|
91 |
public void test4() throws DocumentException, IOException { |
|
92 |
final CommunityConfiguration cc = CommunityConfigurationFactory.fromJson(IOUtils.toString(getClass().getResourceAsStream("community_configuration_selcrit.json"))); |
|
93 |
} |
|
90 | 94 |
|
95 |
@Test |
|
96 |
public void test5() throws IOException, DocumentException { |
|
97 |
final CommunityConfiguration cc = CommunityConfigurationFactory.newInstance(IOUtils.toString(getClass().getResourceAsStream("test.xml"))); |
|
91 | 98 |
|
99 |
System.out.println(cc.toJson()); |
|
100 |
} |
|
92 | 101 |
|
102 |
|
|
103 |
|
|
104 |
|
|
93 | 105 |
} |
modules/dnet-openaireplus-mapping-utils/trunk/src/test/resources/eu/dnetlib/data/bulktag/test.xml | ||
---|---|---|
1 |
<communities> |
|
2 |
<community id="dariah"> |
|
3 |
<subjects/> |
|
4 |
<datasources> |
|
5 |
<datasource> |
|
6 |
<openaireId>opendoar____::7e7757b1e12abcb736ab9a754ffb617a</openaireId> |
|
7 |
<selcriteria>{"criteria":[{"sc":[{"verb":"contains","field":"contributor","value":"DARIAH"}]}]}</selcriteria> |
|
8 |
</datasource> |
|
9 |
</datasources> |
|
10 |
<zenodocommunities> |
|
11 |
<zenodocommunity> |
|
12 |
<zenodoid>dimpo</zenodoid> |
|
13 |
<selcriteria/> |
|
14 |
</zenodocommunity> |
|
15 |
</zenodocommunities> |
|
16 |
</community> |
|
17 |
</communities> |
modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/bulktag/Constraint.java | ||
---|---|---|
12 | 12 |
private String verb; |
13 | 13 |
private String field; |
14 | 14 |
private String value; |
15 |
private Selection selection; |
|
15 |
private transient Selection selection;
|
|
16 | 16 |
|
17 | 17 |
// @Autowired |
18 | 18 |
// private VerbResolver resolver; |
modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/bulktag/selectioncriteria/EqualVerb.java | ||
---|---|---|
18 | 18 |
public boolean apply(String value) { |
19 | 19 |
return value.equalsIgnoreCase(param); |
20 | 20 |
} |
21 |
|
|
22 |
public String getParam() { |
|
23 |
return param; |
|
24 |
} |
|
25 |
|
|
26 |
public void setParam(String param) { |
|
27 |
this.param = param; |
|
28 |
} |
|
21 | 29 |
} |
modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/bulktag/selectioncriteria/NotEqualVerb.java | ||
---|---|---|
14 | 14 |
public NotEqualVerb() { |
15 | 15 |
} |
16 | 16 |
|
17 |
public String getParam() { |
|
18 |
return param; |
|
19 |
} |
|
20 |
|
|
21 |
public void setParam(String param) { |
|
22 |
this.param = param; |
|
23 |
} |
|
24 |
|
|
17 | 25 |
@Override |
18 | 26 |
public boolean apply(String value) { |
19 | 27 |
return !value.equalsIgnoreCase(param); |
modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/bulktag/selectioncriteria/ContainsVerb.java | ||
---|---|---|
16 | 16 |
public boolean apply(String value) { |
17 | 17 |
return value.contains(param); |
18 | 18 |
} |
19 |
|
|
20 |
public String getParam() { |
|
21 |
return param; |
|
22 |
} |
|
23 |
|
|
24 |
public void setParam(String param) { |
|
25 |
this.param = param; |
|
26 |
} |
|
19 | 27 |
} |
modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/bulktag/selectioncriteria/NotContainsVerb.java | ||
---|---|---|
16 | 16 |
public boolean apply(String value) { |
17 | 17 |
return !value.contains(param); |
18 | 18 |
} |
19 |
|
|
20 |
public String getParam() { |
|
21 |
return param; |
|
22 |
} |
|
23 |
|
|
24 |
public void setParam(String param) { |
|
25 |
this.param = param; |
|
26 |
} |
|
19 | 27 |
} |
Also available in: Unified diff
added new test for community configuration and added transient to param selection