Class ContentTypeServiceInternalImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v2.service.content.internal.ContentTypeServiceInternalImpl
-
- All Implemented Interfaces:
ContentTypeServiceInternal
public class ContentTypeServiceInternalImpl extends Object implements ContentTypeServiceInternal
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationService
configurationService
protected ContentService
contentService
protected String
contentTypeBasePathPattern
protected String
contentTypeDefinitionFilename
protected ContentTypeService
contentTypeService
protected String
controllerFormat
protected String
controllerPattern
protected String
defaultPreviewImagePath
protected ItemDAO
itemDao
protected String
previewImageXPath
protected SecurityService
securityService
protected SiteService
siteService
protected String
templateXPath
-
Constructor Summary
Constructors Constructor Description ContentTypeServiceInternalImpl(ContentTypeService contentTypeService, SecurityService securityService, ConfigurationService configurationService, ItemDAO itemDao, SiteService siteService, String contentTypeBasePathPattern, String contentTypeDefinitionFilename, String templateXPath, String controllerPattern, String controllerFormat, String previewImageXPath, String defaultPreviewImagePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteContentType(String siteId, String contentType, boolean deleteDependencies)
Deletes all files related to a given content-typeString
getContentTypeControllerPath(String contentTypeId)
Builds the path of the Groovy controller for a given content type idprotected String
getContentTypePath(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 String
getContentTypePreviewImageFilename(String siteId, String contentTypeId)
Get preview image filename extract from form-definition.xmlString
getContentTypeTemplatePath(String siteId, String contentTypeId)
Extracts the path of the Freemarker template for a given content type idContentTypeUsage
getContentTypeUsage(String siteId, String contentType)
Finds all items related to a given content-typeprotected org.dom4j.Document
getFormDefinitionDocument(String siteId, String contentTypeId)
Get form-definition.xml as Document of a content typeList<QuickCreateItem>
getQuickCreatableContentTypes(String siteId)
Get list of content types marked as quick creatable for given sitevoid
setContentService(ContentService contentService)
-
-
-
Field Detail
-
contentTypeService
protected final ContentTypeService contentTypeService
-
securityService
protected final SecurityService securityService
-
configurationService
protected final ConfigurationService configurationService
-
itemDao
protected final ItemDAO itemDao
-
contentService
protected ContentService contentService
-
siteService
protected final SiteService siteService
-
contentTypeBasePathPattern
protected final String contentTypeBasePathPattern
-
contentTypeDefinitionFilename
protected final String contentTypeDefinitionFilename
-
templateXPath
protected final String templateXPath
-
controllerPattern
protected final String controllerPattern
-
controllerFormat
protected final String controllerFormat
-
previewImageXPath
protected final String previewImageXPath
-
defaultPreviewImagePath
protected final String defaultPreviewImagePath
-
-
Constructor Detail
-
ContentTypeServiceInternalImpl
@ConstructorProperties({"contentTypeService","securityService","configurationService","itemDao","siteService","contentTypeBasePathPattern","contentTypeDefinitionFilename","templateXPath","controllerPattern","controllerFormat","previewImageXPath","defaultPreviewImagePath"}) public ContentTypeServiceInternalImpl(ContentTypeService contentTypeService, SecurityService securityService, ConfigurationService configurationService, ItemDAO itemDao, SiteService siteService, String contentTypeBasePathPattern, String contentTypeDefinitionFilename, String templateXPath, String controllerPattern, String controllerFormat, String previewImageXPath, String defaultPreviewImagePath)
-
-
Method Detail
-
setContentService
public void setContentService(ContentService contentService)
-
getQuickCreatableContentTypes
public List<QuickCreateItem> getQuickCreatableContentTypes(String siteId)
Description copied from interface:ContentTypeServiceInternal
Get list of content types marked as quick creatable for given site- Specified by:
getQuickCreatableContentTypes
in 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:ContentTypeServiceInternal
Finds all items related to a given content-type- Specified by:
getContentTypeUsage
in 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:ContentTypeServiceInternal
Finds the preview image for a given content-type- Specified by:
getContentTypePreviewImage
in 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:ContentTypeServiceInternal
Deletes all files related to a given content-type- Specified by:
deleteContentType
in 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
public String getContentTypeControllerPath(String contentTypeId)
Description copied from interface:ContentTypeServiceInternal
Builds the path of the Groovy controller for a given content type id- Specified by:
getContentTypeControllerPath
in 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:ContentTypeServiceInternal
Extracts the path of the Freemarker template for a given content type id- Specified by:
getContentTypeTemplatePath
in 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
-
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
-
-