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
jensp 2017-06-13 12:04:03 +00:00
parent 7c97e82e87
commit 014fc32ed8
6 changed files with 50 additions and 9 deletions

View File

@ -111,6 +111,10 @@ class ApplyWorkflowController {
final Folder folder, final Folder folder,
final Long workflowTemplateId) { final Long workflowTemplateId) {
Objects.requireNonNull(item);
Objects.requireNonNull(folder);
Objects.requireNonNull(workflowTemplateId);
final WorkflowTemplate workflowTemplate; final WorkflowTemplate workflowTemplate;
if (workflowTemplateId == null if (workflowTemplateId == null
&& permissionChecker && permissionChecker

View File

@ -296,6 +296,7 @@ public class ContentItemRepository
* *
* @return * @return
*/ */
@Transactional(Transactional.TxType.REQUIRED)
public long countByNameInFolder(final Category folder, final String name) { public long countByNameInFolder(final Category folder, final String name) {
final TypedQuery<Long> query = getEntityManager().createNamedQuery( final TypedQuery<Long> query = getEntityManager().createNamedQuery(
@ -317,6 +318,7 @@ public class ContentItemRepository
* *
* @return A list with all items in the folder matching the provided filter. * @return A list with all items in the folder matching the provided filter.
*/ */
@Transactional(Transactional.TxType.REQUIRED)
public List<ContentItem> filterByFolderAndName(final Category folder, public List<ContentItem> filterByFolderAndName(final Category folder,
final String name) { final String name) {
@ -340,6 +342,7 @@ public class ContentItemRepository
* @return The number of items in the folder/category which match the * @return The number of items in the folder/category which match the
* provided pattern. * provided pattern.
*/ */
@Transactional(Transactional.TxType.REQUIRED)
public long countFilterByFolderAndName(final Category folder, public long countFilterByFolderAndName(final Category folder,
final String name) { final String name) {
final TypedQuery<Long> query = getEntityManager() final TypedQuery<Long> query = getEntityManager()
@ -352,6 +355,7 @@ public class ContentItemRepository
return query.getSingleResult(); return query.getSingleResult();
} }
@Transactional(Transactional.TxType.REQUIRED)
public Optional<ContentItem> findItemWithWorkflow(final Workflow workflow) { public Optional<ContentItem> findItemWithWorkflow(final Workflow workflow) {
final TypedQuery<ContentItem> query = getEntityManager() final TypedQuery<ContentItem> query = getEntityManager()
@ -378,6 +382,7 @@ public class ContentItemRepository
* provided path or an empty {@code Optional} if there is no such * provided path or an empty {@code Optional} if there is no such
* item. * item.
*/ */
@Transactional(Transactional.TxType.REQUIRED)
public Optional<ContentItem> findByPath(final String path) { public Optional<ContentItem> findByPath(final String path) {
//The last token is the name of the item itself. Remove this part an get //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 * provided path or an empty {@code Optional} if there is no such
* item. * item.
*/ */
@Transactional(Transactional.TxType.REQUIRED)
public Optional<ContentItem> findByPath(final ContentSection section, public Optional<ContentItem> findByPath(final ContentSection section,
final String path) { final String path) {
@ -429,6 +435,7 @@ public class ContentItemRepository
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
public void save(final ContentItem item) { public void save(final ContentItem item) {
final Date now = new Date(); final Date now = new Date();
final Subject subject = shiro.getSubject(); final Subject subject = shiro.getSubject();

View File

@ -18,7 +18,9 @@
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;
import com.arsdigita.cms.contenttypes.ui.ArticlePropertiesStep;
import com.arsdigita.cms.ui.authoring.PageCreateForm; import com.arsdigita.cms.ui.authoring.PageCreateForm;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
@ -45,8 +47,18 @@ import org.librecms.contentsection.ContentItem;
@Table(name = "ARTICLES", schema = DB_SCHEMA) @Table(name = "ARTICLES", schema = DB_SCHEMA)
@ContentTypeDescription(labelBundle = "org.librecms.contenttypes.Article", @ContentTypeDescription(labelBundle = "org.librecms.contenttypes.Article",
descriptionBundle = "org.librecms.contenttypes.Article") descriptionBundle = "org.librecms.contenttypes.Article")
@AuthoringKit(createComponent = PageCreateForm.class, @AuthoringKit(
steps = {}) 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 { public class Article extends ContentItem implements Serializable {
private static final long serialVersionUID = 3832010184748095822L; private static final long serialVersionUID = 3832010184748095822L;

View File

@ -290,3 +290,9 @@ cms.ui.create=Create
cms.contenttypes.ui.summary=Summary cms.contenttypes.ui.summary=Summary
cms.contenttypes.ui.newsitem.date\ =Release date cms.contenttypes.ui.newsitem.date\ =Release date
cms.contenttypes.ui.event.start_date=Start 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

View File

@ -287,3 +287,9 @@ cms.ui.create=Anlegen
cms.contenttypes.ui.summary=Zusammenfassung cms.contenttypes.ui.summary=Zusammenfassung
cms.contenttypes.ui.newsitem.date\ =Erscheinungsdatum cms.contenttypes.ui.newsitem.date\ =Erscheinungsdatum
cms.contenttypes.ui.event.start_date=Anfangsdatum 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

View File

@ -246,3 +246,9 @@ cms.ui.create=Create
cms.contenttypes.ui.summary=Summary cms.contenttypes.ui.summary=Summary
cms.contenttypes.ui.newsitem.date\ =Release date cms.contenttypes.ui.newsitem.date\ =Release date
cms.contenttypes.ui.event.start_date=Start 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