use of javax.faces.context.ResponseWriter in project acs-community-packaging by Alfresco.
the class NavigatorPluginBean method nodeCollapsed.
/**
* Sets the state of the node given in the 'nodeRef' parameter to collapsed
*/
public void nodeCollapsed() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
Map params = context.getExternalContext().getRequestParameterMap();
String nodeRefStr = (String) params.get("nodeRef");
String area = (String) params.get("area");
if (logger.isDebugEnabled())
logger.debug("nodeCollapsed: area = " + area + ", nodeRef = " + nodeRefStr);
// work out which list to cache the nodes in
Map<String, TreeNode> currentNodes = getNodesMapForArea(area);
if (nodeRefStr != null && currentNodes != null) {
TreeNode treeNode = currentNodes.get(nodeRefStr);
if (treeNode != null) {
treeNode.setExpanded(false);
// we need to return something for the client to be happy!
out.write("<ok/>");
if (logger.isDebugEnabled())
logger.debug("Set node " + treeNode + " to collapsed state");
}
}
}
use of javax.faces.context.ResponseWriter in project acs-community-packaging by Alfresco.
the class PortletActionsBean method checkinItem.
@InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML)
public void checkinItem() throws Exception {
FacesContext fc = FacesContext.getCurrentInstance();
ResponseWriter out = fc.getResponseWriter();
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
String strNodeRef = (String) requestMap.get("noderef");
if (strNodeRef != null && strNodeRef.length() != 0) {
try {
Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f);
props.put(Version.PROP_DESCRIPTION, "");
props.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
Repository.getServiceRegistry(fc).getCheckOutCheckInService().checkin(new NodeRef(strNodeRef), props);
out.write("OK: " + strNodeRef);
} catch (Throwable err) {
out.write("ERROR: " + err.getMessage());
}
}
}
use of javax.faces.context.ResponseWriter in project acs-community-packaging by Alfresco.
the class PortletActionsBean method deleteItem.
@InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML)
public void deleteItem() throws Exception {
FacesContext fc = FacesContext.getCurrentInstance();
ResponseWriter out = fc.getResponseWriter();
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
String strNodeRef = (String) requestMap.get("noderef");
if (strNodeRef != null && strNodeRef.length() != 0) {
try {
Repository.getServiceRegistry(fc).getFileFolderService().delete(new NodeRef(strNodeRef));
out.write("OK: " + strNodeRef);
} catch (Throwable err) {
out.write("ERROR: " + err.getMessage());
}
}
}
use of javax.faces.context.ResponseWriter in project acs-community-packaging by Alfresco.
the class PortletActionsBean method checkoutItem.
@InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML)
public void checkoutItem() throws Exception {
FacesContext fc = FacesContext.getCurrentInstance();
ResponseWriter out = fc.getResponseWriter();
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
String strNodeRef = (String) requestMap.get("noderef");
if (strNodeRef != null && strNodeRef.length() != 0) {
try {
Repository.getServiceRegistry(fc).getCheckOutCheckInService().checkout(new NodeRef(strNodeRef));
out.write("OK: " + strNodeRef);
} catch (Throwable err) {
out.write("ERROR: " + err.getMessage());
}
}
}
use of javax.faces.context.ResponseWriter in project acs-community-packaging by Alfresco.
the class TaskInfoBean method sendTaskResources.
/**
* Returns the resource list for the workflow task identified by the 'taskId'
* parameter found in the ExternalContext.
* <p>
* The result is the formatted HTML to show on the client.
*/
public void sendTaskResources() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
String taskId = (String) context.getExternalContext().getRequestParameterMap().get("taskId");
if (taskId == null || taskId.length() == 0) {
throw new IllegalArgumentException("'taskId' parameter is missing");
}
WorkflowTask task = this.getWorkflowService().getTaskById(taskId);
if (task != null) {
Repository.getServiceRegistry(context).getTemplateService().processTemplate("/alfresco/templates/client/task_resource_panel.ftl", getModel(task), out);
} else {
out.write("<span class='errorMessage'>Task could not be found.</span>");
}
}
Aggregations