How to override (replace) original free marker template of java end webscripts

cancel
Showing results for 
Search instead for 
Did you mean: 
zhi_wang
Member II

How to override (replace) original free marker template of java end webscripts

Hi there,

Is there a way to override (replace) the ftl file used by workflow related webscript in remote-api package? For example, file `workflow.lib.ftl` used by workflow webscripts, it's under the folder path:

https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/remote-api/config/al... 

I found an article here: Overriding Alfresco webscript library ftl files - Nick  talking about overriding `workflow.lib.ftl` by copying it to same folder structure in a module, but I couldn't figure out where I should copy this file to in my module, so I was wondering what the correct path should be? I've tried to put it in:

resources/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl
resources/META-INF/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl

None of them works, please help me.

Thank you.

2 Replies
krutik_jayswal
Senior Member II

Re: How to override (replace) original free marker template of java end webscripts

You can not extend /override the lib ftl file and ideally you should not o that.One place where this file is getting used it task-list.get.html.ftl. You should extend task-list.get.html.ftl and do the customization which you would like to do it over there.

Few link on how you can extend share is as below.

Soft29 blog: Alfresco: extend Share javascript component 

6. Customize Alfresco Share FreeMarker templates | Alfresco Documentation 

zhi_wang
Member II

Re: How to override (replace) original free marker template of java end webscripts

Thank you for your reply, Krutik, but the workflow.lib.ftl in question is used by java-end webscripts, not share-end, I do find the workflow.lib.ftl you mentioned as well in share project, which path is:

share/src/main/resources/alfresco/site-webscripts/org/alfresco/components/workflow/workflow.lib.ftl

Which is to say, there are two workflow.lib.ftl files used by java-end and share-end respectively.

I've managed to override the java-end workflow.lib.ftl by manually copying customised version under folder:

tomcat/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/repository/workflow

and it's working well now, but I couldn't figure out how to do the same thing via module installation, based on your reply, it seems that we're not able to extend or override the lib ftl file, maybe that's the reason why Alfresco doesn't pick my customised ftl from my module although I put it in the same structure as that in tomcat/shared folder.

We have to modify this free marker template as we have a workflow process variable has the below shape:

[[user1, user2], user3, user4]

Unfortunately, the workflow.lib.ftl can't parse this kind of variable as when loop through the variable, it deems all the elements inside a sequence type variable can be convert to a string directly, while in our case, one of elements is sequence again and can't be converted to string directly, which cause an exception is thrown, so we have to modify the template to deal with this case by ourselves. 

Anyway, the issue has been solved for me and thank you for your help Krutik.