CCM NG: Started migration of UI for Lifecycle management in ccm-cms
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4243 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
5ed394bee2
commit
1dccc276d0
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||
import com.arsdigita.bebop.tree.TreeModelBuilder;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.toolbox.ui.SelectionPanel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
/**
|
||||
* A base component for use in CMS admin panes.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
*/
|
||||
public abstract class BaseAdminPane extends SelectionPanel {
|
||||
|
||||
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||
* and set com.arsdigita.cms.ui.BaseAdminPane=DEBUG
|
||||
* by uncommenting or adding the line. */
|
||||
private static final Logger s_log = Logger.getLogger(BaseAdminPane.class);
|
||||
|
||||
protected BaseAdminPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final Component title,
|
||||
final Component selector) {
|
||||
super(title, selector);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final GlobalizedMessage title,
|
||||
final Component selector) {
|
||||
super(title, selector);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final Component title,
|
||||
final Component selector,
|
||||
final SingleSelectionModel model) {
|
||||
super(title, selector, model);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final GlobalizedMessage title,
|
||||
final Component selector,
|
||||
final SingleSelectionModel model) {
|
||||
super(title, selector, model);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final Component title,
|
||||
final ListModelBuilder builder) {
|
||||
super(title, builder);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final GlobalizedMessage title,
|
||||
final ListModelBuilder builder) {
|
||||
super(title, builder);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final Component title,
|
||||
final TreeModelBuilder builder) {
|
||||
super(title, builder);
|
||||
}
|
||||
|
||||
protected BaseAdminPane(final GlobalizedMessage title,
|
||||
final TreeModelBuilder builder) {
|
||||
super(title, builder);
|
||||
}
|
||||
|
||||
protected static GlobalizedMessage gz(final String key) {
|
||||
return new GlobalizedMessage(key, CmsConstants.CMS_BUNDLE);
|
||||
}
|
||||
|
||||
protected static String lz(final String key) {
|
||||
return (String) gz(key).localize();
|
||||
}
|
||||
}
|
||||
|
|
@ -24,9 +24,8 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.cms.ui.BaseAdminPane;
|
||||
import com.arsdigita.cms.ui.BaseDeleteForm;
|
||||
import com.arsdigita.cms.ui.FormSecurityListener;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui.lifecycle;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class LifecycleDefinitionRequestLocal extends RequestLocal {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(LifecycleDefinitionRequestLocal.class);
|
||||
|
||||
public final LifecycleDefinition getLifecycleDefinition
|
||||
(final PageState state) {
|
||||
return (LifecycleDefinition) get(state);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui.lifecycle;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.list.ListModel;
|
||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
|
||||
/**
|
||||
* Loads all the current lifecycles from the database so that they may be
|
||||
* displayed in a list.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
* @author <a href="mailto:pihman@arsdigita.com">Michael Pih</a>
|
||||
* @author <a href="mailto:flattop@arsdigita.com">Jack Chung</a>
|
||||
*/
|
||||
public final class LifecycleListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
|
||||
@Override
|
||||
public final ListModel makeModel(final com.arsdigita.bebop.List list,
|
||||
final PageState state) {
|
||||
return new Model(state);
|
||||
}
|
||||
|
||||
private class Model implements ListModel {
|
||||
|
||||
private List<LifecycleDefinition> m_cycles;
|
||||
|
||||
public Model(final PageState state) {
|
||||
m_cycles = getCollection(state);
|
||||
}
|
||||
|
||||
private List<LifecycleDefinition> getCollection(final PageState state) {
|
||||
final ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
final List<LifecycleDefinition> cycles = section.get
|
||||
getLifecycleDefinitions();
|
||||
|
||||
cycles.addOrder("upper(label)");
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
public boolean next() throws NoSuchElementException {
|
||||
return m_cycles.next();
|
||||
}
|
||||
|
||||
public Object getElement() {
|
||||
return m_cycles.getLifecycleDefinition().getLabel();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return m_cycles.getLifecycleDefinition().getID().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
|
@ -42,6 +41,8 @@ import java.util.ArrayList;
|
|||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import org.libreccm.workflow.WorkflowTemplate;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -53,14 +54,14 @@ import static org.librecms.CmsConstants.*;
|
|||
@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA)
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findByLabel",
|
||||
query = "SELECT s FROM ContentSection s WHERE s.label = :label"),
|
||||
name = "ContentSection.findByLabel",
|
||||
query = "SELECT s FROM ContentSection s WHERE s.label = :label"),
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findPermissions",
|
||||
query = "SELECT p FROM Permission p "
|
||||
+ "WHERE (p.object = :section "
|
||||
+ " OR p.object = :rootDocumentsFolder) "
|
||||
+ "AND p.grantee = :role")
|
||||
name = "ContentSection.findPermissions",
|
||||
query = "SELECT p FROM Permission p "
|
||||
+ "WHERE (p.object = :section "
|
||||
+ " OR p.object = :rootDocumentsFolder) "
|
||||
+ "AND p.grantee = :role")
|
||||
})
|
||||
//@ApplicationType(
|
||||
// name = CONTENT_SECTION_APP_TYPE,
|
||||
|
|
@ -118,10 +119,34 @@ public class ContentSection extends CcmApplication implements Serializable {
|
|||
|
||||
@Column(name = "DEFAULT_LOCALE")
|
||||
private Locale defaultLocale;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "contentSection")
|
||||
private List<ContentType> contentTypes;
|
||||
|
||||
@OneToMany
|
||||
@JoinTable(
|
||||
name = "CONTENT_SECTION_LIFECYCLE_DEFINITIONS",
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "CONTENT_SECTION_ID")
|
||||
},
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(name = "LIFECYCLE_DEFINITION_ID")
|
||||
}
|
||||
)
|
||||
private List<LifecycleDefinition> lifecycleDefinitions;
|
||||
|
||||
@OneToMany
|
||||
@JoinTable(
|
||||
name = "CONTENT_SECTION_WORKFLOW_TEMPLATES",
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "CONTENT_SECTION_ID")
|
||||
},
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(name = "WORKFLOW_TEMPLATE_ID")
|
||||
}
|
||||
)
|
||||
private List<WorkflowTemplate> workflowTemplates;
|
||||
|
||||
public ContentSection() {
|
||||
roles = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -222,19 +247,53 @@ public class ContentSection extends CcmApplication implements Serializable {
|
|||
public List<ContentType> getContentTypes() {
|
||||
return Collections.unmodifiableList(contentTypes);
|
||||
}
|
||||
|
||||
|
||||
protected void setContentTypes(final List<ContentType> contentTypes) {
|
||||
this.contentTypes = contentTypes;
|
||||
}
|
||||
|
||||
|
||||
protected void addContentType(final ContentType contentType) {
|
||||
contentTypes.add(contentType);
|
||||
}
|
||||
|
||||
|
||||
protected void removeContentType(final ContentType contentType) {
|
||||
contentTypes.remove(contentType);
|
||||
}
|
||||
|
||||
|
||||
public List<LifecycleDefinition> getLifecycleDefinitions() {
|
||||
return Collections.unmodifiableList(lifecycleDefinitions);
|
||||
}
|
||||
|
||||
protected void setLifecycleDefinitions(
|
||||
final List<LifecycleDefinition> lifecycleDefinitions) {
|
||||
this.lifecycleDefinitions = lifecycleDefinitions;
|
||||
}
|
||||
|
||||
protected void addLifecycleDefinition(final LifecycleDefinition definition) {
|
||||
lifecycleDefinitions.add(definition);
|
||||
}
|
||||
|
||||
protected void removeLifecycleDefinition(
|
||||
final LifecycleDefinition definition) {
|
||||
lifecycleDefinitions.remove(definition);
|
||||
}
|
||||
|
||||
public List<WorkflowTemplate> getWorkflowTemplates() {
|
||||
return Collections.unmodifiableList(workflowTemplates);
|
||||
}
|
||||
|
||||
protected void setWorkflowTemplates(final List<WorkflowTemplate> workflowTemplates) {
|
||||
this.workflowTemplates = workflowTemplates;
|
||||
}
|
||||
|
||||
protected void addWorkflowTemplate(final WorkflowTemplate template) {
|
||||
workflowTemplates.add(template);
|
||||
}
|
||||
|
||||
protected void removeWorkflowTemplate(final WorkflowTemplate template) {
|
||||
workflowTemplates.remove(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
|
|
@ -301,23 +360,23 @@ public class ContentSection extends CcmApplication implements Serializable {
|
|||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(
|
||||
", label = \"%s\", "
|
||||
+ "rootDocumentsFolder = \"%s\", "
|
||||
+ "rootAssetsFolder = \"%s\", "
|
||||
+ "pageResolverClass = \"%s\", "
|
||||
+ "itemResolverClass = \"%s\", "
|
||||
+ "templateResolverClass = \"%s\", "
|
||||
+ "xmlGeneratorClass = \"%s\", "
|
||||
+ "defaultLocale = \"%s\"%s",
|
||||
label,
|
||||
Objects.toString(rootDocumentsFolder),
|
||||
Objects.toString(rootAssetsFolder),
|
||||
pageResolverClass,
|
||||
itemResolverClass,
|
||||
templateResolverClass,
|
||||
xmlGeneratorClass,
|
||||
Objects.toString(defaultLocale),
|
||||
data));
|
||||
", label = \"%s\", "
|
||||
+ "rootDocumentsFolder = \"%s\", "
|
||||
+ "rootAssetsFolder = \"%s\", "
|
||||
+ "pageResolverClass = \"%s\", "
|
||||
+ "itemResolverClass = \"%s\", "
|
||||
+ "templateResolverClass = \"%s\", "
|
||||
+ "xmlGeneratorClass = \"%s\", "
|
||||
+ "defaultLocale = \"%s\"%s",
|
||||
label,
|
||||
Objects.toString(rootDocumentsFolder),
|
||||
Objects.toString(rootAssetsFolder),
|
||||
pageResolverClass,
|
||||
itemResolverClass,
|
||||
templateResolverClass,
|
||||
xmlGeneratorClass,
|
||||
Objects.toString(defaultLocale),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import javax.inject.Inject;
|
|||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.transaction.Transactional;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
import static org.librecms.contentsection.ContentSection.*;
|
||||
|
|
@ -275,6 +276,43 @@ public class ContentSectionManager {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@AuthorizationRequired
|
||||
@RequiresPrivilege(CoreConstants.ADMIN_PRIVILEGE)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void addLifecycleDefinitionToContentSection(
|
||||
final LifecycleDefinition definition,
|
||||
final ContentSection section) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@AuthorizationRequired
|
||||
@RequiresPrivilege(CoreConstants.ADMIN_PRIVILEGE)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void removeLifecycleDefinitionFromContentSection(
|
||||
final LifecycleDefinition definition,
|
||||
final ContentSection contentSection) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@AuthorizationRequired
|
||||
@RequiresPrivilege(CoreConstants.ADMIN_PRIVILEGE)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void addWorkflowTemplateToContentSection(
|
||||
final LifecycleDefinition definition,
|
||||
final ContentSection section) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@AuthorizationRequired
|
||||
@RequiresPrivilege(CoreConstants.ADMIN_PRIVILEGE)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
|
||||
public void removeWorkflowTemplateFromContentSection(
|
||||
final LifecycleDefinition definition,
|
||||
final ContentSection contentSection) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ItemResolver getItemResolver(final ContentSection section) {
|
||||
try {
|
||||
final Class<ItemResolver> itemResolverClazz = (Class<ItemResolver>) Class.
|
||||
|
|
|
|||
Loading…
Reference in New Issue