Fixed typos in comments

pull/10/head
Jens Pelzetter 2021-05-13 17:44:33 +02:00
parent 3c486f7610
commit 59dac810ac
8 changed files with 64 additions and 49 deletions

View File

@ -21,6 +21,8 @@ package org.librecms.ui.contentsections;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.ui.IsAuthenticatedFilter;
import org.librecms.ui.contentsections.assets.AssetEditStepsValidator;
import org.librecms.ui.contentsections.assets.MvcAssetEditSteps;
import org.librecms.ui.contentsections.documents.AuthoringStepsValidator;
import org.librecms.ui.contentsections.documents.DocumentController;
import org.librecms.ui.contentsections.documents.DocumentLifecyclesController;
@ -50,7 +52,14 @@ public class ContentSectionApplication extends Application {
);
@Inject
private AuthoringStepsValidator stepsValidator;
private AuthoringStepsValidator authoringStepsValidator;
@Inject
private AssetEditStepsValidator editStepsValidator;
@Inject
@Any
private Instance<MvcAssetEditSteps> assetEditSteps;
@Inject
@Any
@ -76,6 +85,9 @@ public class ContentSectionApplication extends Application {
classes.addAll(getAuthoringSteps());
classes.addAll(getAuthoringStepResources());
classes.addAll(getAssetEditSteps());
classes.addAll(getAssetEditStepResources());
classes.add(IsAuthenticatedFilter.class);
return classes;
@ -86,7 +98,7 @@ public class ContentSectionApplication extends Application {
.stream()
.map(MvcAuthoringSteps::getClasses)
.flatMap(Set::stream)
.filter(stepsValidator::validateAuthoringStep)
.filter(authoringStepsValidator::validateAuthoringStep)
.collect(Collectors.toSet());
}
@ -98,4 +110,21 @@ public class ContentSectionApplication extends Application {
.collect(Collectors.toSet());
}
private Set<Class<?>> getAssetEditSteps() {
return assetEditSteps
.stream()
.map(MvcAssetEditSteps::getClasses)
.flatMap(Set::stream)
.filter(editStepsValidator::validateEditStep)
.collect(Collectors.toSet());
}
private Set<Class<?>> getAssetEditStepResources() {
return assetEditSteps
.stream()
.map(MvcAssetEditSteps::getResourceClasses)
.flatMap(Set::stream)
.collect(Collectors.toSet());
}
}

View File

