Project

General

Profile

« Previous | Next » 

Revision 46855

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

View differences:

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