|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface
for managing IPresentationTemplate
s.
Handles Presentation Template creation, removal, retrieval,
and template text validation.
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 IPresentationTemplate s 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 |
public IPresentationTemplate createPresentationTemplate(IFolder containingFolder, java.lang.String name, java.lang.String templateText)
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);
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.
IPresentationTemplate
that
is not yet persisted. Call IPresentationTemplate.
store
to persist the template.
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 characterspublic IPresentationTemplate getPresentationTemplate(java.lang.String UUID) throws ContentSecurityException, ContentException, java.rmi.RemoteException
IPresentationTemplate
by its UUID.
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.
IPresentationTemplate
or null
if the Presentation Template does not exist
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 callpublic IPresentationTemplate[] getPresentationTemplates(IFolder folder) throws ContentSecurityException, ContentException, java.rmi.RemoteException
IPresentationTemplate
s in a given IFolder
.
folder
- the folder to retrieve Presentation Templates from;
cannot be null
IPresentationTemplate
s in the
specified folder. The returned array is not ordered.
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 removedpublic void removePresentationTemplate(IPresentationTemplate presentationTemplate) throws ContentSecurityException, ContentException, java.rmi.RemoteException
IPresentationTemplate
.
presentationTemplate
- the Presentation Template
to be deleted; cannot be null
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 callpublic java.lang.String[] validateTemplateText(IPresentationTemplate presentationTemplate, java.lang.String templateText) throws ContentException, java.rmi.RemoteException
IPresentationTemplateManager
.
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
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright ©2010 Oracle® Corporation. All Rights Reserved.