Project

General

Profile

« Previous | Next » 

Revision 9131

Added by Jing Tao over 9 years ago

Convert the v2 system metadata object to v1 in the getSystemMetadata method.

View differences:

src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java
281 281
        String notFound = "1060";
282 282
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
283 283
                "No system metadata could be found for given PID: "+pid.getValue());
284
		return impl.getSystemMetadata(null, pid);
284
        org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(null, pid);
285
        SystemMetadata retSysMeta = null;
286
        try {
287
            retSysMeta = TypeMarshaller.convertTypeFromType(sysMeta, SystemMetadata.class);
288
        } catch (Exception e) {
289
            // report as service failure
290
            ServiceFailure sf = new ServiceFailure("1090", e.getMessage());
291
            sf.initCause(e);
292
            throw sf;
293
        }
294
        return retSysMeta;
285 295
	}
286 296

  
287 297
	@Override
......
293 303
        String notFound = "1060";
294 304
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
295 305
                "No system metadata could be found for given PID: "+pid.getValue());
296
		return impl.getSystemMetadata(session, pid);
306
        org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(session, pid);
307
        SystemMetadata retSysMeta = null;
308
        try {
309
            retSysMeta = TypeMarshaller.convertTypeFromType(sysMeta, SystemMetadata.class);
310
        } catch (Exception e) {
311
            // report as service failure
312
            ServiceFailure sf = new ServiceFailure("1090", e.getMessage());
313
            sf.initCause(e);
314
            throw sf;
315
        }
316
        return retSysMeta;
297 317
	}
298 318

  
299 319
	@Override

Also available in: Unified diff