Project

General

Profile

« Previous | Next » 

Revision 29694

Update index job node, added parameter backend Id for the new index

View differences:

modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/nodes/index/DeleteIndexJobNode.java
2 2

  
3 3
import org.apache.commons.logging.Log;
4 4
import org.apache.commons.logging.LogFactory;
5
import org.springframework.beans.factory.annotation.Required;
5 6

  
6 7
import com.googlecode.sarasvati.NodeToken;
7 8

  
......
13 14
	private static final Log log = LogFactory.getLog(DeleteIndexJobNode.class);
14 15

  
15 16
	private String indexId;
17
	private String defaultIndexId;
16 18

  
17 19
	@Override
18 20
	protected String getXqueryForServiceId(final NodeToken token) {
......
25 27

  
26 28
		job.setAction("DELETE");
27 29
		job.getParameters().put("id", getIndexId());
30
		job.getParameters().put("backend_Id", defaultIndexId);
28 31

  
29 32
	}
30 33

  
......
32 35
		return indexId;
33 36
	}
34 37

  
38
	@Required
35 39
	public void setIndexId(final String indexId) {
36 40
		this.indexId = indexId;
37 41
	}
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/nodes/index/UpdateIndexJobNode.java
44 44
	private String format;
45 45
	private String layout;
46 46
	private String feedingType;
47
	private String defaultIndexId;
47 48

  
48 49
	/**
49 50
	 * xslt mapped resultset factory.
......
82 83
		job.getParameters().put("resultset_epr", encode(progressProvider.getEpr().toString()));
83 84
		job.getParameters().put("id", getIndexId());
84 85
		job.getParameters().put("feeding_type", getFeedingType());
86
		job.getParameters().put("backend_Id", defaultIndexId);
85 87
	}
86 88

  
87 89
	// helpers
......
121 123

  
122 124
	private String getLayoutSource(final String format, final String layout) throws ISLookUpDocumentNotFoundException, ISLookUpException {
123 125
		return getLookupLocator().getService().getResourceProfileByQuery(
124
				"collection('')//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'MDFormatDSResourceType' and .//NAME='" + format + "']//LAYOUT[@name='"
125
						+ layout + "']");
126
				"collection('')//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'MDFormatDSResourceType' and .//NAME='" + format + "']//LAYOUT[@name='" + layout
127
				+ "']");
126 128
	}
127 129

  
128 130
	private void dumpXslt(final TransformerFactory factory, final DOMResult layoutToXsltXslt) throws TransformerConfigurationException, TransformerException {
......
220 222
		this.lookupLocator = lookupLocator;
221 223
	}
222 224

  
225
	/**
226
	 * @return the defaultIndexId
227
	 */
228
	public String getDefaultIndexId() {
229
		return defaultIndexId;
230
	}
231

  
232
	/**
233
	 * @param defaultIndexId
234
	 *            the defaultIndexId to set
235
	 */
236
	@Required
237
	public void setDefaultIndexId(final String defaultIndexId) {
238
		this.defaultIndexId = defaultIndexId;
239
	}
240

  
223 241
}
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/nodes/index/CreateIndexJobNode.java
4 4

  
5 5
import org.apache.commons.logging.Log;
6 6
import org.apache.commons.logging.LogFactory;
7
import org.springframework.beans.factory.annotation.Required;
7 8

  
8 9
import com.googlecode.sarasvati.Engine;
9 10
import com.googlecode.sarasvati.NodeToken;
......
18 19
	private static final Log log = LogFactory.getLog(CreateIndexJobNode.class);
19 20

  
20 21
	private String outputPrefix = "index_";
22
	private String defaultIndexId;
21 23

  
22 24
	@Override
23 25
	protected String getXqueryForServiceId(final NodeToken token) {
......
36 38
		job.getParameters().put("format", format);
37 39
		job.getParameters().put("layout", layout);
38 40
		job.getParameters().put("interpretation", interp);
41
		job.getParameters().put("backend_Id", defaultIndexId);
39 42
	}
40 43

  
41 44
	public String getOutputPrefix() {
......
60 63
		};
61 64
	}
62 65

  
66
	/**
67
	 * @return the defaultIndexId
68
	 */
69
	public String getDefaultIndexId() {
70
		return defaultIndexId;
71
	}
72

  
73
	/**
74
	 * @param defaultIndexId
75
	 *            the defaultIndexId to set
76
	 */
77
	@Required
78
	public void setDefaultIndexId(final String defaultIndexId) {
79
		this.defaultIndexId = defaultIndexId;
80
	}
81

  
63 82
}
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/msro/service/applicationContext-msro-service.properties
20 20
msro.wf.nodes.mdstoreSearch.format = DMF
21 21
msro.wf.nodes.mdstoreSearch.interpretation = cleaned
22 22
msro.wf.nodes.download.xpathMetadataId = //*[local-name()='objIdentifier']
23
service.msro.index.defaultIndex = solr
23 24

  
24 25
msro.wf.mail.message.baseUrl = http://localhost:8280/app/mvc/ui
25 26

  
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/msro/service/applicationContext-msro-nodes.xml
120 120
		p:layoutToRecordStylesheet="classpath:/eu/dnetlib/msro/workflows/xslt/layoutToRecordStylesheet.xsl"
121 121
		p:xsltRSFactory-ref="xsltResultSetFactory"
122 122
		p:lookupLocator-ref="lookupLocator"
123
		p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory" />
123
		p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory"
124
		p:defaultIndexId="${service.msro.index.defaultIndex}"  />
124 125

  
125 126
	<bean id="wfNodeCreateIndex" class="eu.dnetlib.msro.workflows.nodes.index.CreateIndexJobNode"
126
		scope="prototype" />
127
		scope="prototype" p:defaultIndexId="${service.msro.index.defaultIndex}" />
127 128
		
128 129
	<bean id="wfNodeDeleteIndex" class="eu.dnetlib.msro.workflows.nodes.index.DeleteIndexJobNode"
129
		scope="prototype" />	
130
		scope="prototype" p:defaultIndexId="${service.msro.index.defaultIndex}" />	
130 131
	
131 132
	<!-- Database -->
132 133
	<bean id="wfNodeUpdateDb" class="eu.dnetlib.msro.workflows.nodes.db.UpdateDbJobNode"

Also available in: Unified diff