03-25-2007 03:02 PM
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>03-26-2007 09:44 AM
03-26-2007 12:44 PM
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.