CCM NG: Current status of the migration of the UI of ccm-cms (not tested yet!)
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4210 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
61bea04c13
commit
a704ef72a6
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms;
|
|||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.ui.CMSApplicationPage;
|
||||
import com.arsdigita.cms.ui.contentcenter.MainPage;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
|
|
@ -99,10 +100,10 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
|||
// Addresses previously noted in WEB-INF/resources/content-center-map.xml
|
||||
// Obviously not required.
|
||||
|
||||
//ToDo
|
||||
// addPage("/", new MainPage()); // index page at address ~/cc
|
||||
// addPage("/index", new MainPage());
|
||||
//ToDo End
|
||||
|
||||
addPage("/", new MainPage()); // index page at address ~/cc
|
||||
addPage("/index", new MainPage());
|
||||
|
||||
|
||||
// addPage("/item-search", new CMSItemSearchPage());
|
||||
// Old style
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2001-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.SimpleContainer;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A simple container with XML wrapper tags.
|
||||
*
|
||||
* @author Michael Pih (pihman@arsdigita.com)
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CMSContainer extends SimpleContainer {
|
||||
|
||||
public final static String CMS_XML_NS = "http://www.arsdigita.com/cms/1.0";
|
||||
|
||||
|
||||
public CMSContainer() {
|
||||
super("cms:container", CMS_XML_NS);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
import com.arsdigita.ui.login.LoginServlet;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.CoreConstants;
|
||||
import org.libreccm.security.PermissionChecker;
|
||||
import org.libreccm.web.ApplicationCreator;
|
||||
import org.libreccm.web.ApplicationManager;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.ApplicationType;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Global navigation elements for the CMS admin UIs.</p>
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id$
|
||||
*/
|
||||
// Made public (instead of unspecified, resulting in protected) in 6.6.8
|
||||
public class GlobalNavigation extends SimpleComponent {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(GlobalNavigation.class);
|
||||
private final String m_adminPath;
|
||||
private final String m_centerPath;
|
||||
private final String m_changePasswordPath;
|
||||
private final String m_helpPath;
|
||||
private final String m_signOutPath;
|
||||
private final String m_wspcPath;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GlobalNavigation() {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ApplicationManager appManager = cdiUtil.findBean(
|
||||
ApplicationManager.class);
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
final Map<String, ApplicationType> appTypes = appManager
|
||||
.getApplicationTypes();
|
||||
final ApplicationType adminAppType = appTypes.get(
|
||||
AdminUiConstants.ADMIN_APP_TYPE);
|
||||
final List<CcmApplication> adminApps = appRepo.findByType(adminAppType
|
||||
.name());
|
||||
final ApplicationType contentCenterAppType = appTypes.get(
|
||||
CmsConstants.CONTENT_CENTER_APP_TYPE);
|
||||
final List<CcmApplication> contentCenterApps = appRepo.findByType(
|
||||
contentCenterAppType.name());
|
||||
|
||||
m_adminPath = adminApps.get(0).getPrimaryUrl();
|
||||
m_centerPath = contentCenterApps.get(0).getPrimaryUrl();
|
||||
m_changePasswordPath = LoginServlet.getChangePasswordPageURL();
|
||||
m_helpPath = "/nowhere"; // We don't have this yet XXX.
|
||||
m_signOutPath = LoginServlet.getLogoutPageURL();
|
||||
m_wspcPath = UI.getWorkspaceURL();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
if (isVisible(state)) {
|
||||
final HttpServletRequest sreq = state.getRequest();
|
||||
|
||||
final Element nav = parent.newChildElement("cms:globalNavigation",
|
||||
CMS.CMS_XML_NS);
|
||||
final String centerTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.content_center", CmsConstants.CMS_BUNDLE).localize();
|
||||
final String adminTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.admin_center", CmsConstants.CMS_BUNDLE).localize();
|
||||
final String wspcTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.my_workspace", CmsConstants.CMS_BUNDLE).localize();
|
||||
final String signOutTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.sign_out", CmsConstants.CMS_BUNDLE).localize();
|
||||
final String helpTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.help", CmsConstants.CMS_BUNDLE).localize();
|
||||
final String changePasswordTitle = (String) new GlobalizedMessage(
|
||||
"cms.ui.change_password", CmsConstants.CMS_BUNDLE).localize();
|
||||
|
||||
link(sreq, nav, "cms:contentCenter", m_centerPath, centerTitle);
|
||||
|
||||
/* If the current user has admin permissions, insert a link to the admin center */
|
||||
if (CdiUtil.createCdiUtil().findBean(PermissionChecker.class)
|
||||
.isPermitted(CoreConstants.ADMIN_PRIVILEGE)) {
|
||||
link(sreq, nav, "cms:adminCenter", m_adminPath, adminTitle);
|
||||
}
|
||||
|
||||
link(sreq, nav, "cms:workspace", m_wspcPath, wspcTitle);
|
||||
link(sreq, nav, "cms:changePassword", m_changePasswordPath,
|
||||
changePasswordTitle);
|
||||
link(sreq, nav, "cms:signOut", m_signOutPath, signOutTitle);
|
||||
link(sreq, nav, "cms:help", m_helpPath, helpTitle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sreq
|
||||
* @param parent
|
||||
* @param name
|
||||
* @param path
|
||||
* @param title
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static Element link(final HttpServletRequest sreq,
|
||||
final Element parent,
|
||||
final String name,
|
||||
final String path,
|
||||
final String title) {
|
||||
final Element link = parent.newChildElement(name, CMS.CMS_XML_NS);
|
||||
|
||||
link.addAttribute("href", URL.there(sreq, path).toString());
|
||||
link.addAttribute("title", title);
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.toolbox.ui.ContextBar;
|
||||
import com.arsdigita.web.URL;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.ApplicationManager;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.ApplicationType;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>The context bar of the content center UI.</p>
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id$
|
||||
*/
|
||||
// Made public (instead of unspecified) in 6.6.8
|
||||
public class WorkspaceContextBar extends ContextBar {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(WorkspaceContextBar.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected List entries(final PageState state) {
|
||||
|
||||
final List entries = super.entries(state);
|
||||
|
||||
final String centerTitle = (String) new GlobalizedMessage("cms.ui.content_center", CmsConstants.CMS_BUNDLE).localize();
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
final List<CcmApplication> apps = appRepo.findByType(CmsConstants.CONTENT_SECTION_APP_TYPE);
|
||||
|
||||
final String centerPath = apps.get(0).getPrimaryUrl();
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Got Url: " + centerPath);
|
||||
}
|
||||
final URL url = URL.there(state.getRequest(), centerPath);
|
||||
|
||||
entries.add(new Entry(centerTitle, url));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,17 +17,25 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.contentcenter;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.bebop.parameters.LongParameter;
|
||||
import com.arsdigita.cms.ui.CMSApplicationPage;
|
||||
import com.arsdigita.cms.ui.GlobalNavigation;
|
||||
import com.arsdigita.cms.ui.WorkspaceContextBar;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.ui.CcmObjectSelectionModel;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -59,10 +67,10 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
private TabbedPane m_tabbedPane;
|
||||
|
||||
private TasksPanel m_tasks;
|
||||
private ItemSearch m_search;
|
||||
private IdSearchTab m_IdSearch;
|
||||
private ACSObjectSelectionModel m_typeSel;
|
||||
private ACSObjectSelectionModel m_sectionSel;
|
||||
// private ItemSearch m_search;
|
||||
// private IdSearchTab m_IdSearch;
|
||||
private CcmObjectSelectionModel<ContentType> m_typeSel;
|
||||
private CcmObjectSelectionModel<ContentSection> m_sectionSel;
|
||||
|
||||
public static final String CONTENT_TYPE = "type_id";
|
||||
public static final String CONTENT_SECTION = "section_id";
|
||||
|
|
@ -83,19 +91,14 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
/* Set the class attribute value (down in SimpleComponent). */
|
||||
setClassAttr("cms-admin");
|
||||
|
||||
BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE);
|
||||
LongParameter typeId = new LongParameter(CONTENT_TYPE);
|
||||
addGlobalStateParam(typeId);
|
||||
m_typeSel = new ACSObjectSelectionModel(
|
||||
ContentType.class.getName(),
|
||||
ContentType.BASE_DATA_OBJECT_TYPE,
|
||||
typeId
|
||||
);
|
||||
m_typeSel = new CcmObjectSelectionModel(ContentType.class, typeId);
|
||||
|
||||
BigDecimalParameter sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
LongParameter sectionId = new LongParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(sectionId);
|
||||
m_sectionSel = new ACSObjectSelectionModel(
|
||||
ContentSection.class.getName(),
|
||||
ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
m_sectionSel = new CcmObjectSelectionModel(
|
||||
ContentSection.class,
|
||||
sectionId
|
||||
);
|
||||
|
||||
|
|
@ -103,14 +106,14 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
add(new GlobalNavigation());
|
||||
|
||||
m_tasks = getTasksPane(m_typeSel, m_sectionSel);
|
||||
m_search = getSearchPane();
|
||||
m_IdSearch = getIdSearchPane();
|
||||
// m_search = getSearchPane();
|
||||
// m_IdSearch = getIdSearchPane();
|
||||
|
||||
m_tabbedPane = createTabbedPane();
|
||||
m_tabbedPane.setIdAttr("page-body");
|
||||
add(m_tabbedPane);
|
||||
|
||||
add(new DebugPanel());
|
||||
// add(new DebugPanel());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -118,34 +121,34 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
* Creates, and then caches, the Tasks pane. Overriding this method to
|
||||
* return null will prevent this tab from appearing.
|
||||
*/
|
||||
protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel,
|
||||
ACSObjectSelectionModel sectionModel) {
|
||||
protected TasksPanel getTasksPane(CcmObjectSelectionModel<ContentType> typeModel,
|
||||
CcmObjectSelectionModel<ContentSection> sectionModel) {
|
||||
if (m_tasks == null) {
|
||||
m_tasks = new TasksPanel(typeModel, sectionModel);
|
||||
}
|
||||
return m_tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates, and then caches, the Search pane. Overriding this method to
|
||||
* return null will prevent this tab from appearing.
|
||||
*
|
||||
*/
|
||||
protected ItemSearch getSearchPane() {
|
||||
if (m_search == null) {
|
||||
m_search = new ItemSearch(ContentItem.DRAFT);
|
||||
}
|
||||
|
||||
return m_search;
|
||||
}
|
||||
|
||||
protected IdSearchTab getIdSearchPane() {
|
||||
if (m_IdSearch == null) {
|
||||
m_IdSearch = new IdSearchTab("idsearch");
|
||||
}
|
||||
|
||||
return m_IdSearch;
|
||||
}
|
||||
// /**
|
||||
// * Creates, and then caches, the Search pane. Overriding this method to
|
||||
// * return null will prevent this tab from appearing.
|
||||
// *
|
||||
// */
|
||||
// protected ItemSearch getSearchPane() {
|
||||
// if (m_search == null) {
|
||||
// m_search = new ItemSearch(ContentItem.DRAFT);
|
||||
// }
|
||||
//
|
||||
// return m_search;
|
||||
// }
|
||||
//
|
||||
// protected IdSearchTab getIdSearchPane() {
|
||||
// if (m_IdSearch == null) {
|
||||
// m_IdSearch = new IdSearchTab("idsearch");
|
||||
// }
|
||||
//
|
||||
// return m_IdSearch;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Created the TabbedPane to use for this page. Sets the class attribute for
|
||||
|
|
@ -161,23 +164,24 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
protected TabbedPane createTabbedPane() {
|
||||
TabbedPane tabbedPane = new TabbedPane();
|
||||
tabbedPane.setClassAttr(XSL_CLASS);
|
||||
Label taskLabel = new Label(GlobalizationUtil
|
||||
.globalize("cms.ui.contentcenter.mainpage.taskssections"));
|
||||
Label searchLabel = new Label(GlobalizationUtil
|
||||
.globalize("cms.ui.contentcenter.mainpage.search"));
|
||||
Label taskLabel = new Label(new GlobalizedMessage(
|
||||
"cms.ui.contentcenter.mainpage.taskssections",
|
||||
CmsConstants.CMS_BUNDLE));
|
||||
Label searchLabel = new Label(new GlobalizedMessage(
|
||||
"cms.ui.contentcenter.mainpage.search", CmsConstants.CMS_BUNDLE));
|
||||
Label IdsearchLabel = new Label("ID Search");
|
||||
|
||||
addToPane(tabbedPane,
|
||||
taskLabel,
|
||||
getTasksPane(m_typeSel, m_sectionSel));
|
||||
addToPane(tabbedPane,
|
||||
// searchLabel,
|
||||
new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.contentcenter.mainpage.search")),
|
||||
getSearchPane());
|
||||
addToPane(tabbedPane,
|
||||
IdsearchLabel,
|
||||
getIdSearchPane());
|
||||
// addToPane(tabbedPane,
|
||||
// new Label(new GlobalizedMessage(
|
||||
// "cms.ui.contentcenter.mainpage.search",
|
||||
// CmsConstants.CMS_BUNDLE)),
|
||||
// getSearchPane());
|
||||
// addToPane(tabbedPane,
|
||||
// IdsearchLabel,
|
||||
// getIdSearchPane());
|
||||
|
||||
tabbedPane.addActionListener(this);
|
||||
return tabbedPane;
|
||||
|
|
@ -224,11 +228,12 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
|||
|
||||
if (pane == m_tasks) {
|
||||
m_tasks.reset(state);
|
||||
} else if (pane == m_search) {
|
||||
m_search.reset(state);
|
||||
} else if (pane == m_IdSearch) {
|
||||
m_IdSearch.reset(state);
|
||||
}
|
||||
}
|
||||
// else if (pane == m_search) {
|
||||
// m_search.reset(state);
|
||||
// } else if (pane == m_IdSearch) {
|
||||
// m_IdSearch.reset(state);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,780 @@
|
|||
/*
|
||||
* Copyright (C) 2001-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.contentcenter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Image;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.PaginationModelBuilder;
|
||||
import com.arsdigita.bebop.Paginator;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.ChangeEvent;
|
||||
import com.arsdigita.bebop.event.ChangeListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ui.CMSContainer;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.ui.CcmObjectSelectionModel;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TasksPanel extends CMSContainer {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(TasksPanel.class);
|
||||
// The default number of rows to show
|
||||
private static final int DEFAULT_MAX_ROWS = 15;
|
||||
// Number of tasks to show
|
||||
private final int m_maxRows;
|
||||
private TaskList m_taskList;
|
||||
// private ActionLink m_viewAllLink;
|
||||
// private ActionLink m_viewShortLink;
|
||||
private Paginator m_paginator;
|
||||
private ActionLink m_viewLockLink, m_viewUnlockLink, m_viewAllLockLink;
|
||||
private Label m_viewLockLabel, m_viewUnlockLabel, m_viewAllLockLabel;
|
||||
private StringParameter m_sortDirectionParam;
|
||||
private StringParameter m_sortTypeParam;
|
||||
private StringParameter m_lockFilterParam;
|
||||
// control link variable
|
||||
private static final String TASK_PANEL_CLASS = "taskPanel";
|
||||
private static final String TASK_ACTION = "taskAction";
|
||||
private static final String SORT_DOWN = "sortActionUp";
|
||||
private static final String SORT_UP = "sortActionDown";
|
||||
private static final String LOCK_FILTER_TYPE = "lockFilterType";
|
||||
private static final String SORT_TYPE = "sortType";
|
||||
private static final String SORT_DIRECTION = "sortDirection";
|
||||
private static final String SORT_ACTION = "action";
|
||||
private static final String SORT_DATE = "date";
|
||||
private static final String SORT_STATUS = "status";
|
||||
private static final String SORT_TITLE = "title";
|
||||
private static final String SORT_USER = "user";
|
||||
private static final String SORT_WORKFLOW = "workflow";
|
||||
// IMAGES
|
||||
public static final String UP_ARROW_IMAGE
|
||||
= "/themes/heirfloom/images/gray-triangle-up.gif";
|
||||
public static final String DOWN_ARROW_IMAGE
|
||||
= "/themes/heirfloom/images/gray-triangle-down.gif";
|
||||
// CREATION PANE CONSTANTS
|
||||
private Label m_selectorLabel;
|
||||
//ToDo
|
||||
// private CreationSelector m_selector;
|
||||
// private ContentSectionContainer m_sections;
|
||||
// ToDo End
|
||||
private CcmObjectSelectionModel m_sectionSel;
|
||||
private CcmObjectSelectionModel m_typeSel;
|
||||
|
||||
// private RootFolderSelectionModel m_folderSel;
|
||||
private BoxPanel m_creationPane;
|
||||
|
||||
/**
|
||||
* Constructs a new task panel that shows no more than 15 enabled tasks by
|
||||
* default.
|
||||
*
|
||||
* @param typeModel
|
||||
* @param sectionModel
|
||||
*
|
||||
*/
|
||||
public TasksPanel(CcmObjectSelectionModel typeModel,
|
||||
CcmObjectSelectionModel sectionModel) {
|
||||
this(DEFAULT_MAX_ROWS, typeModel, sectionModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new task panel that shows a specified number enabled tasks.
|
||||
*
|
||||
* @param maxRows the maximum number of rows to show by default
|
||||
* @param typeModel
|
||||
* @param sectionModel
|
||||
*
|
||||
* @pre maxRows != null
|
||||
*
|
||||
*/
|
||||
public TasksPanel(int maxRows, CcmObjectSelectionModel typeModel,
|
||||
CcmObjectSelectionModel sectionModel) {
|
||||
super();
|
||||
|
||||
// Set class attribute
|
||||
setClassAttr(TASK_PANEL_CLASS);
|
||||
|
||||
m_maxRows = maxRows;
|
||||
|
||||
m_typeSel = typeModel;
|
||||
m_sectionSel = sectionModel;
|
||||
|
||||
m_sortDirectionParam = new StringParameter(SORT_DIRECTION);
|
||||
m_sortTypeParam = new StringParameter(SORT_TYPE);
|
||||
m_lockFilterParam = new StringParameter(LOCK_FILTER_TYPE);
|
||||
addComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the components to this tasks panel
|
||||
*/
|
||||
private void addComponents() {
|
||||
m_creationPane = new BoxPanel(BoxPanel.VERTICAL);
|
||||
|
||||
// A label that says "Create $content_type in $section"
|
||||
m_selectorLabel = new Label(new PrintListener() {
|
||||
|
||||
@Override
|
||||
public void prepare(PrintEvent e) {
|
||||
PageState s = e.getPageState();
|
||||
Label t = (Label) e.getTarget();
|
||||
|
||||
ContentType type = (ContentType) m_typeSel.getSelectedObject(s);
|
||||
ContentSection sec = (ContentSection) m_sectionSel
|
||||
.getSelectedObject(s);
|
||||
|
||||
StringBuilder buf = new StringBuilder(
|
||||
new GlobalizedMessage("cms.ui.create",
|
||||
CmsConstants.CMS_BUNDLE).localize()
|
||||
+ " ");
|
||||
buf.append(type.getLabel());
|
||||
buf.append(" in ");
|
||||
buf.append(sec.getLabel());
|
||||
|
||||
t.setLabel(buf.toString());
|
||||
t.setFontWeight(Label.BOLD);
|
||||
t.setClassAttr("creationLabel");
|
||||
}
|
||||
|
||||
});
|
||||
m_selectorLabel.setClassAttr("creationLabel");
|
||||
m_creationPane.add(m_selectorLabel);
|
||||
|
||||
//ToDo
|
||||
// m_folderSel = new RootFolderSelectionModel(m_sectionSel);
|
||||
// m_selector = new CreationSelector(m_typeSel, m_folderSel);
|
||||
// m_creationPane.add(m_selector);
|
||||
//ToDo End
|
||||
|
||||
m_creationPane.setClassAttr("itemCreationPane");
|
||||
add(m_creationPane);
|
||||
|
||||
// The section list UIx
|
||||
//ToDo
|
||||
// m_sections = new ContentSectionContainer(m_typeSel, m_sectionSel);
|
||||
// add(m_sections);
|
||||
//ToDo End
|
||||
// When a new type is selected, show the creation UI.
|
||||
// When the selection is cleared, return to section list
|
||||
m_typeSel.addChangeListener(new ChangeListener() {
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
PageState s = e.getPageState();
|
||||
boolean isSelected = m_typeSel.isSelected(s);
|
||||
|
||||
//ToDo
|
||||
// m_sections.setVisible(s, !isSelected);
|
||||
//ToDo End
|
||||
m_creationPane.setVisible(s, isSelected);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_viewLockLink = new ActionLink(new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_locked", CmsConstants.CMS_BUNDLE)));
|
||||
m_viewLockLink.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
ps.setValue(m_lockFilterParam, "lock");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_viewUnlockLink = new ActionLink(new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_unlocked", CmsConstants.CMS_BUNDLE)));
|
||||
m_viewUnlockLink.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
ps.setValue(m_lockFilterParam, "unlock");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_viewAllLockLink = new ActionLink(new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_all", CmsConstants.CMS_BUNDLE)));
|
||||
m_viewAllLockLink.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
ps.setValue(m_lockFilterParam, "all");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_viewLockLabel = new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_locked", CmsConstants.CMS_BUNDLE));
|
||||
m_viewLockLabel.setFontWeight(Label.BOLD);
|
||||
m_viewUnlockLabel = new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_unlocked", CmsConstants.CMS_BUNDLE));
|
||||
m_viewUnlockLabel.setFontWeight(Label.BOLD);
|
||||
m_viewAllLockLabel = new Label(new GlobalizedMessage(
|
||||
"cms.ui.workflow.task.view_all", CmsConstants.CMS_BUNDLE));
|
||||
m_viewAllLockLabel.setFontWeight(Label.BOLD);
|
||||
|
||||
add(new Label("<br />", false));
|
||||
add(m_viewLockLink);
|
||||
add(m_viewLockLabel);
|
||||
add(new Label(" ", false));
|
||||
add(m_viewUnlockLink);
|
||||
add(m_viewUnlockLabel);
|
||||
add(new Label(" ", false));
|
||||
add(m_viewAllLockLink);
|
||||
add(m_viewAllLockLabel);
|
||||
add(new Label("<br />", false));
|
||||
add(new Label("<br />", false));
|
||||
|
||||
add(getTasksList());
|
||||
add(getPaginator());
|
||||
|
||||
// m_actionLabel = new Label(GlobalizationUtil.globalize("cms.ui.action"));
|
||||
// m_actionLabel.setClassAttr("action");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param p
|
||||
*/
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
|
||||
p.setVisibleDefault(m_creationPane, false);
|
||||
//ToDo
|
||||
// p.addComponentStateParam(this, m_folderSel.getStateParameter());
|
||||
//ToDo End
|
||||
|
||||
p.addGlobalStateParam(m_lockFilterParam);
|
||||
p.addGlobalStateParam(m_sortTypeParam);
|
||||
p.addGlobalStateParam(m_sortDirectionParam);
|
||||
|
||||
p.setVisibleDefault(m_viewLockLabel, false);
|
||||
p.setVisibleDefault(m_viewUnlockLabel, false);
|
||||
p.setVisibleDefault(m_viewAllLockLink, false);
|
||||
|
||||
p.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final PageState state = e.getPageState();
|
||||
|
||||
String lockFilterType = getLockFilterType(state);
|
||||
|
||||
if (lockFilterType.equals("lock")) {
|
||||
m_viewLockLabel.setVisible(state, true);
|
||||
m_viewLockLink.setVisible(state, false);
|
||||
m_viewUnlockLabel.setVisible(state, false);
|
||||
m_viewUnlockLink.setVisible(state, true);
|
||||
m_viewAllLockLabel.setVisible(state, false);
|
||||
m_viewAllLockLink.setVisible(state, true);
|
||||
} else if (lockFilterType.equals("unlock")) {
|
||||
m_viewLockLabel.setVisible(state, false);
|
||||
m_viewLockLink.setVisible(state, true);
|
||||
m_viewUnlockLabel.setVisible(state, true);
|
||||
m_viewUnlockLink.setVisible(state, false);
|
||||
m_viewAllLockLabel.setVisible(state, false);
|
||||
m_viewAllLockLink.setVisible(state, true);
|
||||
} else {
|
||||
m_viewLockLabel.setVisible(state, false);
|
||||
m_viewLockLink.setVisible(state, true);
|
||||
m_viewUnlockLabel.setVisible(state, false);
|
||||
m_viewUnlockLink.setVisible(state, true);
|
||||
m_viewAllLockLabel.setVisible(state, true);
|
||||
m_viewAllLockLink.setVisible(state, false);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void reset(PageState state) {
|
||||
m_typeSel.clearSelection(state);
|
||||
m_sectionSel.clearSelection(state);
|
||||
}
|
||||
|
||||
protected Paginator getPaginator() {
|
||||
if (m_paginator == null) {
|
||||
m_paginator = new Paginator(new TasksPaginationModelBuilder(),
|
||||
m_maxRows);
|
||||
}
|
||||
return m_paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bebop List component to display the tasks
|
||||
*
|
||||
*/
|
||||
private TaskList getTasksList() {
|
||||
if (m_taskList == null) {
|
||||
m_taskList = new TaskList(true);
|
||||
}
|
||||
return m_taskList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of enabled tasks for the specified user.
|
||||
*
|
||||
* @param state
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
protected int numberTasksForUser(PageState state) {
|
||||
return m_taskList.size(state);
|
||||
}
|
||||
|
||||
protected String getSortType(PageState state) {
|
||||
String sortType = (String) state.getValue(m_sortTypeParam);
|
||||
if (sortType == null) {
|
||||
sortType = SORT_DATE;
|
||||
}
|
||||
return sortType;
|
||||
}
|
||||
|
||||
protected String getSortDirection(PageState state) {
|
||||
String sortDirection = (String) state.getValue(m_sortDirectionParam);
|
||||
if (sortDirection == null) {
|
||||
sortDirection = SORT_UP;
|
||||
}
|
||||
return sortDirection;
|
||||
}
|
||||
|
||||
protected String getLockFilterType(PageState state) {
|
||||
String lockFilterType = (String) state.getValue(m_lockFilterParam);
|
||||
if (lockFilterType == null || lockFilterType.equals("")) {
|
||||
lockFilterType = "lock";
|
||||
}
|
||||
return lockFilterType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds filters to the task query
|
||||
*/
|
||||
//ToDo
|
||||
// protected void addQueryFilters(DataQuery query, Party party, PageState state) {
|
||||
// query.setParameter("userId", party.getID());
|
||||
//
|
||||
// FilterFactory ff = query.getFilterFactory();
|
||||
//
|
||||
// // TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
||||
// // TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
||||
// CompoundFilter authorFilter = ff.and();
|
||||
// //cg query changed to refer to task type id
|
||||
// authorFilter.addFilter(ff.equals("taskType", CMSTaskType.AUTHOR));
|
||||
// authorFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(
|
||||
// CMSTaskType.AUTHOR),
|
||||
// party, ff));
|
||||
//
|
||||
// CompoundFilter approveFilter = ff.and();
|
||||
// approveFilter.addFilter(ff.equals("taskType", CMSTaskType.EDIT));
|
||||
// approveFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(
|
||||
// CMSTaskType.EDIT),
|
||||
// party, ff));
|
||||
//
|
||||
// CompoundFilter deployFilter = ff.and();
|
||||
// deployFilter.addFilter(ff.equals("taskType", CMSTaskType.DEPLOY));
|
||||
// deployFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(
|
||||
// CMSTaskType.DEPLOY),
|
||||
// party, ff));
|
||||
//
|
||||
// CompoundFilter permissionFilter = ff.or();
|
||||
// permissionFilter.addFilter(authorFilter);
|
||||
// permissionFilter.addFilter(approveFilter);
|
||||
// permissionFilter.addFilter(deployFilter);
|
||||
//
|
||||
// query.addFilter(permissionFilter);
|
||||
//
|
||||
// String lockFilterType = getLockFilterType(state);
|
||||
// if (lockFilterType.equals("lock")) {
|
||||
// query.addEqualsFilter("isLocked", "t");
|
||||
// query.addEqualsFilter("status", "1");
|
||||
// } else if (lockFilterType.equals("unlock")) {
|
||||
// query.addEqualsFilter("isLocked", "f");
|
||||
// } // else show all
|
||||
// }
|
||||
|
||||
|
||||
// private static class RootFolderSelectionModel
|
||||
// extends FolderSelectionModel {
|
||||
//
|
||||
// CcmObjectSelectionModel m_sectionSel;
|
||||
//
|
||||
// public RootFolderSelectionModel(CcmObjectSelectionModel sectionSel) {
|
||||
// super("f");
|
||||
// m_sectionSel = sectionSel;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected BigDecimal getRootFolderID(PageState s) {
|
||||
// ContentSection sec = (ContentSection) m_sectionSel
|
||||
// .getSelectedObject(s);
|
||||
// Assert.exists(sec);
|
||||
//
|
||||
// User user = Web.getWebContext().getUser();
|
||||
// if (user != null) {
|
||||
// Folder folder = Folder.getUserHomeFolder(user, sec);
|
||||
// if (folder != null) {
|
||||
// return folder.getID();
|
||||
// }
|
||||
// }
|
||||
// return sec.getRootFolder().getID();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//ToDo End
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private class TasksPaginationModelBuilder implements PaginationModelBuilder {
|
||||
|
||||
@Override
|
||||
public int getTotalSize(Paginator paginator,
|
||||
PageState state) {
|
||||
return numberTasksForUser(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(PageState state) {
|
||||
return numberTasksForUser(state) > m_maxRows;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class TaskList extends SimpleComponent {
|
||||
|
||||
private final static String QUERY_NAME
|
||||
= "com.arsdigita.cms.workflow.getEnabledUserTasks";
|
||||
private boolean m_paginate = false;
|
||||
|
||||
public TaskList(boolean paginate) {
|
||||
m_paginate = paginate;
|
||||
}
|
||||
|
||||
// private DataQuery makeQuery(PageState state) {
|
||||
// User user = (User) Kernel.getContext().getParty();
|
||||
//
|
||||
// DataQuery query = SessionManager.getSession()
|
||||
// .retrieveQuery(QUERY_NAME);
|
||||
// addQueryFilters(query, user, state);
|
||||
//
|
||||
// return query;
|
||||
// }
|
||||
|
||||
public int size(PageState ps) {
|
||||
return ((Long) m_taskCount.get(ps)).intValue();
|
||||
}
|
||||
|
||||
private RequestLocal m_taskCount = new RequestLocal() {
|
||||
|
||||
@Override
|
||||
public Object initialValue(PageState state) {
|
||||
// DataQuery query = makeQuery(state);
|
||||
// return new Long(query.size());
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void generateXML(PageState state,
|
||||
Element parent) {
|
||||
Element content = parent.newChildElement("cms:tasksPanel",
|
||||
CMS.CMS_XML_NS);
|
||||
exportAttributes(content);
|
||||
|
||||
// DataQuery query = makeQuery(state);
|
||||
|
||||
String lockFilterType = getLockFilterType(state);
|
||||
content.addAttribute("lockFilterType", lockFilterType);
|
||||
|
||||
if (m_paginate) {
|
||||
// query.setRange(new Integer(m_paginator.getFirst(state)),
|
||||
// new Integer(m_paginator.getLast(state) + 1));
|
||||
}
|
||||
|
||||
String sortKey = getSortType(state);
|
||||
String sortDirection = getSortDirection(state);
|
||||
String sortPostfix = " asc";
|
||||
if (sortDirection.equals(SORT_DOWN)) {
|
||||
sortPostfix = " desc";
|
||||
}
|
||||
|
||||
// if (sortKey.equals(SORT_TITLE)) {
|
||||
// query.setOrder("lower(pageTitle) " + sortPostfix
|
||||
// + ", lower(status) asc, dueDate desc");
|
||||
// } else if (sortKey.equals(SORT_DATE)) {
|
||||
// query.setOrder("dueDate " + sortPostfix
|
||||
// + ", lower(status) asc, lower(pageTitle) asc");
|
||||
// } else if (sortKey.equals(SORT_USER)) {
|
||||
// query.setOrder("lockingUserID " + sortPostfix
|
||||
// + ", lower(status) asc, dueDate desc "
|
||||
// + ", lower(pageTitle) asc");
|
||||
// } else if (sortKey.equals(SORT_STATUS)) {
|
||||
// query.setOrder("lower(status) " + sortPostfix
|
||||
// + ", dueDate desc "
|
||||
// + ", lower(pageTitle) asc");
|
||||
//
|
||||
// } else if (sortKey.equals(SORT_ACTION)) {
|
||||
// query.setOrder("taskType " + sortPostfix
|
||||
// + ", lower(status) asc, dueDate desc "
|
||||
// + ", lower(pageTitle) asc");
|
||||
// } else if (sortKey.equals(SORT_WORKFLOW)) {
|
||||
// query.setOrder("processLabel " + sortPostfix
|
||||
// + ", lower(status) asc, dueDate desc "
|
||||
// + ", lower(pageTitle) asc");
|
||||
// }
|
||||
//
|
||||
// HashMap sections = new HashMap();
|
||||
//
|
||||
// while (query.next()) {
|
||||
// BigDecimal sectionID = (BigDecimal) query.get("sectionID");
|
||||
// String sectionPath = (String) sections.get(sectionID);
|
||||
// if (sectionPath == null) {
|
||||
// try {
|
||||
// ContentSection section
|
||||
// = (ContentSection) DomainObjectFactory
|
||||
// .newInstance(new OID(
|
||||
// ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
// sectionID));
|
||||
// sectionPath = section.getPath();
|
||||
// } catch (DataObjectNotFoundException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "cannot find content section", ex);
|
||||
// }
|
||||
// sections.put(sectionID, sectionPath);
|
||||
// }
|
||||
//
|
||||
// Element task = content.newChildElement("cms:tasksPanelTask",
|
||||
// CMS.CMS_XML_NS);
|
||||
//
|
||||
// BigDecimal itemID = (BigDecimal) query.get("itemID");
|
||||
// String taskType = (String) query.get("taskType");
|
||||
//
|
||||
// task.addAttribute("taskID", query.get("taskID").toString());
|
||||
// task
|
||||
// .addAttribute("processID", query.get("processID").toString());
|
||||
// task.addAttribute("taskLabel", (String) query.get("taskLabel"));
|
||||
// task.addAttribute("taskDescription", (String) query.get(
|
||||
// "taskDescription"));
|
||||
// task.addAttribute("processLabel", (String) query.get(
|
||||
// "processLabel"));
|
||||
//
|
||||
// String isLocked = (String) query.get("isLocked");
|
||||
// task.addAttribute("isLocked", isLocked);
|
||||
// if (query.get("dueDate") != null) {
|
||||
// java.util.Date d = (java.util.Date) query.get("dueDate");
|
||||
// SimpleDateFormat df = new SimpleDateFormat(
|
||||
// "EEE, MMM d, yyyy");
|
||||
//
|
||||
// task.addAttribute("dueDate", df.format(d));
|
||||
// }
|
||||
//
|
||||
// task.addAttribute("itemID", itemID.toString());
|
||||
// task
|
||||
// .addAttribute("sectionID", query.get("sectionID").toString());
|
||||
// task.addAttribute("sectionPath", sectionPath);
|
||||
// task.addAttribute("pageName", (String) query.get("pageName"));
|
||||
// task.addAttribute("pageTitle", (String) query.get("pageTitle"));
|
||||
//
|
||||
// BigDecimal lockingUserID = (BigDecimal) query.get(
|
||||
// "lockingUserID");
|
||||
// if (lockingUserID != null) {
|
||||
// task.addAttribute("lockingUserID", lockingUserID.toString());
|
||||
// if (!"f".equals(isLocked)) {
|
||||
// User lockingUser = User.retrieve(lockingUserID);
|
||||
// if (lockingUser != null) {
|
||||
// task.addAttribute("assignee", lockingUser
|
||||
// .getDisplayName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// task.addAttribute("taskType", taskType);
|
||||
// task.addAttribute("taskTypeClass", (String) query.get(
|
||||
// "taskTypeClass"));
|
||||
// task.addAttribute("status", query.get("status").toString());
|
||||
//
|
||||
// // control event for locking a task
|
||||
// try {
|
||||
// state.setControlEvent(this, TASK_ACTION, itemID.toString());
|
||||
// task.addAttribute("actionURL", state.stateAsURL());
|
||||
// state.clearControlEvent();
|
||||
// } catch (java.io.IOException ex) {
|
||||
// s_log.warn("Error: " + ex.getMessage());
|
||||
// }
|
||||
//
|
||||
// if ("Deploy".equals(taskType)) {
|
||||
// task.addAttribute("editTabNumber",
|
||||
// String.valueOf(
|
||||
// ContentItemPage.PUBLISHING_TAB));
|
||||
// } else {
|
||||
// task.addAttribute("editTabNumber",
|
||||
// String.valueOf(
|
||||
// ContentItemPage.AUTHORING_TAB));
|
||||
// }
|
||||
}
|
||||
|
||||
// m_actionLabel.generateXML(state, content);
|
||||
String[][] sortableHeaders = {{SORT_TITLE,
|
||||
"cms.ui.workflow.task.item_title"},
|
||||
{SORT_ACTION, "cms.ui.action"},
|
||||
{SORT_DATE, "cms.ui.tasks_due_date"},
|
||||
{SORT_STATUS,
|
||||
"cms.ui.tasks_status_no_colon"},
|
||||
{SORT_USER,
|
||||
"cms.ui.workflow.task.locking_user"},
|
||||
{SORT_WORKFLOW, "cms.ui.workflow"}};
|
||||
// for (int i = 0; i < sortableHeaders.length; i++) {
|
||||
// String header = sortableHeaders[i][0];
|
||||
// String labelKey = sortableHeaders[i][1];
|
||||
// if (sortDirection.equals(SORT_UP) && header.equals(sortKey)) {
|
||||
// state.setControlEvent(this, SORT_DOWN, header);
|
||||
// } else {
|
||||
// state.setControlEvent(this, SORT_UP, header);
|
||||
// }
|
||||
// SimpleContainer container = new SimpleContainer();
|
||||
// container.add(new Label(GlobalizationUtil.globalize(labelKey)));
|
||||
// if (header.equals(sortKey)) {
|
||||
// String imageURLStub = null;
|
||||
// if (SORT_UP.equals(sortDirection)) {
|
||||
// imageURLStub = UP_ARROW_IMAGE;
|
||||
// } else {
|
||||
// imageURLStub = DOWN_ARROW_IMAGE;
|
||||
// }
|
||||
// Image image = new Image(imageURLStub);
|
||||
// image.setBorder("0");
|
||||
// container.add(image);
|
||||
// }
|
||||
//
|
||||
// ControlLink link = new ControlLink(container);
|
||||
// link.setHint(GlobalizationUtil
|
||||
// .globalize("cms.ui.contentcenter.task_panel_control"));
|
||||
// link.setClassAttr(header);
|
||||
// link.generateXML(state, content);
|
||||
// state.clearControlEvent();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respond(PageState state) throws ServletException {
|
||||
String key = state.getControlEventName();
|
||||
String value = state.getControlEventValue();
|
||||
if (TASK_ACTION.equals(key)) {
|
||||
BigDecimal itemID = new BigDecimal(value);
|
||||
//
|
||||
// try {
|
||||
// ContentItem item = new ContentItem(itemID);
|
||||
// Workflow wf = Workflow.getObjectWorkflow(item);
|
||||
// int tabNumber = ContentItemPage.AUTHORING_TAB;
|
||||
// String sectionPath = item.getContentSection().getPath();
|
||||
//
|
||||
// if (wf != null) {
|
||||
// User user = Web.getWebContext().getUser();
|
||||
// Engine engine = Engine.getInstance(
|
||||
// CMSEngine.CMS_ENGINE_TYPE);
|
||||
// Iterator i = engine.getEnabledTasks(user, wf.getID())
|
||||
// .iterator();
|
||||
// if (i.hasNext()) {
|
||||
// CMSTask task = (CMSTask) i.next();
|
||||
// Integer taskType = task.getTaskType().getID();
|
||||
//
|
||||
// if (taskType.equals(CMSTaskType.DEPLOY)) {
|
||||
// tabNumber = ContentItemPage.PUBLISHING_TAB;
|
||||
// } else // see if item is locked; if not, lock
|
||||
// {
|
||||
// if (!task.isLocked()) {
|
||||
// task.lock(user);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String redirectURL = Web.getConfig()
|
||||
// .getDispatcherServletPath()
|
||||
// + sectionPath
|
||||
// + "/admin/item.jsp?item_id="
|
||||
// + itemID + "&set_tab=" + tabNumber;
|
||||
// throw new RedirectSignal(redirectURL, true);
|
||||
// } catch (DataObjectNotFoundException ex) {
|
||||
// throw new ServletException("Unknown content ID" + itemID);
|
||||
// }
|
||||
// } else
|
||||
if (SORT_UP.equals(key) || SORT_DOWN.equals(key)) {
|
||||
state.setValue(m_sortTypeParam, value);
|
||||
if (SORT_DOWN.equals(key)) {
|
||||
state.setValue(m_sortDirectionParam, SORT_DOWN);
|
||||
} else {
|
||||
state.setValue(m_sortDirectionParam, SORT_UP);
|
||||
}
|
||||
} else {
|
||||
throw new ServletException("Unknown control event: " + key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private static Filter getTaskFilter(CMSTaskType taskType, Party party,
|
||||
// FilterFactory factory) {
|
||||
// PrivilegeDescriptor privilege;
|
||||
// String queryName;
|
||||
// String queryType;
|
||||
// OID partyOID = party.getOID();
|
||||
// privilege = taskType.getPrivilege();
|
||||
//
|
||||
// return PermissionService.getFilterQuery(factory, "itemID", privilege,
|
||||
// partyOID);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ public class CmsConstants {
|
|||
|
||||
public static final String CMS_BUNDLE = "org.librecms.CmsResources";
|
||||
|
||||
public static final String CONTENT_CENTER_APP_TYPE = "com.arsdigita.cms.ContentCenter";
|
||||
public static final String CONTENT_CENTER_URL = "/content-center/";
|
||||
|
||||
public static final String CONTENT_SECTION_APP_TYPE
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.librecms.contentsection;
|
|||
|
||||
import org.libreccm.categorization.Category;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
|
@ -84,6 +85,10 @@ public class ContentItemManager {
|
|||
final Class<T> type) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends ContentItem> List<T> getPendingVersions() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends ContentItem> T getDraftVersion(final ContentItem item) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,28 @@ package org.librecms.contentsection;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public enum ContentItemVersion {
|
||||
|
||||
|
||||
/**
|
||||
* A draft version is only visible to authenticated users with the
|
||||
* appropriate permissions. The draft version is also the version which is
|
||||
* edited by the authors.
|
||||
*/
|
||||
DRAFT,
|
||||
/**
|
||||
* This version is assigned to the live copy by the
|
||||
* {@link ContentItemManager} while the item is published.
|
||||
*/
|
||||
PUBLISHING,
|
||||
/**
|
||||
* A published version which is not yet visible because its lifecycle
|
||||
* defines a later date.
|
||||
*/
|
||||
PENDING,
|
||||
/**
|
||||
* The live version of a content item is the one which is visible to
|
||||
* most/all users. The live version is basically a copy of the state of the
|
||||
* draft version of a content item on a specific time.
|
||||
*/
|
||||
LIVE
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,11 @@ import javax.persistence.ManyToMany;
|
|||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.libreccm.web.ApplicationType;
|
||||
import org.librecms.contentsection.ui.admin.ApplicationInstanceForm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -120,6 +118,9 @@ public class ContentSection extends CcmApplication implements Serializable {
|
|||
|
||||
@Column(name = "DEFAULT_LOCALE")
|
||||
private Locale defaultLocale;
|
||||
|
||||
@OneToMany(mappedBy = "contentSection")
|
||||
private List<ContentType> contentTypes;
|
||||
|
||||
public ContentSection() {
|
||||
roles = new ArrayList<>();
|
||||
|
|
@ -218,6 +219,22 @@ public class ContentSection extends CcmApplication implements Serializable {
|
|||
this.defaultLocale = defaultLocale;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import org.hibernate.annotations.NamedQueries;
|
||||
import org.hibernate.annotations.NamedQuery;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.librecms.lifecycle.Lifecycle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
|
@ -34,14 +39,23 @@ import javax.persistence.EnumType;
|
|||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* The {@code ContentType} entity links a content item with its content section.
|
||||
* It also provides default values for the lifecycle and the workflow.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "CONTENT_TYPES", schema = DB_SCHEMA)
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "ContentType.findByContenSection",
|
||||
query = "SELECT c FROM ContentType c "
|
||||
+ "WHERE c.contentSection = :contentSection")
|
||||
})
|
||||
public class ContentType extends CcmObject implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2708659750560382851L;
|
||||
|
|
@ -49,6 +63,10 @@ public class ContentType extends CcmObject implements Serializable {
|
|||
@Column(name = "CONTENT_ITEM_CLASS", length = 1024)
|
||||
private String contentItemClass;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "CONTENT_SECTION_ID")
|
||||
private ContentSection contentSection;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
|
|
@ -78,7 +96,13 @@ public class ContentType extends CcmObject implements Serializable {
|
|||
@Enumerated(EnumType.STRING)
|
||||
private ContentItemMode mode;
|
||||
|
||||
//ToDo references for authoring kit etc
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "DEFAULT_LIFECYCLE_ID")
|
||||
private Lifecycle defaultLifecycle;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "DEFAULT_WORKFLOW")
|
||||
private Workflow defaultWorkflow;
|
||||
|
||||
public String getContentItemClass() {
|
||||
return contentItemClass;
|
||||
|
|
@ -88,6 +112,14 @@ public class ContentType extends CcmObject implements Serializable {
|
|||
this.contentItemClass = contentItemClass;
|
||||
}
|
||||
|
||||
public ContentSection getContentSection() {
|
||||
return contentSection;
|
||||
}
|
||||
|
||||
protected void setContentSection(final ContentSection contentSection) {
|
||||
this.contentSection = contentSection;
|
||||
}
|
||||
|
||||
public LocalizedString getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
|
@ -128,6 +160,22 @@ public class ContentType extends CcmObject implements Serializable {
|
|||
this.mode = mode;
|
||||
}
|
||||
|
||||
public Lifecycle getDefaultLifecycle() {
|
||||
return defaultLifecycle;
|
||||
}
|
||||
|
||||
protected void setDefaultLifecycle(final Lifecycle defaultLifecycle) {
|
||||
this.defaultLifecycle = defaultLifecycle;
|
||||
}
|
||||
|
||||
public Workflow getDefaultWorkflow() {
|
||||
return defaultWorkflow;
|
||||
}
|
||||
|
||||
protected void setDefaultWorkflow(final Workflow defaultWorkflow) {
|
||||
this.defaultWorkflow = defaultWorkflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
create table CCM_CMS.ARTICLE_TEXTS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ARTICLES (
|
||||
|
|
@ -43,11 +43,11 @@
|
|||
create table CCM_CMS.ASSET_TITLES_AUD (
|
||||
REV integer not null,
|
||||
ASSET_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, ASSET_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ASSETS (
|
||||
|
|
@ -75,11 +75,11 @@
|
|||
create table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD (
|
||||
REV integer not null,
|
||||
LIST_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, LIST_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, LIST_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ATTACHMENT_LISTS (
|
||||
|
|
@ -152,11 +152,11 @@
|
|||
create table CCM_CMS.BINARY_ASSET_DESCRIPTIONS_AUD (
|
||||
REV integer not null,
|
||||
ASSET_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, ASSET_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.BINARY_ASSETS (
|
||||
|
|
@ -188,11 +188,11 @@
|
|||
create table CCM_CMS.BOOKMARK_DESCRIPTIONS_AUD (
|
||||
REV integer not null,
|
||||
ASSET_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, ASSET_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.BOOKMARKS (
|
||||
|
|
@ -218,11 +218,11 @@
|
|||
create table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTENT_ITEM_NAMES (
|
||||
|
|
@ -235,11 +235,11 @@
|
|||
create table CCM_CMS.CONTENT_ITEM_NAMES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTENT_ITEM_TITLES (
|
||||
|
|
@ -252,11 +252,11 @@
|
|||
create table CCM_CMS.CONTENT_ITEM_TITLES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTENT_ITEMS (
|
||||
|
|
@ -316,6 +316,9 @@
|
|||
DESCENDANTS varchar(1024),
|
||||
mode varchar(255),
|
||||
OBJECT_ID bigint not null,
|
||||
CONTENT_SECTION_ID bigint,
|
||||
DEFAULT_LIFECYCLE_ID bigint,
|
||||
DEFAULT_WORKFLOW bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
|
|
@ -338,11 +341,11 @@
|
|||
create table CCM_CMS.EVENT_COSTS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENT_DATES (
|
||||
|
|
@ -355,11 +358,11 @@
|
|||
create table CCM_CMS.EVENT_DATES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENT_LOCATIONS (
|
||||
|
|
@ -372,11 +375,11 @@
|
|||
create table CCM_CMS.EVENT_LOCATIONS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENT_MAIN_CONTRIBUTORS (
|
||||
|
|
@ -389,11 +392,11 @@
|
|||
create table CCM_CMS.EVENT_MAIN_CONTRIBUTORS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENT_TEXTS (
|
||||
|
|
@ -406,11 +409,11 @@
|
|||
create table CCM_CMS.EVENT_TEXTS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENT_TYPES (
|
||||
|
|
@ -423,11 +426,11 @@
|
|||
create table CCM_CMS.EVENT_TYPES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.EVENTS (
|
||||
|
|
@ -542,11 +545,11 @@
|
|||
create table CCM_CMS.LEGAL_METADATA_RIGHTS_AUD (
|
||||
REV integer not null,
|
||||
ASSET_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, ASSET_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.LIFECYCLE_DEFINITION_DESCRIPTIONS (
|
||||
|
|
@ -625,11 +628,11 @@
|
|||
create table CCM_CMS.MPA_SECTION_TEXTS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.MPA_SECTION_TITLES (
|
||||
|
|
@ -642,11 +645,11 @@
|
|||
create table CCM_CMS.MPA_SECTION_TITLES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.MPA_SUMMARIES (
|
||||
|
|
@ -659,11 +662,11 @@
|
|||
create table CCM_CMS.MPA_SUMMARIES_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.MULTIPART_ARTICLE_SECTIONS (
|
||||
|
|
@ -729,11 +732,11 @@
|
|||
create table CCM_CMS.NEWS_TEXTS_AUD (
|
||||
REV integer not null,
|
||||
OBJECT_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, OBJECT_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.NOTE_TEXTS (
|
||||
|
|
@ -746,11 +749,11 @@
|
|||
create table CCM_CMS.NOTE_TEXTS_AUD (
|
||||
REV integer not null,
|
||||
ASSET_ID bigint not null,
|
||||
LOCALIZED_VALUE clob not null,
|
||||
LOCALIZED_VALUE clob,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE)
|
||||
primary key (REV, ASSET_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.NOTES (
|
||||
|
|
@ -834,7 +837,7 @@
|
|||
alter table CCM_CMS.ASSETS
|
||||
add constraint UK_9l2v1u9beyemgjwqx7isbumwh unique (UUID);
|
||||
|
||||
alter table CCM_CMS.ARTICLE_LEADS
|
||||
alter table CCM_CMS.ARTICLE_LEADS
|
||||
add constraint FK4g66u3qtfyepw0f733kuiiaul
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.WORKFLOW_TASK_TYPES;
|
||||
|
|
@ -1109,6 +1112,21 @@
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.CONTENT_TYPES;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKriohuo8093its1k5rgoc5yrfc
|
||||
foreign key (CONTENT_SECTION_ID)
|
||||
references CCM_CMS.CONTENT_SECTIONS;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKoqvcvktnvt4ncx5k6daqat4u8
|
||||
foreign key (DEFAULT_LIFECYCLE_ID)
|
||||
references CCM_CMS.LIFECYCLES;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKpgeccqsr50xwb268ypmfx0r66
|
||||
foreign key (DEFAULT_WORKFLOW)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FK96vwsbqfbdg33ujeeawajr0v4
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
@ -1558,493 +1576,3 @@
|
|||
add constraint FKge2x94m1y9tr7mk26ensyn674
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||
|
||||
alter table CCM_CORE.APPLICATIONS
|
||||
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.ATTACHMENTS
|
||||
add constraint FK8ju9hm9baceridp803nislkwb
|
||||
foreign key (MESSAGE_ID)
|
||||
references CCM_CORE.MESSAGES;
|
||||
|
||||
alter table CCM_CORE.CATEGORIES
|
||||
add constraint FKrj3marx99nheur4fqanm0ylur
|
||||
foreign key (PARENT_CATEGORY_ID)
|
||||
references CCM_CORE.CATEGORIES;
|
||||
|
||||
alter table CCM_CORE.CATEGORIES
|
||||
add constraint FKpm291swli2musd0204phta652
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.CATEGORIZATIONS
|
||||
add constraint FKejp0ubk034nfq60v1po6srkke
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.CATEGORIZATIONS
|
||||
add constraint FKoyeipswl876wa6mqwbx0uy83h
|
||||
foreign key (CATEGORY_ID)
|
||||
references CCM_CORE.CATEGORIES;
|
||||
|
||||
alter table CCM_CORE.CATEGORY_DESCRIPTIONS
|
||||
add constraint FKhiwjlmh5vkbu3v3vng1la1qum
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CATEGORIES;
|
||||
|
||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||
add constraint FKf25vi73cji01w8fgo6ow1dgg
|
||||
foreign key (ROOT_CATEGORY_ID)
|
||||
references CCM_CORE.CATEGORIES;
|
||||
|
||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||
add constraint FK58xpmnvciohkom1c16oua4xha
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.CATEGORY_TITLES
|
||||
add constraint FKka9bt9f5br0kji5bcjxcmf6ch
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CATEGORIES;
|
||||
|
||||
alter table CCM_CORE.CCM_OBJECTS_AUD
|
||||
add constraint FKr00eauutiyvocno8ckx6h9nw6
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CORE.CCM_OBJECTS_AUD
|
||||
add constraint FKo5s37ctcdny7tmewjwv7705h5
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CORE.DIGESTS
|
||||
add constraint FKc53g09agnye3w1v4euy3e0gsi
|
||||
foreign key (FROM_PARTY_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.DIGESTS
|
||||
add constraint FK845r9ep6xu6nbt1mvxulwybym
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.DOMAIN_DESCRIPTIONS
|
||||
add constraint FKn4i2dxgn8cqysa62dds6eih6a
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CATEGORY_DOMAINS;
|
||||
|
||||
alter table CCM_CORE.DOMAIN_OWNERSHIPS
|
||||
add constraint FK47nsasr7jrdwlky5gx0u6e9py
|
||||
foreign key (domain_OBJECT_ID)
|
||||
references CCM_CORE.CATEGORY_DOMAINS;
|
||||
|
||||
alter table CCM_CORE.DOMAIN_OWNERSHIPS
|
||||
add constraint FK3u4hq6yqau4m419b1xva3xpwq
|
||||
foreign key (owner_OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
||||
alter table CCM_CORE.DOMAIN_TITLES
|
||||
add constraint FK5p526dsdwn94els6lp5w0hdn4
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CATEGORY_DOMAINS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS
|
||||
add constraint FKfh0k9lj3pf4amfc9bbbss0tr1
|
||||
foreign key (COMPONENT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||
add constraint FKpcpmvyiix023b4g5n4q8nkfca
|
||||
foreign key (parentComponent_OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||
add constraint FKt0e0uv00pp1rwhyaltrytghnm
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER
|
||||
add constraint FK48khrbud3xhi2gvsvnlttd8tg
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS
|
||||
add constraint FKbyjjt2ufendvje2obtge2l7et
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS
|
||||
add constraint FK8oriyta1957u7dvbrqk717944
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_WIDGETS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_DATA_QUERIES
|
||||
add constraint FKhhaxpeddbtmrnjr5o0fopju3a
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS
|
||||
add constraint FKsmduu1opoiulkeo2gc8v7lsbn
|
||||
foreign key (DATA_QUERY_ID)
|
||||
references CCM_CORE.FORMBUILDER_DATA_QUERIES;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES
|
||||
add constraint FKju1x82inrw3kguyjuxoetn6gn
|
||||
foreign key (DATA_QUERY_ID)
|
||||
references CCM_CORE.FORMBUILDER_DATA_QUERIES;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_FORMSECTIONS
|
||||
add constraint FKnfhsgxp4lvigq2pm33pn4afac
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_LISTENERS
|
||||
add constraint FK33ilyirwoux28yowafgd5xx0o
|
||||
foreign key (widget_OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_WIDGETS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_LISTENERS
|
||||
add constraint FKlqm76746nq5yrt8ganm474uu0
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_METAOBJECTS
|
||||
add constraint FKf963v6u9mw8pwjmasrw51w8dx
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_OBJECT_TYPES
|
||||
add constraint FKkv337e83rsecf0h3qy8bu7l9w
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_OPTION_LABELS
|
||||
add constraint FKatlsylsvln6yse55eof6wwkj6
|
||||
foreign key (OPTION_ID)
|
||||
references CCM_CORE.FORMBUILDER_OPTIONS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_OPTIONS
|
||||
add constraint FKhe5q71wby9g4i56sotc501h11
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS
|
||||
add constraint FKcv3iu04gxjk9c0pn6tl8rqqv3
|
||||
foreign key (PROCESS_LISTENER_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES
|
||||
add constraint FK8rnyb1m6ij3b9hhmhr7klgd4p
|
||||
foreign key (PROCESS_LISTENER_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS
|
||||
add constraint FK7uiaeax8qafm82e5k729ms5ku
|
||||
foreign key (formSection_OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_FORMSECTIONS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS
|
||||
add constraint FKbdnloo884qk6gn36jwiqv5rlp
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER
|
||||
add constraint FKpajvu9m6fj1enm67a9gcb5ii9
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS
|
||||
add constraint FKsn82ktlq0c9ikijyv8k2bfv4f
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS
|
||||
add constraint FK8kjyu72btjsuaaqh4bvd8npns
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS
|
||||
add constraint FKb1q9bfshcrkwlj7r8w5jb4y8l
|
||||
foreign key (widget_OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_WIDGETS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS
|
||||
add constraint FKm1huo6ghk9l5o8buku9v8y6q7
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_WIDGETS
|
||||
add constraint FKs7qq6vxblhmq0rlf87re65jdp
|
||||
foreign key (label_OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_WIDGET_LABELS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_WIDGETS
|
||||
add constraint FK1wosr4ujbfckdc50u5fgmrhrk
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_COMPONENTS;
|
||||
|
||||
alter table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS
|
||||
add constraint FKjie9co03m7ow4ihig5rk7l8oj
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
|
||||
|
||||
alter table CCM_CORE.GROUP_MEMBERSHIPS
|
||||
add constraint FKq4qnny8ri3eo7eqh4olxco8nk
|
||||
foreign key (GROUP_ID)
|
||||
references CCM_CORE.GROUPS;
|
||||
|
||||
alter table CCM_CORE.GROUP_MEMBERSHIPS
|
||||
add constraint FKc8u86ivkhvoiw6ju8b2p365he
|
||||
foreign key (MEMBER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.GROUPS
|
||||
add constraint FK4f61mlqxw0ct6s7wwpi9m0735
|
||||
foreign key (PARTY_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.INITS
|
||||
add constraint FK3nvvxk10nmq9nfuko8yklqdgc
|
||||
foreign key (REQUIRED_BY_ID)
|
||||
references CCM_CORE.INITS;
|
||||
|
||||
alter table CCM_CORE.LUCENE_DOCUMENTS
|
||||
add constraint FK942kl4yff8rdiwr0pjk2a9g8
|
||||
foreign key (CREATED_BY_PARTY_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.LUCENE_DOCUMENTS
|
||||
add constraint FKc5rs6afx4p9fidabfqsxr5ble
|
||||
foreign key (LAST_MODIFIED_BY)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.LUCENE_INDEXES
|
||||
add constraint FK6gu0yrlviqk07dtb3r02iw43f
|
||||
foreign key (HOST_ID)
|
||||
references CCM_CORE.HOSTS;
|
||||
|
||||
alter table CCM_CORE.MESSAGES
|
||||
add constraint FKph10aehmg9f20pn2w4buki97q
|
||||
foreign key (IN_REPLY_TO_ID)
|
||||
references CCM_CORE.MESSAGES;
|
||||
|
||||
alter table CCM_CORE.MESSAGES
|
||||
add constraint FKjufsx3c3h538fj35h8hgfnb1p
|
||||
foreign key (SENDER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.MESSAGES
|
||||
add constraint FK6w20ao7scwecd9mfwpun2ddqx
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.NOTIFICATIONS
|
||||
add constraint FKqk70c1x1dklhty9ju5t4wukd9
|
||||
foreign key (DIGEST_ID)
|
||||
references CCM_CORE.DIGESTS;
|
||||
|
||||
alter table CCM_CORE.NOTIFICATIONS
|
||||
add constraint FKtt4fjr2p75og79jxxgd8q8mr
|
||||
foreign key (MESSAGE_ID)
|
||||
references CCM_CORE.MESSAGES;
|
||||
|
||||
alter table CCM_CORE.NOTIFICATIONS
|
||||
add constraint FK2vlnma0ox43j0clx8ead08n5s
|
||||
foreign key (RECEIVER_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.NOTIFICATIONS
|
||||
add constraint FKf423hhiaw1bexpxeh1pnas7qt
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.ONE_TIME_AUTH_TOKENS
|
||||
add constraint FKtplfuphkiorfkttaewb4wmfjc
|
||||
foreign key (USER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.PERMISSIONS
|
||||
add constraint FKj9di7pawxgtouxmu2k44bj5c4
|
||||
foreign key (CREATION_USER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.PERMISSIONS
|
||||
add constraint FKikx3x0kn9fito23g50v6xbr9f
|
||||
foreign key (GRANTEE_ID)
|
||||
references CCM_CORE.CCM_ROLES;
|
||||
|
||||
alter table CCM_CORE.PERMISSIONS
|
||||
add constraint FKkamckexjnffnt8lay9nqeawhm
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.PORTALS
|
||||
add constraint FK5a2hdrbw03mmgr74vj5nxlpvk
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.PORTLETS
|
||||
add constraint FK9gr5xjt3rx4uhtw7vl6adruol
|
||||
foreign key (PORTAL_ID)
|
||||
references CCM_CORE.PORTALS;
|
||||
|
||||
alter table CCM_CORE.PORTLETS
|
||||
add constraint FKjmx9uebt0gwxkw3xv34niy35f
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.QUEUE_ITEMS
|
||||
add constraint FKtgkwfruv9kjdybf46l02da088
|
||||
foreign key (MESSAGE_ID)
|
||||
references CCM_CORE.MESSAGES;
|
||||
|
||||
alter table CCM_CORE.QUEUE_ITEMS
|
||||
add constraint FKs9aq1hyxstwmvx7fmfifp4x7r
|
||||
foreign key (RECEIVER_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.RESOURCE_DESCRIPTIONS
|
||||
add constraint FKk9arvj5u21rv23ce3cav4opqx
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.RESOURCE_TITLES
|
||||
add constraint FKto4p6n2wklljyf7tmuxtmyfe0
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS
|
||||
add constraint FKckpihjtv23iahbg3imnpbsr2
|
||||
foreign key (RESOURCE_TYPE_ID)
|
||||
references CCM_CORE.RESOURCE_TYPES;
|
||||
|
||||
alter table CCM_CORE.RESOURCES
|
||||
add constraint FKbo7ibfgodicn9flv2gfo11g5a
|
||||
foreign key (parent_OBJECT_ID)
|
||||
references CCM_CORE.RESOURCES;
|
||||
|
||||
alter table CCM_CORE.RESOURCES
|
||||
add constraint FK262fbwetpjx3k4uuvw24wsiv
|
||||
foreign key (resourceType_RESOURCE_TYPE_ID)
|
||||
references CCM_CORE.RESOURCE_TYPES;
|
||||
|
||||
alter table CCM_CORE.RESOURCES
|
||||
add constraint FKbjdf8pm4frth8r06ev2qjm88f
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.ROLE_MEMBERSHIPS
|
||||
add constraint FK9m88ywi7rcin7b7jrgh53emrq
|
||||
foreign key (MEMBER_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.ROLE_MEMBERSHIPS
|
||||
add constraint FKcsyogv5m2rgsrmtgnhgkjhfw7
|
||||
foreign key (ROLE_ID)
|
||||
references CCM_CORE.CCM_ROLES;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||
add constraint FK8mw4p92s0h3h8bmo8saowu32i
|
||||
foreign key (ENUM_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||
add constraint FK5knjq7cisej0qfx5dw1y93rou
|
||||
foreign key (ENTRY_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FKqeclqa5sf1g53vxs857tpwrus
|
||||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FKe29uwmvxdmol1fjob3auej4qv
|
||||
foreign key (ROLE_ID)
|
||||
references CCM_CORE.CCM_ROLES;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FKc1vovbjg9mp5yegx2fdoutx7u
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||
|
||||
alter table CCM_CORE.THREADS
|
||||
add constraint FKsx08mpwvwnw97uwdgjs76q39g
|
||||
foreign key (ROOT_ID)
|
||||
references CCM_CORE.MESSAGES;
|
||||
|
||||
alter table CCM_CORE.THREADS
|
||||
add constraint FKp97b1sy1kop07rtapeh5l9fb2
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
|
||||
alter table CCM_CORE.USER_EMAIL_ADDRESSES
|
||||
add constraint FKr900l79erul95seyyccf04ufc
|
||||
foreign key (USER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.USERS
|
||||
add constraint FKosh928q71aonu6l1kurb417r
|
||||
foreign key (PARTY_ID)
|
||||
references CCM_CORE.PARTIES;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_DESCRIPTIONS
|
||||
add constraint FKgx7upkqky82dpxvbs95imfl9l
|
||||
foreign key (WORKFLOW_ID)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_NAMES
|
||||
add constraint FKkxedy9p48avfk45r0bn4uc09i
|
||||
foreign key (WORKFLOW_ID)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASK_COMMENTS
|
||||
add constraint FKkfqrf9jdvm7livu5if06w0r5t
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
|
||||
add constraint FK1htp420ki24jaswtcum56iawe
|
||||
foreign key (DEPENDENT_TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
|
||||
add constraint FK8rbggnp4yjpab8quvvx800ymy
|
||||
foreign key (DEPENDS_ON_TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASK_LABELS
|
||||
add constraint FKf715qud6g9xv2xeb8rrpnv4xs
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASKS
|
||||
add constraint FK1693cbc36e4d8gucg8q7sc57e
|
||||
foreign key (WORKFLOW_ID)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS
|
||||
add constraint FK2s2498d2tpojjrtghq7iyaosv
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_TEMPLATES
|
||||
add constraint FK8692vdme4yxnkj1m0k1dw74pk
|
||||
foreign key (WORKFLOW_ID)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_USER_TASKS
|
||||
add constraint FKf09depwj5rgso2dair07vnu33
|
||||
foreign key (LOCKING_USER_ID)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_USER_TASKS
|
||||
add constraint FK6evo9y34awhdfcyl8gv78qb7f
|
||||
foreign key (NOTIFICATION_SENDER)
|
||||
references CCM_CORE.USERS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOW_USER_TASKS
|
||||
add constraint FKefpdf9ojplu7loo31hfm0wl2h
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
|
||||
create table CCM_CMS.ARTICLE_LEADS (
|
||||
OBJECT_ID int8 not null,
|
||||
LOCALIZED_VALUE text,
|
||||
|
|
@ -317,6 +318,9 @@
|
|||
DESCENDANTS varchar(1024),
|
||||
mode varchar(255),
|
||||
OBJECT_ID int8 not null,
|
||||
CONTENT_SECTION_ID int8,
|
||||
DEFAULT_LIFECYCLE_ID int8,
|
||||
DEFAULT_WORKFLOW int8,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1110,6 +1114,21 @@
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.CONTENT_TYPES;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKriohuo8093its1k5rgoc5yrfc
|
||||
foreign key (CONTENT_SECTION_ID)
|
||||
references CCM_CMS.CONTENT_SECTIONS;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKoqvcvktnvt4ncx5k6daqat4u8
|
||||
foreign key (DEFAULT_LIFECYCLE_ID)
|
||||
references CCM_CMS.LIFECYCLES;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FKpgeccqsr50xwb268ypmfx0r66
|
||||
foreign key (DEFAULT_WORKFLOW)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
||||
alter table CCM_CMS.CONTENT_TYPES
|
||||
add constraint FK96vwsbqfbdg33ujeeawajr0v4
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
@ -1558,4 +1577,4 @@
|
|||
alter table CCM_CMS.WORKFLOW_TASKS
|
||||
add constraint FKge2x94m1y9tr7mk26ensyn674
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import org.libreccm.security.User;
|
|||
import org.libreccm.tests.categories.UnitTest;
|
||||
import org.libreccm.testutils.EqualsVerifier;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.librecms.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
|
@ -134,6 +136,18 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
|
||||
final Resource resource2 = new Resource();
|
||||
resource2.setDisplayName("Resource 2");
|
||||
|
||||
final Lifecycle lifecycle1 = new Lifecycle();
|
||||
lifecycle1.setFinished(true);
|
||||
|
||||
final Lifecycle lifecycle2 = new Lifecycle();
|
||||
lifecycle2.setFinished(false);
|
||||
|
||||
final Workflow workflow1 = new Workflow();
|
||||
workflow1.setWorkflowId(-100);
|
||||
|
||||
final Workflow workflow2 = new Workflow();
|
||||
workflow2.setWorkflowId(-200);
|
||||
|
||||
verifier
|
||||
.withPrefabValues(ContentItem.class, item1, item2)
|
||||
|
|
@ -146,7 +160,9 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
.withPrefabValues(Group.class, group1, group2)
|
||||
.withPrefabValues(CcmApplication.class, application1, application2)
|
||||
.withPrefabValues(Domain.class, domain1, domain2)
|
||||
.withPrefabValues(Resource.class, resource1, resource2);
|
||||
.withPrefabValues(Resource.class, resource1, resource2)
|
||||
.withPrefabValues(Lifecycle.class, lifecycle1, lifecycle2)
|
||||
.withPrefabValues(Workflow.class, workflow1, workflow2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Copyright (C) 2001-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.bebop;
|
||||
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
|
||||
/**
|
||||
* A simple wrapper class for images.
|
||||
*
|
||||
* @author David Lutterkort
|
||||
* @author Stanislav Freidin
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
public class Image extends DescriptiveComponent {
|
||||
|
||||
private final String IMAGE_URL = "src";
|
||||
private final String ALT = "alt";
|
||||
private final String HEIGHT = "height";
|
||||
private final String WIDTH = "width";
|
||||
private final String BORDER = "border";
|
||||
|
||||
private PrintListener m_printListener;
|
||||
|
||||
public Image(String imageURL, String alt) {
|
||||
super();
|
||||
setImageURL(imageURL);
|
||||
setAlt(alt);
|
||||
}
|
||||
|
||||
public Image(String imageURL) {
|
||||
this(imageURL, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>Image</code> that uses the print listener
|
||||
* to generate output.
|
||||
*
|
||||
* @param l the print listener used to produce output
|
||||
*/
|
||||
public Image(PrintListener l) {
|
||||
this("");
|
||||
addPrintListener(l);
|
||||
}
|
||||
|
||||
public void setImageURL(String imageURL) {
|
||||
Assert.isUnlocked(this);
|
||||
setAttribute(IMAGE_URL, imageURL);
|
||||
}
|
||||
|
||||
public void setAlt(String alt) {
|
||||
Assert.isUnlocked(this);
|
||||
setAttribute(ALT, alt);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param height
|
||||
*/
|
||||
public void setHeight(String height) {
|
||||
Assert.isUnlocked(this);
|
||||
setAttribute(HEIGHT, height);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param width
|
||||
*/
|
||||
public void setWidth(String width) {
|
||||
Assert.isUnlocked(this);
|
||||
setAttribute(WIDTH, width);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param border
|
||||
*/
|
||||
public void setBorder(String border) {
|
||||
Assert.isUnlocked(this);
|
||||
setAttribute(BORDER, border);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a print listener. Only one print listener can be set for an
|
||||
* image, since the <code>PrintListener</code> is expected to modify the
|
||||
* target of the <code>PrintEvent</code>.
|
||||
* @param listener the print listener
|
||||
* @throws IllegalArgumentException if <code>listener</code> is null.
|
||||
* @throws IllegalStateException if a print listener has previously been
|
||||
* added.
|
||||
* @pre listener != null */
|
||||
public void addPrintListener(PrintListener listener)
|
||||
throws IllegalStateException, IllegalArgumentException
|
||||
{
|
||||
if ( listener == null ) {
|
||||
throw new IllegalArgumentException
|
||||
("Argument listener can not be null");
|
||||
}
|
||||
if ( m_printListener != null ) {
|
||||
throw new IllegalStateException
|
||||
("Too many listeners. Can only have one");
|
||||
}
|
||||
m_printListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a previously added print listener. If <code>listener</code> is
|
||||
* not the listener that was added with {@link #addPrintListener
|
||||
* addPrintListener}, an IllegalArgumentException will be thrown.
|
||||
* @param listener the listener that was previously added with
|
||||
* <code>addPrintListener</code>
|
||||
* @throws IllegalArgumentException if <code>listener</code> is not the
|
||||
* currently registered print listener or is <code>null</code>.
|
||||
* @pre listener != null
|
||||
*/
|
||||
public void removePrintListener(PrintListener listener)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if ( listener == null ) {
|
||||
throw new IllegalArgumentException("listener can not be null");
|
||||
}
|
||||
if ( listener != m_printListener ) {
|
||||
throw new IllegalArgumentException
|
||||
("listener is not registered with this widget");
|
||||
}
|
||||
m_printListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the output to a DOM to be used with the XSLT template
|
||||
* to produce the appropriate output.
|
||||
*
|
||||
* <p>Generates DOM fragment:
|
||||
* <p><code><pre>
|
||||
* <bebop:image [src=...] [alt=...] [height=...]
|
||||
* [width=...] [border=...]/>
|
||||
* </pre></code>
|
||||
*
|
||||
* @param parent the XML element to which the form adds its XML representation
|
||||
* */
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
|
||||
if ( ! isVisible(state) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Image target = firePrintEvent(state);
|
||||
Element image = parent.newChildElement ("bebop:image", BEBOP_XML_NS);
|
||||
target.exportAttributes(image);
|
||||
}
|
||||
|
||||
protected Image firePrintEvent(PageState state) {
|
||||
Image i = this;
|
||||
if ( m_printListener != null ) {
|
||||
try {
|
||||
i = (Image) this.clone();
|
||||
m_printListener.prepare(new PrintEvent(this, state, i));
|
||||
} catch ( CloneNotSupportedException e ) {
|
||||
// FIXME: Failing silently here isn't so great
|
||||
// It probably indicates a serious programming error
|
||||
i = this;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (C) 2001-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.bebop;
|
||||
|
||||
/**
|
||||
* A model builder for
|
||||
* the {@link Paginator} component.
|
||||
*
|
||||
* <p>The {@link #getTotalSize(Paginator, PageState)} method of this
|
||||
* class is called during the generation of page links for a
|
||||
* <code>Paginator</code> component. When using a
|
||||
* <code>Paginator</code> component with a {@link List} or a {@link
|
||||
* Table}, you can achieve greater flexibility in terms of caching and
|
||||
* performance by having the model builder implement this interface.
|
||||
*
|
||||
* <p>Unlike other model builder classes in Bebop, there is no
|
||||
* PaginationModel class, as this would only be an <code>int</code>.
|
||||
*
|
||||
* @see Paginator
|
||||
*
|
||||
* @author Phong Nguyen
|
||||
* @version $Id$
|
||||
* @since 4.6.10
|
||||
**/
|
||||
public interface PaginationModelBuilder {
|
||||
|
||||
// $Change: 44247 $
|
||||
// $Revision$
|
||||
// $DateTime: 2004/08/16 18:10:38 $
|
||||
// $Author$
|
||||
|
||||
/**
|
||||
* Returns the total number of results to paginate.
|
||||
*
|
||||
* @param paginator the Paginator instance that invoked this method
|
||||
* @param state the current page state
|
||||
* @return the total number of results to paginate.
|
||||
**/
|
||||
int getTotalSize(Paginator paginator, PageState state);
|
||||
|
||||
/**
|
||||
* Determines whether the paginator should be visible in the request
|
||||
* represented by <code>state</code>.
|
||||
* This should normally delegate to the isVisible method of the
|
||||
* associated displayed component.
|
||||
*
|
||||
* @return <code>true</code> if the paginator is visible in the request;
|
||||
* <code>false</code> otherwise.
|
||||
*
|
||||
* @param state represents the current request
|
||||
* @return <code>true</code> if the component is visible; <code>false</code>
|
||||
* otherwise.
|
||||
* @pre state != null
|
||||
*/
|
||||
boolean isVisible(PageState state);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,518 @@
|
|||
/*
|
||||
* Copyright (C) 2001-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.bebop;
|
||||
|
||||
import com.arsdigita.bebop.list.ListModel;
|
||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||
import com.arsdigita.bebop.util.GlobalizationUtil;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
/**
|
||||
* A pagination component used to select different page views from a list of
|
||||
* items.
|
||||
*
|
||||
* <p>In most cases, this component will be used with either a {@link
|
||||
* List} or a {@link Table}. Here is an example on how to use this pagination
|
||||
* component with a Table:
|
||||
*
|
||||
* <blockquote><pre><code>
|
||||
* Table myTable = new Table(new myTableModelBuilder(),
|
||||
* new DefaultTableColumnModel());
|
||||
* Paginator pgntr = new Paginator((PaginationModelBuilder) myTable.getModelBuilder(), 10);
|
||||
*
|
||||
* Page p = new Page();
|
||||
* p.add(pgntr);
|
||||
* p.add(myTable);
|
||||
* </code></pre></blockquote>
|
||||
*
|
||||
* <p>The model builder that is used in
|
||||
* <code>myTable</code> was designed to also implement the {@link PaginationModelBuilder}
|
||||
* interface. With both interfaces being implemented by the same class, it is
|
||||
* much easier to cache the results of operations performed on the {@link com.arsdigita.persistence.DataQuery}
|
||||
* used to generate the results.
|
||||
*
|
||||
* <blockquote><pre><code>
|
||||
* public class myTableModelBuilder extends LockableImpl
|
||||
* implements TableModelBuilder, PaginatedModelBuilder {
|
||||
*
|
||||
* private RequestLocal m_query;
|
||||
*
|
||||
* public myTableModelBuilder() {
|
||||
* super();
|
||||
* m_query = new RequestLocal();
|
||||
* }
|
||||
*
|
||||
* private getDataQuery(PageState state) {
|
||||
* // returns the DataQuery used to generate rows for the table
|
||||
* }
|
||||
*
|
||||
* public int getTotalSize(Paginator pgntr, PageState state) {
|
||||
* DataQuery query = getDataQuery(state);
|
||||
* query.setRange(new Integer(pgntr.getFirst(state)),
|
||||
* new Integer(pgntr.getLast(state) + 1));
|
||||
* m_query.set(state, query);
|
||||
* return (int) query.size();
|
||||
* }
|
||||
*
|
||||
* public TableModel makeModel(Table table, PageState state) {
|
||||
* return new myTableModel(table, state, (DataQuery) m_query.get(state));
|
||||
* }
|
||||
* }
|
||||
* </code></pre></blockquote>
|
||||
*
|
||||
* <p>Subclasses that wish to render the page links in a different format will
|
||||
* override the {@link #buildPaginationDisplay()} method. The implementation of
|
||||
* this method must set the selection model used to retrieve the page number by
|
||||
* calling the {@link
|
||||
* #setPageNumSelectionModel(SingleSelectionModel)} method. Aside from changing
|
||||
* the display, this pagination component will hide itself if
|
||||
* {@link PaginationModelBuilder#getTotalSize(Paginator, PageState)} is less
|
||||
* than the page size (i.e., a single page can be used to display the entire
|
||||
* results). This default behavior can be changed by calling {@link #setHiddenIfSinglePage(boolean)}
|
||||
* with
|
||||
* <code>false</code>.
|
||||
*
|
||||
* @see PaginationModelBuilder
|
||||
*
|
||||
* @author Phong Nguyen
|
||||
* @version $Id$
|
||||
* @since 4.6.10
|
||||
*
|
||||
*/
|
||||
public class Paginator extends SimpleContainer implements Resettable {
|
||||
|
||||
// $Change: 44247 $
|
||||
// $Revision$
|
||||
// $DateTime: 2004/08/16 18:10:38 $
|
||||
// $Author$
|
||||
// The builder which returns the total number of items to
|
||||
// paginate.
|
||||
private PaginationModelBuilder m_builder;
|
||||
// The selection model that returns the selected page number. The
|
||||
// contained ParameterModel should be a StringParameter, since
|
||||
// this is the default for List and Table.
|
||||
private SingleSelectionModel m_pageNumModel;
|
||||
// The selection model that returns the number of items to display
|
||||
// for one page.
|
||||
private SingleSelectionModel m_pageSizeModel;
|
||||
// This is used to determine if this component should be hidden
|
||||
// when there is only a single page to display. Defaults to true.
|
||||
private boolean m_hiddenIfSinglePage;
|
||||
// A label that contains a space, " ". This is used to insert
|
||||
// spaces between the page links from within the list's
|
||||
// generateXML() method.
|
||||
private BoxPanel m_spacePanel;
|
||||
private Label m_space;
|
||||
// defined in List.java
|
||||
private static final String _SELECT_EVENT = "s";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param builder The builder used to retrieve the total number of results
|
||||
* to paginate.
|
||||
* @param defaultPageSize The default number of results to display on each
|
||||
* page.
|
||||
*
|
||||
*/
|
||||
public Paginator(PaginationModelBuilder builder, int defaultPageSize) {
|
||||
super();
|
||||
|
||||
m_builder = builder;
|
||||
m_hiddenIfSinglePage = true;
|
||||
|
||||
// Create the selection model which returns the size of one
|
||||
// page and set its default value.
|
||||
IntegerParameter sizeParam = new IntegerParameter("ps");
|
||||
sizeParam.setDefaultValue(new Integer(defaultPageSize));
|
||||
sizeParam.setDefaultOverridesNull(true);
|
||||
m_pageSizeModel = new ParameterSingleSelectionModel(sizeParam);
|
||||
|
||||
// Builds the display for rendering page links, this also sets
|
||||
// the page number selection model.
|
||||
buildPaginationDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the display for rendering the page links. Subclasses can override
|
||||
* this method to provide a different rendering of the page links. If this
|
||||
* is the case, make sure that the {@link
|
||||
* #setPageNumSelectionModel(SingleSelectionModel)} method is called to set
|
||||
* the selection model for retrieving the selected page number.
|
||||
*
|
||||
*/
|
||||
protected void buildPaginationDisplay() {
|
||||
PaginatorList list = new PaginatorList(new PageListModelBuilder(this, getPaginationModelBuilder()));
|
||||
setPageNumSelectionModel(list.getSelectionModel());
|
||||
|
||||
// This is used within the list's generateXML() method to
|
||||
// insert spaces between the page links.
|
||||
m_space = new Label(" ", false);
|
||||
m_spacePanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||
m_spacePanel.add(m_space);
|
||||
|
||||
BoxPanel display = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||
display.add(new Label(GlobalizationUtil.globalize("bebop.page")));
|
||||
display.add(list);
|
||||
display.add(m_space);
|
||||
add(display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection model that is used for returning the selected page
|
||||
* number. Subclasses that override the {@link
|
||||
* #buildPaginationDisplay()} method will need to call this method.
|
||||
*
|
||||
* @param pageNumModel The selection model used for returning the selected
|
||||
* page number.
|
||||
*
|
||||
*/
|
||||
protected void setPageNumSelectionModel(SingleSelectionModel pageNumModel) {
|
||||
m_pageNumModel = pageNumModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the selected page number.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @return The selected page number.
|
||||
*
|
||||
*/
|
||||
public int getSelectedPageNum(PageState state) {
|
||||
String pageNum = (String) m_pageNumModel.getSelectedKey(state);
|
||||
if (pageNum == null) {
|
||||
m_pageNumModel.setSelectedKey(state, "1");
|
||||
return 1;
|
||||
}
|
||||
return Integer.parseInt(pageNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected page number.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @param pageNum The number of the page to set as selected.
|
||||
*
|
||||
*/
|
||||
public void setSelectedPageNum(PageState state, int pageNum) {
|
||||
m_pageNumModel.setSelectedKey(state, String.valueOf(pageNum));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of items to display per page.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @return The number of items to display per page.
|
||||
*
|
||||
*/
|
||||
public int getPageSize(PageState state) {
|
||||
return ((Integer) m_pageSizeModel.getSelectedKey(state)).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of items to display per page.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @param pageSize The number of items to display per page.
|
||||
*
|
||||
*/
|
||||
public void setPageSize(PageState state, int pageSize) {
|
||||
m_pageSizeModel.setSelectedKey(state, new Integer(pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the total number of pages that will be displayed by this
|
||||
* paginator.
|
||||
*
|
||||
* @param state The page state
|
||||
*/
|
||||
public int getTotalPages(PageState state) {
|
||||
int totalSize = m_builder.getTotalSize(this, state);
|
||||
int pageSize = getPageSize(state);
|
||||
int minSize = totalSize / pageSize;
|
||||
if (minSize * pageSize == totalSize) {
|
||||
return minSize;
|
||||
} else {
|
||||
return minSize + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of the first item to display.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @return The number of the first item to display.
|
||||
*
|
||||
*/
|
||||
public int getFirst(PageState state) {
|
||||
return ((getSelectedPageNum(state) - 1) * getPageSize(state)) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of the last item to display.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @return The number of teh last item to display.
|
||||
*
|
||||
*/
|
||||
public int getLast(PageState state) {
|
||||
// NOTE: If the returned integer is used for
|
||||
// DataQuery.setRange(int, int), then it needs to be
|
||||
// incremented by 1.
|
||||
return (getSelectedPageNum(state) * getPageSize(state));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the builder that is used to retrieve the total number of items to
|
||||
* paginate.
|
||||
*
|
||||
* @return The builder used to compute the total number of items to
|
||||
* paginate.
|
||||
*
|
||||
*/
|
||||
public PaginationModelBuilder getPaginationModelBuilder() {
|
||||
return m_builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether this component is hidden if there is only a single page
|
||||
* of items to display.
|
||||
*
|
||||
* @return Returns
|
||||
* <code>true</code> if this component is hidden when there is only a single
|
||||
* page to view.
|
||||
*
|
||||
*/
|
||||
public boolean isHiddenIfSinglePage() {
|
||||
return m_hiddenIfSinglePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not this component should be hidden if there is only a
|
||||
* single page of items to display.
|
||||
*
|
||||
* @param isHidden By default, this component will be hidden when there is
|
||||
* only a single page to display. Set this to
|
||||
* <code>false</code> if this is not the desired effect.
|
||||
*
|
||||
*/
|
||||
public void setHiddenIfSinglePage(boolean isHidden) {
|
||||
m_hiddenIfSinglePage = isHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns
|
||||
* <code>true</code> if this component is visible. This component will not
|
||||
* be visible if the paginator model builder's isVisible method reports
|
||||
* false. If this component is set to be hidden when there is only a single
|
||||
* page to display, then the total page size returned from the {@link PaginationModelBuilder}
|
||||
* object must be greater than the number of items per page.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @return Returns
|
||||
* <code>true</code> if this component is visible.
|
||||
*
|
||||
* @see #getPageSize(PageState)
|
||||
* @see PaginationModelBuilder#getTotalSize(Paginator, PageState)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean isVisible(PageState state) {
|
||||
return (super.isVisible(state)
|
||||
&& m_builder.isVisible(state)
|
||||
&& ((!m_hiddenIfSinglePage)
|
||||
|| m_builder.getTotalSize(this, state) > getPageSize(state)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the page size selection model.
|
||||
*
|
||||
* @param p The page to register with.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
p.setVisibleDefault(m_spacePanel, false);
|
||||
p.addComponentStateParam(this, m_pageSizeModel.getStateParameter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this component by clearing the selected page.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
*
|
||||
*/
|
||||
public void reset(PageState state) {
|
||||
m_pageNumModel.clearSelection(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was added to provide greater flexibility in displaying the
|
||||
* page links. Links can be displayed in a space separated list to support
|
||||
* wrapping or in a table with a fixed number of page links per row. By
|
||||
* default the page links will be rendered inside a one-cell table. If the
|
||||
* number of page links to display per line is specified, then each page
|
||||
* link will be rendered in it's own cell.
|
||||
*
|
||||
*/
|
||||
private class PaginatorList extends List {
|
||||
|
||||
public PaginatorList(ListModelBuilder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the number of page links to display per line is specified then the
|
||||
* generated xml will be similar to that of a Table. Else, it will be
|
||||
* similar to a simple container.
|
||||
*
|
||||
* @param state Represents the current state of the request.
|
||||
* @param parent The element to which to attach the XML.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
if (!this.isVisible(state)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// maybe display the Previous arrow
|
||||
if (getSelectedPageNum(state) > 1) {
|
||||
state.setControlEvent(this, _SELECT_EVENT,
|
||||
Integer.toString(getSelectedPageNum(state) - 1));
|
||||
(new ControlLink(new Label("<"))).generateXML(state, parent);
|
||||
(new Label(" ")).generateXML(state, parent);
|
||||
state.setControlEvent(this, _SELECT_EVENT,
|
||||
Integer.toString(getSelectedPageNum(state) - 1));
|
||||
(new ControlLink(new Label(GlobalizationUtil.globalize("bebop.previous")))).generateXML(state, parent);
|
||||
(new Label(" ")).generateXML(state, parent);
|
||||
}
|
||||
|
||||
ListModel m = getModel(state);
|
||||
Object selKey = getSelectedKey(state);
|
||||
Component c;
|
||||
int i = 0;
|
||||
while (m.next()) {
|
||||
String key = m.getKey();
|
||||
// Converting both keys to String for comparison
|
||||
// since ListModel.getKey returns a String
|
||||
boolean selected = (selKey != null) && (key != null)
|
||||
&& selKey.toString().equals(key.toString());
|
||||
|
||||
state.setControlEvent(this, _SELECT_EVENT, m.getKey());
|
||||
c = getCellRenderer().getComponent(this, state, m.getElement(),
|
||||
m.getKey(), i, selected);
|
||||
c.generateXML(state, parent);
|
||||
m_space.generateXML(state, parent);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
// maybe display the next arrow
|
||||
if (getSelectedPageNum(state) < getTotalPages(state)) {
|
||||
state.setControlEvent(this, _SELECT_EVENT,
|
||||
Integer.toString(getSelectedPageNum(state) + 1));
|
||||
(new Label(" ")).generateXML(state, parent);
|
||||
(new ControlLink(new Label(GlobalizationUtil.globalize("bebop.next")))).generateXML(state, parent);
|
||||
(new Label(" ")).generateXML(state, parent);
|
||||
state.setControlEvent(this, _SELECT_EVENT,
|
||||
Integer.toString(getSelectedPageNum(state) + 1));
|
||||
(new ControlLink(new Label(">"))).generateXML(state, parent);
|
||||
}
|
||||
|
||||
state.clearControlEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A list model builder for the pagination list.
|
||||
*
|
||||
*/
|
||||
private class PageListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
|
||||
Paginator m_paginator;
|
||||
PaginationModelBuilder m_builder;
|
||||
|
||||
public PageListModelBuilder(Paginator paginator,
|
||||
PaginationModelBuilder builder) {
|
||||
super();
|
||||
m_paginator = paginator;
|
||||
m_builder = builder;
|
||||
}
|
||||
|
||||
public ListModel makeModel(List list, PageState state) {
|
||||
return new PageListModel(m_builder.getTotalSize(m_paginator, state),
|
||||
getPageSize(state),
|
||||
getSelectedPageNum(state));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A list model for the pagination list which is used to generate the text
|
||||
* for the page links.
|
||||
*
|
||||
*/
|
||||
private class PageListModel extends LockableImpl
|
||||
implements ListModel {
|
||||
|
||||
int m_totalSize;
|
||||
int m_pageSize;
|
||||
int m_pageCount;
|
||||
int m_current;
|
||||
|
||||
public PageListModel(int totalSize, int pageSize, int current) {
|
||||
super();
|
||||
m_totalSize = totalSize;
|
||||
m_pageSize = pageSize;
|
||||
m_pageCount = 0;
|
||||
m_current = current;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if (m_pageCount * m_pageSize < m_totalSize) {
|
||||
m_pageCount += 1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getElement() {
|
||||
/*
|
||||
* TODO: Remove or relocate this int begin = ((m_pageCount-1) *
|
||||
* m_pageSize) + 1; int end = (m_pageCount) * m_pageSize; if (end >
|
||||
* m_totalSize) { end = m_totalSize; } return "" + begin + "-" +
|
||||
* end;
|
||||
*/
|
||||
if (Math.abs(m_current - m_pageCount) <= 5
|
||||
|| m_pageCount == 1
|
||||
|| m_pageCount * m_pageSize >= m_totalSize) {
|
||||
return Integer.toString(m_pageCount);
|
||||
} else {
|
||||
return ".";
|
||||
}
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return Integer.toString(m_pageCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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.toolbox.ui;
|
||||
|
||||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>A context bar.</p>
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class ContextBar extends SimpleComponent {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ContextBar.class);
|
||||
|
||||
private static final RequestLocal s_entries = new RequestLocal() {
|
||||
protected final Object initialValue(final PageState state) {
|
||||
return new ArrayList();
|
||||
}
|
||||
};
|
||||
|
||||
public ContextBar() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected List entries(final PageState state) {
|
||||
return (List) s_entries.get(state);
|
||||
}
|
||||
|
||||
public final void generateXML(final PageState state, final Element parent) {
|
||||
if (isVisible(state)) {
|
||||
final Element nav = parent.newChildElement
|
||||
("bebop:contextBar", BEBOP_XML_NS);
|
||||
|
||||
for (Iterator iter = entries(state).iterator(); iter.hasNext(); ) {
|
||||
((Entry) iter.next()).generateXML(state, nav);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Entry {
|
||||
private final String m_title;
|
||||
private final String m_href;
|
||||
|
||||
public Entry(final String title, final String href) {
|
||||
super();
|
||||
|
||||
Assert.exists(title, "String title");
|
||||
|
||||
m_title = title;
|
||||
m_href = href;
|
||||
}
|
||||
|
||||
public Entry(final String title, final URL url) {
|
||||
this(title, url.toString());
|
||||
}
|
||||
|
||||
public void generateXML(final PageState state,
|
||||
final Element parent) {
|
||||
final Element elem = parent.newChildElement
|
||||
("bebop:entry", BEBOP_XML_NS);
|
||||
|
||||
elem.addAttribute("title", m_title);
|
||||
elem.addAttribute("href", m_href);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,47 +31,47 @@ import org.libreccm.core.CcmObjectRepository;
|
|||
|
||||
/**
|
||||
* @param <T>
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
||||
*
|
||||
*/
|
||||
public class CcmObjectSelectionModel<T extends CcmObject>
|
||||
implements SingleSelectionModel<Long>{
|
||||
public class CcmObjectSelectionModel<T extends CcmObject>
|
||||
implements SingleSelectionModel<Long> {
|
||||
|
||||
private final Class<T> clazz;
|
||||
private final SingleSelectionModel<Long> model;
|
||||
|
||||
|
||||
public CcmObjectSelectionModel(final LongParameter parameter) {
|
||||
this(null, parameter);
|
||||
}
|
||||
|
||||
|
||||
public CcmObjectSelectionModel(final String parameterName) {
|
||||
this(null, new LongParameter(parameterName));
|
||||
}
|
||||
|
||||
|
||||
// public CcmObjectSelectionModel(final SingleSelectionModel<T> model ) {
|
||||
// this(null, model);
|
||||
// }
|
||||
//
|
||||
public CcmObjectSelectionModel(final Class<T> clazz,
|
||||
public CcmObjectSelectionModel(final Class<T> clazz,
|
||||
final String parameterName) {
|
||||
this(clazz, new LongParameter(parameterName));
|
||||
}
|
||||
|
||||
|
||||
public CcmObjectSelectionModel(final Class<T> clazz,
|
||||
final LongParameter parameter) {
|
||||
this(clazz, new ParameterSingleSelectionModel<>(parameter));
|
||||
}
|
||||
|
||||
public CcmObjectSelectionModel(final Class<T> clazz,
|
||||
|
||||
public CcmObjectSelectionModel(final Class<T> clazz,
|
||||
final SingleSelectionModel<Long> model) {
|
||||
this.clazz = clazz;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSelected(final PageState state) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
return model.isSelected(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -83,35 +83,34 @@ public class CcmObjectSelectionModel<T extends CcmObject>
|
|||
public void setSelectedKey(final PageState state, final Long key) {
|
||||
model.setSelectedKey(state, key);
|
||||
}
|
||||
|
||||
|
||||
public T getSelectedObject(final PageState state) {
|
||||
final Long key = getSelectedKey(state);
|
||||
final CcmObjectRepository repository = CdiUtil.createCdiUtil().findBean(
|
||||
CcmObjectRepository.class);
|
||||
//final T object = repository.findById(key);
|
||||
throw new UnsupportedOperationException();
|
||||
@SuppressWarnings("unchecked")
|
||||
final T object = (T) repository.findById(key);
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSelection(PageState state) {
|
||||
public void clearSelection(final PageState state) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChangeListener(ChangeListener changeListener) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
public void addChangeListener(final ChangeListener changeListener) {
|
||||
model.addChangeListener(changeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChangeListener(ChangeListener changeListener) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
public void removeChangeListener(final ChangeListener changeListener) {
|
||||
model.addChangeListener(changeListener);;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParameterModel getStateParameter() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
return model.getStateParameter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ import com.arsdigita.ui.admin.applications.AdminApplicationCreator;
|
|||
import com.arsdigita.ui.admin.AdminServlet;
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
import com.arsdigita.ui.admin.applications.AdminApplicationSetup;
|
||||
import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
|
||||
import com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane;
|
||||
import com.arsdigita.ui.login.LoginApplicationCreator;
|
||||
import com.arsdigita.ui.login.LoginServlet;
|
||||
import com.arsdigita.ui.login.LoginApplicationSetup;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class ApplicationRepository
|
|||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<CcmApplication> findByType(final String type) {
|
||||
final TypedQuery<CcmApplication> query = getEntityManager()
|
||||
.createNamedQuery("CcmApplication.Application.findByType",
|
||||
.createNamedQuery("CcmApplication.findByType",
|
||||
CcmApplication.class);
|
||||
query.setParameter("type", type);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
@NamedQuery(name = "CcmApplication.retrieveApplicationForPath",
|
||||
query = "SELECT a FROM CcmApplication a "
|
||||
+ "WHERE a.primaryUrl = :path"),
|
||||
@NamedQuery(name = "CcmApplication.Application.findByType",
|
||||
@NamedQuery(name = "CcmApplication.findByType",
|
||||
query = "SELECT A FROM CcmApplication a "
|
||||
+ "WHERE a.applicationType = :type")
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue