Revision 62117
Added by Michele Artini about 2 years ago
SimpleDataTransformer.java | ||
---|---|---|
12 | 12 |
import eu.dnetlib.data.collective.transformation.engine.SimpleTransformationEngine; |
13 | 13 |
import eu.dnetlib.data.collective.transformation.engine.core.TransformationImpl; |
14 | 14 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
15 |
import eu.dnetlib.enabling.datasources.common.Api; |
|
16 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
|
17 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
|
15 | 18 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
16 | 19 |
|
17 | 20 |
public class SimpleDataTransformer implements UnaryFunction<String, String> { |
... | ... | |
42 | 45 |
} |
43 | 46 |
|
44 | 47 |
@Override |
45 |
public String evaluate(String record) { |
|
48 |
public String evaluate(final String record) {
|
|
46 | 49 |
if (log.isDebugEnabled()) { |
47 | 50 |
log.debug("************************************************************"); |
48 | 51 |
log.debug("INPUT: " + record); |
... | ... | |
60 | 63 |
return output; |
61 | 64 |
} |
62 | 65 |
|
63 |
private String transform(String record) { |
|
66 |
private String transform(final String record) {
|
|
64 | 67 |
// use here the xml transformer |
65 | 68 |
return transformationEngine.transform(record); |
66 | 69 |
} |
67 | 70 |
|
68 |
protected void setupEngine(VocabularyRegistry vocabularyRegistry, Resource transformationTemplate, |
|
69 |
Resource defaultSchema, TransformationRulesImportTool rulesProfileUtil, ResourceDao resourceDao, Resource blacklistApi)throws TransformerConfigurationException, ProfileNotFoundException{ |
|
71 |
protected void setupEngine(final VocabularyRegistry vocabularyRegistry, |
|
72 |
final Resource transformationTemplate, |
|
73 |
final Resource defaultSchema, |
|
74 |
final TransformationRulesImportTool rulesProfileUtil, |
|
75 |
final ResourceDao resourceDao, |
|
76 |
final Resource blacklistApi, |
|
77 |
final LocalDatasourceManager<Datasource<?, ?, ?>, Api<?>> dsManager) throws TransformerConfigurationException, ProfileNotFoundException { |
|
70 | 78 |
transformationEngine = new SimpleTransformationEngine(); |
71 | 79 |
transformationEngine.setVocabularyRegistry(vocabularyRegistry); |
72 |
TransformationImpl transformation = new TransformationImpl(); |
|
80 |
transformationEngine.setDsManager(dsManager); |
|
81 |
final TransformationImpl transformation = new TransformationImpl(); |
|
73 | 82 |
transformation.setSchema(defaultSchema); |
74 | 83 |
transformation.setTemplate(transformationTemplate); |
75 | 84 |
transformation.init(); |
... | ... | |
84 | 93 |
transformationEngine.setResourceDao(resourceDao); |
85 | 94 |
transformationEngine.setBlacklistApi(blacklistApi); |
86 | 95 |
} |
87 |
|
|
96 |
|
|
88 | 97 |
public String getRuleProfile() { |
89 | 98 |
return ruleProfile; |
90 | 99 |
} |
91 | 100 |
|
92 |
public void setRuleProfile(String ruleProfile) { |
|
101 |
public void setRuleProfile(final String ruleProfile) {
|
|
93 | 102 |
this.ruleProfile = ruleProfile; |
94 | 103 |
} |
95 | 104 |
|
Also available in: Unified diff
merge from eosc_services