com.plumtree.remote.prc.content.presentationtemplate
Interface IPresentationTemplateManager

All Known Subinterfaces:
IPublishablePresentationTemplateManager

public interface IPresentationTemplateManager

Interface for managing IPresentationTemplates. Handles Presentation Template creation, removal, retrieval, and template text validation.

Modifications to the template text will not be stored permanently until IPresentationTemplate.store is called.

Presentation template text can contain PCS tags that conform to the Publisher Templating Language Syntax. PCS tags allow a published content item to contain data that is tied to the content item's values. However, the presentation template text need not contain PCS tags; HTML or plain text is also valid.

PCS tags are formatted like XML elements and begin with the prefix pcs. During publication, Publisher replaces the pcs tag with the value of the expression, or the contents of the tag if the PCS tag expression fails. IPresentationTemplateManager.validateTemplateText can be used to check basic PCS tag syntax but the method does not guarantee proper tag evaluation at publishing time. Text outside pcs tags is left unchanged when the template is processed during publication. Tags can appear inside HTML elements, inside HTML tags, and inside quoted strings.

The following is an example of Presentation Template text that can be used with IPresentationTemplateManager.createPresentationTemplate and IPresentationTemplate.setTemplateText.

 <pcs:value expr="headline"></pcs:value>
 <pcs:value expr="article.author">Anonymous</pcs:value>
 <pcs:value property='writer.name'></pcs:value>
 <img src="<pcs:value expr="photo.location"></pcs:value>">
 <a href="<pcs:value property='homepage.location'></pcs:value>">
 <pcs:value expr='creation_time' format="MMMM dd"></pcs:value>">
 

Refer to the Administrator Guide for AquaLogic Interaction Publisher for additional details on Presentation Template functionality and sample template text values.

The following is an example of validating template text against a persisted IPresentationTemplate.

 string templateText = "No pcs tags in the initial Presentation Template.";
 IFolder rootFolder = folderManager.getRootFolder();
 IPresentationTemplate presentationTemplate = presentationTemplateManager.createPresentationTemplate(rootFolder, "New Presentation Template", templateText);
 // Persist the presentationTemplate
 presentationTemplate.store();
 String[] errorsInText = presentationTemplateManager.validateTemplateText(presentationTemplate, presentationTemplate.getTemplateText());
 if(errorsInText.length != 0)
 {
  // Correct errors in the Presentation Template text
 }
 else
 {
  // No errors were found
 }
 String updatedTemplateText = "<a href=\"<pcs:value property=\'homepage.location\'></pcs:value>\">";
 errorsInText = presentationTemplateManager.validateTemplateText(presentationTemplate, updatedTemplateText);
 // Repeat the above check of the String[] errorsInText
 // to determine if the updatedTemplateText contained errors.
 presentationTemplate.setTemplateText(updatedTemplateText);
 // Persist the presentationTemplate with the new template text
 presentationTemplate.store();
 


Method Summary
 IPresentationTemplate createPresentationTemplate(IFolder containingFolder, java.lang.String name, java.lang.String templateText)
          Creates a new IPresentationTemplate.
 IPresentationTemplate getPresentationTemplate(java.lang.String UUID)
          Returns an IPresentationTemplate by its UUID.
 IPresentationTemplate[] getPresentationTemplates(IFolder folder)
          Returns all IPresentationTemplates in a given IFolder.
 void removePresentationTemplate(IPresentationTemplate presentationTemplate)
          Deletes the IPresentationTemplate.
 java.lang.String[] validateTemplateText(IPresentationTemplate presentationTemplate, java.lang.String templateText)
          Validates the PCS tag syntax in the template text and returns an array of strings indicating the syntax errors or an empty array if there are no errors.
 

Method Detail

createPresentationTemplate

public IPresentationTemplate createPresentationTemplate(IFolder containingFolder,
                                                        java.lang.String name,
                                                        java.lang.String templateText)
Creates a new IPresentationTemplate. IPresentationEntryTemplate.store needs to be called to persist a newly-created Presentation Template, or any modification to the Presentation Template.

An IllegalStateException will be thrown if the containing folder has not been stored.

