From 7471e031da7722a77513bff5cb344000c1747b37 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Wed, 10 Mar 2021 20:45:31 +0100 Subject: [PATCH] Some work on the interfaces for create step descriptors and authoring step descriptors Former-commit-id: e9bf0d26aa796717b9910784503856d55b70a86a --- .../documents/MvcArticleCreateStep.java | 28 +++++++++- .../documents/MvcArticlePropertiesStep.java | 27 ++++++++++ .../documents/MvcArticleTextBodyStep.java | 27 ++++++++++ .../documents/MvcAuthoringKit.java | 10 ++-- .../documents/MvcAuthoringStep.java | 51 ++++++++++++++++++- .../documents/MvcDocumentCreateStep.java | 42 ++++++++++++++- 6 files changed, 176 insertions(+), 9 deletions(-) diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleCreateStep.java index 5fe371c3b..fa94f6918 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleCreateStep.java @@ -5,10 +5,36 @@ */ package org.librecms.ui.contentsections.documents; +import org.librecms.contentsection.ContentItem; +import org.librecms.contenttypes.Article; + /** - * + * Describes the create step for {@link Article}. + * * @author Jens Pelzetter */ public class MvcArticleCreateStep implements MvcDocumentCreateStep { + + @Override + public Class getSubResourceClass() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Class getDocumentType() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getDescription() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getBundle() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticlePropertiesStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticlePropertiesStep.java index 0d6a520ad..cf8107e10 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticlePropertiesStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticlePropertiesStep.java @@ -5,6 +5,8 @@ */ package org.librecms.ui.contentsections.documents; +import org.librecms.contentsection.ContentItem; + import javax.enterprise.context.RequestScoped; import javax.mvc.Controller; import javax.ws.rs.Path; @@ -17,5 +19,30 @@ import javax.ws.rs.Path; @Controller @Path("/") public class MvcArticlePropertiesStep implements MvcAuthoringStep { + + @Override + public String getPathFragment() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Class supportedDocumenType() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getLabel() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getDescription() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getBundle() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleTextBodyStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleTextBodyStep.java index 078fa686b..361148d82 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleTextBodyStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcArticleTextBodyStep.java @@ -5,6 +5,8 @@ */ package org.librecms.ui.contentsections.documents; +import org.librecms.contentsection.ContentItem; + import javax.enterprise.context.RequestScoped; import javax.mvc.Controller; import javax.ws.rs.Path; @@ -17,5 +19,30 @@ import javax.ws.rs.Path; @Controller @Path("/") public class MvcArticleTextBodyStep implements MvcAuthoringStep { + + @Override + public String getPathFragment() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Class supportedDocumenType() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getLabel() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getDescription() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String getBundle() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringKit.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringKit.java index 46b781643..d2057be6d 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringKit.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringKit.java @@ -12,8 +12,7 @@ import javax.mvc.Controller; /** * Provides the steps for creating and viewing and editing a document (content * item). The classes provided for {@link #createStep()} and - * {@link #authoringSteps() } must MVC controllers (see {@link Controller}) and - * implement a specific interface. + * {@link #authoringSteps() } provide information about the steps. * * This annotation can only be used on classes extending the {@link ContentItem} * class. @@ -25,8 +24,7 @@ public @interface MvcAuthoringKit { /** * Controller of the create step for a document type. * - * @return The controller of the create step for the annotated document - * type.. + * @return Descriptor class for the create step. */ Class createStep(); @@ -34,8 +32,8 @@ public @interface MvcAuthoringKit { * The authoring steps for editing the properties of the document. They are * used in the same order as they are provided here. * - * @return The controllers of the authoring steps for the annotated document - * type. + * @return The descriptor classes ofr the authoring steps for the annotated + * document type. */ Class[] authoringSteps(); diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringStep.java index 9a9f5070d..0d59be8f6 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcAuthoringStep.java @@ -5,10 +5,59 @@ */ package org.librecms.ui.contentsections.documents; +import org.libreccm.l10n.GlobalizationHelper; +import org.librecms.contentsection.ContentItem; + +import java.util.Set; + /** + * Describes an authoring step for a document (content item). * * @author Jens Pelzetter */ public interface MvcAuthoringStep { - + + /** + * Returns the step identifier. + * + * Each authoring step is accessible over the URL {@code /contentsections/documents/{path:+.*}/@authoringsteps/{step}. + * The method provides the identifier for hte step. + * + * @return The path fragment for the authoring step used in URLs. + */ + String getPathFragment(); + + /** + * Authoring steps only support a specific type, and all subtypes. + * + * @return The document type supported by the authoring step. + */ + Class supportedDocumenType(); + + /** + * Gets the localized label of the authoring step. The language variant to + * return should be selected using the locale returned by + * {@link GlobalizationHelper#getNegotiatedLocale()}. + * + * @return The localized label of the authoring step. + */ + String getLabel(); + + /** + * Gets the localized description of the authoring step. The language + * variant to return should be selected using the locale returned by + * {@link GlobalizationHelper#getNegotiatedLocale()}. + * + * @return The localized description of the authoring step. + */ + String getDescription(); + + /** + * Gets the name of the resource bundle providing the localized label and + * description. + * + * @return The resource bundle providing the localized label and description. + */ + String getBundle(); + } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcDocumentCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcDocumentCreateStep.java index cb1408e77..135c20f4f 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcDocumentCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/MvcDocumentCreateStep.java @@ -5,10 +5,50 @@ */ package org.librecms.ui.contentsections.documents; +import org.libreccm.l10n.GlobalizationHelper; +import org.librecms.contentsection.ContentItem; + +import java.util.ResourceBundle; + /** + * Describes the create for a document (content item). * * @author Jens Pelzetter */ public interface MvcDocumentCreateStep { - + + /** + * Get the class implementing the sub resource implemeting the logic for the + * step. This must be a CDI bean. + * + * @return The sub resource class implementing the create step. + */ + Class getSubResourceClass(); + + /** + * The document type generated by the create step described by an instance + * of this class. + * + * @return Document type generated. + */ + Class getDocumentType(); + + /** + * Localized description of the create step. The current locale as returned + * by {@link GlobalizationHelper#getNegotiatedLocale()} should be used to + * select the language variant to return. + * + * @return The localized description of the create step. + */ + String getDescription(); + + /** + * Returns {@link ResourceBundle} providing the localized description of the + * create step. + * + * @return The {@link ResourceBundle} providing the localized description of + * the create step. + */ + String getBundle(); + }