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 d75ca8f commit 91cec09
Showing 1 changed file with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public class IndexerWrapper implements Indexer {

public static final String METADATA_OBJECT = "metadataObject";
private IndexingService indexingService;
private Scheduler scheduler;

Expand Down Expand Up @@ -105,30 +106,45 @@ private void processUnionOperation(Message message, Messages ofMessages) {
// look at message part for a part that is the metadata

for (DataEntity part : message.getHasPart()) {
if (part.getMetadata() == null || part.getMetadata().isEmpty()) {
log.info("no metadata present");
} else {
log.info("part being processed:{}", part);

for (AVU avu : part.getMetadata()) {
/*
* Look for AVU create event
*/

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());
addMetadataEvent.setAvuData(avuData);
this.onMetadataAdd(addMetadataEvent);
} catch (JargonException e) {
log.error("error", e);
throw new GeneralIndexerRuntimeException(
"jargon exception occurred processing AVU", e);
}
}
if (part.getAdditionalProperties() == null
|| part.getAdditionalProperties().isEmpty()) {
log.info("no additional properties");
continue;
}

log.info("inspecting additional properties for avu create");

if (part.getAdditionalProperties().get(METADATA_OBJECT) != null) {
log.info("have a metadataObject property for this part, process as a metadata create");
} else {
log.info("no metadata");
continue;
}

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

log.info("as AVU:{}", avu);

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());
addMetadataEvent.setAvuData(avuData);
this.onMetadataAdd(addMetadataEvent);
} catch (JargonException e) {
log.error("error", e);
throw new GeneralIndexerRuntimeException(
"jargon exception occurred processing AVU", e);
}
}

Expand Down

0 comments on commit 91cec09

Please sign in to comment.