Revision 9083
Added by Jing Tao almost 10 years ago
src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java | ||
---|---|---|
26 | 26 |
import java.io.InputStream; |
27 | 27 |
import java.sql.SQLException; |
28 | 28 |
import java.util.Date; |
29 |
import java.util.List; |
|
29 | 30 |
|
30 | 31 |
import javax.servlet.http.HttpServletRequest; |
31 | 32 |
|
... | ... | |
522 | 523 |
@Override |
523 | 524 |
public ObjectFormatList listFormats() throws ServiceFailure, NotImplemented { |
524 | 525 |
org.dataone.service.types.v2.ObjectFormatList formats = impl.listFormats(); |
525 |
ObjectFormatList retFormats = null;
|
|
526 |
ObjectFormatList retFormats = new ObjectFormatList();
|
|
526 | 527 |
try { |
527 |
retFormats = TypeMarshaller.convertTypeFromType(formats, ObjectFormatList.class); |
|
528 |
if(formats != null) { |
|
529 |
List<org.dataone.service.types.v2.ObjectFormat> objectFormatList = formats.getObjectFormatList(); |
|
530 |
if(objectFormatList != null) { |
|
531 |
for(org.dataone.service.types.v2.ObjectFormat format : objectFormatList) { |
|
532 |
ObjectFormat v1Format = TypeMarshaller.convertTypeFromType(format, ObjectFormat.class); |
|
533 |
retFormats.addObjectFormat(v1Format); |
|
534 |
} |
|
535 |
} |
|
536 |
|
|
537 |
} |
|
538 |
//retFormats = TypeMarshaller.convertTypeFromType(formats, ObjectFormatList.class); |
|
528 | 539 |
} catch (Exception e) { |
529 | 540 |
// report as service failure |
530 | 541 |
ServiceFailure sf = new ServiceFailure("4841", e.getMessage()); |
Also available in: Unified diff
Went through the v2 ObjectFormatList and convert every v2 ObjectFormat to v1 ObjectFormat and put them into a v1 objectFormatList.