Project

General

Profile

« Previous | Next » 

Revision 32563

new locators, increased major version

View differences:

modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/service/DataTransformerFactory.java
7 7
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool;
8 8
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
9 9
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
10
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
11
import eu.dnetlib.enabling.tools.ServiceLocator;
12 10

  
13 11
public class DataTransformerFactory {
14 12

  
15
	@Resource(name = "lookupLocator")
16
	private ServiceLocator<ISLookUpService> lookupLocator;
17

  
18 13
	@Resource(name = "vocabularyRegistry")
19 14
	private VocabularyRegistry vocabularyRegistry;
20
	
15

  
21 16
	@Resource(name = "transformationTemplate")
22 17
	private org.springframework.core.io.Resource transformationTemplate;
23
	
18

  
24 19
	@Resource(name = "defaultSchema")
25 20
	private org.springframework.core.io.Resource defaultSchema;
26
	
21

  
27 22
	@Resource(name = "transformationRuleProfileUtil")
28 23
	private TransformationRulesImportTool transformationRuleProfileUtil;
29
	
24

  
30 25
	@Resource(name = "resourceDao")
31 26
	private ResourceDao resourceDao;
32
	
33
	public SimpleDataTransformer createTransformer(String ruleid) throws ISLookUpDocumentNotFoundException, ISLookUpException {
34
		//String profile = lookupLocator.getService().getResourceProfile(ruleid); 
27

  
28
	public SimpleDataTransformer createTransformer(final String ruleid) throws ISLookUpDocumentNotFoundException, ISLookUpException {
29
		// String profile = lookupLocator.getService().getResourceProfile(ruleid);
35 30
		SimpleDataTransformer transformer = new SimpleDataTransformer(ruleid);
36 31
		try {
37 32
			transformer.setupEngine(vocabularyRegistry, transformationTemplate, defaultSchema, transformationRuleProfileUtil, resourceDao);
......
39 34
			throw new IllegalStateException(e);
40 35
		}
41 36
		return transformer;
42
	}	
37
	}
43 38
}
modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/inspector/DataTransformationController.java
17 17
import eu.dnetlib.enabling.inspector.AbstractInspectorController;
18 18
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
19 19
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
20
import eu.dnetlib.enabling.tools.ServiceLocator;
20
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
21 21

  
22 22
@Controller
23 23
public class DataTransformationController extends AbstractInspectorController {
24 24

  
25 25
	@Resource
26 26
	private DataTransformerFactory dataTransformerFactory;
27
	
28
	@Resource(name = "lookupLocator")
29
	private ServiceLocator<ISLookUpService> lookupLocator;
30 27

  
28
	@Resource
29
	private UniqueServiceLocator serviceLocator;
30

  
31 31
	public static class SelectOption {
32

  
32 33
		private String id;
33 34
		private String name;
34 35
		private boolean selected;
35
		
36
		public SelectOption(String id, String name, boolean selected) {
36

  
37
		public SelectOption(final String id, final String name, final boolean selected) {
37 38
			this.id = id;
38 39
			this.name = name;
39 40
			this.selected = selected;
......
56 57
	public void transform(final Model model,
57 58
			@RequestParam(value = "rule", required = false) final String ruleId,
58 59
			@RequestParam(value = "record", required = false) final String record) throws Exception {
59
	
60
		model.addAttribute("rules",obtainRuleProfiles(ruleId));
61 60

  
61
		model.addAttribute("rules", obtainRuleProfiles(ruleId));
62

  
62 63
		if (ruleId != null && record != null) {
63 64
			final SimpleDataTransformer transformer = dataTransformerFactory.createTransformer(ruleId);
64 65
			model.addAttribute("input", record);
......
70 71
		String xquery = "for $x " +
71 72
				"in collection('/db/DRIVER/TransformationRuleDSResources/TransformationRuleDSResourceType') " +
72 73
				"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//TITLE)";
73
		
74
		return Lists.transform(lookupLocator.getService().quickSearchProfile(xquery), new Function<String, SelectOption>() {
74

  
75
		return Lists.transform(serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery), new Function<String, SelectOption>() {
76

  
75 77
			@Override
76 78
			public SelectOption apply(final String value) {
77 79
				final String[] arr = value.split("@@@");
modules/dnet-data-transformation-service/trunk/pom.xml
9 9
	<groupId>eu.dnetlib</groupId>
10 10
	<artifactId>dnet-data-transformation-service</artifactId>
11 11
	<packaging>jar</packaging>
12
	<version>1.0.1-SNAPSHOT</version>
12
	<version>2.0.0-SNAPSHOT</version>
13 13
	<scm>
14 14
	  <developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/trunk</developerConnection>
15 15
	</scm>
......
22 22
		<dependency>
23 23
			<groupId>eu.dnetlib</groupId>
24 24
			<artifactId>cnr-blackboard-common</artifactId>
25
			<version>[1.0.0,2.0.0)</version>
25
			<version>[2.0.0,3.0.0)</version>
26 26
		</dependency>
27 27
		<dependency>
28 28
			<groupId>eu.dnetlib</groupId>
29 29
			<artifactId>cnr-resultset-service</artifactId>
30
			<version>[1.0.0,2.0.0)</version>
30
			<version>[2.0.0,3.0.0)</version>
31 31
		</dependency>
32 32
		<dependency>
33 33
			<groupId>eu.dnetlib</groupId>
......
37 37
		<dependency>
38 38
			<groupId>eu.dnetlib</groupId>
39 39
			<artifactId>unibi-data-collective-transformation-common</artifactId>
40
			<version>[1.0.0,2.0.0)</version>
40
			<version>[2.0.0,3.0.0)</version>
41 41
		</dependency>
42 42
		<dependency>
43 43
			<groupId>junit</groupId>

Also available in: Unified diff