diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/CMS.java b/ccm-cms/src/main/java/com/arsdigita/cms/CMS.java deleted file mode 100755 index d8059095f..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/CMS.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2002-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; - -/** - *

- * A central location for commonly used CMS services and their accessories.

- * - *

- * Context. {@link #getContext()} fetches the context record ({@link - * com.arsdigita.kernel.KernelContext}) of the current thread.

- * - * @author Daniel Berrange - * @see com.arsdigita.kernel.Kernel - */ -public abstract class CMS { - - - /** - * The CMS XML namespace. - */ - public final static String CMS_XML_NS = "http://www.arsdigita.com/cms/1.0"; - - /** - * Constant string used as key for creating Workspace (content-center) as a - * legacy application. - */ - public static final String WORKSPACE_PACKAGE_KEY = "content-center"; - - /** - * Constant string used as key for creating service package as a legacy - * application. - */ - public final static String SERVICE_PACKAGE_KEY = "cms-service"; - - static final CMSContext s_initialContext = new CMSContext(); - - private static final ThreadLocal s_context = new ThreadLocal() { - - @Override - public Object initialValue() { - return s_initialContext; - } - - }; - - /** - * Get the context record of the current thread. - * - * @post return != null - */ - public static final CMSContext getContext() { - return (CMSContext) s_context.get(); - } - - static final void setContext(CMSContext context) { - s_context.set(context); - } - - -} diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/CMSContext.java b/ccm-cms/src/main/java/com/arsdigita/cms/CMSContext.java deleted file mode 100755 index 942cf88f1..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/CMSContext.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2002-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; - -import com.arsdigita.util.Assert; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.librecms.contentsection.ContentItem; -import org.librecms.contentsection.ContentSection; - - -/** - *

The entry point into all the global state that CCM CMS code expects to - * have available to it when running, e.g. the current content section, - * current item - * - *

This is a session object that provides an environment in which - * code can execute. The CMSContext contains all session-specific - * variables. One session object is maintained per thread.

- * - *

Accessors of this class will assert that the item it returned is - * not null. If the caller wants to handle the case where an item is - * null explicitly, then use the hasContentItem and hasContentSection - * methods first. - * - * @see com.arsdigita.kernel.KernelContext - * @see com.arsdigita.cms.CMS - * - * @author Daniel Berrange - */ -public final class CMSContext { - - private static final Logger LOGGER = LogManager.getLogger(CMSContext.class); - - private ContentSection m_section = null; - private ContentItem m_item = null; - private SecurityManager m_security = null; - - CMSContext() { - // Empty - } - - public final String getDebugInfo() { - final String info = "Current state of " + this + ":\n" + - " getContentSection() -> " + getContentSection() + "\n" + - " getContentItem() -> " + getContentItem() + "\n" + - " getSecurityManager() -> " + getSecurityManager(); - - return info; - } - - final CMSContext copy() { - final CMSContext result = new CMSContext(); - - result.m_section = m_section; - result.m_item = m_item; - result.m_security = m_security; - - return result; - } - - /** - * Checks if a content section is available - * @return true if a content section is available - */ - public final boolean hasContentSection() { - return m_section != null; - } - - /** - * Gets the current content section - * not anymore: hasContentSection() == true - * @return the currently selected content section - */ - public final ContentSection getContentSection() { - // removing this which is not true when viewing category pages - //Assert.exists(m_section, "section"); - return m_section; - } - - /** - * Sets the current content section - * @param section the new content section - */ - public final void setContentSection(final ContentSection section) { - m_section = section; - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Content section set to " + section); - } - } - - /** - * Checks if a content item is available - * @return true if a content item is available - */ - public final boolean hasContentItem() { - return m_item != null; - } - - /** - * Returns the current content item - * @pre hasContentItem() == true - * @return the current content item - */ - public final ContentItem getContentItem() { - // removing this which is necessarily true in ContentList - //Assert.exists(m_item, "item"); - if (LOGGER.isDebugEnabled() && m_item == null) { - LOGGER.debug("Content item is null"); - } - return m_item; - } - - /** - * Sets the current content item - * @param item the new content item - */ - public final void setContentItem(final ContentItem item) { - m_item = item; - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Content item set to " + item); - } - } - - /** - * Checks if there is a CMS SecurityManager for this - * session. - * - * @see com.arsdigita.cms.SecurityManager - * @return true if a security manager is available - */ - public final boolean hasSecurityManager() { - return m_security != null; - } - - /** - * Returns the current security manager. - * - * @return the current security manager - */ - public final SecurityManager getSecurityManager() { - Assert.exists(m_security, SecurityManager.class); - - return m_security; - } - - public final void setSecurityManager(final SecurityManager security) { - m_security = security; - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Security manager set to " + security); - } - } -} diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ItemSelectionModel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ItemSelectionModel.java deleted file mode 100755 index 9c9eb488e..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ItemSelectionModel.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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; - -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.parameters.LongParameter; -import com.arsdigita.ui.CcmObjectSelectionModel; - -import org.libreccm.cdi.utils.CdiUtil; -import org.librecms.contentsection.ContentItem; -import org.librecms.contentsection.ContentType; -import org.librecms.contentsection.ContentTypeRepository; -import org.librecms.contenttypes.ContentTypeInfo; - -import java.math.BigDecimal; - -/** - *

- * Loads a subclass of a {@link com.arsdigita.cms.ContentItem} from the - * database. This model should be used as a parameter to the constructor of - * authoring kit components.

- * - *

- * It is possible to instantiate this model with a {@link - * com.arsdigita.cms.ContentType} as a constructor parameter. In this case, the - * model will only instantiate items that are of the specified content type, or - * one of it subclasses.

- * - * @author Stanislav Freidin (stas@arsdigita.com) - * @author Jens Pelzetter - * - * @see com.arsdigita.kernel.ui.ACSObjectSelectionModel - * @see com.arsdigita.bebop.SingleSelectionModel - */ -public class ItemSelectionModel extends CcmObjectSelectionModel { - - private Long typeId; - - public ItemSelectionModel(final LongParameter parameter) { - super(ContentItem.class.getName(), parameter); - } - - public ItemSelectionModel(final String parameterName) { - super(ContentItem.class.getName(), parameterName); - } - - /** - * Construct a new ItemSelectionModel - * - * @param type The content type for the items this model will - * generate - * - * @param parameterName The name of the state parameter which will be used - * to store the item. - */ - public ItemSelectionModel(final ContentType type, - final String parameterName) { - this(type, new LongParameter(parameterName)); - } - - /** - * Construct a new ItemSelectionModel - * - * @param type The content type for the items this model will generate - * - * @param parameter The state parameter which should be used by this item - * - */ - public ItemSelectionModel(final ContentType type, - final LongParameter parameter) { - super(type.getContentItemClass(), parameter); - typeId = type.getObjectId(); - } - - /** - * Construct a new ItemSelectionModel - * - * @param type The content type for the items this model will generate - * - * @param model The {@link SingleSelectionModel} which will supply a - * {@link BigDecimal} id of the currently selected object - * - */ - public ItemSelectionModel(final ContentType type, - final SingleSelectionModel model) { - super(type.getContentItemClass(), model); - typeId = type.getObjectId(); - } - - public ItemSelectionModel(final ContentTypeInfo type, - final SingleSelectionModel model) { - super(type.getContentItemClass().getName(), model); - typeId = null; - } - - public ItemSelectionModel(final ContentTypeInfo type, - final LongParameter parameter) { - super(type.getContentItemClass().getName(), parameter); - typeId = null; - } - - /** - * A convenience method that gets the currently selected object and casts it - * to a ContentItem - * - * @param state the current page state - * - * @return the currently selected ContentItem, or null if no - * item was selected. - */ - public final ContentItem getSelectedItem(final PageState state) { - return getSelectedObject(state); - } - - /** - * - * @return The content type of the items which are produced by this model, - * or null if the content type has not been specified in the - * constructor. - */ - public ContentType getContentType() { - - ContentType type = null; - - if (typeId != null) { - type = CdiUtil.createCdiUtil().findBean(ContentTypeRepository.class) - .findById(typeId).get(); - } - - return type; - } - -} diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/PageLocations.java b/ccm-cms/src/main/java/com/arsdigita/cms/PageLocations.java deleted file mode 100755 index 656129039..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/PageLocations.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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; - -/** - * Specifies the standard locations of the pages that comprise the - * content section user interface. - * - * @author Karl Goldstein (karlg at arsdigita dot com) - * - * @version $Id: PageLocations.java 2090 2010-04-17 08:04:14Z pboy $ - **/ -public interface PageLocations { - public String SECTION_PAGE = "admin/index.jsp"; - public String ITEM_PAGE = "admin/item.jsp"; -}