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;
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>
*/
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;
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<? 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;
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<? 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
* 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<? extends MvcDocumentCreateStep> 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<? extends MvcAuthoringStep>[] authoringSteps();

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
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;
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>
*/
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();
}