ContentSectionNotFound without
+ * detail message.
+ *
+ * @param errorMessageTemplate Template for the error message.
+ */
+ ContentSectionNotFoundException(final String errorMessageTemplate) {
+ super();
+ this.errorMessageTemplate = errorMessageTemplate;
+ }
+
+ /**
+ * Constructs an instance of ContentSectionNotFound with the
+ * specified detail message.
+ *
+ * @param msg The detail message.
+ * @param errorMessageTemplate Template for the error message.
+ */
+ ContentSectionNotFoundException(
+ final String errorMessageTemplate, final String msg
+ ) {
+ super(msg);
+ this.errorMessageTemplate = errorMessageTemplate;
+ }
+
+ public String showErrorMessage() {
+ return errorMessageTemplate;
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DocumentController.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DocumentController.java
index a7454ea08..541973f1c 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DocumentController.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DocumentController.java
@@ -75,6 +75,9 @@ import javax.ws.rs.core.MediaType;
@Controller
public class DocumentController {
+ @Inject
+ private AuthoringStepsValidator stepsValidator;
+
/**
* Item manager instance for performing operations on {@link ContentItem}s.
*/
@@ -326,7 +329,7 @@ public class DocumentController {
) {
final CreateStepResult result = findCreateStep(
sectionIdentifier,
- folderPath,
+ folderPath,
documentType
);
@@ -337,141 +340,140 @@ public class DocumentController {
}
}
- /**
- * Redirects to the first authoring step for the document identified by the
- * provided path.
- *
- * @param sectionIdentifier The identifier of the current content section.
- * @param documentPath The path of the document.
- *
- * @return A redirect to the first authoring step of the document, or the
- * {@link DocumentNotFound} pseudo authoring step.
- */
- @GET
- @Path("/{documentPath:(.+)?}")
- @AuthorizationRequired
- @Transactional(Transactional.TxType.REQUIRED)
- public String showEditDocument(
- @PathParam("sectionIdentifier") final String sectionIdentifier,
- @PathParam("documentPath") final String documentPath
- ) {
- final OptionalDocumentNotFoundException without
+ * detail message.
+ *
+ * @param errorMessageTemplate Template for the error message.
+ */
+ public DocumentNotFoundException(final String errorMessageTemplate) {
+ super();
+ this.errorMessageTemplate = errorMessageTemplate;
+ }
+
+ /**
+ * Constructs an instance of DocumentNotFoundException with the
+ * specified detail message.
+ *
+ * @param errorMessageTemplate
+ * @param msg The detail message. Template for the error
+ * message.
+ */
+ public DocumentNotFoundException(
+ final String errorMessageTemplate, final String msg
+ ) {
+ super(msg);
+ this.errorMessageTemplate = errorMessageTemplate;
+ }
+
+ public String showErrorMessage() {
+ return errorMessageTemplate;
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/ExampleAuthoringStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/ExampleAuthoringStep.java
new file mode 100644
index 000000000..1135ad5f8
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/ExampleAuthoringStep.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.librecms.ui.contentsections.documents;
+
+import org.librecms.contentsection.ContentSection;
+import org.librecms.ui.contentsections.ContentSectionModel;
+import org.librecms.ui.contentsections.ContentSectionsUi;
+
+import java.util.Optional;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.mvc.Controller;
+import javax.mvc.Models;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Path(MvcAuthoringSteps.PATH_PREFIX + "example")
+@Controller
+public class ExampleAuthoringStep {
+
+
+ @Inject
+ private Models models;
+
+ @Inject
+ private ContentSectionModel sectionModel;
+
+ @Inject
+ private ContentSectionsUi sectionsUi;
+
+ @GET
+ @Path("/")
+ public String showStep(
+ @PathParam("sectionIdentifier") final String sectionIdentifier,
+ @PathParam("documentPath") final String documentPath
+ ) {
+ models.put("sectionIdentifier", sectionIdentifier);
+ models.put("documentPath", documentPath);
+
+ final Optional