Class ContentTypeServiceInternalImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.content.internal.ContentTypeServiceInternalImpl
- All Implemented Interfaces:
ContentTypeServiceInternal
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConfigurationServiceprotected ContentServiceprotected final Stringprotected final Stringprotected final Stringprotected final ContentTypeServiceprotected final Stringprotected final Stringprotected final Stringprotected final Stringprotected final ItemDAOprotected final Stringprotected final SecurityServiceprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionContentTypeServiceInternalImpl(ContentTypeService contentTypeService, SecurityService securityService, ConfigurationService configurationService, ItemDAO itemDao, String contentTypeBasePathPattern, String contentTypeDefinitionFilename, String contentTypeConfigFilename, String contentTypesRootPath, String templateXPath, String controllerPattern, String controllerFormat, String previewImageXPath, String defaultPreviewImagePath, GitRepositoryHelper gitRepositoryHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteContentType(String siteId, String contentType, boolean deleteDependencies) Deletes all files related to a given content-typegetAllModelDefinitions(String site) Get all content types for the given site.getContentTypeControllerPath(String contentTypeId) Builds the path of the Groovy controller for a given content type idprotected StringgetContentTypePath(String contentType) org.apache.commons.lang3.tuple.ImmutablePair<String, org.springframework.core.io.Resource> getContentTypePreviewImage(String siteId, String contentTypeId) Finds the preview image for a given content-typeprotected StringgetContentTypePreviewImageFilename(String siteId, String contentTypeId) Get preview image filename extract from form-definition.xmlgetContentTypeTemplatePath(String siteId, String contentTypeId) Extracts the path of the Freemarker template for a given content type idgetContentTypeUsage(String siteId, String contentType) Finds all items related to a given content-typeprotected org.dom4j.DocumentgetFormDefinitionDocument(String siteId, String contentTypeId) Get form-definition.xml as Document of a content typegetQuickCreatableContentTypes(String siteId) Get list of content types marked as quick creatable for given sitevoidsetContentService(ContentService contentService)
-
Field Details
-
contentTypeService
-
securityService
-
configurationService
-
itemDao
-
contentService
-
contentTypeBasePathPattern
-
contentTypesRootPath
-
contentTypeDefinitionFilename
-
contentTypeConfigFilename
-
templateXPath
-
controllerPattern
-
controllerFormat
-
previewImageXPath
-
defaultPreviewImagePath
-
-
Constructor Details
-
ContentTypeServiceInternalImpl
@ConstructorProperties({"contentTypeService","securityService","configurationService","itemDao","contentTypeBasePathPattern","contentTypeDefinitionFilename","contentTypeConfigFilename","contentTypesRootPath","templateXPath","controllerPattern","controllerFormat","previewImageXPath","defaultPreviewImagePath","gitRepositoryHelper"}) public ContentTypeServiceInternalImpl(ContentTypeService contentTypeService, SecurityService securityService, ConfigurationService configurationService, ItemDAO itemDao, String contentTypeBasePathPattern, String contentTypeDefinitionFilename, String contentTypeConfigFilename, String contentTypesRootPath, String templateXPath, String controllerPattern, String controllerFormat, String previewImageXPath, String defaultPreviewImagePath, GitRepositoryHelper gitRepositoryHelper)
-
-
Method Details
-
setContentService
-
getQuickCreatableContentTypes
Description copied from interface:ContentTypeServiceInternalGet list of content types marked as quick creatable for given site- Specified by:
getQuickCreatableContentTypesin interfaceContentTypeServiceInternal- Parameters:
siteId- site identifier- Returns:
- List of quick creatable content types
-
getContentTypeUsage
public ContentTypeUsage getContentTypeUsage(String siteId, String contentType) throws ServiceLayerException Description copied from interface:ContentTypeServiceInternalFinds all items related to a given content-type- Specified by:
getContentTypeUsagein interfaceContentTypeServiceInternal- Parameters:
siteId- the id of the sitecontentType- the id of the content-type- Returns:
- the usage
- Throws:
ServiceLayerException- if there is any error finding the items
-
getContentTypePreviewImage
public org.apache.commons.lang3.tuple.ImmutablePair<String,org.springframework.core.io.Resource> getContentTypePreviewImage(String siteId, String contentTypeId) throws ServiceLayerException Description copied from interface:ContentTypeServiceInternalFinds the preview image for a given content-type- Specified by:
getContentTypePreviewImagein interfaceContentTypeServiceInternal- Parameters:
siteId- the id of the sitecontentTypeId- the id of the content-type- Returns:
- the preview image file as a pair of path and resource
- Throws:
ServiceLayerException- if there is any error finding the items
-
deleteContentType
public void deleteContentType(String siteId, String contentType, boolean deleteDependencies) throws ServiceLayerException, AuthenticationException, DeploymentException, UserNotFoundException Description copied from interface:ContentTypeServiceInternalDeletes all files related to a given content-type- Specified by:
deleteContentTypein interfaceContentTypeServiceInternal- Parameters:
siteId- the id of the sitecontentType- the id of the content-typedeleteDependencies- indicates if all dependencies should be deleted- Throws:
ServiceLayerException- if there is any error deleting the filesAuthenticationException- if there is any error authenticating the userDeploymentException- if there is any error publishing the changesUserNotFoundException
-
getContentTypeControllerPath
Description copied from interface:ContentTypeServiceInternalBuilds the path of the Groovy controller for a given content type id- Specified by:
getContentTypeControllerPathin interfaceContentTypeServiceInternal- Parameters:
contentTypeId- the id of the content type- Returns:
- the path of the controller or null
-
getContentTypeTemplatePath
public String getContentTypeTemplatePath(String siteId, String contentTypeId) throws ServiceLayerException Description copied from interface:ContentTypeServiceInternalExtracts the path of the Freemarker template for a given content type id- Specified by:
getContentTypeTemplatePathin interfaceContentTypeServiceInternal- Parameters:
siteId- the id of the sitecontentTypeId- the id of the content type- Returns:
- the path of the template or null
- Throws:
ServiceLayerException- if there is any error reading the content type definition
-
getAllModelDefinitions
Description copied from interface:ContentTypeServiceInternalGet all content types for the given site.- Specified by:
getAllModelDefinitionsin interfaceContentTypeServiceInternal- Parameters:
site- the id of the site- Returns:
- a collection of content types including their config files (config.xml, form-definition.xml)
- Throws:
ServiceLayerException- if there is any error getting the content types
-
getContentTypePath
-
getContentTypePreviewImageFilename
protected String getContentTypePreviewImageFilename(String siteId, String contentTypeId) throws ServiceLayerException Get preview image filename extract from form-definition.xml- Parameters:
siteId-contentTypeId-- Returns:
- preview image filename
- Throws:
ServiceLayerException
-
getFormDefinitionDocument
protected org.dom4j.Document getFormDefinitionDocument(String siteId, String contentTypeId) throws ServiceLayerException Get form-definition.xml as Document of a content type- Parameters:
siteId-contentTypeId-- Returns:
- Document of form-definition.xml
- Throws:
ServiceLayerException
-