public class CmsResourceTypeConfig extends java.lang.Object implements I_CmsConfigurationObject<CmsResourceTypeConfig>
| Modifier and Type | Class and Description |
|---|---|
static class |
CmsResourceTypeConfig.AddMenuType
Enum used to distinguish the type of menu in which a configured resource type can be displayed.
|
static class |
CmsResourceTypeConfig.AddMenuVisibility
Represents the visibility status of a resource type in the 'Add' menu of the container page editor.
|
| Modifier and Type | Field and Description |
|---|---|
protected CmsObject |
m_cms
The CMS object used for VFS operations.
|
DEFAULT_ORDER| Constructor and Description |
|---|
CmsResourceTypeConfig(java.lang.String typeName,
boolean disabled,
CmsContentFolderDescriptor folder,
java.lang.String pattern)
Creates a new resource type configuration.
|
CmsResourceTypeConfig(java.lang.String typeName,
boolean disabled,
CmsContentFolderDescriptor folder,
java.lang.String pattern,
boolean detailPagesDisabled,
boolean addDisabled,
boolean createDisabled,
CmsUUID elementView,
java.lang.String localization,
java.lang.Boolean showInDefaultView,
java.lang.Boolean copyInModels,
int order,
CmsCntPageData.ElementDeleteMode elementDeleteMode)
Creates a new resource type configuration.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkCreatable(CmsObject cms,
java.lang.String pageFolderRootPath)
Checks if this resource type is creatable.
|
void |
checkInitialized()
Checks whether the object is initialized and throws an exception otherwise.
|
void |
checkOffline(CmsObject cms)
Checks whether the cms context is in the offline project and throws an exception otherwise.
|
boolean |
checkViewable(CmsObject cms,
java.lang.String referenceUri)
Checks if a resource type is viewable for the current user.
|
void |
configureCreateNewElement(CmsObject cms,
java.lang.String pageFolderRootPath,
CmsNewResourceBuilder builder)
Similar to createNewElement, but just sets parameters on a resource builder instead of actually creating the resource.
|
protected CmsResourceTypeConfig |
copy()
Creates a shallow copy of this resource type configuration object.
|
protected CmsResourceTypeConfig |
copy(boolean disabled)
Creates a shallow copy of this resource type configuration object.
|
CmsResource |
createNewElement(CmsObject userCms,
CmsResource modelResource,
java.lang.String pageFolderRootPath)
Creates a new element.
|
CmsResource |
createNewElement(CmsObject userCms,
java.lang.String pageFolderRootPath)
Creates a new element.
|
CmsResourceTypeConfig.AddMenuVisibility |
getAddMenuVisibility(CmsUUID elementViewId,
CmsResourceTypeConfig.AddMenuType menuType)
Gets the visibility status in the 'add' menu for this type and the given element view.
|
java.lang.String |
getConfiguredWorkplaceBundle()
Returns the bundle that is configured as workplace bundle for the resource type, or
null if none is configured. |
CmsCntPageData.ElementDeleteMode |
getElementDeleteMode()
Gets the element delete mode.
|
CmsUUID |
getElementView()
Returns the element view id.
|
protected CmsContentFolderDescriptor |
getFolderOrName()
Returns the folder bean from the configuration.
|
java.lang.String |
getFolderPath(CmsObject cms,
java.lang.String pageFolderRootPath)
Computes the folder path for this resource type.
|
java.lang.String |
getKey()
The name of the configuration object.
|
protected java.lang.String |
getNamePattern()
Gets the configured name pattern.
|
java.lang.String |
getNamePattern(boolean useDefaultIfEmpty)
Gets the name pattern.
|
int |
getOrder()
Returns the number used for sorting module resource types.
|
I_CmsResourceType |
getType()
Gets the actual resource type for which this is a configuration.
|
java.lang.String |
getTypeName()
Returns the type name.
|
void |
initialize(CmsObject cms)
Initializes this instance.
|
boolean |
isAddDisabled()
Returns true if adding elements of this type via ADE should be disabled.
|
boolean |
isCopyInModels()
Returns if elements of this type when used in models should be copied instead of reused.
|
boolean |
isCreateDisabled()
Returns whether creating elements of this type via ADE should be disabled.
|
boolean |
isDetailPagesDisabled()
True if the detail page creation should be disabled for this resource type.
|
boolean |
isDisabled()
If true, this configuration object will disable an inherited configuration object of the same name.
|
boolean |
isPageRelative()
Returns true if this resource type is configured as 'page relative', i.e. elements of this type are to be stored
with the container page on which they were created.
|
boolean |
isShowInDefaultView()
Returns true if the type should be shown in the default view if it is not assigned to it.
|
CmsResourceTypeConfig |
merge(CmsResourceTypeConfig childConfig)
Merges this configuration object with a child configuration object.
|
protected CmsObject |
rootCms(CmsObject cms)
Creates a new CMS object based on existing one and changes its site root to the site root.
|
protected void |
tryToUnlock(CmsObject cms,
java.lang.String folderPath)
Tries to remove a lock on an ancestor of a given path owned by the current user.
|
protected void |
updateBasePath(java.lang.String basePath)
Updates the base path for the folder information.
|
public CmsResourceTypeConfig(java.lang.String typeName, boolean disabled, CmsContentFolderDescriptor folder, java.lang.String pattern)
typeName - the resource type namedisabled - true if this is a disabled configurationfolder - the folder referencepattern - the name patternpublic CmsResourceTypeConfig(java.lang.String typeName, boolean disabled, CmsContentFolderDescriptor folder, java.lang.String pattern, boolean detailPagesDisabled, boolean addDisabled, boolean createDisabled, CmsUUID elementView, java.lang.String localization, java.lang.Boolean showInDefaultView, java.lang.Boolean copyInModels, int order, CmsCntPageData.ElementDeleteMode elementDeleteMode)
typeName - the resource type namedisabled - true if this is a disabled configurationfolder - the folder referencepattern - the name patterndetailPagesDisabled - true if detail page creation should be disabled for this typeaddDisabled - true if adding elements of this type via ADE should be disabledcreateDisabled - true if creating elements of this type via ADE should be disabledelementView - the element view idlocalization - the base name of the bundle to add as workplace bundle for the resource typeshowInDefaultView - if true, the element type should be shown in the default element view even if it doesn't belong to itcopyInModels - if elements of this type when used in models should be copied instead of reusedelementDeleteMode - the element delete modeorder - the number used for sorting resource types from modulespublic boolean checkCreatable(CmsObject cms, java.lang.String pageFolderRootPath) throws CmsException
cms - the current CMS contextpageFolderRootPath - the root path of the folder containing the current container pagetrue if the resource type is creatableCmsException - if something goes wrongpublic void checkInitialized()
public void checkOffline(CmsObject cms)
cms - the cms contextpublic boolean checkViewable(CmsObject cms, java.lang.String referenceUri)
cms - the current CMS contextreferenceUri - the resource URI to check permissions fortrue if the resource type is viewablepublic void configureCreateNewElement(CmsObject cms, java.lang.String pageFolderRootPath, CmsNewResourceBuilder builder) throws CmsException
cms - the CMS contextpageFolderRootPath - the page folder root pathbuilder - the resource builderCmsException - if something goes wrongpublic CmsResource createNewElement(CmsObject userCms, CmsResource modelResource, java.lang.String pageFolderRootPath) throws CmsException
userCms - the CMS context to usemodelResource - the model resource to usepageFolderRootPath - the root path of the folder containing the current container pageCmsException - if something goes wrongpublic CmsResource createNewElement(CmsObject userCms, java.lang.String pageFolderRootPath) throws CmsException
userCms - the CMS context to usepageFolderRootPath - root path of the folder containing the current container pageCmsException - if something goes wrongpublic CmsResourceTypeConfig.AddMenuVisibility getAddMenuVisibility(CmsUUID elementViewId, CmsResourceTypeConfig.AddMenuType menuType)
elementViewId - the id of the view for which to compute the visibility statusmenuType - the menu type for which we want to evaluate the visibilitypublic java.lang.String getConfiguredWorkplaceBundle()
null if none is configured.null if none is configured.public CmsCntPageData.ElementDeleteMode getElementDeleteMode()
public CmsUUID getElementView()
public java.lang.String getFolderPath(CmsObject cms, java.lang.String pageFolderRootPath)
cms - the cms context to usepageFolderRootPath - root path of the folder containing the current container pagepublic java.lang.String getKey()
I_CmsConfigurationObjectThis name should be unique for each single configuration
getKey in interface I_CmsConfigurationObject<CmsResourceTypeConfig>I_CmsConfigurationObject.getKey()public java.lang.String getNamePattern(boolean useDefaultIfEmpty)
useDefaultIfEmpty - if true, uses a default value if the name pattern isn't set directlypublic int getOrder()
public I_CmsResourceType getType() throws CmsException
CmsException - if something goes wrongpublic java.lang.String getTypeName()
public void initialize(CmsObject cms)
cms - the CMS context to usepublic boolean isAddDisabled()
public boolean isCopyInModels()
public boolean isCreateDisabled()
true if creating elements of this type via ADE should be disabledpublic boolean isDetailPagesDisabled()
public boolean isDisabled()
I_CmsConfigurationObjectisDisabled in interface I_CmsConfigurationObject<CmsResourceTypeConfig>I_CmsConfigurationObject.isDisabled()public boolean isPageRelative()
public boolean isShowInDefaultView()
This defaults to 'false' if not set.
public CmsResourceTypeConfig merge(CmsResourceTypeConfig childConfig)
I_CmsConfigurationObjectmerge in interface I_CmsConfigurationObject<CmsResourceTypeConfig>childConfig - the child configuration objectI_CmsConfigurationObject.merge(org.opencms.ade.configuration.I_CmsConfigurationObject)protected CmsResourceTypeConfig copy()
protected CmsResourceTypeConfig copy(boolean disabled)
disabled - true if the copy should be disabled regardless of whether the original is disabledprotected CmsContentFolderDescriptor getFolderOrName()
Normally, you should use getFolderPath() instead.
protected java.lang.String getNamePattern()
protected CmsObject rootCms(CmsObject cms) throws CmsException
cms - the CMS contextCmsException - if something goes wrongprotected void tryToUnlock(CmsObject cms, java.lang.String folderPath) throws CmsException
cms - the CMS contextfolderPath - the path for which the lock should be removedCmsException - if something goes wrongprotected void updateBasePath(java.lang.String basePath)
basePath - the new base path