HI i built my extensions module with is action link anf form , now i want if anything happened during the execution of the action on the java code print a popup with info of the exception on share is possibile with spring surf extensions?
Here my extensions module code:
<extension>
<modules>
<module>
<id>SignSurfAction</id>
<version>${project.version}</version>
<auto-deploy>true</auto-deploy>
<configurations>
<config evaluator="string-compare" condition="DocumentLibrary">
<indicators>
<indicator id="it.abd.indicator.isSigned"
icon="signed-doc-16.png"
index="100"
label="it.abd.indicator.isSigned.label">
<evaluator>it.abd.alfresco.evaluator.isSignable</evaluator>
</indicator>
</indicators>
<toolbar-actions>
<action type="action-link" id="onSignSurfAction" label="menu.selected-items.signSurfAction" />
</toolbar-actions>
</config>
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="onSignSurfAction" icon="sign" type="javascript"
label="it.abd.doclib.action.signSurfAction.label">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">signSurfAction</param> <!-- Repository action id = Spring Bean id -->
<param name="mode">create</param>
<param name="destination">{node.nodeRef}</param>
<param name="successMessage">it.abd.sign.doclib.action.signed.msg.success</param>
<param name="failureMessage">it.abd.sign.doclib.action.signed.msg.failure</param>
//if the action failed show the popup with the failed message, butn i want to customize the text based on
//the java exception i get from the code java action class
<evaluator>it.abd.alfresco.evaluator.isSignable</evaluator>
</action>
</actions>
<actionGroups>
<actionGroup id="document-browse">
<action index="400" id="onSignSurfAction" />
</actionGroup>
<actionGroup id="document-details">
<action index="400" id="onSignSurfAction" />>
</actionGroup>
</actionGroups>
</config>
<config evaluator="string-compare" condition="DocLibCustom">
<dependencies>
<css src="/webdesktop-share-amp/css/toolbar/custom-toolbar.css"/>
<js src="/webdesktop-share-amp/js/corslite.js"/>
</dependencies>
</config>
<!-- ========================================================= -->
<!-- FORMS -->
<!-- ========================================================= -->
<config evaluator="string-compare" condition="signSurfAction"> <!-- ID for the Repository Action that this form is associated with -->
<forms>
<form>
<edit-form template="/2-column-edit-form.ftl" />
<field-visibility>
<show id="firmaProfilo"/>
<show id="firmaOtp"/>
<show id="firmaLuogo"/>
<show id="firmaMotivo"/>
<show id="firmaFirmatario"/>
<show id="firmaUsername"/>
<show id="firmaPassword"/>
</field-visibility>
<appearance>
<field id="firmaProfilo" label-id="property.form.sign.firma.profilo">
<control template="/org/alfresco/components/form/controls/profiloFirmaSelectOneDinamic.ftl"/>
</field>
<field id="firmaOtp" label-id="property.form.sign.firma.otp">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="firmaLuogo" label-id="property.form.sign.firma.luogo">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="firmaMotivo" label-id="property.form.sign.firma.motivo">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="firmaFirmatario" label-id="property.form.sign.firma.firmatario">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="firmaUsername" label-id="property.form.sign.firma.username">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="firmaPassword" label-id="property.form.sign.firma.password">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</configurations>
</module>
</modules>
</extension>
And here my java action class:
public class SignSurfAction extends ActionExecuterAbstractBase {
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
try {
//MY CODE
} catch (Throwable t) {
logger.debug("Servizio di firma non disponibile, impossibile proseguire l'azione",t);
throw new WebScriptException("Bla bla bla : " + t.getMessage(), t);
//THERE IS A WAY TO PRINT THE MESSAGE OF THE EXECPTION ON A POPUP ON SHARE ?
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
paramList.add(new ParameterDefinitionImpl("firmaProfilo", DataTypeDefinition.TEXT, true, getParamDisplayLabel("firmaProfilo")));
paramList.add(new ParameterDefinitionImpl("firmaTipoProfilo", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaTipoProfilo")));
paramList.add(new ParameterDefinitionImpl("firmaTipo", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaTipo")));
paramList.add(new ParameterDefinitionImpl("firmaUsername", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaUsername")));
paramList.add(new ParameterDefinitionImpl("firmaPassword", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaPassword")));
paramList.add(new ParameterDefinitionImpl("firmaOtp", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaOtp")));
paramList.add(new ParameterDefinitionImpl("firmaLuogo", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaLuogo")));
paramList.add(new ParameterDefinitionImpl("firmaMotivo", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaMotivo")));
paramList.add(new ParameterDefinitionImpl("firmaFirmatario", DataTypeDefinition.TEXT, false, getParamDisplayLabel("firmaFirmatario")));
}
}
There is a way to print the exception message of java on the text of the failure message on the extensions module of share?
Greetings.
Solved! Go to Solution.
Alfresco provides the ability to define a "failure" parameter for the action which should be a function to handle any form submission failures. This function could extract the error message from the HTTP response (which should be your exception message in Java) and display it.
Unfortunately, there is a bug in the client-side JavaScript source code for alfresco.js (original Alfresco code) and the "success" parameter is actually mapped as the failureCallback function...
Alfresco provides the ability to define a "failure" parameter for the action which should be a function to handle any form submission failures. This function could extract the error message from the HTTP response (which should be your exception message in Java) and display it.
Unfortunately, there is a bug in the client-side JavaScript source code for alfresco.js (original Alfresco code) and the "success" parameter is actually mapped as the failureCallback function...
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.