Revision 41441
Added by Alessia Bardi over 8 years ago
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U source:jar", |
|
2 |
"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-openaire-blacklist/trunk/", |
|
3 |
"deploy_repository": "dnet4-snapshots", "version": "4", "mail": "alessia.bardi@isti.cnr.it", |
|
4 |
"deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-openaire-blacklist"} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/test/java/eu/dnetlib/openaire/blacklist/OpenaireIdResolverTest.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
6 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
7 |
import junit.framework.Assert; |
|
8 |
import org.apache.commons.logging.Log; |
|
9 |
import org.apache.commons.logging.LogFactory; |
|
10 |
import org.junit.Before; |
|
11 |
import org.junit.Ignore; |
|
12 |
import org.junit.Test; |
|
13 |
import org.junit.runner.RunWith; |
|
14 |
import org.mockito.Mock; |
|
15 |
import org.mockito.Mockito; |
|
16 |
import org.mockito.runners.MockitoJUnitRunner; |
|
17 |
|
|
18 |
@RunWith(MockitoJUnitRunner.class) |
|
19 |
public class OpenaireIdResolverTest { |
|
20 |
|
|
21 |
private static final Log log = LogFactory.getLog(OpenaireIdResolverTest.class); |
|
22 |
private final String id = "dedup_wf_001::00066fdc65f1e21677c69d976a8e852d"; |
|
23 |
private OpenaireIdResolver resolver; |
|
24 |
@Mock |
|
25 |
private ISLookUpService isLookupService; |
|
26 |
@Mock |
|
27 |
private UniqueServiceLocator serviceLocator; |
|
28 |
|
|
29 |
@Before |
|
30 |
public void setUp() throws Exception { |
|
31 |
resolver = new OpenaireIdResolver(); |
|
32 |
Mockito.when(serviceLocator.getService(ISLookUpService.class)).thenReturn(isLookupService); |
|
33 |
Mockito.when( |
|
34 |
isLookupService.getResourceProfileByQuery(Mockito.startsWith("for $x in collection('/db/DRIVER/ServiceResources/IndexServiceResourceType')"))) |
|
35 |
.thenReturn("beta.solr.openaire.eu:9983"); |
|
36 |
Mockito.when( |
|
37 |
isLookupService.getResourceProfileByQuery(Mockito.startsWith("for $x in collection('/db/DRIVER/ServiceResources/SearchServiceResourceType')"))) |
|
38 |
.thenReturn("DMF"); |
|
39 |
resolver.setServiceLocator(serviceLocator); |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
@Ignore |
|
44 |
@Test |
|
45 |
public void testFindOriginalIds() throws Exception { |
|
46 |
log.debug("Testing for " + id); |
|
47 |
List<String> originals = resolver.findOriginalIds(id); |
|
48 |
Assert.assertTrue(originals.contains("od_______165::deb6d865011c09f228af41a30e0ff1a4")); |
|
49 |
Assert.assertTrue(originals.contains("od_______165::00066fdc65f1e21677c69d976a8e852d")); |
|
50 |
Assert.assertTrue(originals.size() == 2); |
|
51 |
|
|
52 |
} |
|
53 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/test/java/eu/dnetlib/openaire/blacklist/BlacklistManagerTest.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import com.google.common.collect.Lists; |
|
6 |
import org.apache.commons.lang.StringUtils; |
|
7 |
import org.junit.Before; |
|
8 |
import org.junit.Test; |
|
9 |
|
|
10 |
public class BlacklistManagerTest { |
|
11 |
|
|
12 |
private List<String> input = Lists.newArrayList(); |
|
13 |
private BlacklistManager blManager; |
|
14 |
|
|
15 |
@Before |
|
16 |
public void setUp() throws Exception { |
|
17 |
input.add( |
|
18 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ROW><FIELD name=\"iis_module\">iis::document_referencedProjects</FIELD><FIELD name=\"ticket_id\">1245</FIELD><FIELD name=\"last_update_time\">2015-09-18 12:39:11.781532</FIELD><FIELD name=\"status\">accepted</FIELD><FIELD name=\"userid\">unknown</FIELD><FIELD name=\"iis_module_profile\" isNull=\"true\"/><FIELD name=\"original_target_objects\" isNull=\"true\"/><FIELD name=\"relationship\">resultProject_outcome_isProducedBy</FIELD><FIELD name=\"id\">1</FIELD><FIELD name=\"provenance\">iis</FIELD><FIELD name=\"iis_status\">unsolved</FIELD><FIELD name=\"original_source_objects\" isNull=\"true\"/><FIELD name=\"creation_time\">2015-09-18 12:39:11.781532</FIELD><FIELD name=\"target_object\">corda_______::fda6a1c19dac47508b6fb619518328c7</FIELD><FIELD name=\"note\" isNull=\"true\"/><FIELD name=\"source_object\">od_______908::a47e1c3ede9a21ee5278a2e5c338d69b</FIELD><FIELD name=\"source_type\">result</FIELD><FIELD name=\"target_type\">project</FIELD></ROW>"); |
|
19 |
input.add( |
|
20 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ROW><FIELD name=\"iis_module\">iis::document_referencedProjects</FIELD><FIELD name=\"ticket_id\">1245</FIELD><FIELD name=\"last_update_time\">2015-09-18 12:39:11.789433</FIELD><FIELD name=\"status\">accepted</FIELD><FIELD name=\"userid\">unknown</FIELD><FIELD name=\"iis_module_profile\" isNull=\"true\"/><FIELD name=\"original_target_objects\" isNull=\"true\"/><FIELD name=\"relationship\">resultProject_outcome_isProducedBy</FIELD><FIELD name=\"id\">2</FIELD><FIELD name=\"provenance\">iis</FIELD><FIELD name=\"iis_status\">unsolved</FIELD><FIELD name=\"original_source_objects\" isNull=\"true\"/><FIELD name=\"creation_time\">2015-09-18 12:39:11.789433</FIELD><FIELD name=\"target_object\">corda_______::189ff31d637eaaeaf4d3584dc490b1cf</FIELD><FIELD name=\"note\" isNull=\"true\"/><FIELD name=\"source_object\">od_______908::a47e1c3ede9a21ee5278a2e5c338d69b</FIELD><FIELD name=\"source_type\">result</FIELD><FIELD name=\"target_type\">project</FIELD></ROW>"); |
|
21 |
input.add( |
|
22 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ROW><FIELD name=\"iis_module\">iis::document_referencedProjects</FIELD><FIELD name=\"ticket_id\">1297</FIELD><FIELD name=\"last_update_time\">2015-09-18 12:39:11.854513</FIELD><FIELD name=\"status\">accepted</FIELD><FIELD name=\"userid\">unknown</FIELD><FIELD name=\"iis_module_profile\" isNull=\"true\"/><FIELD name=\"original_target_objects\" isNull=\"true\"/><FIELD name=\"relationship\">resultProject_outcome_isProducedBy</FIELD><FIELD name=\"id\">12</FIELD><FIELD name=\"provenance\">iis</FIELD><FIELD name=\"iis_status\">unsolved</FIELD><FIELD name=\"original_source_objects\" isNull=\"true\"/><FIELD name=\"creation_time\">2015-09-18 12:39:11.854513</FIELD><FIELD name=\"target_object\">corda_______::35695c955c51f0bb39482ce5477047c7</FIELD><FIELD name=\"note\" isNull=\"true\"/><FIELD name=\"source_object\">webcrawl____::ae0ae3ea5641ac24fa148ac38397dfcd</FIELD><FIELD name=\"source_type\">result</FIELD><FIELD name=\"target_type\">project</FIELD></ROW>"); |
|
23 |
input.add( |
|
24 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ROW><FIELD name=\"iis_module\">iis::document_referencedProjects</FIELD><FIELD name=\"ticket_id\">1297</FIELD><FIELD name=\"last_update_time\">2015-09-18 12:39:11.895653</FIELD><FIELD name=\"status\">accepted</FIELD><FIELD name=\"userid\">unknown</FIELD><FIELD name=\"iis_module_profile\" isNull=\"true\"/><FIELD name=\"original_target_objects\" isNull=\"true\"/><FIELD name=\"relationship\">resultProject_outcome_isProducedBy</FIELD><FIELD name=\"id\">17</FIELD><FIELD name=\"provenance\">iis</FIELD><FIELD name=\"iis_status\">unsolved</FIELD><FIELD name=\"original_source_objects\" isNull=\"true\"/><FIELD name=\"creation_time\">2015-09-18 12:39:11.895653</FIELD><FIELD name=\"target_object\">corda_______::35695c955c51f0bb39482ce5477047c7</FIELD><FIELD name=\"note\" isNull=\"true\"/><FIELD name=\"source_object\">webcrawl____::6ce2789da52c6036501533ed5613d71a</FIELD><FIELD name=\"source_type\">result</FIELD><FIELD name=\"target_type\">project</FIELD></ROW>"); |
|
25 |
input.add( |
|
26 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ROW><FIELD name=\"iis_module\">iis::document_referencedProjects</FIELD><FIELD name=\"ticket_id\">1360</FIELD><FIELD name=\"last_update_time\">2015-09-18 12:39:11.955417</FIELD><FIELD name=\"status\">accepted</FIELD><FIELD name=\"userid\">unknown</FIELD><FIELD name=\"iis_module_profile\" isNull=\"true\"/><FIELD name=\"original_target_objects\" isNull=\"true\"/><FIELD name=\"relationship\">resultProject_outcome_isProducedBy</FIELD><FIELD name=\"id\">23</FIELD><FIELD name=\"provenance\">iis</FIELD><FIELD name=\"iis_status\">unsolved</FIELD><FIELD name=\"original_source_objects\" isNull=\"true\"/><FIELD name=\"creation_time\">2015-09-18 12:39:11.955417</FIELD><FIELD name=\"target_object\">corda_______::800e636c0a24ac3767701a789a96ba89</FIELD><FIELD name=\"note\" isNull=\"true\"/><FIELD name=\"source_object\">od______2367::eb76f733498920166d4ce77ec37d487c</FIELD><FIELD name=\"source_type\">result</FIELD><FIELD name=\"target_type\">project</FIELD></ROW>"); |
|
27 |
|
|
28 |
blManager = new BlacklistManager(); |
|
29 |
} |
|
30 |
|
|
31 |
@Test |
|
32 |
public void testGetBlacklistIterator() { |
|
33 |
Iterable<BlacklistEntry> entries = this.blManager.getBlacklistIterable(input); |
|
34 |
for (BlacklistEntry e : entries) |
|
35 |
System.out.println(e); |
|
36 |
} |
|
37 |
|
|
38 |
@Test |
|
39 |
public void testFormat() { |
|
40 |
System.out.println(String.format("INSERT INTO blacklist(id, entitytype, pippo) VALUES('%2$s', '%1$s', '%2$s')", "the entity type", "the id")); |
|
41 |
} |
|
42 |
|
|
43 |
@Test |
|
44 |
public void testJoinForSQLArray() { |
|
45 |
List<String> list = Lists.newArrayList("one", "two", "three"); |
|
46 |
System.out.println("{\"" + StringUtils.join(list, "\",\"") + "\"}"); |
|
47 |
} |
|
48 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/test/resources/log4j.properties | ||
---|---|---|
1 |
### Root Level ### |
|
2 |
log4j.rootLogger=WARN, CONSOLE |
|
3 |
|
|
4 |
|
|
5 |
### Configuration for the CONSOLE appender ### |
|
6 |
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender |
|
7 |
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout |
|
8 |
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %d %c - %m%n |
|
9 |
|
|
10 |
org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger |
|
11 |
|
|
12 |
### Application Level ### |
|
13 |
log4j.logger.eu.dnetlib=INFO |
|
14 |
log4j.logger.eu.dnetlib.openaire.blacklist=DEBUG |
|
15 |
|
|
16 |
|
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/msro/workflows/blacklist/ApplyBlacklistJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workflows.blacklist; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Map; |
|
6 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
7 |
|
|
8 |
import com.google.common.collect.Lists; |
|
9 |
import com.google.common.collect.Maps; |
|
10 |
import com.googlecode.sarasvati.Arc; |
|
11 |
import com.googlecode.sarasvati.NodeToken; |
|
12 |
import eu.dnetlib.data.hadoop.rmi.HadoopService; |
|
13 |
import eu.dnetlib.data.hadoop.rmi.HadoopServiceException; |
|
14 |
import eu.dnetlib.data.hadoop.rmi.hbase.Column; |
|
15 |
import eu.dnetlib.data.hadoop.rmi.hbase.HBaseRowDescriptor; |
|
16 |
import eu.dnetlib.data.mapreduce.util.OafRowKeyDecoder; |
|
17 |
import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions; |
|
18 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
19 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
20 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
21 |
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory; |
|
22 |
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode; |
|
23 |
import eu.dnetlib.openaire.blacklist.BlacklistManager; |
|
24 |
import org.apache.commons.lang.StringUtils; |
|
25 |
import org.apache.commons.logging.Log; |
|
26 |
import org.apache.commons.logging.LogFactory; |
|
27 |
import org.dom4j.Document; |
|
28 |
import org.dom4j.io.SAXReader; |
|
29 |
import org.springframework.beans.factory.annotation.Autowired; |
|
30 |
|
|
31 |
/** |
|
32 |
* Created by alessia on 23/10/15. |
|
33 |
*/ |
|
34 |
public class ApplyBlacklistJobNode extends SimpleJobNode { |
|
35 |
|
|
36 |
private static final Log log = LogFactory.getLog(ApplyBlacklistJobNode.class); |
|
37 |
|
|
38 |
@Autowired |
|
39 |
private BlacklistManager blacklistManager; |
|
40 |
|
|
41 |
@Autowired |
|
42 |
private UniqueServiceLocator serviceLocator; |
|
43 |
|
|
44 |
@Autowired |
|
45 |
private ResultSetClientFactory resultSetClientFactory; |
|
46 |
|
|
47 |
private String clusterName; |
|
48 |
|
|
49 |
private String tableName; |
|
50 |
|
|
51 |
@Override |
|
52 |
protected String execute(NodeToken token) throws Exception { |
|
53 |
final W3CEndpointReference epr = this.blacklistManager.getAcceptedBlacklistEntries(); |
|
54 |
final HadoopService hadoopService = serviceLocator.getService(HadoopService.class); |
|
55 |
|
|
56 |
final SAXReader r = new SAXReader(); |
|
57 |
|
|
58 |
final Map<String, String> relCache = Maps.newHashMap(); |
|
59 |
int count = 0; |
|
60 |
|
|
61 |
for(String s : resultSetClientFactory.getClient(epr)) { |
|
62 |
final Document doc = r.read(new StringReader(s)); |
|
63 |
|
|
64 |
if (log.isDebugEnabled()) { |
|
65 |
log.debug(doc.asXML()); |
|
66 |
} |
|
67 |
|
|
68 |
final ResolvedBlacklistEntry rbeRoot = new ResolvedBlacklistEntry(); |
|
69 |
|
|
70 |
final String source = fullId(doc.valueOf("//FIELD[./@name='source_type']"), doc.valueOf("//FIELD[./@name='source']")); |
|
71 |
rbeRoot.setSource(getResolvedId(source, hadoopService.describeHBaseColumn(getClusterName(), getTableName(), source).getColumns())); |
|
72 |
|
|
73 |
final String target = fullId(doc.valueOf("//FIELD[./@name='target_type']"), doc.valueOf("//FIELD[./@name='target']")); |
|
74 |
rbeRoot.setTarget(getResolvedId(target, hadoopService.describeHBaseColumn(getClusterName(), getTableName(), target).getColumns())); |
|
75 |
|
|
76 |
final String relType = doc.valueOf("//FIELD[./@name='relationship']"); |
|
77 |
rbeRoot.setRelType(relType); |
|
78 |
|
|
79 |
final ResolvedBlacklistEntry rbeNative = new ResolvedBlacklistEntry(source, target, relType); |
|
80 |
|
|
81 |
applyBlackListEntry(hadoopService, relCache, rbeRoot); |
|
82 |
applyBlackListEntry(hadoopService, relCache, rbeNative); |
|
83 |
|
|
84 |
count++; |
|
85 |
} |
|
86 |
|
|
87 |
log.info("blacklist size: " + count); |
|
88 |
token.getEnv().setAttribute("blacklistSize", count); |
|
89 |
|
|
90 |
return Arc.DEFAULT_ARC; |
|
91 |
} |
|
92 |
|
|
93 |
private void applyBlackListEntry(final HadoopService hadoopService, final Map<String, String> relCache, final ResolvedBlacklistEntry rbe) |
|
94 |
throws ISLookUpException, HadoopServiceException { |
|
95 |
if (!relCache.containsKey(rbe.getRelType())) { |
|
96 |
relCache.put(rbe.getRelType(), fetchInverse(rbe.getRelType())); |
|
97 |
} |
|
98 |
|
|
99 |
hadoopService.deleteHBaseColumn(getClusterName(), getTableName(), getHBaseRowDescriptor(rbe.getSource(), rbe.getTarget(), rbe.getRelType())); |
|
100 |
|
|
101 |
hadoopService.deleteHBaseColumn(getClusterName(), getTableName(), getHBaseRowDescriptor(rbe.getTarget(), rbe.getSource(), relCache.get( |
|
102 |
rbe.getRelType()))); |
|
103 |
} |
|
104 |
|
|
105 |
private HBaseRowDescriptor getHBaseRowDescriptor(final String source, final String target, final String relType) { |
|
106 |
|
|
107 |
final List<Column> cols = Lists.newArrayList(new Column(relType, Lists.newArrayList(target))); |
|
108 |
return new HBaseRowDescriptor(source, cols); |
|
109 |
} |
|
110 |
|
|
111 |
private String fetchInverse(final String relType) throws ISLookUpException { |
|
112 |
final String xquery = "let $x:= /RESOURCE_PROFILE[" |
|
113 |
+ " .//RESOURCE_TYPE/@value = 'OntologyDSResourceType' and " |
|
114 |
+ " .//TERM/@encoding='"+relType+"']" |
|
115 |
+ "let $y:= $x//TERM[./@encoding='"+relType+"']//RELATION[./@type='inverseOf']/@code/string() " |
|
116 |
+ "return $x//TERM[./@code = $y]/@encoding/string()"; |
|
117 |
return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xquery); |
|
118 |
} |
|
119 |
|
|
120 |
private String fullId(final String type, final String id) { |
|
121 |
final String fullId = AbstractDNetXsltFunctions.oafSimpleId(type, id); |
|
122 |
|
|
123 |
return OafRowKeyDecoder.decode(fullId).getKey(); |
|
124 |
} |
|
125 |
|
|
126 |
private String getResolvedId(String originalId, List<Column> columns) { |
|
127 |
if (StringUtils.isBlank(originalId)) { |
|
128 |
throw new IllegalArgumentException("cannot resolve an empty id"); |
|
129 |
} |
|
130 |
|
|
131 |
for (Column c : columns) { |
|
132 |
if (c.getFamily().contains("isMergedIn")) { |
|
133 |
|
|
134 |
for (String s : c.getQualifier()) { |
|
135 |
if (StringUtils.isNotBlank(s)) return s; |
|
136 |
} |
|
137 |
} |
|
138 |
} |
|
139 |
return originalId; |
|
140 |
} |
|
141 |
|
|
142 |
public String getClusterName() { |
|
143 |
return clusterName; |
|
144 |
} |
|
145 |
|
|
146 |
public void setClusterName(final String clusterName) { |
|
147 |
this.clusterName = clusterName; |
|
148 |
} |
|
149 |
|
|
150 |
public String getTableName() { |
|
151 |
return tableName; |
|
152 |
} |
|
153 |
|
|
154 |
public void setTableName(final String tableName) { |
|
155 |
this.tableName = tableName; |
|
156 |
} |
|
157 |
|
|
158 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/msro/workflows/blacklist/ResolvedBlacklistEntry.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workflows.blacklist; |
|
2 |
|
|
3 |
import com.google.common.base.Objects; |
|
4 |
import com.google.gson.Gson; |
|
5 |
|
|
6 |
/** |
|
7 |
* Created by alessia on 26/10/15. |
|
8 |
*/ |
|
9 |
public class ResolvedBlacklistEntry { |
|
10 |
|
|
11 |
private String source; |
|
12 |
|
|
13 |
private String target; |
|
14 |
|
|
15 |
private String relType; |
|
16 |
|
|
17 |
public ResolvedBlacklistEntry() { |
|
18 |
} |
|
19 |
|
|
20 |
public ResolvedBlacklistEntry(final String source, final String target, final String relType) { |
|
21 |
this.source = source; |
|
22 |
this.target = target; |
|
23 |
this.relType = relType; |
|
24 |
} |
|
25 |
|
|
26 |
public static ResolvedBlacklistEntry fromJson(String json) { |
|
27 |
return new Gson().fromJson(json, ResolvedBlacklistEntry.class); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public String toString() { |
|
32 |
return new Gson().toJson(this); |
|
33 |
} |
|
34 |
|
|
35 |
public String getSource() { |
|
36 |
return source; |
|
37 |
} |
|
38 |
|
|
39 |
public void setSource(String source) { |
|
40 |
this.source = source; |
|
41 |
} |
|
42 |
|
|
43 |
public String getTarget() { |
|
44 |
return target; |
|
45 |
} |
|
46 |
|
|
47 |
public void setTarget(String target) { |
|
48 |
this.target = target; |
|
49 |
} |
|
50 |
|
|
51 |
public String getRelType() { |
|
52 |
return relType; |
|
53 |
} |
|
54 |
|
|
55 |
public void setRelType(String relType) { |
|
56 |
this.relType = relType; |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public boolean equals(Object another) { |
|
61 |
if (!(another instanceof ResolvedBlacklistEntry)) return false; |
|
62 |
final ResolvedBlacklistEntry rbe = (ResolvedBlacklistEntry) another; |
|
63 |
return Objects.equal(getSource(), rbe.getSource()) && Objects.equal(getTarget(), rbe.getTarget()) && Objects.equal(getRelType(), rbe.getRelType()); |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public int hashCode() { |
|
68 |
return Objects.hashCode(getSource(), getTarget(), getRelType()); |
|
69 |
} |
|
70 |
|
|
71 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/openaire/blacklist/OpenaireIdResolver.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import com.google.common.base.Function; |
|
7 |
import com.google.common.collect.Iterables; |
|
8 |
import com.google.common.collect.Lists; |
|
9 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
11 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
12 |
import org.apache.commons.lang.StringUtils; |
|
13 |
import org.apache.commons.logging.Log; |
|
14 |
import org.apache.commons.logging.LogFactory; |
|
15 |
import org.apache.solr.client.solrj.SolrQuery; |
|
16 |
import org.apache.solr.client.solrj.impl.CloudSolrServer; |
|
17 |
import org.apache.solr.client.solrj.response.QueryResponse; |
|
18 |
import org.apache.solr.common.SolrDocument; |
|
19 |
import org.apache.solr.common.SolrDocumentList; |
|
20 |
import org.dom4j.Attribute; |
|
21 |
import org.dom4j.Document; |
|
22 |
import org.dom4j.DocumentException; |
|
23 |
import org.dom4j.io.SAXReader; |
|
24 |
import org.springframework.beans.factory.annotation.Autowired; |
|
25 |
|
|
26 |
/** |
|
27 |
* The goal of this task is to return the original identifiers of objects merged in a representative object by deduplication. |
|
28 |
* Created by alessia on 09/02/16. |
|
29 |
*/ |
|
30 |
public class OpenaireIdResolver { |
|
31 |
|
|
32 |
public final static String SOLR_COLLECTION_POSTFIX = "-index-openaire"; |
|
33 |
private static final Log log = LogFactory.getLog(OpenaireIdResolver.class); |
|
34 |
private final static String RESULT_FIELD = "__result"; |
|
35 |
private final static String XPATH_TO_MERGED = "//*[local-name()='entity']/*//children/result/@objidentifier"; |
|
36 |
private final SAXReader saxReader = new SAXReader(); |
|
37 |
@Autowired |
|
38 |
private UniqueServiceLocator serviceLocator; |
|
39 |
|
|
40 |
public List<String> resolveIdentifier(final String id) { |
|
41 |
if (StringUtils.isBlank(id)) return Lists.newArrayList(); |
|
42 |
else { |
|
43 |
return findOriginalIds(id); |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
protected List<String> findOriginalIds(final String id) { |
|
48 |
CloudSolrServer solrCore = null; |
|
49 |
SolrQuery q = new SolrQuery("objidentifier:\"" + id + "\""); |
|
50 |
QueryResponse response = null; |
|
51 |
try { |
|
52 |
solrCore = new CloudSolrServer(getIndexEndpoint()); |
|
53 |
solrCore.setDefaultCollection(getPublicIndexCollection() + SOLR_COLLECTION_POSTFIX); |
|
54 |
response = solrCore.query(q); |
|
55 |
SolrDocumentList results = response.getResults(); |
|
56 |
if (results.isEmpty()) { |
|
57 |
log.debug("Query " + q + " returned 0 documents"); |
|
58 |
return Lists.newArrayList(); |
|
59 |
} |
|
60 |
//my results contain the document with the given identifier |
|
61 |
SolrDocument solrDoc = results.get(0); |
|
62 |
return extractMergedIdentifiers(solrDoc); |
|
63 |
} catch (Exception e) { |
|
64 |
log.error(e); |
|
65 |
throw new RuntimeException("Can't get original ids for " + id + "\n " + e); |
|
66 |
} finally { |
|
67 |
solrCore.shutdown(); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
protected List<String> extractMergedIdentifiers(final SolrDocument doc) throws DocumentException { |
|
72 |
List<String> originals = Lists.newArrayList(); |
|
73 |
String xmlRecord = (String) doc.getFirstValue(RESULT_FIELD); |
|
74 |
Document xmlDoc = this.saxReader.read(new StringReader(xmlRecord)); |
|
75 |
return Lists.newArrayList(Iterables.transform(xmlDoc.selectNodes(XPATH_TO_MERGED), new Function<Attribute, String>() { |
|
76 |
@Override |
|
77 |
public String apply(final Attribute a) { |
|
78 |
return a.getStringValue(); |
|
79 |
} |
|
80 |
})); |
|
81 |
} |
|
82 |
|
|
83 |
protected String getIndexEndpoint() throws ISLookUpException { |
|
84 |
return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery( |
|
85 |
"for $x in collection('/db/DRIVER/ServiceResources/IndexServiceResourceType') return $x//PROTOCOL[./@name='solr']/@address/string()"); |
|
86 |
} |
|
87 |
|
|
88 |
protected String getPublicIndexCollection() throws ISLookUpException { |
|
89 |
return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery( |
|
90 |
"for $x in collection('/db/DRIVER/ServiceResources/SearchServiceResourceType') return $x[.//PROPERTY[@key='infrastructure']/@value='public']//PROPERTY[@key='mdformat']/@value/string()"); |
|
91 |
} |
|
92 |
|
|
93 |
public UniqueServiceLocator getServiceLocator() { |
|
94 |
return serviceLocator; |
|
95 |
} |
|
96 |
|
|
97 |
public void setServiceLocator(final UniqueServiceLocator serviceLocator) { |
|
98 |
this.serviceLocator = serviceLocator; |
|
99 |
} |
|
100 |
|
|
101 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/openaire/blacklist/BlacklistManager.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Set; |
|
7 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
8 |
|
|
9 |
import com.google.common.collect.Lists; |
|
10 |
import eu.dnetlib.enabling.database.rmi.DatabaseService; |
|
11 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
12 |
import eu.dnetlib.enabling.resultset.client.IterableResultSetClient; |
|
13 |
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory; |
|
14 |
import eu.dnetlib.miscutils.collections.MappedCollection; |
|
15 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
16 |
import eu.dnetlib.openaire.hadoop.utils.HBaseTableUtils; |
|
17 |
import org.apache.commons.lang.StringUtils; |
|
18 |
import org.apache.commons.logging.Log; |
|
19 |
import org.apache.commons.logging.LogFactory; |
|
20 |
import org.dom4j.Document; |
|
21 |
import org.dom4j.DocumentException; |
|
22 |
import org.dom4j.Element; |
|
23 |
import org.dom4j.io.SAXReader; |
|
24 |
import org.springframework.beans.factory.annotation.Autowired; |
|
25 |
import org.springframework.beans.factory.annotation.Value; |
|
26 |
|
|
27 |
public class BlacklistManager { |
|
28 |
|
|
29 |
private static final Log log = LogFactory.getLog(BlacklistManager.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
30 |
@Value("${dnet.openaire.blacklist.db.name}") |
|
31 |
private String blacklistDatabaseName; |
|
32 |
@Autowired |
|
33 |
private UniqueServiceLocator serviceLocator; |
|
34 |
@Autowired |
|
35 |
private ResultSetClientFactory resultSetClientFactory; |
|
36 |
@Autowired |
|
37 |
private OpenaireIdResolver openaireIdResolver; |
|
38 |
|
|
39 |
private List<String> getOriginalIds(String id, String entityType) { |
|
40 |
List<String> originalIds = Lists.newArrayList(); |
|
41 |
//We need to find original ids only for entities that are deduplicated: result, organization, person. |
|
42 |
if (entityType.equals("result") || entityType.equals("organization") || entityType.equals("person")) { |
|
43 |
originalIds = openaireIdResolver.resolveIdentifier(id); |
|
44 |
} |
|
45 |
return originalIds; |
|
46 |
} |
|
47 |
|
|
48 |
public boolean addToBlacklist(final BlacklistEntry entry) throws Exception { |
|
49 |
List<String> sourceIds = getOriginalIds(entry.getSourceObject(), entry.getSourceType()); |
|
50 |
List<String> targetIds = getOriginalIds(entry.getTargetObject(), entry.getTargetType()); |
|
51 |
entry.setOriginalSourceObjects(sourceIds); |
|
52 |
entry.setOriginalTargetObjects(targetIds); |
|
53 |
|
|
54 |
DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
55 |
String addQuery = String.format( |
|
56 |
"INSERT INTO blacklist(userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, " |
|
57 |
+ "ticket_id, original_source_objects, original_target_objects, note) " |
|
58 |
+ " VALUES('%1$s', '%2$s', '%3$s', '%4$s', '%5$s', '%6$s', '%7$s', '%8$s', '%9$s', '%10$s', '%11$s', '%12$s', '%13$s', '%14$s') ", |
|
59 |
entry.getUser(), |
|
60 |
entry.getRelationship(), |
|
61 |
entry.getProvenance(), |
|
62 |
entry.getIisModule(), |
|
63 |
entry.getIisStatus(), |
|
64 |
entry.getStatus(), |
|
65 |
entry.getSourceObject(), |
|
66 |
entry.getSourceType(), |
|
67 |
entry.getTargetObject(), |
|
68 |
entry.getTargetType(), |
|
69 |
entry.getTicketId(), |
|
70 |
joinCollectionForSQL(sourceIds.isEmpty() ? |
|
71 |
Lists.newArrayList(entry.getSourceObject()) : |
|
72 |
sourceIds), |
|
73 |
joinCollectionForSQL(targetIds.isEmpty() ? |
|
74 |
Lists.newArrayList(entry.getTargetObject()) : |
|
75 |
targetIds), |
|
76 |
entry.getNote()); |
|
77 |
log.debug("Adding new blacklist entry"); |
|
78 |
return this |
|
79 |
.safeUpdateSql( |
|
80 |
dbService, |
|
81 |
blacklistDatabaseName, addQuery); |
|
82 |
} |
|
83 |
|
|
84 |
private String joinCollectionForSQL(final Collection<String> coll) { |
|
85 |
return "{\"" + StringUtils.join(coll, "\",\"") + "\"}"; |
|
86 |
} |
|
87 |
|
|
88 |
public boolean editBlacklistEntry(BlacklistEntry entry) throws Exception { |
|
89 |
List<String> sourceIds = getOriginalIds(entry.getSourceObject(), entry.getSourceType()); |
|
90 |
List<String> targetIds = getOriginalIds(entry.getTargetObject(), entry.getTargetType()); |
|
91 |
entry.setOriginalSourceObjects(sourceIds); |
|
92 |
entry.setOriginalTargetObjects(targetIds); |
|
93 |
DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
94 |
String editQuery = String.format( |
|
95 |
"UPDATE blacklist SET userid='%s', relationship='%s', provenance='%s', iis_module='%s', iis_status='%s', status='%s', source_object='%s', source_type='%s', " |
|
96 |
+ "target_object='%s', target_type='%s', ticket_id='%s', original_source_objects='%s', original_target_objects='%s', note='%s' WHERE id='%s' ", |
|
97 |
entry.getUser(), |
|
98 |
entry.getRelationship(), |
|
99 |
entry.getProvenance(), |
|
100 |
entry.getIisModule(), |
|
101 |
entry.getIisStatus(), |
|
102 |
entry.getStatus(), |
|
103 |
entry.getSourceObject(), |
|
104 |
entry.getSourceType(), |
|
105 |
entry.getTargetObject(), |
|
106 |
entry.getTargetType(), |
|
107 |
entry.getTicketId(), |
|
108 |
joinCollectionForSQL(sourceIds.isEmpty() ? |
|
109 |
Lists.newArrayList(entry.getSourceObject()) : |
|
110 |
sourceIds), |
|
111 |
joinCollectionForSQL(targetIds.isEmpty() ? |
|
112 |
Lists.newArrayList(entry.getTargetObject()) : |
|
113 |
targetIds), |
|
114 |
entry.getNote(), |
|
115 |
entry.getId()); |
|
116 |
log.debug("Editing blacklist entry: " + entry.getId()); |
|
117 |
return this |
|
118 |
.safeUpdateSql( |
|
119 |
dbService, |
|
120 |
blacklistDatabaseName, editQuery); |
|
121 |
|
|
122 |
} |
|
123 |
|
|
124 |
public boolean deleteFromBlacklist(int entryId) throws Exception { |
|
125 |
DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
126 |
log.debug("Deleting entry " + entryId + " from blacklist"); |
|
127 |
return this |
|
128 |
.safeUpdateSql( |
|
129 |
dbService, |
|
130 |
blacklistDatabaseName, |
|
131 |
String.format( |
|
132 |
"DELETE FROM blacklist WHERE id='%s' ", entryId)); |
|
133 |
} |
|
134 |
|
|
135 |
public Iterable<BlacklistEntry> getBlacklist() { |
|
136 |
String sqlQuery = "SELECT * from blacklist order by ticket_id"; |
|
137 |
W3CEndpointReference epr = serviceLocator.getService(DatabaseService.class).searchSQL(blacklistDatabaseName, sqlQuery); |
|
138 |
IterableResultSetClient iter = resultSetClientFactory.getClient(epr); |
|
139 |
return this.getBlacklistIterable(iter); |
|
140 |
} |
|
141 |
|
|
142 |
public W3CEndpointReference getAcceptedBlacklistEntries() { |
|
143 |
String sqlQuery = |
|
144 |
"SELECT source_type, unnest(original_source_objects) as source, target_type, unnest(original_target_objects) as target, relationship FROM blacklist WHERE status = 'ACCEPTED'"; |
|
145 |
return serviceLocator.getService(DatabaseService.class).searchSQL(blacklistDatabaseName, sqlQuery); |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 |
private boolean safeUpdateSql(final DatabaseService dbService, final String dbName, final String sql) throws Exception { |
|
150 |
log.info(sql); |
|
151 |
return dbService.updateSQL(dbName, sql); |
|
152 |
} |
|
153 |
|
|
154 |
public Iterable<BlacklistEntry> getBlacklistIterable(final Iterable<String> xmlEntries) { |
|
155 |
return new MappedCollection<BlacklistEntry, String>(xmlEntries, new UnaryFunction<BlacklistEntry, String>() { |
|
156 |
|
|
157 |
@Override |
|
158 |
public BlacklistEntry evaluate(final String dbEntry) { |
|
159 |
SAXReader saxReader = new SAXReader(); |
|
160 |
BlacklistEntry be = new BlacklistEntry(); |
|
161 |
Document doc; |
|
162 |
try { |
|
163 |
doc = saxReader.read(new StringReader(dbEntry)); |
|
164 |
be.setId(Integer.parseInt(doc.selectSingleNode("//FIELD[./@name='id']").getText())); |
|
165 |
be.setCreationDate(doc.selectSingleNode("//FIELD[./@name='creation_time']").getText()); |
|
166 |
be.setLastUpdateDate(doc.selectSingleNode("//FIELD[./@name='last_update_time']").getText()); |
|
167 |
be.setNote(doc.selectSingleNode("//FIELD[./@name='note']").getText()); |
|
168 |
be.setRelationship(doc.selectSingleNode(".//FIELD[./@name='relationship']").getText()); |
|
169 |
be.setStatus(STATUS.valueOf(StringUtils.upperCase(doc.selectSingleNode("//FIELD[./@name='status']").getText()))); |
|
170 |
be.setTicketId(doc.selectSingleNode("//FIELD[./@name='ticket_id']").getText()); |
|
171 |
be.setUser(doc.selectSingleNode("//FIELD[./@name='userid']").getText()); |
|
172 |
be.setSourceObject(doc.selectSingleNode("//FIELD[./@name='source_object']").getText()); |
|
173 |
be.setSourceType(doc.selectSingleNode("//FIELD[./@name='source_type']").getText()); |
|
174 |
be.setTargetObject(doc.selectSingleNode("//FIELD[./@name='target_object']").getText()); |
|
175 |
be.setTargetType(doc.selectSingleNode("//FIELD[./@name='target_type']").getText()); |
|
176 |
String provenance = doc.selectSingleNode("//FIELD[./@name='provenance']").getText(); |
|
177 |
be.setProvenance(provenance); |
|
178 |
if (provenance.equalsIgnoreCase("iis")) { |
|
179 |
be.setIisModule(doc.selectSingleNode("//FIELD[./@name='iis_module']").getText()); |
|
180 |
be.setIisStatus(IIS_STATUS.valueOf(StringUtils.upperCase(doc.selectSingleNode("//FIELD[./@name='iis_status']").getText()))); |
|
181 |
} |
|
182 |
// get the array of original identifiers |
|
183 |
List<Element> sources = doc.selectNodes("//FIELD[./@name='original_source_objects']/ITEM"); |
|
184 |
if ((sources != null) && !sources.isEmpty()) { |
|
185 |
for (Element e : sources) { |
|
186 |
be.getOriginalSourceObjects().add(e.getText()); |
|
187 |
} |
|
188 |
} |
|
189 |
|
|
190 |
List<Element> targets = doc.selectNodes("//FIELD[./@name='original_target_objects']/ITEM"); |
|
191 |
if ((targets != null) && !targets.isEmpty()) { |
|
192 |
for (Element e : targets) { |
|
193 |
be.getOriginalTargetObjects().add(e.getText()); |
|
194 |
} |
|
195 |
} |
|
196 |
} catch (DocumentException e) { |
|
197 |
log.error(e); |
|
198 |
throw new RuntimeException(e); |
|
199 |
} |
|
200 |
return be; |
|
201 |
} |
|
202 |
}); |
|
203 |
} |
|
204 |
|
|
205 |
public Set<String> getListOfRelationships() { |
|
206 |
return HBaseTableUtils.listRelationships(); |
|
207 |
} |
|
208 |
|
|
209 |
public enum IIS_STATUS { |
|
210 |
UNSOLVED, SOLVED |
|
211 |
} |
|
212 |
|
|
213 |
public enum STATUS { |
|
214 |
PENDING, ACCEPTED, REFUSED, DELETED |
|
215 |
} |
|
216 |
|
|
217 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/openaire/blacklist/BlacklistEntry.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import com.google.common.collect.Lists; |
|
6 |
import com.google.gson.Gson; |
|
7 |
import eu.dnetlib.openaire.blacklist.BlacklistManager.IIS_STATUS; |
|
8 |
import eu.dnetlib.openaire.blacklist.BlacklistManager.STATUS; |
|
9 |
|
|
10 |
public class BlacklistEntry { |
|
11 |
|
|
12 |
|
|
13 |
private int id; |
|
14 |
/** |
|
15 |
* The user who reported the wrong link |
|
16 |
**/ |
|
17 |
private String user = "unknown"; |
|
18 |
/** |
|
19 |
* A note regarding the reported 'wrong' relationship |
|
20 |
**/ |
|
21 |
private String note; |
|
22 |
/** |
|
23 |
* The id of the ticket associated to this entry |
|
24 |
**/ |
|
25 |
private String ticketId; |
|
26 |
/** |
|
27 |
* Provenance of the relationship. 'iis' when the relationship is inferred. 'crosswalk' if it is aggregated. 'claim' if it is a claim. |
|
28 |
**/ |
|
29 |
private String provenance; |
|
30 |
/** |
|
31 |
* Relationship label: 'resultProject_outcome_isProducedBy' for result-project relationships. |
|
32 |
*/ |
|
33 |
private String relationship; |
|
34 |
|
|
35 |
/** |
|
36 |
* The inference module that generated the relationship. 'iis::document_referencedProjects' for result-project relationships. Blank if provenance is not 'iis'. |
|
37 |
**/ |
|
38 |
private String iisModule = ""; |
|
39 |
|
|
40 |
/** |
|
41 |
* Status of the report |
|
42 |
**/ |
|
43 |
private STATUS status = STATUS.PENDING; |
|
44 |
/** |
|
45 |
* Status of the issue from the pov of IIS. Blank if provenance is not 'iis'. |
|
46 |
**/ |
|
47 |
private IIS_STATUS iisStatus = null; |
|
48 |
|
|
49 |
private String creationDate, lastUpdateDate; |
|
50 |
|
|
51 |
/** |
|
52 |
* OpenAIRE ids of the objects linked by the 'wrong' relationship |
|
53 |
**/ |
|
54 |
private String sourceObject, targetObject; |
|
55 |
/** |
|
56 |
* Type of the source and target objects. |
|
57 |
**/ |
|
58 |
private String sourceType, targetType; |
|
59 |
/** |
|
60 |
* If the source or the target are representatives, then the following strings are not empty and contain the json strings with the ids of the merged objects |
|
61 |
**/ |
|
62 |
private List<String> originalSourceObjects = Lists.newArrayList(), originalTargetObjects = Lists.newArrayList(); |
|
63 |
|
|
64 |
@Override |
|
65 |
public String toString() { |
|
66 |
Gson gson = new Gson(); |
|
67 |
return gson.toJson(this); |
|
68 |
} |
|
69 |
|
|
70 |
public String getRelationship() { |
|
71 |
return relationship; |
|
72 |
} |
|
73 |
|
|
74 |
public void setRelationship(final String relationship) { |
|
75 |
this.relationship = relationship; |
|
76 |
} |
|
77 |
|
|
78 |
public String getSourceType() { |
|
79 |
return sourceType; |
|
80 |
} |
|
81 |
|
|
82 |
public void setSourceType(final String sourceType) { |
|
83 |
this.sourceType = sourceType; |
|
84 |
} |
|
85 |
|
|
86 |
public String getTargetType() { |
|
87 |
return targetType; |
|
88 |
} |
|
89 |
|
|
90 |
public void setTargetType(final String targetType) { |
|
91 |
this.targetType = targetType; |
|
92 |
} |
|
93 |
|
|
94 |
public int getId() { |
|
95 |
return id; |
|
96 |
} |
|
97 |
|
|
98 |
public void setId(int id) { |
|
99 |
this.id = id; |
|
100 |
} |
|
101 |
|
|
102 |
public String getUser() { |
|
103 |
return user; |
|
104 |
} |
|
105 |
|
|
106 |
public void setUser(final String user) { |
|
107 |
this.user = user; |
|
108 |
} |
|
109 |
|
|
110 |
public String getNote() { |
|
111 |
return note; |
|
112 |
} |
|
113 |
|
|
114 |
public void setNote(final String note) { |
|
115 |
this.note = note; |
|
116 |
} |
|
117 |
|
|
118 |
public String getTicketId() { |
|
119 |
return ticketId; |
|
120 |
} |
|
121 |
|
|
122 |
public void setTicketId(final String ticketId) { |
|
123 |
this.ticketId = ticketId; |
|
124 |
} |
|
125 |
|
|
126 |
public String getProvenance() { |
|
127 |
return provenance; |
|
128 |
} |
|
129 |
|
|
130 |
public void setProvenance(final String provenance) { |
|
131 |
this.provenance = provenance; |
|
132 |
} |
|
133 |
|
|
134 |
public String getIisModule() { |
|
135 |
return iisModule; |
|
136 |
} |
|
137 |
|
|
138 |
public void setIisModule(final String iisModule) { |
|
139 |
this.iisModule = iisModule; |
|
140 |
} |
|
141 |
|
|
142 |
public STATUS getStatus() { |
|
143 |
return status; |
|
144 |
} |
|
145 |
|
|
146 |
public void setStatus(final STATUS status) { |
|
147 |
this.status = status; |
|
148 |
} |
|
149 |
|
|
150 |
public IIS_STATUS getIisStatus() { |
|
151 |
return iisStatus; |
|
152 |
} |
|
153 |
|
|
154 |
public void setIisStatus(final IIS_STATUS iisStatus) { |
|
155 |
this.iisStatus = iisStatus; |
|
156 |
} |
|
157 |
|
|
158 |
public String getCreationDate() { |
|
159 |
return creationDate; |
|
160 |
} |
|
161 |
|
|
162 |
public void setCreationDate(final String creationDate) { |
|
163 |
this.creationDate = creationDate; |
|
164 |
} |
|
165 |
|
|
166 |
public String getLastUpdateDate() { |
|
167 |
return lastUpdateDate; |
|
168 |
} |
|
169 |
|
|
170 |
public void setLastUpdateDate(final String lastUpdateDate) { |
|
171 |
this.lastUpdateDate = lastUpdateDate; |
|
172 |
} |
|
173 |
|
|
174 |
public String getSourceObject() { |
|
175 |
return sourceObject; |
|
176 |
} |
|
177 |
|
|
178 |
public void setSourceObject(final String sourceObject) { |
|
179 |
this.sourceObject = sourceObject; |
|
180 |
} |
|
181 |
|
|
182 |
public String getTargetObject() { |
|
183 |
return targetObject; |
|
184 |
} |
|
185 |
|
|
186 |
public void setTargetObject(final String targetObject) { |
|
187 |
this.targetObject = targetObject; |
|
188 |
} |
|
189 |
|
|
190 |
public List<String> getOriginalSourceObjects() { |
|
191 |
return originalSourceObjects; |
|
192 |
} |
|
193 |
|
|
194 |
public void setOriginalSourceObjects(final List<String> originalSourceObjects) { |
|
195 |
this.originalSourceObjects = originalSourceObjects; |
|
196 |
} |
|
197 |
|
|
198 |
public List<String> getOriginalTargetObjects() { |
|
199 |
return originalTargetObjects; |
|
200 |
} |
|
201 |
|
|
202 |
public void setOriginalTargetObjects(final List<String> originalTargetObjects) { |
|
203 |
this.originalTargetObjects = originalTargetObjects; |
|
204 |
} |
|
205 |
|
|
206 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/functionality/modular/ui/blacklist/BlacklistEntryPointController.java | ||
---|---|---|
1 |
package eu.dnetlib.functionality.modular.ui.blacklist; |
|
2 |
|
|
3 |
import javax.servlet.http.HttpServletRequest; |
|
4 |
import javax.servlet.http.HttpServletResponse; |
|
5 |
|
|
6 |
import org.springframework.ui.ModelMap; |
|
7 |
|
|
8 |
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint; |
|
9 |
|
|
10 |
/** |
|
11 |
* Created by alessia on 18/09/15. |
|
12 |
*/ |
|
13 |
public class BlacklistEntryPointController extends ModuleEntryPoint { |
|
14 |
|
|
15 |
@Override |
|
16 |
protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {} |
|
17 |
|
|
18 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/java/eu/dnetlib/functionality/modular/ui/blacklist/BlacklistInternalController.java | ||
---|---|---|
1 |
package eu.dnetlib.functionality.modular.ui.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
import java.util.Set; |
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import com.google.common.collect.Lists; |
|
8 |
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController; |
|
9 |
import eu.dnetlib.openaire.blacklist.BlacklistEntry; |
|
10 |
import eu.dnetlib.openaire.blacklist.BlacklistManager; |
|
11 |
import org.apache.commons.logging.Log; |
|
12 |
import org.apache.commons.logging.LogFactory; |
|
13 |
import org.springframework.stereotype.Controller; |
|
14 |
import org.springframework.web.bind.annotation.RequestBody; |
|
15 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
16 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
17 |
|
|
18 |
/** |
|
19 |
* Created by alessia on 18/09/15. |
|
20 |
*/ |
|
21 |
@Controller |
|
22 |
public class BlacklistInternalController extends AbstractAjaxController { |
|
23 |
|
|
24 |
private static final Log log = LogFactory.getLog(BlacklistInternalController.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
25 |
|
|
26 |
@Resource |
|
27 |
private BlacklistManager blacklistManager; |
|
28 |
|
|
29 |
@ResponseBody |
|
30 |
@RequestMapping(value = "/ui/blacklist/getBlacklist.do") |
|
31 |
public List<BlacklistEntry> getBlacklist() { |
|
32 |
log.debug("getBlacklist"); |
|
33 |
return Lists.newArrayList(this.blacklistManager.getBlacklist()); |
|
34 |
} |
|
35 |
|
|
36 |
@ResponseBody |
|
37 |
@RequestMapping(value = "/ui/blacklist/addToBlacklist.do") |
|
38 |
public boolean addToBlacklist(@RequestBody(required = true) final BlacklistEntry entry) throws Exception { |
|
39 |
log.debug("addToBlacklist"); |
|
40 |
return this.blacklistManager.addToBlacklist(entry); |
|
41 |
} |
|
42 |
|
|
43 |
@ResponseBody |
|
44 |
@RequestMapping(value = "/ui/blacklist/editBlacklistEntry.do") |
|
45 |
public boolean editBlacklistEntry(@RequestBody(required = true) final BlacklistEntry entry) throws Exception { |
|
46 |
log.debug("editing blacklist entry " + entry.getId()); |
|
47 |
return this.blacklistManager.editBlacklistEntry(entry); |
|
48 |
} |
|
49 |
|
|
50 |
@ResponseBody |
|
51 |
@RequestMapping(value = "/ui/blacklist/deleteFromBlacklist.do") |
|
52 |
public boolean deleteFromBlacklist(@RequestBody(required = true) final int entryId) throws Exception { |
|
53 |
log.debug("deleting blacklist entry " + entryId); |
|
54 |
return this.blacklistManager.deleteFromBlacklist(entryId); |
|
55 |
} |
|
56 |
|
|
57 |
@ResponseBody |
|
58 |
@RequestMapping(value = "/ui/blacklist/getListOfRelationships.do") |
|
59 |
public Set<String> getListOfRelationships() throws Exception { |
|
60 |
return this.blacklistManager.getListOfRelationships(); |
|
61 |
} |
|
62 |
|
|
63 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/applicationContext-dnet-openaire-blacklist.properties | ||
---|---|---|
1 |
dnet.openaire.blacklist.db.name=dnet_openaire_blacklist |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/openaire/blacklist/db/dnet_blacklists_data.sql | ||
---|---|---|
1 |
CREATE TYPE IIS_STATUS AS ENUM ('UNSOLVED', 'SOLVED'); |
|
2 |
CREATE TYPE STATUS AS ENUM ('PENDING', 'ACCEPTED', 'REFUSED', 'DELETED'); |
|
3 |
|
|
4 |
CREATE TABLE blacklist ( |
|
5 |
id SERIAL, |
|
6 |
source_object CHARACTER VARYING(255) NOT NULL, |
|
7 |
target_object CHARACTER VARYING(255) NOT NULL, |
|
8 |
|
|
9 |
source_type CHARACTER VARYING(255) NOT NULL, |
|
10 |
target_type CHARACTER VARYING(255) NOT NULL, |
|
11 |
|
|
12 |
relationship CHARACTER VARYING(255) NOT NULL, |
|
13 |
|
|
14 |
provenance CHARACTER VARYING(255) NOT NULL, |
|
15 |
iis_module CHARACTER VARYING(255), |
|
16 |
iis_module_profile CHARACTER VARYING(255), |
|
17 |
|
|
18 |
iis_status IIS_STATUS, |
|
19 |
status STATUS NOT NULL, |
|
20 |
|
|
21 |
original_source_objects CHARACTER VARYING(255) ARRAY, |
|
22 |
original_target_objects CHARACTER VARYING(255) ARRAY, |
|
23 |
|
|
24 |
creation_time TIMESTAMP DEFAULT now(), |
|
25 |
last_update_time TIMESTAMP DEFAULT now(), |
|
26 |
|
|
27 |
note TEXT, |
|
28 |
ticket_id CHARACTER VARYING(255), |
|
29 |
userid CHARACTER VARYING(255) NOT NULL, |
|
30 |
|
|
31 |
PRIMARY KEY (source_object, target_object, relationship) |
|
32 |
|
|
33 |
); |
|
34 |
|
|
35 |
CREATE INDEX ON blacklist (source_object); |
|
36 |
CREATE INDEX ON blacklist (target_object); |
|
37 |
CREATE INDEX ON blacklist (ticket_id, original_source_objects, original_target_objects); |
|
38 |
CREATE INDEX ON blacklist (iis_status); |
|
39 |
CREATE INDEX ON blacklist (status); |
|
40 |
|
|
41 |
--TRIGGER TO UPDATE THE last_update_time on UPDATES |
|
42 |
CREATE OR REPLACE FUNCTION update_modified_column() |
|
43 |
RETURNS TRIGGER AS $$ |
|
44 |
BEGIN |
|
45 |
NEW.last_update_time = now(); |
|
46 |
RETURN NEW; |
|
47 |
END; |
|
48 |
$$ LANGUAGE 'plpgsql'; |
|
49 |
|
|
50 |
CREATE TRIGGER update_blacklist_modtime BEFORE UPDATE ON blacklist FOR EACH ROW EXECUTE PROCEDURE update_modified_column(); |
|
51 |
|
|
52 |
-- Just for test |
|
53 |
|
|
54 |
-- INSERT INTO blacklist (userid, relationship, provenance, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
55 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'crosswalk', |
|
56 |
-- 'ACCEPTED', 'od________18::xxxxxxxxxxxxxxxxxx', 'result', |
|
57 |
-- 'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1'); |
|
58 |
-- INSERT INTO blacklist (userid, relationship, provenance, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
59 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'crosswalk', |
|
60 |
-- 'PENDING', 'od________18::yyyyyyyyyyyyyyyyyyyy', 'result', |
|
61 |
-- 'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1'); |
|
62 |
-- INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
63 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
64 |
-- 'iis::document_referencedProjects', |
|
65 |
-- 'UNSOLVED', 'ACCEPTED', 'od______2367::eb76f733498920166d4ce77ec37d4X', 'result', |
|
66 |
-- 'corda_______::800e636c0a24ac3767701a789a96baX', 'project', '1360', '{"idsource::origi1", "idsource:orig2"}', |
|
67 |
-- '{"idtarget::origi1", "idtarget:orig2","idtarget:orig3"}'); |
|
68 |
|
|
69 |
-- https://issue.openaire.research-infrastructures.eu/issues/1245 |
|
70 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
71 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
72 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od_______908::a47e1c3ede9a21ee5278a2e5c338d69b', 'result', |
|
73 |
'corda_______::fda6a1c19dac47508b6fb619518328c7', 'project', '1245', '{"od_______908::a47e1c3ede9a21ee5278a2e5c338d69b"}', '{"corda_______::fda6a1c19dac47508b6fb619518328c7"}'); |
|
74 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
75 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
76 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od_______908::a47e1c3ede9a21ee5278a2e5c338d69b', 'result', |
|
77 |
'corda_______::189ff31d637eaaeaf4d3584dc490b1cf', 'project', '1245', '{"od_______908::a47e1c3ede9a21ee5278a2e5c338d69b"}', '{"corda_______::189ff31d637eaaeaf4d3584dc490b1cf"}'); |
|
78 |
|
|
79 |
-- https://issue.openaire.research-infrastructures.eu/issues/1360 |
|
80 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
81 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
82 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od________18::a727cc288016db7132ef9a799aa83350', 'result', |
|
83 |
'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1360', '{"od________18::a727cc288016db7132ef9a799aa83350"}', '{"corda_______::9826e8aba3e8f3a2a46545cf341838a8"}'); |
|
84 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
85 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
86 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od________18::062cf091d5c7a7d730001c34177042e3', 'result', |
|
87 |
'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1360', '{"od________18::062cf091d5c7a7d730001c34177042e3"}', |
|
88 |
'{"corda_______::9826e8aba3e8f3a2a46545cf341838a8"}'); |
|
89 |
|
|
90 |
-- https://issue.openaire.research-infrastructures.eu/issues/1254 |
|
91 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
92 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
93 |
'iis::document_referencedProjects', 'SOLVED', |
|
94 |
'ACCEPTED', 'webcrawl____::68c191d9b972b47a235d311804c7f6f5', 'result', 'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', |
|
95 |
'1254', '{"webcrawl____::68c191d9b972b47a235d311804c7f6f5"}', '{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
96 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
97 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
98 |
'iis::document_referencedProjects', |
|
99 |
'UNSOLVED', 'ACCEPTED', 'od_______908::1b172ab34639e7935e2357119cf20830', 'result', |
|
100 |
'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', '1254', '{"od_______908::1b172ab34639e7935e2357119cf20830"}', |
|
101 |
'{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
102 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
103 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
104 |
'iis::document_referencedProjects', |
|
105 |
'UNSOLVED', 'ACCEPTED', 'doajarticles::cb234c66327d29ba5f13c0db7a4cf423', 'result', |
|
106 |
'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', '1254', '{"doajarticles::cb234c66327d29ba5f13c0db7a4cf423"}', |
|
107 |
'{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
108 |
|
|
109 |
-- https://issue.openaire.research-infrastructures.eu/issues/1297 |
|
110 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
111 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
112 |
'iis::document_referencedProjects', 'UNSOLVED', |
|
113 |
'ACCEPTED', 'od______1146::e2fafaba636a14e408f02c6ea26acb0e', 'result', 'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', |
|
114 |
'1297', '{"od______1146::e2fafaba636a14e408f02c6ea26acb0e"}', '{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
115 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
116 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
117 |
'iis::document_referencedProjects', |
|
118 |
'UNSOLVED', 'ACCEPTED', 'od_______908::b8e86ed982ff331764456e1f0759ed9c', 'result', |
|
119 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::b8e86ed982ff331764456e1f0759ed9c"}', |
|
120 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
121 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
122 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
123 |
'iis::document_referencedProjects', |
|
124 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::c472bf5944ce0495844d505d43d1c021', 'result', |
|
125 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::c472bf5944ce0495844d505d43d1c021"}', |
|
126 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
127 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
128 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
129 |
'iis::document_referencedProjects', |
|
130 |
'UNSOLVED', 'ACCEPTED', 'od_______908::bbe86580e44dbefa401d435259baddf1', 'result', |
|
131 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::bbe86580e44dbefa401d435259baddf1"}', |
|
132 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
133 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
134 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
135 |
'iis::document_referencedProjects', |
|
136 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::ae0ae3ea5641ac24fa148ac38397dfcd', 'result', |
|
137 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::ae0ae3ea5641ac24fa148ac38397dfcd"}', |
|
138 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
139 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
140 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
141 |
'iis::document_referencedProjects', |
|
142 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::5f46a8c6420f5b5eaf30d7212b0ada5b', 'result', |
|
143 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::5f46a8c6420f5b5eaf30d7212b0ada5b"}', |
|
144 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
145 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
146 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
147 |
'iis::document_referencedProjects', |
|
148 |
'UNSOLVED', 'ACCEPTED', 'od_______908::49d9b3df9cf7e9c991e09e53677e40e3', 'result', |
|
149 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::49d9b3df9cf7e9c991e09e53677e40e3"}', |
|
150 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
151 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
152 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
153 |
'iis::document_referencedProjects', |
|
154 |
'UNSOLVED', 'ACCEPTED', 'od_______330::aa2edd06a6121a1a1db63be83cd7b7c7', 'result', |
|
155 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______330::aa2edd06a6121a1a1db63be83cd7b7c7"}', |
|
156 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
157 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
158 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
159 |
'iis::document_referencedProjects', |
|
160 |
'UNSOLVED', 'ACCEPTED', 'od_______908::45f342e6f10d5543631a757b417388d7', 'result', |
|
161 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::45f342e6f10d5543631a757b417388d7"}', |
|
162 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
163 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
164 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
165 |
'iis::document_referencedProjects', |
|
166 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::6ce2789da52c6036501533ed5613d71a', 'result', |
|
167 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::6ce2789da52c6036501533ed5613d71a"}', |
|
168 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
169 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
170 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
171 |
'iis::document_referencedProjects', |
|
172 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::f887afc3d7a8e8c708b9b773d26cdd9d', 'result', |
|
173 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::f887afc3d7a8e8c708b9b773d26cdd9d"}', |
|
174 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
175 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
176 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
177 |
'iis::document_referencedProjects', |
|
178 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::161ee67349e268750701ee437188340b', 'result', |
|
179 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::161ee67349e268750701ee437188340b"}', |
|
180 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
181 |
|
|
182 |
-- https://issue.openaire.research-infrastructures.eu/issues/1412 |
|
183 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
184 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
185 |
'iis::document_referencedProjects', |
|
186 |
'UNSOLVED', 'ACCEPTED', 'od______2367::eb76f733498920166d4ce77ec37d487c', 'result', |
|
187 |
'corda_______::800e636c0a24ac3767701a789a96ba89', 'project', '1360', '{"od______2367::eb76f733498920166d4ce77ec37d487c"}', |
|
188 |
'{"corda_______::800e636c0a24ac3767701a789a96ba89"}'); |
|
189 |
|
|
190 |
-- https://issue.openaire.research-infrastructures.eu/issues/1530 |
|
191 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
192 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
193 |
'iis::document_referencedProjects', |
|
194 |
'UNSOLVED', 'ACCEPTED', 'dedup_wf_001::67d425112b2858ac59c44589496260b6', 'result', |
|
195 |
'corda__h2020::c4093823864f0ceb5747977245d1ad57', 'project', '1360', |
|
196 |
'{"doajarticles::67d425112b2858ac59c44589496260b6", "issn20484194::e8fe2f03154ed785e968ab72f54707e1"}', |
|
197 |
'{"corda__h2020::c4093823864f0ceb5747977245d1ad57"}'); |
|
198 |
|
|
199 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
200 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
201 |
'iis::document_referencedProjects', |
|
202 |
'UNSOLVED', 'ACCEPTED', 'dedup_wf_001::42baa97c7d0a4316f72bc61c373b6d2c', 'result', |
|
203 |
'corda__h2020::bc993a53736173ace2f6dd2ddc459dd5', 'project', '1360', |
|
204 |
'{"erc_________::42baa97c7d0a4316f72bc61c373b6d2c", "webcrawl____::488517651c5e126d97b45ad0416dd8a8", "od_______908::80a1640c67870bc5d4673a8d1ad0534a", "od_______610::9a1a5461cd13d2192950497bbe0b52ed"}', |
|
205 |
'{"corda__h2020::bc993a53736173ace2f6dd2ddc459dd5"}'); |
|
206 |
|
|
207 |
|
|
208 |
|
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/applicationContext-dnet-openaire-blacklist.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xmlns="http://www.springframework.org/schema/beans" |
|
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
|
5 |
|
|
6 |
<bean id="blacklistManager" class="eu.dnetlib.openaire.blacklist.BlacklistManager" /> |
|
7 |
|
|
8 |
<bean id="openaireIdResolver" class="eu.dnetlib.openaire.blacklist.OpenaireIdResolver"/> |
|
9 |
|
|
10 |
<bean id="wfNodeApplyBlacklistJob" class="eu.dnetlib.msro.workflows.blacklist.ApplyBlacklistJobNode" |
|
11 |
scope="prototype" /> |
|
12 |
|
|
13 |
</beans> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-blacklist.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" |
|
4 |
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing" |
|
5 |
xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration" |
|
6 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
7 |
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" |
|
8 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
|
9 |
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd |
|
10 |
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
11 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
12 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
13 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd |
|
14 |
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd |
|
15 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> |
|
16 |
|
|
17 |
|
|
18 |
<bean name="/ui/blacklist.do" |
|
19 |
class="eu.dnetlib.functionality.modular.ui.blacklist.BlacklistEntryPointController" |
|
20 |
p:menu="Blacklist Manager" |
|
21 |
p:title="Blacklist Manager" |
|
22 |
p:description="Manager for the Blacklist of links" |
|
23 |
p:group="Tools"> |
|
24 |
<property name="permissionLevels"> |
|
25 |
<set> |
|
26 |
<value>IS_ADMIN</value> |
|
27 |
</set> |
|
28 |
</property> |
|
29 |
</bean> |
|
30 |
|
|
31 |
</beans> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/blacklist.st | ||
---|---|---|
1 |
$common/master( header={ |
|
2 |
<script type="text/javascript" src="../resources/js/angular.min.js" ></script> |
|
3 |
<script type="text/javascript" src="../resources/js/angular-route.min.js"></script> |
|
4 |
<script type="text/javascript" src="../resources/js/ui-bootstrap.min.js"></script> |
|
5 |
<script type="text/javascript" src="../resources/js/jquery-ui-1.10.4.min.js"></script> |
|
6 |
|
|
7 |
<script type="text/javascript" src="../resources/js/blacklist.js"></script> |
|
8 |
<script type="text/javascript" src="../resources/js/blacklist_controllers.js"></script> |
|
9 |
|
|
10 |
<link rel="stylesheet" type="text/css" href="../resources/css/jquery-ui-1.10.4.min.css" /> |
|
11 |
|
|
12 |
}, body={ |
|
13 |
<div ng-app="blacklist"> |
|
14 |
<div ng-view></div> |
|
15 |
</div> |
|
16 |
} )$ |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/web/resources/html/blacklist/blacklistEntryForm.html | ||
---|---|---|
1 |
<form> |
|
2 |
<div class="form-group"> |
|
3 |
<label for="ticket">Ticket id</label> |
|
4 |
|
|
5 |
<div><input class="form-control" ng-model="entry.ticketId" id="ticket" type="text"/></div> |
|
6 |
</div> |
|
7 |
|
|
8 |
<div class="form-group"> |
|
9 |
<label for="sourceTypeSelect">Source object type</label> |
|
10 |
|
|
11 |
<div> |
|
12 |
<select class="form-control" id="sourceTypeSelect" ng-model="entry.sourceType"> |
|
13 |
<option ng-repeat="entityType in entityTypes" value="{{entityType}}">{{entityType}}</option> |
|
14 |
</select> |
|
15 |
</div> |
|
16 |
</div> |
|
17 |
<div class="form-group"> |
|
18 |
<label for="sourceObject">Source object id</label> |
|
19 |
|
|
20 |
<div> |
|
21 |
<input class="form-control" id="sourceObject" ng-model="entry.sourceObject" |
|
22 |
type="text"/> |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
|
|
26 |
<div class="form-group"> |
|
27 |
<label for="relationType">Relationship</label> |
|
28 |
|
|
29 |
<div> |
|
30 |
<select class="form-control" id="relationType" ng-model="entry.relationship"> |
|
31 |
<option ng-repeat="relType in relationTypes" value="{{relType}}">{{relType}}</option> |
|
32 |
</select> |
|
33 |
</div> |
|
34 |
</div> |
|
35 |
<div class="form-group"> |
|
36 |
<label for="targetTypeSelect">Target object type</label> |
|
37 |
|
|
38 |
<div> |
|
39 |
<select class="form-control" required id="targetTypeSelect" ng-model="entry.targetType"> |
|
40 |
<option ng-repeat="entityType in entityTypes" value="{{entityType}}">{{entityType}}</option> |
|
41 |
</select> |
|
42 |
</div> |
|
43 |
</div> |
|
44 |
<div class="form-group"> |
|
45 |
<label for="targetObject">Target object id</label> |
|
46 |
|
|
47 |
<div> |
|
48 |
<input class="form-control" id="targetObject" ng-model="entry.targetObject" |
|
49 |
type="text"/> |
|
50 |
</div> |
|
51 |
</div> |
|
52 |
|
|
53 |
<div class="form-group"> |
|
54 |
<label for="provenanceSelect">Provenance</label> |
|
55 |
|
|
56 |
<div><select class="form-control" id="provenanceSelect" ng-model="entry.provenance"> |
|
57 |
<option>iis</option> |
|
58 |
<option>crosswalk</option> |
|
59 |
<option>claim</option> |
|
60 |
<option>unknown</option> |
|
61 |
</select></div> |
|
62 |
</div> |
|
63 |
<!-- |
|
64 |
<div class="form-group"> |
|
65 |
<label for="provenance">Provenance</label> |
|
66 |
|
|
67 |
<div> |
|
68 |
<input id="provenance" class="form-control" ng-model="entry.provenance" |
|
69 |
type="text" placeholder="E.g. iis, crosswalk, claim"/> |
|
70 |
</div> |
|
71 |
</div> |
|
72 |
--> |
|
73 |
<div class="form-group"> |
|
74 |
<label for="iisModule">IIS module</label> |
|
75 |
|
|
76 |
<div> |
|
77 |
<input id="iisModule" class="form-control" ng-model="entry.iisModule" |
|
78 |
type="text" placeholder="E.g. iis::document_referencedProjects"/> |
|
79 |
</div> |
|
80 |
</div> |
|
81 |
<div class="form-group"> |
|
82 |
<label for="status">Status</label> |
|
83 |
|
|
84 |
<div><select class="form-control" id="status" ng-model="entry.status"> |
|
85 |
<option>PENDING</option> |
|
86 |
<option>ACCEPTED</option> |
|
87 |
<option>REFUSED</option> |
|
88 |
<option>DELETED</option> |
|
89 |
</select></div> |
|
90 |
</div> |
|
91 |
<div class="form-group"> |
|
92 |
<label for="iisStatus">IIS Status</label> |
|
93 |
|
|
94 |
<div><select ng-model="entry.iisStatus" class="form-control" id="iisStatus"> |
|
95 |
<option>UNSOLVED</option> |
|
96 |
<option>SOLVED</option> |
|
97 |
</select></div> |
|
98 |
</div> |
|
99 |
|
|
100 |
<div class="form-group"> |
|
101 |
<label for="note">Note</label> |
|
102 |
|
|
103 |
<div><textarea class="form-control" rows="3" ng-model="entry.note" id="note"></textarea> |
|
104 |
</div> |
|
105 |
</div> |
|
106 |
</form> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.3/src/main/resources/eu/dnetlib/web/resources/html/blacklist/blacklist.html | ||
---|---|---|
1 |
<!-- Button trigger modal --> |
|
2 |
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addToBlacklistModal" |
|
3 |
xmlns="http://www.w3.org/1999/html"> |
|
4 |
New blacklist entry |
|
5 |
</button> |
|
6 |
|
|
7 |
<!-- Modal --> |
|
8 |
<!-- New BL entry --> |
|
9 |
|
|
10 |
<div class="modal fade" id="addToBlacklistModal" tabindex="-1" role="dialog" aria-labelledby="addToBlacklistModalLabel"> |
|
11 |
<div class="modal-dialog" role="document"> |
|
12 |
<div class="modal-content"> |
|
13 |
<div class="modal-header"> |
|
14 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span |
|
15 |
aria-hidden="true">×</span></button> |
|
16 |
<h4 class="modal-title" id="addToBlacklistModalLabel">Add new blacklist entry</h4> |
|
17 |
</div> |
|
18 |
<div class="modal-body"> |
|
19 |
<ng-blacklist-form entry="newEntry"></ng-blacklist-form> |
|
20 |
</div> |
|
21 |
<div class="modal-footer"> |
|
22 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
23 |
<button type="button" class="btn btn-primary" |
|
24 |
ng-click="addToBlacklist(newEntry)"> |
|
25 |
Save changes |
|
26 |
</button> |
|
27 |
</div> |
|
28 |
</div> |
|
29 |
</div> |
|
30 |
</div> |
|
31 |
|
|
32 |
<!-- Edit BL entry --> |
|
33 |
<div class="modal fade" id="editBlacklistEntryModal" tabindex="-1" role="dialog" |
|
34 |
aria-labelledby="editBlacklistEntryModalLabel"> |
|
35 |
<div class="modal-dialog modal-lg" role="document"> |
|
36 |
<div class="modal-content"> |
|
37 |
<div class="modal-header"> |
|
38 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span |
|
39 |
aria-hidden="true">×</span></button> |
|
40 |
<h4 class="modal-title" id="editBlacklistEntryModalLabel">Edit blacklist entry {{entryToEdit.id}}</h4> |
|
41 |
</div> |
|
42 |
<div class="modal-body"> |
|
43 |
<ng-blacklist-form entry="entryToEdit"></ng-blacklist-form> |
|
44 |
</div> |
|
45 |
<div class="modal-footer"> |
|
46 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
47 |
<button type="button" class="btn btn-primary" |
|
48 |
ng-click="editBlacklistEntry(entryToEdit)"> |
|
49 |
Save changes |
|
50 |
</button> |
|
51 |
</div> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
</div> |
|
55 |
|
|
56 |
<table class="table table-hover"> |
|
57 |
<thead> |
|
58 |
<tr> |
|
59 |
<!--<th>ID</th>--> |
|
60 |
<th>Ticket id</th> |
|
61 |
<!--<th>User</th>--> |
|
62 |
<th>Status</th> |
|
63 |
<th>IIS Status</th> |
|
64 |
<th>Source object</th> |
|
65 |
<th>Relationship</th> |
|
66 |
<th>Target object</th> |
|
67 |
<th>Provenance / IIS Module</th> |
|
68 |
<!--<th>IIS module</th>--> |
|
69 |
<th>Note</th> |
|
70 |
<th>Last update date</th> |
|
71 |
<th>Action</th> |
|
72 |
</tr> |
|
73 |
</thead> |
|
74 |
<tbody> |
|
75 |
<tr ng-repeat="entry in blacklist"> |
|
76 |
<!--<td>{{entry.id}}</td>--> |
|
77 |
<td><a target="_blank" href="https://issue.openaire.research-infrastructures.eu/issues/{{entry.ticketId}}">{{entry.ticketId}}</a></td> |
|
78 |
<!--<td>{{entry.user}}</td>--> |
|
79 |
<td>{{entry.status}}</td> |
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-openaire-blacklist-1.0.3