AnsweredAssumed Answered

Custom Dialog problem

Question asked by jbarrett on Mar 25, 2007
Latest reply on Mar 26, 2007 by jbarrett
I am having a problem with my custom dialog and need some help.  I have a ContactDialogBean that extends BaseDialogBean where I have default values set for each of the beans properties.  The problem I am having is with my JSP.  For some reason the only property value that gets populated is the name property.  When I submit the page I get a bunch of conversion errors.

If I only display the name property in the jsp when I submit the page I get no errors and everything executes as I expected.  Below is the code for the bean and the jsp. 

package com.microstrat.ecm.alfresco.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.faces.context.FacesContext;

import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.microstrat.ecm.alfresco.bean.repository.MSIModel;

public class ContactDialogBean extends BaseDialogBean {
   private static Log logger = LogFactory.getLog(ContactDialogBean.class);
   protected String name = "Josh";
   protected String company = "TEST CO";
   protected String jobTitle = "CEO";
   protected String office = "444444444";
   protected String cell = "3333333333";
   protected String fax = "32232232111";
   protected String email ="Josh@test.com";
   protected String web = "blablabla";
   protected String icon = "contact";
   
   @Override
   protected String finishImpl(FacesContext context, String outcome)
         throws Exception {
      System.out.println(ContentModel.PROP_TITLE.getNamespaceURI()+ "-"+ContentModel.PROP_TITLE.getLocalName());
      
      System.out.println(outcome);
      NodeRef parentNodeRef;
        String nodeId = this.navigator.getCurrentNodeId();
        System.out.println("NODEID:"+nodeId);
        if (nodeId == null)
        {
           parentNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
        }
        else
        {
           parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
        }
       
        System.out.println("PARENTNODEREF:"+parentNodeRef.getId());
        FileInfo fileInfo = fileFolderService.create(
              parentNodeRef,
              this.name, MSIModel.CONTACT);
        NodeRef nodeRef = fileInfo.getNodeRef();
       
        if (logger.isDebugEnabled())
           logger.debug("Created Contact node with name: " + this.name);
       
        Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(5);
        uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon);
        uiFacetsProps.put(ContentModel.PROP_TITLE, this.name);
        uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.name+" description");
        this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps);
      
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_CELL, this.cell);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_COMPANY, this.company);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_EMAIL, this.email);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_FAX, this.fax);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_JOB_TITLE, this.jobTitle);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_OFFICE, this.office);
        this.nodeService.setProperty(nodeRef, MSIModel.CONTACT_WEB, this.web);

        if (logger.isDebugEnabled())
           logger.debug("Added uifacets aspect with properties: " + uiFacetsProps);

      return outcome;
   }
   
   @Override
      public boolean getFinishButtonDisabled()
      {
         return false;
      }
   
   public String getCell() {
      return cell;
   }
   public void setCell(String cell) {
      this.cell = cell;
   }
   public String getCompany() {
      return company;
   }
   public void setCompany(String company) {
      this.company = company;
   }
   public String getEmail() {
      return email;
   }
   public void setEmail(String email) {
      this.email = email;
   }
   public String getFax() {
      return fax;
   }
   public void setFax(String fax) {
      this.fax = fax;
   }
   public String getJobTitle() {
      return jobTitle;
   }
   public void setJobTitle(String jobTitle) {
      this.jobTitle = jobTitle;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public String getOffice() {
      return office;
   }
   public void setOffice(String office) {
      this.office = office;
   }
   public String getWeb() {
      return web;
   }
   public void setWeb(String web) {
      this.web = web;
   }

}


<%@ 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:panelGrid id="addContactGrid" columns="2">
   <h:outputText value="Name:"/>
   <h:inputText id="name" value="#{DialogManager.bean.name}"/>
   <h:outputText value="Company:"/>
   <h:inputText id="company" value="#{DialogManger.bean.company}"/>
   <h:outputText value="Job Title:"/>
   <h:inputText id="jobtitle" value="#{DialogManger.bean.jobTitle}"/>
   <h:outputText value="Office:"/>
   <h:inputText id="office" value="#{DialogManger.bean.office}"/>
   <h:outputText value="Cell:"/>
   <h:inputText id="cell" value="#{DialogManger.bean.cell}"/>
   <h:outputText value="Fax:"/>
   <h:inputText id="fax" value="#{DialogManger.bean.fax}"/>
   <h:outputText value="Email:"/>
   <h:inputText id="email" value="#{DialogManger.bean.email}"/>
   <h:outputText value="Web Site:"/>
   <h:inputText id="web" value="#{DialogManger.bean.web}"/>    
</h:panelGrid>


Please help.

Thanks,
Josh

Outcomes