09-13-2010 11:50 AM
<alfresco-config>
<config evaluator="string-compare" condition="Action Wizards">
<action-handlers>
<handler name="publish" class="com.custom.alfresco.action.publish.PublishActionHandler" />
</action-handlers>
</config>
<config>
<actions>
<action id="publish">
<label>Publish Content</label>
<image>/images/extension/custom.png</image>
<action>wizard:publishWizard</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<action-group id="space_details_actions">
<action idref="publish" />
</action-group>
</actions>
</config>
<config>
<wizards>
<!– Definition of the publish action wizard–>
<wizard name="publishWizard" managed-bean="PublishActionWizard"
title-id="publish_action_title" description-id="publish_action_desc"
icon="/images/icons/new_rule_large.gif">
<step name="publish" title-id="publish_action_title" description-id="publish_action_desc">
<page path="/jsp/actions/extension/publish.jsp"
title-id="run_action_step1_title"
description-id=""
instruction-id="default_instruction"/>
</step>
</wizard>
</wizards>
</config>
</alfresco-config>
At this level the action is shown well in the menu of the actions (on the detailed view of a space and in the list of the actions in "Run Action Wizard").
…
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="2" class="mainSubTitle"><h:outputText value="#{msg.set_action_values}" /></td>
</tr>
<tr><td colspan="2" class="paddingRow"></td></tr>
<tr>
<td><nobr><h:outputText value="#{customMsg.filters}:"/></nobr></td>
<td width="95%">
<h:selectOneMenu value="#{WizardManager.bean.actionProperties.filter}">
<f:selectItems value="#{PublishActionWizard.filters}" />
</h:selectOneMenu>
</td>
</tr>
<tr>
<td><nobr><h:outputText value="#{customMsg.folders}:"/></nobr></td>
<td width="95%">
<h:selectOneMenu value="#{WizardManager.bean.actionProperties.folder}">
<f:selectItems value="#{PublishActionWizard.folders}" />
</h:selectOneMenu>
</td>
</tr>
<tr>
<td colspan="2"><h:outputText value="#{customMsg.want_index_content}"/></td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td valign="top">
<h:selectOneRadio id="index"
value="#{WizardManager.bean.actionProperties.index}">
<f:selectItem itemValue="yes" itemLabel="#{msg.yes}" />
<f:selectItem itemValue="no" itemLabel="#{msg.no}" />
</h:selectOneRadio>
</td>
</tr>
</table>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
</table>
…
I created the "Handler " and the "Executor "
…
public abstract class PublishActionWizard extends RunActionWizard
{
private static final long serialVersionUID = 5925759221710403043L;
private static final Log logger = LogFactory.getLog(PublishActionWizard.class);
protected List<SelectItem> filters;
protected List<SelectItem> folders;
// ——————————————————————————
// Wizard implementation
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception{
logger.debug("finishImpl(FacesContext " + context + ",outcome " + outcome + ") called");
super.finishImpl(context, outcome);
return outcome;
}
// ——————————————————————————
// Bean Getters and Setters
public List<SelectItem> getFilters(){
…
return this.filters;
}
public List<SelectItem> getFolders(){
…
return this.folders;
}
…
}
<?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>PublishActionWizard</managed-bean-name>
<managed-bean-class>com.custom.alfresco.action.wizard.PublishActionWizard</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>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>actionService</property-name>
<value>#{ActionService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>mimetypeService</property-name>
<value>#{MimetypeService}</value>
</managed-property>
<managed-property>
<property-name>personService</property-name>
<value>#{PersonService}</value>
</managed-property>
<managed-property>
<property-name>authorityService</property-name>
<value>#{AuthorityService}</value>
</managed-property>
</managed-bean>
</faces-config>
But, when I launch the action from the detailed view, I obtain the following error:org.alfresco.error.AlfrescoRuntimeException: 08030002 Failed to start wizard as managed bean 'PublishActionWizard' has not been defined
javax.faces.FacesException: javax.faces.el.EvaluationException: Cannot get value for expression '#{PublishActionWizard.filters}'
caused by:
org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{PublishActionWizard.filters}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{PublishActionWizard.filters}'
caused by:
javax.faces.FacesException: java.lang.InstantiationException
caused by:
java.lang.InstantiationException
…
org.alfresco.error.AlfrescoRuntimeException: 08030002 Failed to start wizard as managed bean 'PublishActionWizard' has not been defined
09-15-2010 05:16 AM
09-20-2010 01:19 PM
…
public class PublishContentWizard extends BaseWizardBean
{
private static final long serialVersionUID = 5925759221710403043L;
private static final Log logger = LogFactory.getLog(PublishContentWizard.class);
protected List<SelectItem> filters;
protected String filter;
protected List<SelectItem> folders;
protected String folder;
// ——————————————————————————
// Wizard implementation
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception{
logger.debug("finishImpl(FacesContext " + context + ",outcome " + outcome + ") called");
return outcome;
}
// ——————————————————————————
// Bean Getters and Setters
public String getFilter() {
logger.debug("getFilter() called");
return filter;
}
public void setFilter(String filter) {
logger.debug("setFilter( Filter " + filter + ") called");
this.filter = filter;
}
public String getFolder() {
logger.debug("getFolder() called");
return folder;
}
public void setFolder(String folder) {
logger.debug("setFolder(Folder " + folder + ") called");
this.folder = folder;
}
public List<SelectItem> getFilters()
{
logger.debug("getFilters() called");
if (this.filters == null)
{
this.filters = new ArrayList<SelectItem>();
try {
…
this.filters.add(new SelectItem( filterVal));
…
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.filters, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
} catch (Exception ex) {
…
}
}
return this.filters;
}
public List<SelectItem> getFolders(){
logger.debug("getFolders() called");
if (this.folders == null || this.folders.isEmpty())
{
this.folders = new ArrayList<SelectItem>();
if (selectedFilter != null) {
try {
…
this.folders.add(new SelectItem(folderVal));
…
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.folders, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
} catch (Exception ex) {
…
}
}
}
return this.folders;
}
…
}
- Declaration of the bean in "faces-config-custom.xml":
<?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>PublishContentWizard</managed-bean-name>
<managed-bean-class>com.rsd.alfresco.action.wizard.PublishContentWizard</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>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>namespaceService</property-name>
<value>#{NamespaceService}</value>
</managed-property>
</managed-bean>
</faces-config>
- Nothing to put in "web-client-config-custom.xml ", only the declaration of the Handler.<f:selectItems value="#{PublishContentWizard.filters}" />
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.