Project

General

Profile

« Previous | Next » 

Revision 42892

static methods to calculate the objId

View differences:

modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/objects/PublicationEntry.java
192 192
		final DatasourceEntry collectedFromEntry = getDatasourceInfo(collectedFromId, lookupService);
193 193
		final DatasourceEntry hostedByEntry = getDatasourceInfo(hostedById, lookupService);
194 194

  
195
		final String objId = collectedFromEntry.getPrefix() + "::" + Hashing.md5(originalId);
195
		final String objId = calculateObjId(originalId, collectedFromEntry);
196 196

  
197 197
		final Map<String, Object> model = new HashMap<String, Object>();
198 198
		model.put("esc", new EscapeTool());
......
213 213
		return VelocityEngineUtils.mergeTemplateIntoString(ve, "/eu/dnetlib/msro/openaireplus/api/indexRecord.xml.vm", "UTF-8", model);
214 214
	}
215 215

  
216
	public static String calculateObjId(final String originalId, final DatasourceEntry collectedFromEntry) {
217
		return collectedFromEntry.getPrefix() + "::" + Hashing.md5(originalId);
218
	}
219

  
220
	public static String calculateObjId(final String originalId, final String collectedFromId, final ISLookUpService lookupService) throws ISLookUpException {
221
		return calculateObjId(originalId, getDatasourceInfo(collectedFromId, lookupService));
222
	}
223

  
216 224
	private synchronized static DatasourceEntry getDatasourceInfo(final String dsId, final ISLookUpService lookupService) throws ISLookUpException {
217 225
		if (StringUtils
218 226
				.isBlank(dsId)) { return new DatasourceEntry("openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18", "Unknown Repository", "unknown_____"); }

Also available in: Unified diff