The following is an example of creating an IPresentationTemplate.

 String templateText = "<a href=\"<pcs:value property=\'homepage.location\'></pcs:value>\">";
 IFolder rootFolder = folderManager.getRootFolder();
 IPresentationTemplate presentationTemplate = presentationTemplateManager.createPresentationTemplate(rootFolder, "New Presentation Template", templateText);
 

Parameters:
containingFolder - the folder the Presentation Template will be created in; cannot be null
name - name of the template. Presentation Template names are case-insensitive, cannot be the empty string, and cannot be 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.
templateText - template text of this Presentation Template. The template text will determine the published layout of any content item associated with this Presentation Template. The text cannot be null but the text can be empty. There is no limit on the length of the template text.
Returns:
an IPresentationTemplate that is not yet persisted. Call IPresentationTemplate.store to persist the template.
Throws:
java.lang.IllegalStateException - if specified folder has not yet been stored or has already been removed
java.lang.IllegalArgumentException - if the name is an empty string or longer than 255 characters

getPresentationTemplate

public IPresentationTemplate getPresentationTemplate(java.lang.String UUID)
                                              throws ContentSecurityException,
                                                     ContentException,
                                                     java.rmi.RemoteException
Returns an IPresentationTemplate by its UUID.

Parameters:
UUID - the Presentation Template UUID; cannot be null, empty, or longer than 255 characters. The UUID of an object can be obtained using the getUUID method in the IPresentationTemplate class.
Returns:
the IPresentationTemplate or null if the Presentation Template does not exist
Throws:
java.lang.IllegalArgumentException - if the UUID is empty or longer than 255 characters
ContentSecurityException - if the user does not have permission to access the template
ContentException - if the method call resulted in a Publisher exception
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call

getPresentationTemplates

public IPresentationTemplate[] getPresentationTemplates(IFolder folder)
                                                 throws ContentSecurityException,
                                                        ContentException,
                                                        java.rmi.RemoteException
Returns all IPresentationTemplates in a given IFolder.

Parameters:
folder - the folder to retrieve Presentation Templates from; cannot be null
Returns:
an array of IPresentationTemplates in the specified folder. The returned array is not ordered.
Throws:
ContentSecurityException - if the user does not have permission to access the folder
ContentException - if the method call resulted in a Publisher exception
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call
java.lang.IllegalStateException - if the folder has not yet been stored or has already been removed

removePresentationTemplate

public void removePresentationTemplate(IPresentationTemplate presentationTemplate)
                                throws ContentSecurityException,
                                       ContentException,
                                       java.rmi.RemoteException
Deletes the IPresentationTemplate.

Parameters:
presentationTemplate - the Presentation Template to be deleted; cannot be null
Throws:
ContentSecurityException - if the user does not have permission to delete the Presentation Template
ContentException - if the method call resulted in a Publisher exception
java.rmi.RemoteException - if there was a communication problem during the execution of the remote method call

validateTemplateText

public java.lang.String[] validateTemplateText(IPresentationTemplate presentationTemplate,
                                               java.lang.String templateText)
                                        throws ContentException,
                                               java.rmi.RemoteException
Validates the PCS tag syntax in the template text and returns an array of strings indicating the syntax errors or an empty array if there are no errors. This method does not guarantee proper PCS tag evaluation at publishing time.

This method will only validate PCS tags. It will not validate html or xml syntax. The template text of a Presentation Template can contain one or more PCS tags which are part of the Publisher Templating Language syntax.

Refer to the Administrator Guide for AquaLogic Interaction Publisher for more details about PCS tags and sample template text values.

If validate returns no errors the template text can be set for a Presentation Template. The template text is used to determine the layout of a content item when it is published.

An example using validateTemplateText can be found in the documentation for IPresentationTemplateManager.

Parameters:
presentationTemplate - the Presentation Template to validate the PCS tag syntax against. The Presentation Template must be live (persisted and not deleted).
templateText - the template PCS tag text to be validiated; cannot be null
Returns:
a string array that indicates each syntax error in the template text or an empty array if there are no errors
Throws:
java.lang.IllegalStateException - if the presentationTemplate is not yet stored or was deleted
ContentException - if the method call resulted in a Publisher exception
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.