Revision 48755
Added by Sandro La Bruzzo almost 7 years ago
ResolveAndIndexJobNode.java | ||
---|---|---|
21 | 21 |
import org.springframework.http.converter.StringHttpMessageConverter; |
22 | 22 |
import org.springframework.web.client.RestTemplate; |
23 | 23 |
|
24 |
import java.net.HttpURLConnection; |
|
24 | 25 |
import java.net.URI; |
26 |
import java.net.URL; |
|
27 |
import java.net.URLConnection; |
|
25 | 28 |
import java.nio.charset.Charset; |
26 | 29 |
import java.time.LocalDateTime; |
27 | 30 |
import java.util.Arrays; |
... | ... | |
81 | 84 |
continue; |
82 | 85 |
} |
83 | 86 |
for (final ObjectRelation rels : result.getRelations()) { |
87 |
URL url = new URL(String.format(BASE_CFG_URL, indexHost, indexName, generateIdentifier(result.getPid(), rels.getTargetPID().getId()))); |
|
88 |
HttpURLConnection http = (HttpURLConnection) url.openConnection(); |
|
89 |
int statusCode = http.getResponseCode(); |
|
90 |
http.disconnect(); |
|
91 |
if (statusCode == 200) |
|
92 |
continue; |
|
93 |
|
|
84 | 94 |
final ResolvedObject resolvedRelation = resolveRelation(rels.getTargetPID(), result.getDatasourceProvenance().get(0)); |
85 | 95 |
|
86 | 96 |
|
... | ... | |
131 | 141 |
token.setProgressProvider(this); |
132 | 142 |
} |
133 | 143 |
|
144 |
|
|
145 |
private String generateIdentifier(final String source, final String target) { |
|
146 |
return AbstractDNetXsltFunctions.md5(String.format("%s::%s", source.toLowerCase().trim(), target.toLowerCase().trim())); |
|
147 |
|
|
148 |
} |
|
149 |
|
|
134 | 150 |
private String generateIdentifier(final ResolvedObject source, ResolvedObject target) { |
135 | 151 |
|
136 | 152 |
return AbstractDNetXsltFunctions.md5(String.format("%s::%s", source.getPid().toLowerCase().trim(), target.getPid().toLowerCase().trim())); |
Also available in: Unified diff
upgraded node to avoid to reindex and resolve object already indexed