Revision 48830
Added by Alessia Bardi over 6 years ago
X3MTransformJobNode.java | ||
---|---|---|
51 | 51 |
private XPathSelector xpathSelectorFooter; |
52 | 52 |
private XPathSelector xpathSelectorObjIdentifier; |
53 | 53 |
|
54 |
/** |
|
55 |
* true to pass the full record to X3m-engine. False to pass only what's in the metadata section. |
|
56 |
**/ |
|
57 |
private boolean passFullRecord = false; |
|
54 | 58 |
|
59 |
|
|
55 | 60 |
@Autowired |
56 | 61 |
private ResultSetFactory resultSetFactory; |
57 | 62 |
@Autowired |
... | ... | |
78 | 83 |
String objIdentifier = extractFromRecord(record, xpathSelectorObjIdentifier); |
79 | 84 |
log.debug("Transforming record objIdentifier: " + objIdentifier); |
80 | 85 |
} |
86 |
ApplyX3Mapping mappingFunction = new ApplyX3Mapping(mappings, policy, verboseLogging); |
|
87 |
|
|
88 |
String toTransform = record; |
|
81 | 89 |
Instant startExtraction = Instant.now(); |
82 |
String metadata = extractFromRecord(record, xpathSelectorMetadata); |
|
83 |
log.debug(metadata); |
|
90 |
if(!isPassFullRecord()) { |
|
91 |
toTransform = extractFromRecord(record, xpathSelectorMetadata); |
|
92 |
} |
|
93 |
log.debug(toTransform); |
|
84 | 94 |
String header = extractFromRecord(record, xpathSelectorHeader); |
85 | 95 |
String provenanceFooter = extractFromRecord(record, xpathSelectorFooter); |
86 | 96 |
Instant endExtraction = Instant.now(); |
87 | 97 |
|
88 |
ApplyX3Mapping mappingFunction = new ApplyX3Mapping(mappings, policy, verboseLogging); |
|
89 |
|
|
90 | 98 |
Instant startTransform = Instant.now(); |
91 |
String transformed = mappingFunction.apply(metadata);
|
|
99 |
String transformed = mappingFunction.apply(toTransform);
|
|
92 | 100 |
Instant endTransform = Instant.now(); |
93 | 101 |
|
94 | 102 |
if(log.isDebugEnabled()){ |
... | ... | |
112 | 120 |
return mappings; |
113 | 121 |
} |
114 | 122 |
|
115 |
protected String buildXML(String header, String transformationDate, String metadata, String provenance) {
|
|
123 |
protected String buildXML(final String header, final String transformationDate, final String metadata, final String provenance) {
|
|
116 | 124 |
Instant start = Instant.now(); |
117 | 125 |
try { |
118 | 126 |
XMLIndenter xmlHelper = new XMLIndenter(); |
... | ... | |
236 | 244 |
public void setServiceLocator(final UniqueServiceLocator serviceLocator) { |
237 | 245 |
this.serviceLocator = serviceLocator; |
238 | 246 |
} |
247 |
|
|
248 |
public boolean isPassFullRecord() { |
|
249 |
return passFullRecord; |
|
250 |
} |
|
251 |
|
|
252 |
public void setPassFullRecord(final boolean passFullRecord) { |
|
253 |
this.passFullRecord = passFullRecord; |
|
254 |
} |
|
239 | 255 |
} |
Also available in: Unified diff
New parameter to decide to pass the full record or only the metadata content to x3m