Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Commit

Permalink
#4 fixes for metadata create
Browse files Browse the repository at this point in the history
  • Loading branch information
mconway committed Aug 22, 2014
1 parent 91cec09 commit bb02ef9
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.irods.jargon.indexing.wrapper;

import java.util.ArrayList;
import java.util.List;

import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.pub.domain.AvuData;
import org.irods.jargon.indexing.wrapper.IndexingConstants.actionsEnum;
Expand Down Expand Up @@ -128,17 +131,25 @@ private void processUnionOperation(Message message, Messages ofMessages) {

log.info("have metadata object:{}", part.getAdditionalProperties()
.get(METADATA_OBJECT));
AVU avu = (AVU) part.getAdditionalProperties().get(METADATA_OBJECT);
List avuDataEntry = (ArrayList) part.getAdditionalProperties().get(
METADATA_OBJECT);

if (avuDataEntry.size() != 3) {
log.warn("expected 3 elements in avu data...discarded");
continue;
}

log.info("as AVU:{}", avu);
String attribute = (String) avuDataEntry.get(2);
String value = (String) avuDataEntry.get(1);
String unit = (String) avuDataEntry.get(0);

log.info("process as AVU add event{}", part);
MetadataEvent addMetadataEvent = new MetadataEvent();
addMetadataEvent.setActionsEnum(actionsEnum.ADD);
addMetadataEvent.setIrodsAbsolutePath(part.getDescription());
try {
AvuData avuData = AvuData.instance(avu.getAttribute(),
avu.getValue(), avu.getUnit());
AvuData avuData = AvuData.instance(attribute.substring(10),
value.substring(6), unit.substring(5));
addMetadataEvent.setAvuData(avuData);
this.onMetadataAdd(addMetadataEvent);
} catch (JargonException e) {
Expand Down

0 comments on commit bb02ef9

Please sign in to comment.