Revision 56861
Added by Alessia Bardi over 4 years ago
modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/OpenaireMdBuilderJobNode.java | ||
---|---|---|
17 | 17 |
import org.apache.commons.logging.LogFactory; |
18 | 18 |
import org.springframework.beans.factory.annotation.Required; |
19 | 19 |
|
20 |
import java.io.UnsupportedEncodingException; |
|
21 |
import java.net.URLEncoder; |
|
22 |
|
|
20 | 23 |
public class OpenaireMdBuilderJobNode extends SimpleJobNode { |
21 | 24 |
|
22 | 25 |
private static final Log log = LogFactory.getLog(OpenaireMdBuilderJobNode.class); |
... | ... | |
47 | 50 |
final String inputEpr = token.getEnv().getAttribute(inputEprParam); |
48 | 51 |
|
49 | 52 |
if ((inputEpr == null) || inputEpr.isEmpty()) throw new MSROException("InputEprParam (" + inputEprParam + ") not found in ENV"); |
50 |
|
|
53 |
final StringTemplate st = new StringTemplate(getMdBuilderTemplateXslt().getTemplate()); |
|
51 | 54 |
try { |
52 |
final StringTemplate st = new StringTemplate(getMdBuilderTemplateXslt().getTemplate()); |
|
53 |
|
|
54 | 55 |
st.setAttribute("xpath", getMetadataIdentifierXPath()); |
55 | 56 |
st.setAttribute("datasourceId", datasourceId); |
56 | 57 |
if (token.getEnv().hasAttribute("namespacePrefix")) { |
... | ... | |
65 | 66 |
st.setAttribute("trust", getTrust()); |
66 | 67 |
st.setAttribute("provenanceactionclassname", getProvenanceactionclassname()); |
67 | 68 |
st.setAttribute("provenanceactionclassid", getProvenanceactionclassid()); |
68 |
st.setAttribute("baseurl", getBaseUrl());
|
|
69 |
st.setAttribute("baseurl", URLEncoder.encode(getBaseUrl(), "UTF-8"));
|
|
69 | 70 |
st.setAttribute("metadatanamespace", getMetadataNamespace()); |
70 | 71 |
|
71 | 72 |
final W3CEndpointReference epr = xsltMappedResultSetFactory.createMappedResultSet(new EPRUtils().getEpr(inputEpr), st.toString()); |
... | ... | |
75 | 76 |
return Arc.DEFAULT_ARC; |
76 | 77 |
} catch (ISLookUpException e) { |
77 | 78 |
throw new MSROException("Error while initializing mdBuilder template for datasource " + datasourceId, e); |
79 |
} catch (UnsupportedEncodingException e) { |
|
80 |
log.error("Cannot encode baseUrl in UTF-8"); |
|
81 |
throw new MSROException(e); |
|
78 | 82 |
} |
79 | 83 |
} |
80 | 84 |
|
Also available in: Unified diff
Encode baseUrl like in "normal" MDBuilder