JavaDoc for classes in ccm-cms/org.librecms.ui.contenttypes
parent
892476c905
commit
b6b3db46ec
|
|
@ -19,11 +19,13 @@
|
||||||
package org.librecms.ui.contenttypes;
|
package org.librecms.ui.contenttypes;
|
||||||
|
|
||||||
import org.libreccm.ui.AbstractMessagesBean;
|
import org.libreccm.ui.AbstractMessagesBean;
|
||||||
|
import org.librecms.contenttypes.Article;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Message bundle fo the authoring steps for editing an {@link Article}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
package org.librecms.ui.contenttypes;
|
package org.librecms.ui.contenttypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constants for the authoring steps for editing an {@link Article}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -31,6 +32,4 @@ public final class ArticleStepsConstants {
|
||||||
public static final String BUNDLE
|
public static final String BUNDLE
|
||||||
= "org.libreccms.ui.contenttypes.ArticleBundle";
|
= "org.libreccms.ui.contenttypes.ArticleBundle";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
package org.librecms.ui.contenttypes;
|
package org.librecms.ui.contenttypes;
|
||||||
|
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.workflow.Workflow;
|
import org.libreccm.workflow.Workflow;
|
||||||
import org.librecms.contentsection.ContentItemManager;
|
import org.librecms.contentsection.ContentItemManager;
|
||||||
import org.librecms.contentsection.ContentItemRepository;
|
import org.librecms.contentsection.ContentItemRepository;
|
||||||
|
|
@ -53,39 +54,78 @@ import javax.ws.rs.FormParam;
|
||||||
@Named("CmsArticleCreateStep")
|
@Named("CmsArticleCreateStep")
|
||||||
public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
|
public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with content items.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemManager itemManager;
|
private ContentItemManager itemManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to save the article.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemRepository itemRepo;
|
private ContentItemRepository itemRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides operations for folders.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private FolderManager folderManager;
|
private FolderManager folderManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with {@link LocalizedString}s.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private GlobalizationHelper globalizationHelper;
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to provided data for the views without a named bean.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private Models models;
|
private Models models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current content section.
|
||||||
|
*/
|
||||||
private ContentSection section;
|
private ContentSection section;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current folder.
|
||||||
|
*/
|
||||||
private Folder folder;
|
private Folder folder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messages to be shown to the user.
|
||||||
|
*/
|
||||||
private SortedMap<String, String> messages;
|
private SortedMap<String, String> messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the article.
|
||||||
|
*/
|
||||||
@FormParam("name")
|
@FormParam("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title of the article.
|
||||||
|
*/
|
||||||
@FormParam("title")
|
@FormParam("title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary of the article.
|
||||||
|
*/
|
||||||
@FormParam("summary")
|
@FormParam("summary")
|
||||||
private String summary;
|
private String summary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The initial locale of the article.
|
||||||
|
*/
|
||||||
@FormParam("locale")
|
@FormParam("locale")
|
||||||
private String initialLocale;
|
private String initialLocale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The workflow to use for the new article.
|
||||||
|
*/
|
||||||
@FormParam("selectedWorkflow")
|
@FormParam("selectedWorkflow")
|
||||||
private String selectedWorkflow;
|
private String selectedWorkflow;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.librecms.ui.contenttypes;
|
||||||
|
|
||||||
import org.libreccm.core.UnexpectedErrorException;
|
import org.libreccm.core.UnexpectedErrorException;
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
import org.librecms.contentsection.ContentItem;
|
import org.librecms.contentsection.ContentItem;
|
||||||
import org.librecms.contentsection.ContentItemManager;
|
import org.librecms.contentsection.ContentItemManager;
|
||||||
import org.librecms.contentsection.ContentItemRepository;
|
import org.librecms.contentsection.ContentItemRepository;
|
||||||
|
|
@ -48,6 +49,7 @@ import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authoring step for editing the basic properties of an a {@link Article}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,22 +60,43 @@ import javax.ws.rs.PathParam;
|
||||||
@Named("CmsArticlePropertiesStep")
|
@Named("CmsArticlePropertiesStep")
|
||||||
public class MvcArticlePropertiesStep implements MvcAuthoringStep {
|
public class MvcArticlePropertiesStep implements MvcAuthoringStep {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path fragment of the step.
|
||||||
|
*/
|
||||||
static final String PATH_FRAGMENT = "basicproperties";
|
static final String PATH_FRAGMENT = "basicproperties";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for retrieving and saving the article.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemRepository itemRepo;
|
private ContentItemRepository itemRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with content items.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemManager itemManager;
|
private ContentItemManager itemManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with folders.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private FolderManager folderManager;
|
private FolderManager folderManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with {@link LocalizedString}s.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private GlobalizationHelper globalizationHelper;
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current content section.
|
||||||
|
*/
|
||||||
private ContentSection section;
|
private ContentSection section;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Article} to edit.
|
||||||
|
*/
|
||||||
private Article document;
|
private Article document;
|
||||||
|
|
||||||
@Override
|
@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() {
|
public String getName() {
|
||||||
return document.getDisplayName();
|
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
|
@POST
|
||||||
@Path("/name")
|
@Path("/name")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@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<String, String> getTitleValues() {
|
public Map<String, String> getTitleValues() {
|
||||||
return document
|
return document
|
||||||
.getTitle()
|
.getTitle()
|
||||||
|
|
@ -186,6 +226,11 @@ 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<String> getUnusedTitleLocales() {
|
public List<String> getUnusedTitleLocales() {
|
||||||
final Set<Locale> titleLocales = document
|
final Set<Locale> titleLocales = document
|
||||||
.getTitle()
|
.getTitle()
|
||||||
|
|
@ -198,6 +243,14 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep {
|
||||||
.collect(Collectors.toList());
|
.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
|
@POST
|
||||||
@Path("/title/@add")
|
@Path("/title/@add")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@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
|
@POST
|
||||||
@Path("/title/@edit/{locale}")
|
@Path("/title/@edit/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@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
|
@POST
|
||||||
@Path("/title/@remove/{locale}")
|
@Path("/title/@remove/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -254,7 +322,13 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> 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<String> getUnusedDescriptionLocales() {
|
||||||
final Set<Locale> descriptionLocales = document
|
final Set<Locale> descriptionLocales = document
|
||||||
.getDescription()
|
.getDescription()
|
||||||
.getAvailableLocales();
|
.getAvailableLocales();
|
||||||
|
|
@ -266,6 +340,11 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep {
|
||||||
.collect(Collectors.toList());
|
.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<String, String> getDescriptionValues() {
|
public Map<String, String> getDescriptionValues() {
|
||||||
return document
|
return document
|
||||||
.getDescription()
|
.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
|
@POST
|
||||||
@Path("/title/@add")
|
@Path("/title/@add")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@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
|
@POST
|
||||||
@Path("/title/@edit/{locale}")
|
@Path("/title/@edit/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@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
|
@POST
|
||||||
@Path("/title/@remove/{locale}")
|
@Path("/title/@remove/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authoring step for editing the main text of an {@link Article}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,22 +58,37 @@ import javax.ws.rs.PathParam;
|
||||||
@Named("CmsArticleTextBodyStep")
|
@Named("CmsArticleTextBodyStep")
|
||||||
public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path fragment of the step.
|
||||||
|
*/
|
||||||
static final String PATH_FRAGMENT = "text";
|
static final String PATH_FRAGMENT = "text";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for retrieving and saving the article.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemRepository itemRepo;
|
private ContentItemRepository itemRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides functions for working with content items.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemManager itemManager;
|
private ContentItemManager itemManager;
|
||||||
|
|
||||||
@Inject
|
/**
|
||||||
private FolderManager folderManager;
|
* Provides functions for working with {@link LocalizedString}s.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private GlobalizationHelper globalizationHelper;
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current content section.
|
||||||
|
*/
|
||||||
private ContentSection section;
|
private ContentSection section;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Article} to edit.
|
||||||
|
*/
|
||||||
private Article document;
|
private Article document;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -150,6 +165,11 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
||||||
return "org/librecms/ui/contenttypes/article/article-text.xhtml";
|
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<String, String> getTextValues() {
|
public Map<String, String> getTextValues() {
|
||||||
return document
|
return document
|
||||||
.getText()
|
.getText()
|
||||||
|
|
@ -164,6 +184,11 @@ 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<String> getUnusedLocales() {
|
public List<String> getUnusedLocales() {
|
||||||
final Set<Locale> locales = document
|
final Set<Locale> locales = document
|
||||||
.getText()
|
.getText()
|
||||||
|
|
@ -176,6 +201,14 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
||||||
.collect(Collectors.toList());
|
.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
|
@POST
|
||||||
@Path("/@add")
|
@Path("/@add")
|
||||||
public String addTextValue(
|
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
|
@POST
|
||||||
@Path("/@edit/{locale}")
|
@Path("/@edit/{locale}")
|
||||||
public String editTextValue(
|
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
|
@POST
|
||||||
@Path("/@remove/{locale}")
|
@Path("/@remove/{locale}")
|
||||||
public String remvoeTextValue(
|
public String remvoeTextValue(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue