Project

General

Profile

« Previous | Next » 

Revision 9317

Added by Jing Tao about 9 years ago

use the TypeFactory to convert the Log and ObjectFormatList objects from the v2 to v1.

View differences:

src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java
538 538
        }
539 539
		org.dataone.service.types.v2.Log log = impl.getLogRecords(session, fromDate, toDate, eventValue, pidFilter, start, count);
540 540
		try {
541
			//retLog = TypeFactory.convertTypeFromType(log, Log.class);
542
            LogV2toV1Converter converter = new LogV2toV1Converter();
543
            retLog = converter.convert(log);
541
			retLog = TypeFactory.convertTypeFromType(log, Log.class);
542
            //LogV2toV1Converter converter = new LogV2toV1Converter();
543
            //retLog = converter.convert(log);
544 544
		} catch (Exception e) {
545 545
			// report as service failure
546 546
			ServiceFailure sf = new ServiceFailure("1490", e.getMessage());
......
577 577
		org.dataone.service.types.v2.ObjectFormatList formats = impl.listFormats();
578 578
		ObjectFormatList retFormats = new ObjectFormatList();
579 579
		try {
580
		    if(formats != null) {
580
		    /*if(formats != null) {
581 581
		        List<org.dataone.service.types.v2.ObjectFormat> objectFormatList = formats.getObjectFormatList();
582 582
		        if(objectFormatList != null) {
583 583
		            for(org.dataone.service.types.v2.ObjectFormat format : objectFormatList) {
......
586 586
	                }
587 587
		        }
588 588
		        
589
		    }
590
			//retFormats = TypeFactory.convertTypeFromType(formats, ObjectFormatList.class);
589
		    }*/
590
			retFormats = TypeFactory.convertTypeFromType(formats, ObjectFormatList.class);
591 591
		} catch (Exception e) {
592 592
			// report as service failure
593 593
			ServiceFailure sf = new ServiceFailure("4841", e.getMessage());
src/edu/ucsb/nceas/metacat/dataone/v1/MNodeService.java
465 465
		org.dataone.service.types.v2.Log log = impl.getLogRecords(session, fromDate, toDate, eventValue, pidFilter, start, count);
466 466
		
467 467
		try {
468
			//retLog = TypeFactory.convertTypeFromType(log, Log.class);
469
		    LogV2toV1Converter converter = new LogV2toV1Converter();
470
		    retLog = converter.convert(log);
468
			retLog = TypeFactory.convertTypeFromType(log, Log.class);
469
		    //LogV2toV1Converter converter = new LogV2toV1Converter();
470
		   // retLog = converter.convert(log);
471 471
		} catch (Exception e) {
472 472
			// report as service failure
473 473
			ServiceFailure sf = new ServiceFailure("1490", e.getMessage());

Also available in: Unified diff