Revision 5555
Added by berkley over 14 years ago
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
806 | 806 |
info.setSize(new Long(size.trim()).longValue()); |
807 | 807 |
} |
808 | 808 |
//add the ObjectInfo to the ObjectList |
809 |
if(info.getIdentifier().getValue() != null ||
|
|
810 |
(info.getObjectFormat() != null &&
|
|
811 |
!info.getObjectFormat().toString().trim().equals("")))
|
|
809 |
logCrud.info("objectFormat: " + info.getObjectFormat().toString());
|
|
810 |
logCrud.info("id: " + info.getIdentifier().getValue());
|
|
811 |
if(info.getIdentifier().getValue() != null)
|
|
812 | 812 |
{ //id can be null from tests. should not happen in production. |
813 |
ol.addObjectInfo(info); |
|
813 |
if((info.getObjectFormat() != null && !info.getObjectFormat().toString().trim().equals(""))) |
|
814 |
{ //objectFormat needs to not be null and not be an empty string |
|
815 |
ol.addObjectInfo(info); |
|
816 |
} |
|
814 | 817 |
} |
815 | 818 |
|
816 | 819 |
} |
... | ... | |
1652 | 1655 |
} |
1653 | 1656 |
|
1654 | 1657 |
/** |
1655 |
* serialize an ObjectInfo object |
|
1656 |
* @param info |
|
1657 |
* @return |
|
1658 |
* @throws ServiceFailure |
|
1658 |
* serialize a dataone type |
|
1659 | 1659 |
*/ |
1660 |
public static ByteArrayOutputStream serializeObjectInfo(ObjectInfo info)
|
|
1661 |
throws ServiceFailure
|
|
1660 |
private void serializeServiceType(Class type, Object object, OutputStream out)
|
|
1661 |
throws JiBXException
|
|
1662 | 1662 |
{ |
1663 |
IBindingFactory bfact; |
|
1664 |
ByteArrayOutputStream sysmetaOut = null; |
|
1665 |
try { |
|
1666 |
bfact = BindingDirectory.getFactory(ObjectInfo.class); |
|
1667 |
IMarshallingContext mctx = bfact.createMarshallingContext(); |
|
1668 |
sysmetaOut = new ByteArrayOutputStream(); |
|
1669 |
mctx.marshalDocument(info, "UTF-8", null, sysmetaOut); |
|
1670 |
} catch (JiBXException e) { |
|
1671 |
e.printStackTrace(); |
|
1672 |
throw new ServiceFailure("1190", "Failed to serialize and insert SystemMetadata: " + e.getMessage()); |
|
1673 |
} |
|
1674 |
|
|
1675 |
return sysmetaOut; |
|
1663 |
IBindingFactory bfact = BindingDirectory.getFactory(type); |
|
1664 |
IMarshallingContext mctx = bfact.createMarshallingContext(); |
|
1665 |
mctx.marshalDocument(object, "UTF-8", null, out); |
|
1676 | 1666 |
} |
1677 | 1667 |
|
1678 | 1668 |
/** |
Also available in: Unified diff
checking for a null objectformat