01-28-2016 11:53 AM
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="dtdlm:deliveryTicketDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Data list type to track progress of a Delivery Ticket Workflow.</description>
<author>Mike Kay</author>
<version>1.0</version>
<!– Imports are required to allow references to definitions in other models –>
<imports>
<!– Import Alfresco Dictionary Definitions –>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!– Import Alfresco Content Domain Model Definitions –>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.test.com/model/deliveryTicketDataListModel/1.0" prefix="dtdlm" />
</namespaces>
<!– Constraint definitions –>
<constraints>
</constraints>
<!– Type and property definitions –>
<types>
<type name="dtdlm:deliveryTicketDataList">
<title>Active Delivery Ticket</title>
<description>Delivery Ticket in Progress</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="dtdlm:title">
<title>Title</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="dtdlm:dateSubmitted">
<title>Current State</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="dtdlm:submitter">
<title>Submitted By</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="dtdlm:dateChanged">
<title>Last Activity</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="dtdlm:status">
<title>Status</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
</properties>
</type>
</types>
</model>
//execution.setVariable("alfrescoSite", "testing");
execution.setVariable("alfrescoSite", "workflow-testing");
// Set unique node token based on the initiator's user name + a timestamp
execution.setVariable("deliveryTicketWorkflow_nodeName", initiator.properties.userName + "_" + Date.now());
//
// Create initial data list item
//
// Get the site name and dataLists
// var site = siteService.getSite(execution.getVariable("alfrescoSite"));
var dataLists = companyhome.childByNamePath("Sites/" + execution.getVariable("alfrescoSite") + "/dataLists");
var site = companyhome.childByNamePath("Sites/" + execution.getVariable("alfrescoSite"));
// Check for data list existence
if (!dataLists) {
var dataLists = site.createNode("dataLists", "cm:folder");
var dataListProps = new Array(1);
dataListProps["st:componentId"] = "dataLists";
dataLists.addAspect("st:siteContainer", dataListProps);
dataLists.save();
}
// Create new data list variable
var deliveryTicketDataList = dataLists.childByNamePath("deliveryTicketDataList");
// If the data list hasn't been created yet, create it
if (!deliveryTicketDataList) {
var deliveryTicketDataList = dataLists.createNode("deliveryTicketDataList","dl:dataList");
// Tells Alfresco share which type of items to create
deliveryTicketDataList.properties["dl:dataListItemType"] = "dtdlm:deliveryTicketDataList";
deliveryTicketDataList.save();
var deliveryTicketDataListProps = [];
deliveryTicketDataListProps["cm:title"] = "Delivery Tickets: In Progress";
deliveryTicketDataListProps["cm:description"] = "Delivery tickets that are in progress.";
deliveryTicketDataList.addAspect("cm:titled", deliveryTicketDataListProps);
}
var deliveryTicket = deliveryTicketDataList.childByNamePath(execution.getVariable("deliveryTicketWorkflow_nodeName"));
// If node was removed, create it
if (!deliveryTicket ) {
var deliveryTicket = deliveryTicketDataList.createNode(execution.getVariable("deliveryTicketWorkflow_nodeName"), "dtdlm:deliveryTicketDataList");
deliveryTicket.properties["dtdlm:title"] = execution.getVariable("bpm_workflowDescription");
deliveryTicket.properties["dtdlm:submitter"] = initiator.properties.firstName + " " + person.properties.lastName;
deliveryTicket.properties["dtdlm:dateSubmitted"] = Date().toString();
deliveryTicket.properties["dtdlm:status"] = "Initial Submission";
deliveryTicket.properties["dtdlm:dateChanged"] = Date().toString();
deliveryTicket.save();
}
01-28-2016 04:06 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.