Skip to content

Commit b5abbd5

Browse files
author
Nathan McMinn
committed
Fix for missing destination folder
When “in-place” actions are chosen, the destination folder may be null or empty string. Alfresco doesn’t like this, so we have to fix it in-situ with a form filter.
1 parent c07304c commit b5abbd5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pdf-toolkit-repo/src/main/java/org/alfresco/extension/pdftoolkit/form/PDFActionFormFilter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44
import java.util.Map;
55

6+
import org.alfresco.extension.pdftoolkit.repo.action.executer.BasePDFActionExecuter;
67
import org.alfresco.extension.pdftoolkit.repo.action.executer.PDFWatermarkActionExecuter;
78
import org.alfresco.repo.action.ActionDefinitionImpl;
89
import org.alfresco.repo.forms.Form;
@@ -19,6 +20,8 @@ public class PDFActionFormFilter extends AbstractFilter<Object, ActionFormResult
1920
private static Log logger = LogFactory.getLog(PDFActionFormFilter.class);
2021
private String WATERMARK_IMAGE_FIELD = "assoc_watermark-image_added";
2122
private String DESTINATION_FOLDER_FIELD = "assoc_destination-folder_added";
23+
private String INPLACE_PARAM = "prop_" + BasePDFActionExecuter.PARAM_INPLACE;
24+
2225
private ServiceRegistry serviceRegistry;
2326

2427
@Override
@@ -48,6 +51,17 @@ public void beforePersist(Object obj, FormData formData) {
4851
//check the action, is it one we need to handle?
4952
if(obj != null)
5053
{
54+
/*
55+
* For all pdf-toolkit actions, check for the "in place" parameter. If it is
56+
* set to true, rewrite the destination folder field value so Alfresco will
57+
* let the form action pass.
58+
*/
59+
FieldData inplace = formData.getFieldData(INPLACE_PARAM);
60+
if(Boolean.valueOf(String.valueOf(inplace.getValue())))
61+
{
62+
formData.addFieldData(DESTINATION_FOLDER_FIELD, "null://null/null", true);
63+
}
64+
5165
ActionDefinitionImpl act = (ActionDefinitionImpl)obj;
5266
if(act.getName().equals(PDFWatermarkActionExecuter.NAME))
5367
{

0 commit comments

Comments
 (0)