com.plumtree.remote.prc.content.dataentrytemplate
Interface IDataEntryTemplate


public interface IDataEntryTemplate

Represents a Data Entry Template in Publisher. Defines a set of properties needed for creating and publishing an IContentItem. All properties that can be added to a Data Entry Template are sub-types of IBaseProperty.

To properly define a Data Entry Template, use IDataEntryTemplateManager.createDataEntryTemplate to create a new template and add one or more properties to the template using IDataEntryTemplate.addProperty. A newly-created Data Entry Template or any property modification to an existing Data Entry Template will not be permanently stored until IDataEntryTemplate.store is called.

The following example code shows how to create a Data Entry Template, add properties of different types, attach an existing Presentation Template to the template, and finally persist the Data Entry Template.

         // Create a DET object.
         IDataEntryTemplate det = detManager.createDataEntryTemplate(folder, "My Data Entry Template");
  
         // Add an integer property.
         IIntegerProperty intProp = propertyManager.createIntegerProperty("Integer Prop", "Description for intProp");
         det.addProperty(intProp);
  
         // Add a boolean property
         IBooleanProperty boolProp = propertyManager.createBooleanProperty("Boolean Prop", "Description for boolProp");
         det.addProperty(boolProp);
  
         // Add a float property.
         IDoubleProperty doubleProp = propertyManager.createDoubleProperty("Double Prop", "Description for doubleProp");
         det.addProperty(doubleProp);
  
         // Add a date property.
         IDateProperty dateProp = propertyManager.createDateProperty("Date Prop", "Description for dateProp");
         det.addProperty(dateProp);
  
         // Add a text line property.
         //  Text lines are brief strings without newline characters.
         //  Use the text block property for storing longer strings.
         ITextLineProperty textLineProp = propertyManager.createTextLineProperty("TextLine Prop", "Description for textLineProp");
         det.addProperty(textLineProp);
  
         // 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.
         //
         //  Not shown is the item collection property.  It is
         //  similar to the item reference property, but links to
         //  multiple content items.
         IItemReferenceProperty itemRefProp = propertyManager.createItemReferenceProperty("Item Reference Prop", "Description for itemRefProp");
         det.addProperty(itemRefProp);
  
         // 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.
         String[] listValues = { "Portal", "Search Server", "Collaboration Server", "Content Server", "Analytics" };
         ISelectionList selectionList = slManager.createSelectionList(folder, "Products Selection List", listValues);
         selectionList.store();
  
         ISelectionListProperty selectionListProp = propertyManager.createSelectionListProperty("Selection List Prop", "Description for SelectionListProp", selectionList);
         det.addProperty(selectionListProp);
  
         // 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 textBlockProp = propertyManager.createTextBlockProperty("Text Block Prop", "Description for textBlockProp");
         det.addProperty(textBlockProp);
  
         // 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);
  
         // Attach an existing Presentation Template
         det.attachPresentationTemplate(storedPresentationTemplate);
  
         // Actually store the DET with the attached Presentation Template and all the properties associated with it.
         det.store();
 

A persisted Data Entry Template is required to create a content item, otherwise an IllegalStateException will be thrown when IContentItemManager.checkInItem is called. To publish a content item, attachPresentationTemplate is required to call with a IPresentationTemplate with valid template text set, otherwise an IllegalStateException will be thrown.


Method Summary
 void addProperty(IBaseProperty property)
          Adds a property to the Data Entry Template.
 void attachPresentationTemplate(IPresentationTemplate presentationTemplate)
          Attaches an IPresentationTemplate to the Data Entry Template.
 void detachPresentationTemplate()
          Detaches the IPresentationTemplate from this Data Entry Template.
 IBaseProperty[] getAllProperties()
          Returns an array of IBaseProperty for all the properties on the Data Entry Template.
 IPresentationTemplate getAttachedPresentationTemplate()
          Returns the attached Presentation Template or null if no Presentation Template has been attached.
 IFolder getContainingFolder()
          Returns the folder that contains this Data Entry Template.
 java.lang.String getName()
          Returns the Data Entry Template name.
 IBaseProperty getProperty(java.lang.String name)
          Returns an IBaseProperty of the specified name if it exists on the Data Entry Template.
 java.lang.String getUUID()
          Returns the Data Entry Template UUID.
 void removeProperty(IBaseProperty property)
          Removes a property from the Data Entry Template.
 void setName(java.lang.String name)
          Sets the name for this Data Entry Template.
 void store()
          Stores the Data Entry Template.
 

