Project

General

Profile

« Previous | Next » 

Revision 27552

removed option for record patch: the file HDFS is correctly generated according to the openaire schema.

View differences:

modules/dnet-oai-store-service/trunk/src/main/java/eu/dnetlib/data/oai/store/mongo/MongoPublisherStore.java
351 351
				}
352 352
			}
353 353
		}
354
		// TODO: for test purpose, we have to patch the record in order to have it compliant to the schema. This will have to be removed as
355
		// soon as the generation of records is fixed on the hadoop side
356
		String patchedRecord = record;
357
		if (patch) {
358
			patchedRecord = this.patchXMLForSchema(record);
359
		}
360
		obj.put(OAIConfigurationReader.BODY_FIELD, patchedRecord);
354
		obj.put(OAIConfigurationReader.BODY_FIELD, record);
361 355
		obj.put(OAIConfigurationReader.DELETED_FIELD, false);
362 356
		return obj;
363 357
	}
364 358

  
365
	private String patchXMLForSchema(final String record) {
366

  
367
		String patched = record
368
				.replaceAll(
369
						"<oaf:entity ",
370
						"<oaf:entity xsi:schemaLocation=\"http://namespace.openaire.eu/oaf http://svn-public.driver.research-infrastructures.eu/driver/dnet30/modules/dnet-openaireplus-schema/schema/oaf.xsd\" ");
371

  
372
		// String patched = record.replaceAll("oaf:entity", "entity").replaceAll("xmlns:oaf=", "xmlns=").replaceAll("oaf:datasource",
373
		// "datasource")
374
		// .replaceAll("oaf:organization", "organization").replaceAll("oaf:person", "person").replaceAll("oaf:project", "project")
375
		// .replaceAll("oaf:result", "result");
376
		return patched;
377

  
378
	}
379

  
380 359
	private void feedNew(final String oaiID, final String record, final Multimap<String, String> recordProperties, final Date feedDate) {
381 360
		log.debug("New record received. Assigned oai id: " + oaiID);
382 361
		DBObject obj = this.createBasicObject(oaiID, record, recordProperties);
......
385 364
		obj.put(OAIConfigurationReader.UPDATED_FIELD, false);
386 365
		collection.insert(obj);
387 366
		this.upsertSets(recordProperties.get(OAIConfigurationReader.SET_FIELD));
388

  
389 367
	}
390 368

  
391 369
	private void updateRecord(final String oaiID, final String record, final Multimap<String, String> recordProperties, final Date feedDate) {

Also available in: Unified diff