From 014fc32ed8c4e7f5a814f78c23a406c5f408a1d9 Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 13 Jun 2017 12:04:03 +0000 Subject: [PATCH] CCM NG/ccm-cms: Several changes/fixes for getting the authoring kits working git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4778 8810af33-2d31-482b-a856-94f89814c4df --- .../ui/authoring/ApplyWorkflowController.java | 4 +++ .../contentsection/ContentItemRepository.java | 7 +++++ .../org/librecms/contenttypes/Article.java | 30 +++++++++++++------ .../org/librecms/CmsResources.properties | 6 ++++ .../org/librecms/CmsResources_de.properties | 6 ++++ .../org/librecms/CmsResources_fr.properties | 6 ++++ 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ApplyWorkflowController.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ApplyWorkflowController.java index ed4dd573b..5615bec31 100644 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ApplyWorkflowController.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ApplyWorkflowController.java @@ -111,6 +111,10 @@ class ApplyWorkflowController { final Folder folder, final Long workflowTemplateId) { + Objects.requireNonNull(item); + Objects.requireNonNull(folder); + Objects.requireNonNull(workflowTemplateId); + final WorkflowTemplate workflowTemplate; if (workflowTemplateId == null && permissionChecker diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentItemRepository.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentItemRepository.java index 61b64e0e4..b09a6928f 100644 --- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentItemRepository.java +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentItemRepository.java @@ -296,6 +296,7 @@ public class ContentItemRepository * * @return */ + @Transactional(Transactional.TxType.REQUIRED) public long countByNameInFolder(final Category folder, final String name) { final TypedQuery query = getEntityManager().createNamedQuery( @@ -317,6 +318,7 @@ public class ContentItemRepository * * @return A list with all items in the folder matching the provided filter. */ + @Transactional(Transactional.TxType.REQUIRED) public List filterByFolderAndName(final Category folder, final String name) { @@ -340,6 +342,7 @@ public class ContentItemRepository * @return The number of items in the folder/category which match the * provided pattern. */ + @Transactional(Transactional.TxType.REQUIRED) public long countFilterByFolderAndName(final Category folder, final String name) { final TypedQuery query = getEntityManager() @@ -352,6 +355,7 @@ public class ContentItemRepository return query.getSingleResult(); } + @Transactional(Transactional.TxType.REQUIRED) public Optional findItemWithWorkflow(final Workflow workflow) { final TypedQuery query = getEntityManager() @@ -378,6 +382,7 @@ public class ContentItemRepository * provided path or an empty {@code Optional} if there is no such * item. */ + @Transactional(Transactional.TxType.REQUIRED) public Optional findByPath(final String path) { //The last token is the name of the item itself. Remove this part an get @@ -408,6 +413,7 @@ public class ContentItemRepository * provided path or an empty {@code Optional} if there is no such * item. */ + @Transactional(Transactional.TxType.REQUIRED) public Optional findByPath(final ContentSection section, final String path) { @@ -429,6 +435,7 @@ public class ContentItemRepository } @Override + @Transactional(Transactional.TxType.REQUIRED) public void save(final ContentItem item) { final Date now = new Date(); final Subject subject = shiro.getSubject(); diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java index c8e2fb4ba..ecace1344 100644 --- a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java +++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java @@ -18,7 +18,9 @@ */ package org.librecms.contenttypes; +import com.arsdigita.cms.contenttypes.ui.ArticlePropertiesStep; import com.arsdigita.cms.ui.authoring.PageCreateForm; + import java.io.Serializable; import java.util.Objects; @@ -45,27 +47,37 @@ import org.librecms.contentsection.ContentItem; @Table(name = "ARTICLES", schema = DB_SCHEMA) @ContentTypeDescription(labelBundle = "org.librecms.contenttypes.Article", descriptionBundle = "org.librecms.contenttypes.Article") -@AuthoringKit(createComponent = PageCreateForm.class, - steps = {}) +@AuthoringKit( + createComponent = PageCreateForm.class, + steps = { + @AuthoringStep( + component = ArticlePropertiesStep.class, + labelBundle = "org.librecms.CmsResources", + labelKey = "cms.contenttypes.shared.basic_properties.title", + descriptionBundle = "org.librecms.CmsResources", + descriptionKey = "cms.contenttypes.shared.basic_properties" + + ".description", + order = 1) + }) public class Article extends ContentItem implements Serializable { private static final long serialVersionUID = 3832010184748095822L; @Embedded @AssociationOverride( - name = "values", - joinTable = @JoinTable(name = "ARTICLE_TEXTS", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "values", + joinTable = @JoinTable(name = "ARTICLE_TEXTS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID")} + )) private LocalizedString text; public Article() { super(); text = new LocalizedString(); } - + public LocalizedString getText() { return text; } diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties index 45ca59e3b..02ac08a5f 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties @@ -290,3 +290,9 @@ cms.ui.create=Create cms.contenttypes.ui.summary=Summary cms.contenttypes.ui.newsitem.date\ =Release date cms.contenttypes.ui.event.start_date=Start date +cms.contenttypes.shared.basic_properties.title=Edit basic properties +cms.contenttypes.shared.basic_properties.description=Edit basic properties +cms.contenttypes.shared.body_text.title=Body text +cms.contenttypes.shared.body_text.description=Edit body text +cms.contenttypes.shared.assign_categories.title=Categories +cms.contenttypes.shared.assign_categories.description=Edit category assignments diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties index e2becc411..e006c159d 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties @@ -287,3 +287,9 @@ cms.ui.create=Anlegen cms.contenttypes.ui.summary=Zusammenfassung cms.contenttypes.ui.newsitem.date\ =Erscheinungsdatum cms.contenttypes.ui.event.start_date=Anfangsdatum +cms.contenttypes.shared.basic_properties.title=Basiseigenschaften bearbeiten +cms.contenttypes.shared.basic_properties.description=Basiseigenschaften bearbeiten +cms.contenttypes.shared.body_text.title=Haupttext +cms.contenttypes.shared.body_text.description=Haupttext bearbeiten +cms.contenttypes.shared.assign_categories.title=Kategorien +cms.contenttypes.shared.assign_categories.description=Kategorienzuweisungen bearbeiten diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties index 29ffb54f7..dbc265b23 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties @@ -246,3 +246,9 @@ cms.ui.create=Create cms.contenttypes.ui.summary=Summary cms.contenttypes.ui.newsitem.date\ =Release date cms.contenttypes.ui.event.start_date=Start date +cms.contenttypes.shared.basic_properties.title=Edit basic properties +cms.contenttypes.shared.basic_properties.description=Edit basic properties +cms.contenttypes.shared.body_text.title=Body text +cms.contenttypes.shared.body_text.description=Edit body text +cms.contenttypes.shared.assign_categories.title=Categories +cms.contenttypes.shared.assign_categories.description=Edit category assignments