01-25-2010 08:49 AM
> jsp
> extension
> add-aspect.jsp
> WEB-INF
> lib
> custom-dialog.jar
> alfresco
> extension
> web-client-config-custom.xml
> META-INF
> faces-config.xml
> MANIFEST.MF
> org
> alfresco
> sample
> AddAspectDialog.class
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:outputText value="#{msg.aspect}: " />
<h:selectOneMenu value="#{DialogManager.bean.aspect}">
<f:selectItems value="#{RunActionWizard.testableAspects}" />
</h:selectOneMenu>
<alfresco-config>
<config>
<actions>
<!– Launch Add Aspect Dialog –>
<action id="add_aspect">
<label>Add Aspect</label>
<image>/images/icons/add.gif</image>
<action>dialog:addAspect</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!– Add action to more actions menu for each space –>
<action-group id="space_browse_menu">
<action idref="add_aspect" />
</action-group>
</actions>
<dialogs>
<dialog name="addAspect" page="/jsp/extension/add-aspect.jsp" managed-bean="AddAspectDialog"
icon="/images/icons/add_content_large.gif" title="Add Aspect"
description="Adds an aspect to the selected node" />
</dialogs>
</config>
</alfresco-config>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>AddAspectDialog</managed-bean-name>
<managed-bean-class>org.alfresco.sample.AddAspectDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
</managed-bean>
</faces-config>
Manifest-Version: 1.0
Created-By: Nicolas
Class-Path: web-client-config-custom.xml
package org.alfresco.sample;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;
public class AddAspectDialog extends BaseDialogBean
{
protected String aspect;
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// get the space the action will apply to
NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();
// resolve the fully qualified aspect name
QName aspectToAdd = Repository.resolveToQName(this.aspect);
// add the aspect to the space
getNodeService().addAspect(nodeRef, aspectToAdd, null);
// return the default outcome
return outcome;
}
public boolean getFinishButtonDisabled()
{
return false;
}
public String getAspect()
{
return aspect;
}
public void setAspect(String aspect)
{
this.aspect = aspect;
}
}
01-26-2010 04:55 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.