AnsweredAssumed Answered

Bean not recognised in JSP propertySheetGrid

Question asked by magarcia_sm on Nov 11, 2015
Hi there

We are creating a simple wizard where we would like to show as a the first step the metadata of a content so the user can introduce the values.

Wizard has been correctly declared in web-client-config-custom.xml, and a new Bean has been created (code shown below). Bean also is included in the faces-config-custom.xml correctly.

The situation comes with in the JSP page we use as step1 of the wizard, we try to include the following propertySheetGreed tab

<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>

<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>

<f:loadBundle basename="alfresco.extension.webclient" var="mensajes"/>
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
             width="100%" rowClasses="wizardSectionHeading">
    <h:outputText value="Creación del Espacio Expediente y tipificado"/>

<r:propertySheetGrid id="content-props-expediente"
                     mode = "edit"
                     rendered="#{!empty {WizardManager.bean.newNodeExpediente}"
                     finishButtonId="next-button" />

our web-client-config-custom.xml (wizards declaration)

            <wizard name="lanzarExpedienteFactura" managed-bean="LanzarExpedienteFactura"
                    title-id="lanzar_exp_title" description-id="lanzar_exp_desc"

                <step name="introducir_datos" title-id="introducir_datos_title" description-id="introducir_datos_desc">
                    <page path="/jsp/wizard/lanzarExpedienteFactura/lanzarExpedienteStep1.jsp"
                <step name="verificar_datos" title-id="verificar_datos_title" description-id="verificar_datos_desc">
                    <page path="/jsp/wizard/lanzarExpedienteFactura/lanzarExpedienteStep2.jsp"


the situation is that if we remove this propertySheetGrid from the jsp page, wizard works fine. But if we use this tag in the JSP page, then alfresco returns an error as if it does not find the property newNodeExpediente defined in the bean:

javax.faces.el.PropertyNotFoundException: Bean: org.alfresco.web.wizards.LanzarExpedienteFactura, property: newNodeExpediente

Also launching the wizard and obtaining the error takes almost 2 mins which I think it is too long as the bean just creates a node folder and assigns the type to it, dont you think?

Any ideas why Alfresco wizard is not recognizing the property defined in the bean.

the java bean definition is

public class LanzarExpedienteFactura extends BaseWizardBean {
    // Constants
    private static final long serialVersionUID = 2917623558917193097L;
    private static Log logger = LogFactory.getLog(LanzarExpedienteFactura.class);
    public static final String BEAN_IMPORTER_BOOTSTRAP = "spacesBootstrap";
    private static final String MSG_DEFAULT_DISCUSSION_TOPIC = "default_discussion_topic";
    private static final String STEP_NOTIFY = "notify";
    private static final String NOTIFY_YES = "yes";
    private static final String NOTIFY_NO = "no";
    public static final String NAMESPACE = "ExpedienteModel.model";
    public static final QName TYPE_QNAME_EXPEDIENTE_PROPERTIES = QName.createQName(NAMESPACE, "expediente_facturas");

    // Dependencies
    private AuthorityService authorityService;
    private PersonService personService;
    private PermissionService permissionService;
    private static ApplicationContext applicationContext;

    private ChildAssociationRef assoc;
    private Node newNodeExpediente;
    private Node currentNode;
    private String currentUser;
    private NodeRef destination;
    private final List<String> ListaErrores = new ArrayList();
    private String step;

    transient private DataModel userDataModel = null;
    protected List<UserGroup> userGroups = null;
    private boolean discussionFlag = true;
    private String notify = NOTIFY_NO;
    private String discussionTopic = "Respond with your feedback on    this candidate";
    protected TemplateMailHelperBean mailHelper;
    transient private JavaMailSender mailSender;
    private ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
    private ServiceRegistry serviceRegistry = (ServiceRegistry) context.getBean(ServiceRegistry.SERVICE_REGISTRY);
    private ContentService contentService = serviceRegistry.getContentService();
    private FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
    private NamespaceService nameSpaceService = serviceRegistry.getNamespaceService();
    private NodeService nodeService = serviceRegistry.getNodeService();
    private AuthenticationService authenticationService;

    public void init(Map<String, String> parameters) {


        this.newNodeExpediente = null;

        FacesContext context2 = FacesContext.getCurrentInstance();
        User user = Application.getCurrentUser(context2);
        currentUser = user.getUserName();

        /** nodo actual factura **/
        currentNode = this.getNode();

        if (currentNode == null) {
            logger.debug("———————– currentNode = null –");
            ListaErrores.add("No existe nodo Factura");

        /** obtenemos la referencia al espacio Expediente_Facturas **/
        final String stringQuery = "+PATH:\"/app:company_home/cm:Expediente_Facturas\""
                + "+TYPE:\"" + ContentModel.TYPE_FOLDER + "\"";

        this.newNodeExpediente = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Node>() {
            public Node doWork() throws Exception {
                ResultSet results = serviceRegistry.getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, stringQuery);
                if (results.getNodeRefs().size() > 0) {

                    String nombreEspacio = "01234545";
                    Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
                    properties.put(ContentModel.PROP_NAME, nombreEspacio);

                    String assocName = QName.createValidLocalName(nombreEspacio);
                    ChildAssociationRef car = nodeService.createNode(results.getNodeRef(0),
                            ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, assocName),
                            TYPE_QNAME_EXPEDIENTE_PROPERTIES, properties);

                    Node nodo = null;
                    if (car.getChildRef() != null) {
                        nodo = new Node(car.getChildRef());
                    } else {
              "***********newNodeExpediente es NULL!!!");

                    return nodo;

                } else {

                    logger.debug("No existe Factura: results_aux.getNodeRefs() vacio");
                    ListaErrores.add("No Existe espacio Expediente_Facturas");
                    return null;

        }, currentUser);

    "————————- Busqueda terminada");

    } // end of Init


}//End of class

   the code generates de space as we want, but we never get to see the setp1 jsp page with the propertySheetGrid to introduce the metadata values.

Thanks a lot in advance