Project

General

Profile

« Previous | Next » 

Revision 46855

UpdateIndex must consider also the interpretation, not only format and layout

View differences:

modules/dnet-parthenos/trunk/src/main/resources/eu/dnetlib/parthenos/workflows/repo-hi/publish_wf.xml.st
19 19
            <PARAMETERS>
20 20
                <PARAM name="cleanMdstoreId"        description="Store for cleaned records"         required="true"     managedBy="system"  category="MDSTORE_ID"     />
21 21
				<PARAM name="indexId"               description="Identifier of the Index"           required="true" managedBy="system"  category="INDEX_ID"/>
22
            	<PARAM name="indexInterpretation"   description="Index Interpretation"              required="true" managedBy="system"  type="string">public</PARAM>
22 23
            	<PARAM name="feedingType"           description="Index feeding type"                required="true" managedBy="user"    type="string"   function="validValues(['REFRESH','INCREMENTAL'])">REFRESH</PARAM>
23 24
            	<PARAM name="OAIFormat"             description="OAI Format"                        required="true" managedBy="user"  type="string">CIDOC</PARAM>
24 25
                <PARAM name="OAILayout"             description="OAI Layout"                        required="true" managedBy="system"  type="string">OAI</PARAM>
......
39 40
                                <ENTRY key="cleanMdstoreId"     ref="cleanMdstoreId" />
40 41
                                <ENTRY key="indexId"            ref="indexId" />
41 42
                                <ENTRY key="feedingType"        ref="feedingType" />
43
                                <ENTRY key="interpretation"     ref="indexInterpretation" />
42 44
                            </MAP>
43 45
                        </PARAM>
44 46
                    </PARAMETERS>
modules/dnet-parthenos/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/workflows/index_template.xml
15 15
				<PARAM name="cleanMdstoreId" description="Store for transformed records" required="true" type="string"/>
16 16
				<PARAM name="indexId" description="Index Identifier" required="true" type="string"/>
17 17
				<PARAM name="feedingType" description="Index feeding type" required="true" type="string"/>
18
				<PARAM name="interpretation" description="Interpretation of the MDFormat" required="true" type="string"/>
18 19
			</PARAMETERS>
19 20
			<WORKFLOW>
20 21
				<NODE name="fetchMdStore" type="FetchMDStoreRecords" isStart="true">
......
33 34
						<PARAM name="eprParam" value="clean_epr"/>
34 35
						<PARAM name="indexId" ref="indexId"/>
35 36
						<PARAM name="format" value="CIDOC"/>
37
						<PARAM name="interpretation" ref="interpretation"/>
36 38
						<PARAM name="layout" value="index"/>
37 39
						<PARAM name="feedingType" ref="feedingType"/>
38 40
					</PARAMETERS>
modules/dnet-msro-service/branches/saxonHE/src/main/java/eu/dnetlib/msro/workflows/nodes/index/UpdateIndexJobNode.java
40 40
	private String eprParam;
41 41
	private String indexId;
42 42
	private String format;
43
	@Value("${service.index.solr.default.interpretation}")
44
	private String interpretation;
43 45
	private String layout;
44 46
	private String feedingType;
45 47
	private String defaultIndexId;
......
76 78

  
77 79
		final ResultSet<?> rs = token.getEnv().getAttribute(getEprParam(), ResultSet.class);
78 80

  
79
		final ResultSet<?> mappedRs = prepareForIndexing(rs, getFormat(), getLayout());
81
		final ResultSet<?> mappedRs = prepareForIndexing(rs, getFormat(), getInterpretation(), getLayout());
80 82

  
81 83
		token.setProgressProvider(new ResultsetProgressProvider(mappedRs, this.resultSetClient));
82 84

  
......
104 106
	 * @throws TransformerException
105 107
	 *             could happen
106 108
	 */
107
	protected ResultSet<String> prepareForIndexing(final ResultSet<?> resultSet, final String format, final String layout)
109
	protected ResultSet<String> prepareForIndexing(final ResultSet<?> resultSet, final String format, final String interpretation, final String layout)
108 110
			throws ISLookUpException, IOException, TransformerException {
109 111

  
110 112
		log.info("Using layout to record stylesheet: "+getLayoutToRecordStylesheet().getURI());
......
112 114

  
113 115
		final DOMResult layoutToXsltXslt = new DOMResult();
114 116
		layoutTransformer.setParameter("format", format);
115
		layoutTransformer.transform(new StreamSource(new StringReader(getLayoutSource(format, layout))), layoutToXsltXslt);
117
		layoutTransformer.transform(new StreamSource(new StringReader(getLayoutSource(format, interpretation, layout))), layoutToXsltXslt);
116 118

  
117 119
		dumpXslt(layoutToXsltXslt);
118 120

  
119 121
		return this.resultSetFactory.xsltMap(resultSet, new DOMSource(layoutToXsltXslt.getNode()));
120 122
	}
121 123

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

  
......
175 177
		this.format = format;
176 178
	}
177 179

  
180
	public String getInterpretation() {
181
		return interpretation;
182
	}
183

  
184
	public void setInterpretation(final String interpretation) {
185
		this.interpretation = interpretation;
186
	}
187

  
178 188
	public String getLayout() {
179 189
		return this.layout;
180 190
	}

Also available in: Unified diff