public class EditContentTypeHelper extends AbstractLogEnabled implements Component, Serviceable
Modifier and Type | Field and Description |
---|---|
private static String |
__CONTENT_TYPE_PREFIX
The prefix for id of automatic content types
|
private static String |
__CONTENT_TYPES_DIR
The directory path of content types
|
private static String |
__NAMESPACE_URI
The namespace uri
|
protected AmetysObjectResolver |
_ametysObjectResolver
The ametys object resolver instance
|
protected ContentDAO |
_contentDAO
DAO for contents
|
protected ContentTypeExtensionPoint |
_contentTypeExtensionPoint
The content type extension point instance
|
protected SourceResolver |
_sourceResolver
The source resolver
|
static String |
ROLE
The Avalon role name
|
Constructor and Description |
---|
EditContentTypeHelper() |
Modifier and Type | Method and Description |
---|---|
private void |
_archiveContentType(ContentType contentType) |
private boolean |
_isAutomaticContentType(String contentTypeId) |
private boolean |
_isInUseContentType(String contentTypeId) |
private boolean |
_isLeafContentType(String contentTypeId) |
private void |
_saxChildrenMetadata(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxComposite(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxContentType(ContentTypeDefinition contentTypeDef,
boolean override) |
private void |
_saxContentType(ContentTypeDefinition contentTypeDef,
boolean override,
TransformerHandler handler) |
private void |
_saxCustomEnumerator(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxCustomValidator(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxDefaultEnumerator(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxDefaultMetadataSet(String name,
String view,
TransformerHandler handler) |
private void |
_saxDefaultMetadataSets(TransformerHandler handler) |
private void |
_saxDefaultValidator(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxEnumeration(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxGeneralInformation(ContentTypeDefinition contentTypeDef,
TransformerHandler handler) |
private void |
_saxI18nizableText(TransformerHandler handler,
String tagName,
I18nizableText text) |
private void |
_saxI18nizableText(TransformerHandler handler,
String tagName,
I18nizableText text,
AttributesImpl attrs) |
private void |
_saxIcons(String iconGlyph,
TransformerHandler handler) |
private void |
_saxMetadata(ContentTypeDefinition contentTypeDef,
TransformerHandler handler) |
private void |
_saxMetadata(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxMetadataSets(AbstractMetadataSetElement abstractMetadataSetElement,
TransformerHandler handler) |
private void |
_saxMetadataSets(ContentTypeDefinition contentType,
TransformerHandler handler) |
private void |
_saxParentRef(String parentRef,
TransformerHandler handler) |
private void |
_saxRepeater(RepeaterDefinition repeater,
TransformerHandler handler) |
private void |
_saxRight(String right,
TransformerHandler handler) |
private void |
_saxSimpleMetadata(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxTags(Set<String> tags,
TransformerHandler handler) |
private void |
_saxValidator(MetadataDefinition metadata,
TransformerHandler handler) |
private void |
_saxWidget(MetadataDefinition metadata,
TransformerHandler handler) |
boolean |
canRemoveContentType(String contentTypeId)
Determines if the content type can be removed
|
void |
createContentType(ContentTypeDefinition contentTypeDef)
Create a new content type.
|
void |
editContentType(ContentTypeDefinition contentTypeDef)
Modify a existing content type.
|
File |
getArchiveRootDirectory()
Get the root directory for all archived content types.
|
File |
getArchiveRootDirectory(ContentType contentType)
Get the root archive directory for a given content type.
|
File |
getContentTypeDirectory(ContentType contentType)
Get the root directory for a given content type.
|
File |
getContentTypeDirectory(ContentTypeDefinition contentType,
boolean override)
Get the root directory for a given content type.
|
File |
getContentTypeFile(ContentType contentType)
Get the XML definition file for a given content type.
|
File |
getContentTypeFile(ContentTypeDefinition contentType,
boolean override)
Get the XML definition file for a given content type.
|
File |
getContentTypeRootDirectory()
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) |
getLogger, setLogger
private static final String __CONTENT_TYPES_DIR
private static final String __CONTENT_TYPE_PREFIX
private static final String __NAMESPACE_URI
protected SourceResolver _sourceResolver
protected AmetysObjectResolver _ametysObjectResolver
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
protected ContentDAO _contentDAO
public EditContentTypeHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public File getContentTypeRootDirectory() throws MalformedURLException, IOException
MalformedURLException
- if failed to get the root directoryIOException
- if failed to get the root directorypublic File getArchiveRootDirectory() throws MalformedURLException, IOException
MalformedURLException
- if failed to get the root directoryIOException
- if failed to get the root directorypublic File getArchiveRootDirectory(ContentType contentType) throws MalformedURLException, IOException
contentType
- The content typeMalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directorypublic File getContentTypeDirectory(ContentTypeDefinition contentType, boolean override) throws MalformedURLException, IOException
contentType
- The content type definitionoverride
- true if this is a overriden content type.MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directorypublic File getContentTypeDirectory(ContentType contentType) throws MalformedURLException, IOException
contentType
- The content typeMalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directorypublic File getContentTypeFile(ContentTypeDefinition contentType, boolean override) throws MalformedURLException, IOException
contentType
- The content type definitionoverride
- true if this is a overriden content type.MalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directorypublic File getContentTypeFile(ContentType contentType) throws MalformedURLException, IOException
contentType
- The content typeMalformedURLException
- if failed to get the archive directoryIOException
- if failed to get the archive directorypublic void createContentType(ContentTypeDefinition contentTypeDef) throws EditContentTypeException
contentTypeDef
- The content type definitionEditContentTypeException
- if failed to create the content typepublic void editContentType(ContentTypeDefinition contentTypeDef) throws EditContentTypeException
contentTypeDef
- The content type definitionEditContentTypeException
- if failed to edit this content typeprivate void _saxContentType(ContentTypeDefinition contentTypeDef, boolean override) throws EditContentTypeException
EditContentTypeException
private void _saxContentType(ContentTypeDefinition contentTypeDef, boolean override, TransformerHandler handler) throws SAXException, EditContentTypeException, ConfigurationException
private void _saxGeneralInformation(ContentTypeDefinition contentTypeDef, TransformerHandler handler) throws SAXException, EditContentTypeException
SAXException
EditContentTypeException
private void _saxIcons(String iconGlyph, TransformerHandler handler) throws SAXException
SAXException
private void _saxTags(Set<String> tags, TransformerHandler handler) throws SAXException
SAXException
private void _saxParentRef(String parentRef, TransformerHandler handler) throws SAXException
SAXException
private void _saxRight(String right, TransformerHandler handler) throws SAXException
SAXException
private void _saxMetadata(ContentTypeDefinition contentTypeDef, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxMetadata(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxRepeater(RepeaterDefinition repeater, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxComposite(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxChildrenMetadata(MetadataDefinition metadata, TransformerHandler handler) throws ConfigurationException, SAXException
ConfigurationException
SAXException
private void _saxSimpleMetadata(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxWidget(MetadataDefinition metadata, TransformerHandler handler) throws SAXException
SAXException
private void _saxEnumeration(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxDefaultEnumerator(MetadataDefinition metadata, TransformerHandler handler)
private void _saxCustomEnumerator(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxValidator(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxDefaultValidator(MetadataDefinition metadata, TransformerHandler handler) throws SAXException
SAXException
private void _saxCustomValidator(MetadataDefinition metadata, TransformerHandler handler) throws SAXException, ConfigurationException
SAXException
ConfigurationException
private void _saxMetadataSets(ContentTypeDefinition contentType, TransformerHandler handler) throws SAXException
SAXException
private void _saxDefaultMetadataSets(TransformerHandler handler) throws SAXException
SAXException
private void _saxDefaultMetadataSet(String name, String view, TransformerHandler handler) throws SAXException
SAXException
private void _saxMetadataSets(AbstractMetadataSetElement abstractMetadataSetElement, TransformerHandler handler) throws SAXException
SAXException
private void _saxI18nizableText(TransformerHandler handler, String tagName, I18nizableText text) throws SAXException
SAXException
private void _saxI18nizableText(TransformerHandler handler, String tagName, I18nizableText text, AttributesImpl attrs) throws SAXException
SAXException
public boolean canRemoveContentType(String contentTypeId)
contentTypeId
- The id of content typepublic void removeContentType(String contentTypeId) throws RemoveContentTypeException
contentTypeId
- the id of content type to removeRemoveContentTypeException
- if the content type could not be removedprivate void _archiveContentType(ContentType contentType) throws RemoveContentTypeException
RemoveContentTypeException
private boolean _isInUseContentType(String contentTypeId)
private boolean _isAutomaticContentType(String contentTypeId)
private boolean _isLeafContentType(String contentTypeId)