Below is a small code for applying a template to a content using web service API
Note – For applying a template, you need to set the template node ref as a template property
I have taken reference of alfresco out of the box document template.
You can download it here. Start it once before you run first foundation client.
I hope you will not face any issues running it.
After it's been run successfully, start your tomcat, you will see a new file created in company home space.
Whenever you want to add any kind of action link into alfresco, you need to make changes into 'web-client-config-actions.xml' or 'web-client-config-actions-custom.xml'.
As alfresco says, it's better to make changes in custom file as it keeps you code separate from alfresco and is easy for debugging also.
Suppose you want to add an action 'Approved' for particular document.
You want this action to appear in actions column and in view details of your content.
Below are the steps of doing this
<action id="approveDoc"> - A valid ID for your action
<permissions>
<permission allow="true">Write</permission> - Default Permissions
</permissions>
<label>Profile Review Complete</label> - Label to display when you put your mouse over the action text
<label-id>approve_document</label-id> - Name to appear in JSP
<image>/images/icons/green_tick.gif</image> - Icon to appear in JSP
<action-listener>
#{[YOUR BEAN NAME].[METHOD TO CALL]} – Bean method to call when action is performed
</action-listener>
<action>[Outcome]</action> - This is to navigate the page when action is completed
<params>
<param name="id">#{actionContext.id}</param> - Specifically for getting the node ref from context id
</params>
</action>
This action group name will need to be used for displaying the actions in JSP file
/* For Actions column */
<action-group id="approve_doc_actions_browse">
<show-link>false</show-link>
<style-class>inlineAction</style-class>
<action idref="approveDoc" />
</action-group>
/* For view details page*/
<action-group id="approve_doc_actions_details">
<action idref="approveDoc" /> - The action which we have defined above
</action-group>
3. Use below tag to display the action into the actions column of the content in browse page
<%-- Content Actions column --%>
<a:column id="fo_col18" actions="true" style="text-align:left"
rendered="#{NavigationBean.searchContext == null}">
<f:facet name="header">
<h:outputText id="fo_col-txt" value="#{msg.actions}"/>
</f:facet>
<a:actionLink id="fo_col-act" value="#{r.name}" href="#{r.url}"
target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" />
<%-- actions are configured in web-client-config-actions.xml --%>
<r:actions id="fo_col-acts" value="approve_doc_actions_browse" context="#{r}"
showLink="false" styleClass="inlineAction" />
</a:column>
<%-- Document Actions --%>
<a:panel label="#{msg.actions}" id="actions-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" style="text-align:center" progressive="true" expanded='#{DialogManager.bean.panels["actions-panel"]}'
expandedActionListener="#{DialogManager.bean.expandPanel}">
<r:actions id="actions_doc" value="fo_doc_details_actions" context="#{DialogManager.bean.document}"
verticalSpacing="3" style="white-space:nowrap" />
</a:panel>
Now you have created your new customized action link.
Similarly you can create more actions and display it in one action group.