Interface ContentTemplateService


  • @ExperimentalApi
    public interface ContentTemplateService
    • Method Detail

      • getTemplates

        default 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 for
        space - space object
        pageRequest - 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
      • create

        ContentTemplate create​(ContentTemplate contentTemplate,
                               Expansion... expand)
        Create Template.
        Parameters:
        contentTemplate - the ContentTemplate to be created.
        expand - a comma-separated list of properties to expand in the response.
        Returns:
        ContentTemplate
      • update

        ContentTemplate update​(ContentTemplate contentTemplate,
                               Expansion... expansions)
        Update an existing template
        Parameters:
        contentTemplate - The updated ContentTemplate
        expansions - a comma-separated list of properties to expand in the response.
        Returns:
        The updated ContentTemplate
      • delete

        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. 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.
      • find

        ContentTemplateService.TemplateFinder find​(Expansion... expansions)
        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 draft
         
        
           ContentTemplateId 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();
         
         
        When create page, use 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.