Package org.opencms.ade.galleries
Class CmsAddContentRestriction
- java.lang.Object
-
- org.opencms.ade.galleries.CmsAddContentRestriction
-
public class CmsAddContentRestriction extends java.lang.Object
Replacement configuration for the 'add content' dialog.A replacement configuration contains a list of entries, one for each type, with a list of resources for each type and optionally a title string for each of the resources. The list of resources replaces the search results that would be normally shown for the type in the 'add content' dialog.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsAddContentRestriction.TypeEntry
Contains the replacements (and titles of the replacements) for a single type.
-
Field Summary
Fields Modifier and Type Field Description static CmsAddContentRestriction
EMPTY
Empty configuration.static java.lang.String
N_ENTRY
XML node name.static java.lang.String
N_RESOURCE
XML node name.static java.lang.String
N_TITLE
XML node name.static java.lang.String
N_TYPE
XML node name.static java.lang.String
TYPE_NAME
The name of the resource type from which the configuration is read.
-
Constructor Summary
Constructors Constructor Description CmsAddContentRestriction(java.util.Collection<CmsAddContentRestriction.TypeEntry> entries)
Creates a new configuration from a list of entries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CmsGallerySearchResult>
getResult(CmsObject cms, java.lang.String type)
Gets the replaced results for a specific resource type.java.util.Set<java.lang.String>
getTypes()
Gets the set of names of types for which the search results are replaced.CmsAddContentRestriction
merge(CmsAddContentRestriction child)
Merges this configuration and a child configuration into a new configuration object, where an entry for a type in the child overrides an entry for the same type in the parent.static CmsAddContentRestriction
read(CmsObject cms, I_CmsXmlContentLocation parent, java.lang.String nodeName)
Reads a content restriction from an XML content.static CmsAddContentRestriction.TypeEntry
readEntry(CmsObject cms, I_CmsXmlContentValueLocation location)
Reads the entry for a single type from the configuration.
-
-
-
Field Detail
-
EMPTY
public static final CmsAddContentRestriction EMPTY
Empty configuration.
-
N_ENTRY
public static final java.lang.String N_ENTRY
XML node name.- See Also:
- Constant Field Values
-
N_RESOURCE
public static final java.lang.String N_RESOURCE
XML node name.- See Also:
- Constant Field Values
-
N_TITLE
public static final java.lang.String N_TITLE
XML node name.- See Also:
- Constant Field Values
-
N_TYPE
public static final java.lang.String N_TYPE
XML node name.- See Also:
- Constant Field Values
-
TYPE_NAME
public static final java.lang.String TYPE_NAME
The name of the resource type from which the configuration is read.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsAddContentRestriction
public CmsAddContentRestriction(java.util.Collection<CmsAddContentRestriction.TypeEntry> entries)
Creates a new configuration from a list of entries.- Parameters:
entries
- the list of configuration entries
-
-
Method Detail
-
read
public static CmsAddContentRestriction read(CmsObject cms, I_CmsXmlContentLocation parent, java.lang.String nodeName)
Reads a content restriction from an XML content.- Parameters:
cms
- the CMS contextparent
- the parent locationnodeName
- the name of the XML elements containing the content restrictions- Returns:
- the content restriction
-
readEntry
public static CmsAddContentRestriction.TypeEntry readEntry(CmsObject cms, I_CmsXmlContentValueLocation location)
Reads the entry for a single type from the configuration.- Parameters:
cms
- the CMS contextlocation
- the location from which to read the entry- Returns:
- the entry that was read
-
getResult
public java.util.List<CmsGallerySearchResult> getResult(CmsObject cms, java.lang.String type)
Gets the replaced results for a specific resource type.- Parameters:
cms
- the CMS contexttype
- the type name- Returns:
- the replacement results for the given type
-
getTypes
public java.util.Set<java.lang.String> getTypes()
Gets the set of names of types for which the search results are replaced.- Returns:
- the set of types for which there are replacements configured
-
merge
public CmsAddContentRestriction merge(CmsAddContentRestriction child)
Merges this configuration and a child configuration into a new configuration object, where an entry for a type in the child overrides an entry for the same type in the parent.- Parameters:
child
- the child configuration- Returns:
- the merged configuration
-
-