Method Detail

addProperty

public void addProperty(IBaseProperty property)
                 throws NameAlreadyInUseException
Adds a property to the Data Entry Template. The property can be any sub-type of IBaseProperty. The added property will not be persisted until store is called.

All properties in the same Data Entry Template must have a unique name. If a property with the same name and a different type is added, a NameAlreadyInUseException will be thrown. If a property with the same name and the same type is added, it will be ignored.

The updated properties will affect all associated unpublished content items after the Data Entry Template is stored. The updated properties will not affect published content items unless they are republished.

Note: If an ISelectionListProperty is added to the template, and the corresponding selection list is later deleted, the ISelectionListProperty will be automatically removed from the template.

Parameters:
property - a sub-type of IBaseProperty to be added to the Data Entry Template; cannot be null
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed
NameAlreadyInUseException - if there was already a property with the same name in the Data Entry Template
See Also:
ISelectionListManager.removeSelectionList(com.plumtree.remote.prc.content.selectionlist.ISelectionList)

attachPresentationTemplate

public void attachPresentationTemplate(IPresentationTemplate presentationTemplate)
Attaches an IPresentationTemplate to the Data Entry Template. The attachment will not be persisted until store is called. A Presentation Template can only be attached to one Data Entry Template at a time, and similarily, a Data Entry Template can have only one Presentation Template attached at a time. Calling this method when the Data Entry Template already has a Presentation Template attached will result in an IllegalStateException.

If this method is called with a Presentation Template that has already been attached to another Data Entry Template, then an IllegalStateException will be thrown when store is called on the Data Entry Template.

In order to change the attached Presentation Template, call detachPresentationTemplate, store, then attachPresentationTemplate. The Data Entry Template must be persisted after calling detachPresentationTemplate, before attaching a different Presentation Template or an IllegalStateException will be thrown.

This method must be called prior to IContentItemManager.publishContentItem, because when an IContentItem of a particular IDataEntryTemplate is published, the layout of the published item will be determined by the template text of the IPresentationTemplate attached to the item's Data Entry Template.

Parameters:
presentationTemplate - the persisted Presentation Template to be attached to this Data Entry Template; cannot be null. The template text of the attached Presentation Template will be used to determine the layout of the published content items created with this Data Entry Template.
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed, or the Data Entry Template has already been attached with a different Presentation Template, or the Presentation Template has already been removed

detachPresentationTemplate

public void detachPresentationTemplate()
Detaches the IPresentationTemplate from this Data Entry Template. The detachment will not be persisted until store is called. This method can only be called on a persisted Data Entry Template, otherwise an IllegalStateException will be thrown.

Detaching the Presentation Template twice will not result in an exception.

After a Presentation Template is detached from the Data Entry Template and persisted, it can be attached to a different Data Entry Template.

Throws:
java.lang.IllegalStateException - if the Data Entry Template has not been persisted or has already been removed

getAllProperties

public IBaseProperty[] getAllProperties()
Returns an array of IBaseProperty for all the properties on the Data Entry Template. The returned properties are sub-types of IBaseProperty.

If one or more content items have been created with this Data Entry Template, the getAllProperties method can be called on the content item(s) to retrieve the same properties defined on the underlying Data Entry Template.

Returns:
an array of IBaseProperty for all the properties on the Data Entry Template or an empty array if there are no properties. The returned array is not ordered.
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed
See Also:
IContentItem.getAllProperties()

getAttachedPresentationTemplate

public IPresentationTemplate getAttachedPresentationTemplate()
                                                      throws ContentSecurityException,
                                                             ContentException,
                                                             java.rmi.RemoteException
