Some work on the interfaces for create step descriptors and authoring step descriptors

Former-commit-id: e9bf0d26aa796717b9910784503856d55b70a86a
pull/10/head
Jens Pelzetter 2021-03-10 20:45:31 +01:00
parent 3925b228bb
commit 7471e031da
6 changed files with 176 additions and 9 deletions

View File

@ -5,10 +5,36 @@
*/ */
package org.librecms.ui.contentsections.documents; package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contenttypes.Article;
/** /**
* Describes the create step for {@link Article}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class MvcArticleCreateStep implements MvcDocumentCreateStep { 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<? extends ContentItem> 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.
}
} }

View File

@ -5,6 +5,8 @@
*/ */
package org.librecms.ui.contentsections.documents; package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -18,4 +20,29 @@ import javax.ws.rs.Path;
@Path("/") @Path("/")
public class MvcArticlePropertiesStep implements MvcAuthoringStep { 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<? extends ContentItem> 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.
}
} }

View File

@ -5,6 +5,8 @@
*/ */
package org.librecms.ui.contentsections.documents; package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -18,4 +20,29 @@ import javax.ws.rs.Path;
@Path("/") @Path("/")
public class MvcArticleTextBodyStep implements MvcAuthoringStep { 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<? extends ContentItem> 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.
}
} }

View File

@ -12,8 +12,7 @@ import javax.mvc.Controller;
/** /**
* Provides the steps for creating and viewing and editing a document (content * Provides the steps for creating and viewing and editing a document (content
* item). The classes provided for {@link #createStep()} and * item). The classes provided for {@link #createStep()} and
* {@link #authoringSteps() } must MVC controllers (see {@link Controller}) and * {@link #authoringSteps() } provide information about the steps.
* implement a specific interface.
* *
* This annotation can only be used on classes extending the {@link ContentItem} * This annotation can only be used on classes extending the {@link ContentItem}
* class. * class.
@ -25,8 +24,7 @@ public @interface MvcAuthoringKit {
/** /**
* Controller of the create step for a document type. * Controller of the create step for a document type.
* *
* @return The controller of the create step for the annotated document * @return Descriptor class for the create step.
* type..
*/ */
Class<? extends MvcDocumentCreateStep> createStep(); Class<? extends MvcDocumentCreateStep> createStep();
@ -34,8 +32,8 @@ public @interface MvcAuthoringKit {
* The authoring steps for editing the properties of the document. They are * The authoring steps for editing the properties of the document. They are
* used in the same order as they are provided here. * used in the same order as they are provided here.
* *
* @return The controllers of the authoring steps for the annotated document * @return The descriptor classes ofr the authoring steps for the annotated
* type. * document type.
*/ */
Class<? extends MvcAuthoringStep>[] authoringSteps(); Class<? extends MvcAuthoringStep>[] authoringSteps();

View File

@ -5,10 +5,59 @@
*/ */
package org.librecms.ui.contentsections.documents; 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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public interface MvcAuthoringStep { 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<? extends ContentItem> 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();
} }

View File

@ -5,10 +5,50 @@
*/ */
package org.librecms.ui.contentsections.documents; 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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public interface MvcDocumentCreateStep { 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<? extends ContentItem> 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();
} }