/// Gets the DET that defines what fields are present in each
/// customer support incident.
///
/// In this sample, we will create a new DET. In your real
/// application, this method would probably query for an existing DET. * existing DET.
///
private static IDataEntryTemplate RetrieveDET(IContentFactory factory, IFolder folder)
{
//
// A Data Entry Template object is a collection of
// property objects. Each property object represents
// a field in the records associated with the DET.
//
// This sample uses all of the classes of properties
// available in Content Server. Each customer support
// incidents will have:
// (integer) Incident ID
// (boolean) If the incident has been resolved
// (float) Incident severity rating
// (date) Date the incident was opened
// (text line) Customer name
// (item reference) Link to other content item representing the customer
// (selection list) The product the incident was reported in
// (text block) Reported problem
// (file) Logs of problem
// (image) Screen shot of problem
//
// Get manager objects needed for creating a DET.
IDataEntryTemplateManager detManager = factory.GetDataEntryTemplateManager();
// Check to see if the data entry template already exists
IDataEntryTemplate det = detManager.GetDataEntryTemplate(folder, "Support Incident Data Entry Template");
if(det != null)
{
return det;
}
IPropertyManager propertyManager = factory.GetPropertyManager();
ISelectionListManager slManager = factory.GetSelectionListManager();
// Create a DET object.
det = detManager.CreateDataEntryTemplate(folder, "Support Incident Data Entry Template");
// Add an integer property.
IIntegerProperty incident = propertyManager.CreateIntegerProperty("Incident ID", "The ticket number for this incident.");
det.AddProperty(incident);
// Add a boolean property
IBooleanProperty resolved = propertyManager.CreateBooleanProperty("Resolved", "True if the incident has been closed; false if it is still open.");
det.AddProperty(resolved);
// Add a double property.
IDoubleProperty severity = propertyManager.CreateDoubleProperty("Severity", "Percentage stating how severe the incident is.");
det.AddProperty(severity);
// Add a date property.
IDateProperty opened = propertyManager.CreateDateProperty("Date Opened", "The date and time the incident was reported.");
det.AddProperty(opened);
// Add a text line property.
// Text lines are brief strings without newline characters.
// Use the text block property for storing longer strings.
ITextLineProperty customerName = propertyManager.CreateTextLineProperty("Customer Name", "The name of the customer.");
det.AddProperty(customerName);
// Add an item reference property.
// An item reference links to another content item. The
// content item does not have to be associated with the
// same DET. For example, we will link to a fictional
// content item representing the customer that is having
// the support problem; which would be associated with
// a DET representing customers.
//
// Not shown is the item collection property. It is
// similar to the item reference property, but links to
// multiple content items.
IItemReferenceProperty customerData = propertyManager.CreateItemReferenceProperty("Customer Information", "Links to information about the customer such as the contact and their phone number.");
det.AddProperty(customerData);
// Add a selection list property.
// A selection list is a defined set of choices of which
// one may be selected. This can be visualized as a
// drop down box.
//Check to see if the selection list already exists
ISelectionList selectionList = null;
ISelectionList[] selectionLists = slManager.GetSelectionLists(folder);
foreach(ISelectionList sl in selectionLists)
{
if(sl.Name.Equals("Products Selection List"))
{
selectionList = sl;
break;
}
}
if(selectionList == null)
{
string[] listValues = {"Portal", "Search Server", "Collaboration Server", "Content Server", "Analytics"};
selectionList = slManager.CreateSelectionList(folder, "Products Selection List", listValues);
selectionList.Store();
}
ISelectionListProperty products = propertyManager.CreateSelectionListProperty("Product", "The product which the support incident is opened against", selectionList);
det.AddProperty(products);
// Add a text block property.
// Text block properties are used to store long strings
// that can span many lines. For short strings contained
// on only one line, use the text line property instead.
ITextBlockProperty description = propertyManager.CreateTextBlockProperty("Incident Description", "A writeup summarizing the problem the customer is experiencing.");
det.AddProperty(description);
// Add a file property.
IFileProperty log = propertyManager.CreateFileProperty("Log File", "A log file taken while the problem occurred.");
det.AddProperty(log);
// Add an image property.
IImageProperty screenShot = propertyManager.CreateImageProperty("Screen Shot", "A screen shot of the problem.");
det.AddProperty(screenShot);
// Actually store the DET and all the properties associated with it.
det.Store();
return det;
}
///