Returns the attached Presentation Template or null if no Presentation Template has been attached.

Returns:
if the attached Presentation Template or null if no Presentation Template has been attached
Throws:
ContentSecurityException - if the user does not have permission to access the attached Presentation Template
ContentException - if the method call resulted in a Publisher exception
java.lang.IllegalStateException - if the Data Entry Template has not been stored or has already been removed
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call

getContainingFolder

public IFolder getContainingFolder()
                            throws ContentSecurityException,
                                   ContentException,
                                   java.rmi.RemoteException
Returns the folder that contains this Data Entry Template.

Returns:
the folder that contains this Data Entry Template
Throws:
ContentSecurityException - if the user does not have permission to access the containing folder
ContentException - if the method call resulted in a Publisher exception
java.lang.IllegalStateException - if the Data Entry Template has not yet been stored or has already been removed
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call

getName

public java.lang.String getName()
Returns the Data Entry Template name.

Returns:
the Data Entry Template name
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed

getProperty

public IBaseProperty getProperty(java.lang.String name)
Returns an IBaseProperty of the specified name if it exists on the Data Entry Template. The returned property is a sub-type of IBaseProperty, that is, its actual type will be one of the derived property types, such as ITextLineProperty, IDoubleProperty, etc.

The parameter name must be the full name of the property, does not support wildcards, will be trimmed of leading and trailing whitespace, and is case-insensitive for comparison.

Parameters:
name - the name of the property to retrieve; cannot be null, empty, or longer than 255 characters. The string used for the name will be trimmed of leading and trailing whitespace and is case-insensitive during comparison.
Returns:
an IBaseProperty matching the specified name on the Data Entry Template or null if no such property exists
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed
See Also:
getAllProperties()

getUUID

public java.lang.String getUUID()
Returns the Data Entry Template UUID. This UUID can be used in IDataEntryTemplateManager.getDataEntryTemplate. to retrieve the template.

Returns:
the Data Entry Template UUID
Throws:
java.lang.IllegalStateException - if the Data Entry Template has not yet been stored or has already been removed

removeProperty

public void removeProperty(IBaseProperty property)
Removes a property from the Data Entry Template. The property can be any sub-type of IBaseProperty. The removal will not be stored permanently until store is called.

Parameters:
property - a sub-type of IBaseProperty to be removed from the Data Entry Template; cannot be null
Throws:
java.lang.IllegalArgumentException - if the property to be removed cannot be found in the Data Entry Template
java.lang.IllegalStateException - if the Data Entry Template has already been removed

setName

public void setName(java.lang.String name)
Sets the name for this Data Entry Template.

Parameters:
name - name of the Data Entry Template; cannot be null, empty, or longer than 255 characters. The string used for the name will be trimmed of leading and trailing whitespace when it is stored and is case-insensitive during name comparison.
Throws:
java.lang.IllegalStateException - if the Data Entry Template has already been removed
java.lang.IllegalArgumentException - if the name is an empty string or longer than 255 characters

store

public void store()
           throws ContentSecurityException,
                  NameAlreadyInUseException,
                  ContentException,
                  java.rmi.RemoteException
Stores the Data Entry Template. This method is used to persist a newly-created Data Entry Template or persist any modification to an existing Data Entry Template, including property addition, removal, or Presentation Template attachment, and detachment.

Throws:
ContentSecurityException - if the user does not have the permission to store the Data Entry Template, or to attach a Presentation Template to it
NameAlreadyInUseException - if there is already a Data Entry Template with the same name in the containing folder
ContentException - if the method call resulted in a Publisher exception
java.lang.IllegalStateException - if the Data Entry Template has already been removed, or the containing folder has been removed, or if the Presentation Template to be attached is already attached to another Data Entry Template
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call


For additional information on the Oracle® WebCenter Interaction Development Kit, including tutorials, blogs, code samples and more, see the Oracle Technology Network (http://www.oracle.com/technology/index.html).

Copyright ©2010 Oracle® Corporation. All Rights Reserved.