if (currentItems != null) {
// Add each of the selected items to the experiment:
for (FileTreeNode dob : currentItems) {
// Only include selected items that are eligible:
if (dob.isSelectable() && dob.isSelected()) {
DigitalObjectReference dor = new DigitalObjectReference(dob
.getUri());
URI dobURI = dob.getUri();
DigitalObject o = null;
try {
// Special handling for the digital objects from OAI and JCR repositories
// data registry URI and digital object URI is not the same
if (dobURI.toString().contains(OAIDigitalObjectManagerDCBase.REGISTRY_NAME)
|| dobURI.toString().contains(OAIDigitalObjectManagerKBBase.REGISTRY_NAME)
|| dobURI.toString().contains(DOJCRConstants.REGISTRY_NAME)) {
logger.info("addToWorkflow() special dobURI: " + dobURI);
o = dr.getDataManager(dobURI).retrieve(dobURI);
// o = recreateByValue(o);
} else {
logger.info("addToWorkflow() dobURI: " + dobURI);
o = dr.getDataManager(dobURI).retrieve(dobURI);
// Recreate digital object by value to enable workflow execution.
// At the moment digital object uses a DataHandler. It is not serializable
// and it is not possible to execute workflows.
InputStream streamContent = o.getContent().getInputStream();
byte[] byteContent = null;
try {
byteContent = IOUtils.toByteArray(streamContent);
} catch (IOException e) {
e.printStackTrace();
}
DigitalObjectContent content = Content.byValue(byteContent);
o = (new DigitalObject.Builder(o)).content(content)
.title(dor.getLeafname()).permanentUri(
dobURI).build();
}
//DigitalObject.Builder b = new DigitalObject.Builder(o);
//o = b.title(dor.getLeafname()).build();
logger.info("adding file name: " + dor.getLeafname());
} catch (DigitalObjectNotFoundException e) {
errorMessageString
.add("\nUnable to retrieve selected digital object!");
e.printStackTrace();