use of org.alfresco.repo.content.transform.TransformerInfoException in project acs-community-packaging by Alfresco.
the class NodeInfoBean method sendNodeInfo.
/**
* Returns information on the node identified by the 'noderef'
* parameter found in the ExternalContext. If no noderef is supplied, then the template
* is executed without context.
* <p>
* The result is the formatted HTML to show on the client.
*/
public void sendNodeInfo() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
String strNodeRef = (String) requestMap.get("noderef");
String strTemplate = (String) requestMap.get("template");
if (strTemplate == null || strTemplate.length() == 0) {
strTemplate = "node_summary_panel.ftl";
}
NodeRef nodeRef = null;
if (strNodeRef != null && strNodeRef.length() != 0) {
nodeRef = new NodeRef(strNodeRef);
if (this.getNodeService().exists(nodeRef) == false) {
out.write("<span class='errorMessage'>Node could not be found in the repository!</span>");
return;
}
}
try {
Repository.getServiceRegistry(context).getTemplateService().processTemplate("/alfresco/templates/client/" + strTemplate, getModel(nodeRef, requestMap), out);
} catch (TemplateException ex) {
// Try to catch TransformerInfoException to display it in NodeInfo pane.
// Fix bug reported in https://issues.alfresco.com/jira/browse/ETWOTWO-440
Throwable cause = ex.getCause();
while (cause != null) {
cause = cause.getCause();
if (cause instanceof TransformerInfoException) {
out.write("<tr><td colspan=\"2\"><span class='errorMessage'>" + cause.getMessage() + "</span></td></tr>");
return;
}
}
throw ex;
}
}
Aggregations