@Override
public boolean execute( Property inputProperty,
Node outputNode,
Context context ) throws Exception {
Binary binaryValue = (Binary)inputProperty.getBinary();
CheckArg.isNotNull(binaryValue, "binary");
String inputFileName = getInputFileName(inputProperty);
String mimeType = binaryValue.getMimeType(inputFileName);
Node sequencedNode = outputNode;
if (outputNode.isNew()) {
outputNode.setPrimaryType(METADATA_NODE);
} else {
sequencedNode = outputNode.addNode(METADATA_NODE, METADATA_NODE);
}
setProperty(sequencedNode, JCR_MIME_TYPE, mimeType);
if (isPowerpoint(mimeType)) {
try (InputStream stream = binaryValue.getStream()) {
sequencePowerpoint(sequencedNode, context.valueFactory(), stream);
return true;
}
}
if (isWord(mimeType)) {
try (InputStream stream = binaryValue.getStream()) {
sequenceWord(sequencedNode, context.valueFactory(), stream);
return true;
}
}
if (isExcel(mimeType)) {
try (InputStream stream = binaryValue.getStream()) {
sequenceExcel(sequencedNode, context.valueFactory(), stream);
return true;
}
}