Revision 8594
Added by ben leinfelder almost 11 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
import javax.servlet.http.HttpServletRequest; |
54 | 54 |
|
55 |
import org.apache.commons.beanutils.BeanUtils; |
|
56 | 55 |
import org.apache.commons.io.IOUtils; |
57 | 56 |
import org.apache.log4j.Logger; |
58 | 57 |
import org.dataone.client.CNode; |
... | ... | |
114 | 113 |
import org.dataone.service.types.v1_1.QueryEngineList; |
115 | 114 |
import org.dataone.service.types.v1_1.QueryField; |
116 | 115 |
import org.dataone.service.util.Constants; |
116 |
import org.dataone.service.util.TypeMarshaller; |
|
117 | 117 |
import org.dspace.foresite.OREException; |
118 | 118 |
import org.dspace.foresite.OREParserException; |
119 | 119 |
import org.dspace.foresite.ORESerialiserException; |
... | ... | |
1653 | 1653 |
// get the original SM |
1654 | 1654 |
SystemMetadata originalSystemMetadata = this.getSystemMetadata(session, originalIdentifier); |
1655 | 1655 |
|
1656 |
// make copy of it |
|
1657 |
SystemMetadata sysmeta = new SystemMetadata();
|
|
1656 |
// make copy of it using the marshaller to ensure DEEP copy
|
|
1657 |
SystemMetadata sysmeta = null;
|
|
1658 | 1658 |
try { |
1659 |
BeanUtils.copyProperties(sysmeta, originalSystemMetadata); |
|
1659 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
|
1660 |
TypeMarshaller.marshalTypeToOutputStream(originalSystemMetadata, baos); |
|
1661 |
sysmeta = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, new ByteArrayInputStream(baos.toByteArray())); |
|
1660 | 1662 |
} catch (Exception e) { |
1661 | 1663 |
// report as service failure |
1662 | 1664 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
... | ... | |
1725 | 1727 |
SystemMetadata originalOreSysMeta = this.getSystemMetadata(session, potentialOreIdentifier); |
1726 | 1728 |
SystemMetadata oreSysMeta = new SystemMetadata(); |
1727 | 1729 |
try { |
1728 |
BeanUtils.copyProperties(oreSysMeta, originalOreSysMeta); |
|
1730 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
|
1731 |
TypeMarshaller.marshalTypeToOutputStream(originalOreSysMeta, baos); |
|
1732 |
oreSysMeta = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, new ByteArrayInputStream(baos.toByteArray())); |
|
1729 | 1733 |
} catch (Exception e) { |
1730 | 1734 |
// report as service failure |
1731 | 1735 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
... | ... | |
1740 | 1744 |
oreSysMeta.setChecksum(ChecksumUtil.checksum(resourceMapString.getBytes("UTF-8"), oreSysMeta.getChecksum().getAlgorithm())); |
1741 | 1745 |
|
1742 | 1746 |
// ensure ORE is publicly readable |
1743 |
oreSysMeta = makePublicIfNot(sysmeta, potentialOreIdentifier);
|
|
1747 |
oreSysMeta = makePublicIfNot(oreSysMeta, potentialOreIdentifier);
|
|
1744 | 1748 |
|
1745 | 1749 |
// ensure all data objects allow public read |
1746 | 1750 |
List<String> pidsToSync = new ArrayList<String>(); |
Also available in: Unified diff
make all objects in a package publicly readable when published. https://projects.ecoinformatics.org/ecoinfo/issues/6415