08-28-2014 11:20 AM
public class NotSupportedContentTransformer extends AbstractContentTransformer2 {
…
@Override
protected void transformInternal(ContentReader reader,
ContentWriter writer, TransformationOptions options) throws Exception {
// At this point we know that something went wrong so lets give a shout
// to the Work-Group administrators to let them know…
String fileName = this.serviceRegistry.getFileFolderService().getFileInfo(
options.getSourceNodeRef()).getName();
sendFailedThumbnailNotification(fileName, options.getSourceNodeRef());
InputStream input = this.getClass().getClassLoader().getResourceAsStream(corruptedFileTemplate);
OutputStream output = writer.getContentOutputStream();
IOUtils.copy(input, output);
output.close();
input.close();
// if everything is O.K. we apply the aspect "icmr:emcryptedContet". Even if it is not encrypted but corrupted
try {
this.serviceRegistry.getNodeService().addAspect(options.getSourceNodeRef(),
IcmrModel.ASPECT_ENCRYPTED_CONTENT, null);
} catch (Exception e) {
log.error("Unexpected error", e);
}
}
08-28-2014 10:35 PM
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setForceWritable(true);
boolean requiresNew = false;
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_READ_WRITE)
{
requiresNew = true;
}
txnHelper.doInTransaction(new RetryingTransactionCallback<Object>()
{
@Override
public Object execute() throws Throwable
{
try {
this.serviceRegistry.getNodeService().addAspect(options.getSourceNodeRef(),
IcmrModel.ASPECT_ENCRYPTED_CONTENT, null);
} catch (Exception e) {
log.error("Unexpected error", e);
}
}
}, false, requiresNew);
08-29-2014 04:00 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.