diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleMessageBundle.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleMessageBundle.java index 68fc2fa3f..86c9a172a 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleMessageBundle.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleMessageBundle.java @@ -19,12 +19,14 @@ package org.librecms.ui.contenttypes; import org.libreccm.ui.AbstractMessagesBean; +import org.librecms.contenttypes.Article; import javax.enterprise.context.RequestScoped; import javax.inject.Named; /** - * + * Message bundle fo the authoring steps for editing an {@link Article}. + * * @author Jens Pelzetter */ @RequestScoped diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleStepsConstants.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleStepsConstants.java index 5a0b4fc8f..73d3006ad 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleStepsConstants.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/ArticleStepsConstants.java @@ -19,6 +19,7 @@ package org.librecms.ui.contenttypes; /** + * Constants for the authoring steps for editing an {@link Article}. * * @author Jens Pelzetter */ @@ -31,6 +32,4 @@ public final class ArticleStepsConstants { public static final String BUNDLE = "org.libreccms.ui.contenttypes.ArticleBundle"; - - } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleCreateStep.java index b63f20bd3..394c61e44 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleCreateStep.java @@ -19,6 +19,7 @@ package org.librecms.ui.contenttypes; import org.libreccm.l10n.GlobalizationHelper; +import org.libreccm.l10n.LocalizedString; import org.libreccm.workflow.Workflow; import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentItemRepository; @@ -53,39 +54,78 @@ import javax.ws.rs.FormParam; @Named("CmsArticleCreateStep") public class MvcArticleCreateStep implements MvcDocumentCreateStep
{ + /** + * Provides functions for working with content items. + */ @Inject private ContentItemManager itemManager; + /** + * Used to save the article. + */ @Inject private ContentItemRepository itemRepo; + /** + * Provides operations for folders. + */ @Inject private FolderManager folderManager; + /** + * Provides functions for working with {@link LocalizedString}s. + */ @Inject private GlobalizationHelper globalizationHelper; + /** + * Used to provided data for the views without a named bean. + */ @Inject private Models models; + /** + * The current content section. + */ private ContentSection section; + /** + * The current folder. + */ private Folder folder; + /** + * Messages to be shown to the user. + */ private SortedMap messages; + /** + * Name of the article. + */ @FormParam("name") private String name; + /** + * Title of the article. + */ @FormParam("title") private String title; + /** + * Summary of the article. + */ @FormParam("summary") private String summary; + /** + * The initial locale of the article. + */ @FormParam("locale") private String initialLocale; + /** + * The workflow to use for the new article. + */ @FormParam("selectedWorkflow") private String selectedWorkflow; diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticlePropertiesStep.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticlePropertiesStep.java index 3ff745f89..5d7cec87a 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticlePropertiesStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticlePropertiesStep.java @@ -20,6 +20,7 @@ package org.librecms.ui.contenttypes; import org.libreccm.core.UnexpectedErrorException; import org.libreccm.l10n.GlobalizationHelper; +import org.libreccm.l10n.LocalizedString; import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentItemRepository; @@ -48,6 +49,7 @@ import javax.ws.rs.POST; import javax.ws.rs.PathParam; /** + * Authoring step for editing the basic properties of an a {@link Article}. * * @author Jens Pelzetter */ @@ -58,22 +60,43 @@ import javax.ws.rs.PathParam; @Named("CmsArticlePropertiesStep") public class MvcArticlePropertiesStep implements MvcAuthoringStep { + /** + * The path fragment of the step. + */ static final String PATH_FRAGMENT = "basicproperties"; + /** + * Used for retrieving and saving the article. + */ @Inject private ContentItemRepository itemRepo; + /** + * Provides functions for working with content items. + */ @Inject private ContentItemManager itemManager; + /** + * Provides functions for working with folders. + */ @Inject private FolderManager folderManager; + /** + * Provides functions for working with {@link LocalizedString}s. + */ @Inject private GlobalizationHelper globalizationHelper; + /** + * The current content section. + */ private ContentSection section; + /** + * The {@link Article} to edit. + */ private Article document; @Override @@ -151,10 +174,22 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { } + /** + * Gets the display name of the current article. + * + * @return The display name of the current article. + */ public String getName() { return document.getDisplayName(); } + /** + * Updates the name of the current article. + * + * @param name The new name of the article. + * + * @return A redirect to this authoring step. + */ @POST @Path("/name") @Transactional(Transactional.TxType.REQUIRED) @@ -172,6 +207,11 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Get the values of the localized title of the article. + * + * @return The values of the localized title of the article. + */ public Map getTitleValues() { return document .getTitle() @@ -185,7 +225,12 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ) ); } - + + /** + * Get the locales for which no localized title has been defined yet. + * + * @return The locales for which no localized title has been defined yet. + */ public List getUnusedTitleLocales() { final Set titleLocales = document .getTitle() @@ -198,6 +243,14 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { .collect(Collectors.toList()); } + /** + * Adds a localized title to the article. + * + * @param localeParam The locale of the title. + * @param value The title value. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@add") @Transactional(Transactional.TxType.REQUIRED) @@ -217,6 +270,14 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Updates a localized title of the article. + * + * @param localeParam The locale to update. + * @param value The updated title value. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@edit/{locale}") @Transactional(Transactional.TxType.REQUIRED) @@ -236,6 +297,13 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Removes a localized title of the article. + * + * @param localeParam The locale to remove. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@remove/{locale}") @Transactional(Transactional.TxType.REQUIRED) @@ -254,7 +322,13 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } - public List getUnusedDescriptionLocales() { + /** + * Get the locales for which no localized description has been defined yet. + * + * @return The locales for which no localized description has been defined + * yet. + */ + public List getUnusedDescriptionLocales() { final Set descriptionLocales = document .getDescription() .getAvailableLocales(); @@ -265,7 +339,12 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { .map(Locale::toString) .collect(Collectors.toList()); } - + + /** + * Get the values of the localized decrription of the article. + * + * @return The values of the localized description of the article. + */ public Map getDescriptionValues() { return document .getDescription() @@ -280,6 +359,14 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Adds a localized description to the article. + * + * @param localeParam The locale of the description. + * @param value The description value. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@add") @Transactional(Transactional.TxType.REQUIRED) @@ -299,6 +386,14 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Updates a localized description of the article. + * + * @param localeParam The locale to update. + * @param value The updated description value. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@edit/{locale}") @Transactional(Transactional.TxType.REQUIRED) @@ -318,6 +413,13 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep { ); } + /** + * Removes a localized description of the article. + * + * @param localeParam The locale to remove. + * + * @return A redirect to this authoring step. + */ @POST @Path("/title/@remove/{locale}") @Transactional(Transactional.TxType.REQUIRED) diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleTextBodyStep.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleTextBodyStep.java index 9c7b761ce..21e44ba7c 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleTextBodyStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/MvcArticleTextBodyStep.java @@ -46,8 +46,8 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.PathParam; - /** + * Authoring step for editing the main text of an {@link Article}. * * @author Jens Pelzetter */ @@ -58,22 +58,37 @@ import javax.ws.rs.PathParam; @Named("CmsArticleTextBodyStep") public class MvcArticleTextBodyStep implements MvcAuthoringStep { + /** + * The path fragment of the step. + */ static final String PATH_FRAGMENT = "text"; + /** + * Used for retrieving and saving the article. + */ @Inject private ContentItemRepository itemRepo; + /** + * Provides functions for working with content items. + */ @Inject private ContentItemManager itemManager; - @Inject - private FolderManager folderManager; - + /** + * Provides functions for working with {@link LocalizedString}s. + */ @Inject private GlobalizationHelper globalizationHelper; + /** + * The current content section. + */ private ContentSection section; + /** + * The {@link Article} to edit. + */ private Article document; @Override @@ -150,6 +165,11 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep { return "org/librecms/ui/contenttypes/article/article-text.xhtml"; } + /** + * Get all localized values of the main text. + * + * @return The localized values of the main text. + */ public Map getTextValues() { return document .getText() @@ -163,7 +183,12 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep { ) ); } - + + /** + * Gets the locales for which the main text has not been defined yet. + * + * @return The locales for which the main text has not been defined yet. + */ public List getUnusedLocales() { final Set locales = document .getText() @@ -176,6 +201,14 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep { .collect(Collectors.toList()); } + /** + * Adds a localized main text. + * + * @param localeParam The locale of the text. + * @param value The text. + * + * @return A redirect to this authoring step. + */ @POST @Path("/@add") public String addTextValue( @@ -194,6 +227,14 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep { ); } + /** + * Updates a localized main text. + * + * @param localeParam The locale of the text. + * @param value The text. + * + * @return A redirect to this authoring step. + */ @POST @Path("/@edit/{locale}") public String editTextValue( @@ -212,6 +253,13 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep { ); } + /** + * Removes a localized main text. + * + * @param localeParam The locale of the text. + * + * @return A redirect to this authoring step. + */ @POST @Path("/@remove/{locale}") public String remvoeTextValue(