Interface ContentTemplateService
public interface ContentTemplateService
This is the interface contains all the methods common between Page and Blueprint template service.
So we don't have declare them twice.
- Since:
- 5.10
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(ContentTemplate contentTemplate, Expansion... expand) Create Template.default ContentBlueprintInstance
createInstance
(ContentBlueprintInstance blueprintInstance, Expansion... expansions) Create a page/draft content from a template.void
delete
(ContentTemplateId contentTemplateId) Delete a template for global or space, for blueprint template it means remove the template and revert to use the default template from the plugin.Creates an Template finder for locating Templates.getTemplate
(ContentTemplateId contentTemplateId, Expansion... expansions) Return an individual template.getTemplates
(ContentTemplateType contentTemplateType, Optional<Space> space, PageRequest pageRequest, Expansion... expansions) Returns templates of the current space, or returns global templates if no space specified.update
(ContentTemplate contentTemplate, Expansion... expansions) Update an existing templatevalidator
(ContentTemplateType contentTemplateType) Return the Validator for operations.
-
Method Details
-
getTemplates
PageResponse<ContentTemplate> getTemplates(ContentTemplateType contentTemplateType, Optional<Space> space, PageRequest pageRequest, Expansion... expansions) Returns templates of the current space, or returns global templates if no space specified.- Parameters:
contentTemplateType
- ContentTemplateType for the template to look forspace
- space objectpageRequest
- PageRequest to control the pageResponse to return.expansions
- a comma-separated list of properties to expand in the response.- Returns:
- Paged list of ContentTemplate
- Since:
- 6.13.0
-
getTemplate
Return an individual template.- Parameters:
contentTemplateId
-ContentTemplateId
expansions
- a comma-separated list of properties to expand in the response.- Returns:
ContentTemplate
-
create
Create Template.- Parameters:
contentTemplate
- the ContentTemplate to be created.expand
- a comma-separated list of properties to expand in the response.- Returns:
ContentTemplate
-
update
Update an existing template- Parameters:
contentTemplate
- The updated ContentTemplateexpansions
- a comma-separated list of properties to expand in the response.- Returns:
- The updated ContentTemplate
-
delete
Delete a template for global or space, for blueprint template it means remove the template and revert to use the default template from the plugin. When revert a blueprint template defined in space, it revert to use its global customised template if global customisation exists.- Parameters:
contentTemplateId
-ContentTemplateId
the id of the content template to remove.
-
validator
Return the Validator for operations.- Parameters:
contentTemplateType
-- Returns:
- return a TemplateFinder
-
find
Creates an Template finder for locating Templates.Currently an Template finder requires a template id, or else it will return list templates, or return the first found.
For example, to locate an template with id:
ContentTemplate template = ContentTemplateService.find() .withId(templateId) .fetchOneOrNull();
- Parameters:
expansions
- the expansions to apply to the values returned from a fetch- Returns:
-
createInstance
default ContentBlueprintInstance createInstance(ContentBlueprintInstance blueprintInstance, Expansion... expansions) Create a page/draft content from a template. Template is specified inside ContentBlueprintInstance For example, to construct a ContentBlueprintInstance to create a draftContentTemplateId id = ContentTemplateId.fromLong(longTemplateId); ContentBlueprintInstance cbi = ContentBlueprintInstance.builder() .content(Content.builder() .title("Title for Draft") .space("Space Key here") .status(ContentStatus.DRAFT).build()) .contentBlueprintSpec(ContentBlueprintSpec.builder() .contentTemplateId(id).build()) .build();
ContentStatus
CURRENT for status of Content.- Parameters:
blueprintInstance
-ContentBlueprintInstance
expansions
-- Returns:
- TODO CRA-1266 change default method to interface after Blueprint service in CC plugin implemented this interface.
-