public class PresetsManager extends Object
Presets are defined as XML snippets representing the model objects for a given set. Each file can contain many presets each referenced by a unique ID. The preset definitions can be located in any Store and any number of stores can be searched.
A set of parameterised model objects such as page, template instances and component bindings can be defined for a preset. The XML for each model object definition is effectively identical to that used to define the model object within its own file - but nested within the preset structure as follows:
<One important difference to standard model object XML is that the ID for an object is specified as an attribute on the parent element, for instance:?xml version='1.0' encoding='UTF-8'?> <presets> <preset id="someid"> <components> ... </components> <pages> ... </pages> <template-instances> ... </template-instances> </preset> <preset id="anotherid"> ... </preset> </presets>
<page id="user/${userid}/dashboard">
See the file slingshot\config\alfresco\site-data\presets\presets.xml for example usage.
Each preset supports parameterisation via "token" name/value pair replacements. For example:
<preset id="site-dashboard">
<components>
<component>
<scope>${scope}</scope>
<region-id>title</region-id>
<source-id>site/${siteid}/dashboard</source-id>
<url>/components/title/collaboration-title</url>
</component>
...
where the values of "${scope}" and "${siteid}" would be replaced if supplied in the token
map during preset construction. See the method constructPreset() below.
| Constructor and Description |
|---|
PresetsManager() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
constructPreset(String id,
Map<String,String> tokens)
Construct the model objects for a given preset.
|
void |
setFiles(List<String> files)
This setter is provided to allow the Spring application context to set the filename suffices
that should be used for presets.
|
void |
setModelObjectService(ModelObjectService modelObjectService) |
void |
setSearchPath(org.springframework.extensions.webscripts.SearchPath searchPath) |
public void setModelObjectService(ModelObjectService modelObjectService)
modelObjectService - the model object servicepublic void setSearchPath(org.springframework.extensions.webscripts.SearchPath searchPath)
searchPath - The SearchPath to setpublic void setFiles(List<String> files)
This setter is provided to allow the Spring application context to set the filename suffices that should be used for presets. Originally this was treated as a list of complete filenames but has since been expanded to increase the ability to extend default application presets.
files - A list of filename suffices that can be matched to presets configuration files.public boolean constructPreset(String id, Map<String,String> tokens)
id - Preset ID to usetokens - Name value pair tokens to replace in preset definitionCopyright © 2005–2016 Alfresco Software. All rights reserved.