@Component
@Exposed
@Scope(value="request",
proxyMode=TARGET_CLASS)
public class WebCmsComponentModelHierarchy
extends Object
WebCmsComponentModelSets that have a scope name.
Components can be looked up by name in the hierarchy in which case (depending on the parameter)
all registered sets will be queried in reverse order until a result is returned.
The hierarchy will always contain an initial scope name GLOBAL and DOMAIN.
Both scopes will fetch a component from the repository only when it is requested.
If no current domain is active, the DOMAIN scope will be an alias to GLOBAL.
Otherwise the DOMAIN scope will contain all components shared across that domain.| Modifier and Type | Field and Description |
|---|---|
static String |
ASSET |
static String |
CONTAINER |
static String |
DEFAULT |
static String |
DOMAIN |
static String |
GLOBAL |
static String |
REQUEST_ATTRIBUTE |
| Constructor and Description |
|---|
WebCmsComponentModelHierarchy() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsScope(String scopeName) |
WebCmsComponentModel |
get(String componentName)
Get the component by name by traversing the entire hierarchy bottom up.
|
WebCmsComponentModel |
get(String componentName,
boolean searchParentScopes)
Get the component by name and optionally traverse the hierarchy.
|
WebCmsComponentModelSet |
getComponentsForScope(String scopeName) |
String |
getDefaultScope()
Get the first scope that will be checked when requesting a component.
|
WebCmsComponentModel |
getFromScope(String componentName,
String scopeName)
Get the component by name from the specific scope.
|
WebCmsComponentModel |
getFromScope(String componentName,
String scopeName,
boolean searchParentScopes)
Get the component by name from a specific scope.
|
Collection<String> |
getScopeNames() |
void |
registerAliasForScope(String alias,
String targetScopeName)
Add an alias for another scope.
|
void |
registerComponentsForScope(WebCmsComponentModelSet componentModelSet,
String scopeName)
Add a set of components to the very end of the hierarchy.
|
boolean |
removeComponents(String scopeName)
Removes the components for that scope.
|
boolean |
removeComponents(WebCmsComponentModelSet componentModelSet) |
void |
setScopeOrder(String... scopeNames)
Re-order all scopes.
|
public static final String REQUEST_ATTRIBUTE
public static final String GLOBAL
public static final String DEFAULT
public static final String DOMAIN
public static final String ASSET
public static final String CONTAINER
public void registerComponentsForScope(WebCmsComponentModelSet componentModelSet, String scopeName)
componentModelSet - to addscopeName - for which to register componentspublic boolean removeComponents(String scopeName)
public boolean removeComponents(WebCmsComponentModelSet componentModelSet)
public WebCmsComponentModelSet getComponentsForScope(String scopeName)
scopeName - namepublic void setScopeOrder(String... scopeNames)
scopeNames - in orderpublic Collection<String> getScopeNames()
public String getDefaultScope()
null if the hierarchy is emptypublic WebCmsComponentModel get(String componentName)
componentName - name of the componentpublic WebCmsComponentModel get(String componentName, boolean searchParentScopes)
componentName - name of the componentsearchParentScopes - true if parent scopes should be searched as wellpublic WebCmsComponentModel getFromScope(String componentName, String scopeName)
componentName - name of the componentscopeName - name of the scope to start withpublic WebCmsComponentModel getFromScope(String componentName, String scopeName, boolean searchParentScopes)
componentName - name of the componentscopeName - name of the scope to start withsearchParentScopes - true if parent scopes should be searched as wellpublic void registerAliasForScope(String alias, String targetScopeName)
alias - to addtargetScopeName - the alias is forpublic boolean containsScope(String scopeName)
Copyright © 2020. All rights reserved.