mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Heinous merge from HEAD. Seems to basically work. Be on guard however.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4137 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -109,6 +109,11 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
*/
|
||||
private ServiceRegistry serviceRegistry;
|
||||
|
||||
/**
|
||||
* Mail header encoding scheme
|
||||
*/
|
||||
private String headerEncoding = null;
|
||||
|
||||
/**
|
||||
* @param javaMailSender the java mail sender
|
||||
*/
|
||||
@@ -164,6 +169,14 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param headerEncoding The mail header encoding to set.
|
||||
*/
|
||||
public void setHeaderEncoding(String headerEncoding)
|
||||
{
|
||||
this.headerEncoding = headerEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the rule action
|
||||
@@ -180,6 +193,12 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
{
|
||||
MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
|
||||
|
||||
// set header encoding if one has been supplied
|
||||
if (headerEncoding != null && headerEncoding.length() != 0)
|
||||
{
|
||||
mimeMessage.setHeader("Content-Transfer-Encoding", headerEncoding);
|
||||
}
|
||||
|
||||
// set recipient
|
||||
String to = (String)ruleAction.getParameterValue(PARAM_TO);
|
||||
if (to != null && to.length() != 0)
|
||||
|
@@ -84,6 +84,10 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
|
||||
{
|
||||
NodeRef scriptRef = (NodeRef)action.getParameterValue(PARAM_SCRIPTREF);
|
||||
NodeRef spaceRef = this.serviceRegistry.getRuleService().getOwningNodeRef(action);
|
||||
if (spaceRef == null)
|
||||
{
|
||||
spaceRef = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef();
|
||||
}
|
||||
|
||||
if (nodeService.exists(scriptRef))
|
||||
{
|
||||
|
@@ -240,7 +240,10 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
|
||||
contentWriter.setMimetype(mimeType); // new mimetype
|
||||
contentWriter.setEncoding(contentReader.getEncoding()); // original encoding
|
||||
|
||||
// Try and transform the content
|
||||
// Try and transform the content - failures are caught and allowed to fail silently.
|
||||
// This is unique to this action, and is essentially a broken pattern.
|
||||
// Clients should rather get the exception and then decide to replay with rules/actions turned off or not.
|
||||
// TODO: Check failure patterns for actions.
|
||||
try
|
||||
{
|
||||
doTransform(ruleAction, contentReader, contentWriter);
|
||||
@@ -258,8 +261,16 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executed in a new transaction so that failures don't cause the entire transaction to rollback.
|
||||
*/
|
||||
protected void doTransform(Action ruleAction, ContentReader contentReader, ContentWriter contentWriter)
|
||||
{
|
||||
// try to pre-empt the lack of a transformer
|
||||
if (!this.contentService.isTransformable(contentReader, contentWriter))
|
||||
{
|
||||
throw new NoTransformerException(contentReader.getMimetype(), contentWriter.getMimetype());
|
||||
}
|
||||
this.contentService.transform(contentReader, contentWriter);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user