org.springframework.extensions.surf
Class PresetsManager

java.lang.Object
  extended by org.springframework.extensions.surf.PresetsManager

public class PresetsManager
extends Object

Spring util bean responsible for preset model object generation.

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:
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:

     
         
             
                 ${scope}
                 title
                 site/${siteid}/dashboard
                 /components/title/collaboration-title
             
             ...
 
where the values of "${scope}" and "${siteid}" would be replaced if supplied in the token map during preset construction. See the method constructPreset() below.

Author:
Kevin Roast

Constructor Summary
PresetsManager()
           
 
Method Summary
 void constructPreset(Model model, String id, Map<String,String> tokens)
          Construct the model objects for a given preset.
 void setFiles(List<String> files)
           
 void setSearchPath(SearchPath searchPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PresetsManager

public PresetsManager()
Method Detail

setSearchPath

public void setSearchPath(SearchPath searchPath)
Parameters:
searchPath - the SearchPath to set

setFiles

public void setFiles(List<String> files)
Parameters:
files - the preset files list to set

constructPreset

public void constructPreset(Model model,
                            String id,
                            Map<String,String> tokens)
Construct the model objects for a given preset. Objects persist to the default store for the appropriate object type.

Parameters:
id - Preset ID to use
tokens - Name value pair tokens to replace in preset definition


Copyright © 2009 SpringSource, Inc. All Rights Reserved.