@ -43,7 +43,8 @@ public class AuthoringStepsValidator {
"Class {} is part of a set of authoringsteps, but is not"
+ " annotated with {}. The class will be ignored.",
stepClass.getName(),
Controller.class.getName());
Controller.class.getName()
);
return false;
}
@ -86,7 +87,8 @@ public class AuthoringStepsValidator {
public boolean supportsItem(
final Class<?> stepClass, final ContentItem item
) {
final MvcAuthoringStepDef stepAnnotation = stepClass.getAnnotation(MvcAuthoringStepDef.class
final MvcAuthoringStepDef stepAnnotation = stepClass.getAnnotation(
MvcAuthoringStepDef.class
);
if (stepAnnotation == null) {
@ -97,4 +99,5 @@ public class AuthoringStepsValidator {
stepAnnotation.supportedDocumentType()
);
}
}

View File

@ -26,7 +26,7 @@ package org.librecms.ui.contentsections.documents;
public final class DefaultAuthoringStepConstants {
private DefaultAuthoringStepConstants() {
// Nothing
}
/**

View File

@ -49,7 +49,6 @@ import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
import javax.mvc.Controller;
import javax.mvc.Models;
@ -113,19 +112,12 @@ public class DocumentController {
@Inject
private ContentItemRepository itemRepo;
/**
* All available {@link MvcAuthoringStepDef}s.
*/
@Inject
@Any
private Instance<MvcAuthoringStepDef> authoringSteps;
/**
* All available {@link MvcDocumentCreateStep}s.
*/
@Inject
@Any
private Instance<MvcDocumentCreateStep<?>> createSteps;
private Instance<MvcDocumentCreateStep<?>> documentCreateSteps;
/**
* Messages for default steps
@ -161,7 +153,7 @@ public class DocumentController {
private PublishStepModel publishStepModel;
/**
* Named beans providing access to the properties of the selected document
* Named bean providing access to the properties of the selected document
* (content item} from the view.
*/
@Inject
@ -188,15 +180,15 @@ public class DocumentController {
// return "org/librecms/ui/contentsection/documents/pathTest.xhtml";
// }
/**
* Redirect requests to the root path of this controller to the
* {@link DocumentFolderController}. The root path of this controller has no
* function. We assume that somebody who access the root folders wants to
* browse all documents in the content section. Therefore we redirect these
* requests to the {@link DocumentFolderController}.
* Redirect requests to the root path of this controller to the path for
* displaying the content of the root document folder. The root path of this
* controller has no function. We assume that somebody who access the root
* folders wants to browse all documents in the content section. Therefore
* we redirect these requests to the root folder.
*
* @param sectionIdentifier The identififer of the current content section.
*
* @return A redirect to the {@link DocumentFolderController}.
* @return A redirect to the root documents folder.
*/
@GET
@Path("/")
@ -284,7 +276,6 @@ public class DocumentController {
@Path("/{folderPath:(.+)?}/@create/{documentType}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@SuppressWarnings("unchecked")
public String showCreateStepPost(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("folderPath") final String folderPath,
@ -320,7 +311,6 @@ public class DocumentController {
@AuthorizationRequired
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Transactional(Transactional.TxType.REQUIRED)
@SuppressWarnings({"unchecked", "unchecked"})
public String createDocument(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("folderPath") final String folderPath,
@ -823,7 +813,8 @@ public class DocumentController {
item.getContentType().getContentSection().getLabel()
)
.replace(
String.format("/{%s}",
String.format(
"/{%s}",
MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM
),
itemManager.getItemPath(item)
@ -895,7 +886,7 @@ public class DocumentController {
/**
* Helper method for showing the "document folder not found" page if there
* is not folder for the provided path.
* is no folder for the provided path.
*
* @param section The content section.
* @param folderPath The folder path.
@ -916,9 +907,9 @@ public class DocumentController {
* requested document type is not available for the current content section.
*
* @param section The content section.
* @param folderPath The folder path.
* @param documentType The folder path.
*
* @return The template of the "document folder not found" page.
* @return The template of the "document type not found" page.
*/
private String showDocumentTypeNotFound(
final ContentSection section, final String documentType
@ -1021,7 +1012,7 @@ public class DocumentController {
// final Instance<MvcDocumentCreateStep<?>> instance = createSteps
// .select(new CreateDocumentOfTypeLiteral(documentClass));
final Instance<? extends MvcDocumentCreateStep<?>> instance
= createSteps.select(createStepClass);
= documentCreateSteps.select(createStepClass);
if (instance.isUnsatisfied() || instance.isAmbiguous()) {
return new CreateStepResult(
showCreateStepNotAvailable(section, folderPath, documentType)

View File

@ -20,11 +20,13 @@ package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Provides the steps for creating and viewing and editing a document (content
* Provides the steps for creating, viewing, and editing a document (content
* item). The classes provided for {@link #createStep()} and
* {@link #authoringSteps() } provide information about the steps.
*
@ -33,6 +35,7 @@ import java.lang.annotation.RetentionPolicy;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MvcAuthoringKit {

View File

@ -25,19 +25,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Named;
/**
* Metadata of an authoring step for documents (content items).
*
* An authoring step for a document (content item). Implementing classes are
* used as subresources by {@link DocumentController#editDocument(java.lang.String, java.lang.String, java.lang.String)
* }. An implementation must be a named CDI bean (annotated with {@link Named},
* annotated with the {@link AuthoringStepPathFragment} qualifier annotation.
*
* An implementation may contain multiple subresource paths for for displaying
* forms and apply changes from these forms.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Target(ElementType.TYPE)

View File

@ -28,13 +28,13 @@ import java.util.ResourceBundle;
/**
* A create step for a document/content item. Implementing classes are MUST be
* A create step for a document/content item. Implementing classes MUST be
* CDI beans (request scope is recommended). They are retrieved by the
* {@link DocumentController} using CDI. The {@link DocumentController} will
* first call
* {@link #setContentSection(org.librecms.contentsection.ContentSection)} and {@link #setFolder(org.librecms.contentsection.Folder)
* } to provide the current current content section and folder. After that,
* depending on the request method, either {@link #showCreateStep} or {@link #createItem(javax.ws.rs.core.Form)]
* depending on the request method, either {@link #showCreateStep} or {@link #createItem(java.util.Map)
* will be called.
*
* In most cases, {@link AbstractMvcDocumentCreateStep} should be used as

View File

@ -48,7 +48,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Path;
import javax.ws.rs.core.UriBuilder;
import static javax.transaction.Transactional.TxType.values;
/**
* Model/named bean providing data about the currently selected document for