Revision 53031
Added by Argiro Kokogiannaki over 5 years ago
DMFContextHandler.java | ||
---|---|---|
24 | 24 |
QueryGenerator queryGenerator = null; |
25 | 25 |
DMFParser dmfParser = null; |
26 | 26 |
|
27 |
|
|
27 | 28 |
private String fetchAllDMFContext(String id) throws Exception, SQLStoreException { |
28 | 29 |
ResultSet rs = sqlDAO.executePreparedQuery(queryGenerator.generateSelectConceptDMFClaimsQuery(-1)); |
29 | 30 |
return rs.getString("xml"); |
... | ... | |
34 | 35 |
return rs.getString("xml"); |
35 | 36 |
} |
36 | 37 |
|
37 |
public Context extractContextFromDMF(String xml) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { |
|
38 |
return fetchContextById(dmfParser.getContextIdFromDMF(xml)); |
|
38 |
public Context extractContextFromDMF(String xml, Boolean production) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException {
|
|
39 |
return fetchContextById(dmfParser.getContextIdFromDMF(xml),production );
|
|
39 | 40 |
} |
40 | 41 |
|
41 |
public Context fetchContextByIdFromDmf(String id) throws Exception, SQLStoreException { |
|
42 |
return extractContextFromDMF(fetchDMFContext(id)); |
|
42 |
public Context fetchContextByIdFromDmf(String id, Boolean production) throws Exception, SQLStoreException {
|
|
43 |
return extractContextFromDMF(fetchDMFContext(id), production);
|
|
43 | 44 |
} |
44 | 45 |
|
45 |
public static Context fetchContextById(String openaireId) { |
|
46 |
public static Context fetchContextById(String openaireId, Boolean production) {
|
|
46 | 47 |
Context context = new Context(); |
47 | 48 |
if(openaireId == null ){ |
48 | 49 |
return null; |
49 | 50 |
} |
50 | 51 |
context.setOpenaireId(openaireId); |
51 | 52 |
try { |
52 |
context.setTitle(ContextUtils.extractLabel(context.getOpenaireId())); |
|
53 |
context.setTitle(ContextUtils.extractLabel(context.getOpenaireId(),production));
|
|
53 | 54 |
|
54 | 55 |
} catch (Exception e) { |
55 | 56 |
log.error("ContextUtils: Couldn't get Egi label for id " + context.getOpenaireId(),e); |
Also available in: Unified diff
Parameterize context utils methods with a boolean parameter for productionIndex, add production url
In delete claims method add check for deleting record