Hi All, thanks for readingTime ago I created a custom-transformer and added to the end of the chain of some fail-over transformers to make some jobs (send email, replace the content of the document with an default content, add aspect, etc) if the content cannot be transform for some reason (encrypted, corrupted, etc) It used to work like a charm for community 4.2.d but since I upgraded to the community 5.0.a it doesn't work anymore (I updated all the old configuration for transformers to the new mechanism in the alfresco-global.properties). The thing is that my custom transformer is still called if something is going wrong but fails to add the custom aspect, reason: Read-Write transaction started within read-only transaction. I know that the exception it is produced when applying the aspect but don't know how to sort it out. Any help?Excuse my english
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);
}
}