Package org.ametys.cms.contenttype
Class EditContentTypeHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.contenttype.EditContentTypeHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Helper for create, edit and remove a content type
-
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The ametys object resolver instanceprotected ContentDAO
DAO for contentsprotected ContentTypeExtensionPoint
The content type extension point instanceprotected SourceResolver
The source resolverstatic final String
The Avalon role name -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canRemoveContentType
(String contentTypeId) Determines if the content type can be removedvoid
createContentType
(ContentTypeDefinition contentTypeDef) Create a new content type.void
editContentType
(ContentTypeDefinition contentTypeDef) Modify a existing content type.Get the root directory for all archived content types.getArchiveRootDirectory
(ContentType contentType) Get the root archive directory for a given content type.getContentTypeDirectory
(ContentType contentType) Get the root directory for a given content type.getContentTypeDirectory
(ContentTypeDefinition contentType, boolean override) Get the root directory for a given content type.getContentTypeFile
(ContentType contentType) Get the XML definition file for a given content type.getContentTypeFile
(ContentTypeDefinition contentType, boolean override) Get the XML definition file for a given content type.Get the root directory for all custom content types.void
removeContentType
(String contentTypeId) Remove a existing content type defined in WEB-INF/param/content-types directory.
This method archived the content type into the WEB-INF/param/content-types/_archives/pluginName folder.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role name -
_sourceResolver
The source resolver -
_ametysObjectResolver
The ametys object resolver instance -
_contentTypeExtensionPoint
The content type extension point instance -
_contentDAO
DAO for contents
-
-
Constructor Details
-
EditContentTypeHelper
public EditContentTypeHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getContentTypeRootDirectory
Get the root directory for all custom content types. The directory is created if does not exist.- Returns:
- the root directory for all custom content types.
- Throws:
MalformedURLException
- if failed to get the root directoryIOException
- if failed to get the root directory
-
getArchiveRootDirectory
Get the root directory for all archived content types. The directory is created if does not exist.- Returns:
- the root directory for archived content types.
- Throws:
MalformedURLException
- if failed to get the root directoryIOException
- if failed to get the root directory
-
getArchiveRootDirectory
public File getArchiveRootDirectory(ContentType contentType) throws MalformedURLException, IOException Get the root archive directory for a given content type. The directory is created if does not exist.- Parameters:
contentType
- The content type- Returns:
- the root archive directory for this content type.
- Throws:
MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directory
-
getContentTypeDirectory
public File getContentTypeDirectory(ContentTypeDefinition contentType, boolean override) throws MalformedURLException, IOException Get the root directory for a given content type. The directory is created if does not exist.- Parameters:
contentType
- The content type definitionoverride
- true if this is a overriden content type.- Returns:
- the root directory for this content type.
- Throws:
MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directory
-
getContentTypeDirectory
public File getContentTypeDirectory(ContentType contentType) throws MalformedURLException, IOException Get the root directory for a given content type. The directory is created if does not exist.- Parameters:
contentType
- The content type- Returns:
- the root directory for this content type.
- Throws:
MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directory
-
getContentTypeFile
public File getContentTypeFile(ContentTypeDefinition contentType, boolean override) throws MalformedURLException, IOException Get the XML definition file for a given content type.- Parameters:
contentType
- The content type definitionoverride
- true if this is a overriden content type.- Returns:
- the XML definition file for this content type.
- Throws:
MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directory
-
getContentTypeFile
Get the XML definition file for a given content type.- Parameters:
contentType
- The content type- Returns:
- the XML definition file for this content type.
- Throws:
MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directory
-
createContentType
Create a new content type. This method creates a new xml file into WEB-INF/param/content-types folder.- Parameters:
contentTypeDef
- The content type definition- Throws:
EditContentTypeException
- if failed to create the content type
-
editContentType
Modify a existing content type. This method edit the corresponding XML file of the content type in WEB-INF/param/content-types folder.- Parameters:
contentTypeDef
- The content type definition- Throws:
EditContentTypeException
- if failed to edit this content type
-
canRemoveContentType
Determines if the content type can be removed- Parameters:
contentTypeId
- The id of content type- Returns:
- true if the content type can be removed
-
removeContentType
Remove a existing content type defined in WEB-INF/param/content-types directory.
This method archived the content type into the WEB-INF/param/content-types/_archives/pluginName folder.- Parameters:
contentTypeId
- the id of content type to remove- Throws:
RemoveContentTypeException
- if the content type could not be removed
-