Enhancement ccm Loader (kann mehrere sections anlegen), Korrekturen und Bugfixes Loader, Codebereinigung.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1330 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-12-09 22:35:47 +00:00
parent 9d5e995a6a
commit 4d624f4d88
9 changed files with 124 additions and 147 deletions

View File

@ -531,10 +531,12 @@ public final class CMSConfig extends AbstractConfig {
// ///////////////////////////////////////////
// Content Section config related parameters
// ///////////////////////////////////////////
private final Parameter m_defaultSection = new StringParameter(
"com.arsdigita.cms.default_content_section",
Parameter.REQUIRED,
"content");
// Nolonger used,
// replaced by c.ad.cms.ContentSection.getDefaultSection().getName()
// private final Parameter m_defaultSection = new StringParameter(
// "com.arsdigita.cms.default_content_section",
// Parameter.REQUIRED,
// "content");
// ///////////////////////////////////////////
// Content Section creation parameters
// XXX these are probably temporary parameters, as the
@ -655,7 +657,7 @@ public final class CMSConfig extends AbstractConfig {
register(m_contentCenterMap);
// Content Section config related parameters
register(m_defaultSection);
// register(m_defaultSection);
// Content Section creation parameters
register(m_defaultItemResolverClass);
@ -712,8 +714,14 @@ public final class CMSConfig extends AbstractConfig {
return (InputStream) get(m_itemAdapters);
}
/**
*
* @deprecated
* use com.arsdigita.cms.ContentSection.getDefaultSection().getName() instead
*/
public final String getDefaultContentSection() {
return (String) get(m_defaultSection);
// return (String) get(m_defaultSection);
return (String) ContentSection.getDefaultSection().getName();
}
public final boolean getUseStreamlinedCreation() {

View File

@ -38,10 +38,11 @@ com.arsdigita.cms.item_adapters.purpose=Path to an XML resource containing adapt
com.arsdigita.cms.item_adapters.example=/WEB-INF/resources/cms-item-adapters.xml
com.arsdigita.cms.item_adapters.format=[string]
com.arsdigita.cms.default_content_section.title = Default Content Section
com.arsdigita.cms.default_content_section.purpose = The name of the default content section
com.arsdigita.cms.default_content_section.example = content
com.arsdigita.cms.default_content_section.format = [string]
# No longer used
# com.arsdigita.cms.default_content_section.title = Default Content Section
# com.arsdigita.cms.default_content_section.purpose = The name of the default content section
# com.arsdigita.cms.default_content_section.example = content
# com.arsdigita.cms.default_content_section.format = [string]
com.arsdigita.cms.use_streamlined_creation.title=Use streamlined content creation
com.arsdigita.cms.use_streamlined_creation.purpose=Use streamlined content creation: upon item creation, automatically open authoring steps and forward to the next step

View File

@ -1056,6 +1056,43 @@ public class ContentSection extends Application {
return new ContentSectionCollection(da);
}
/**
* Retrieve the default content section in the system.
*
* Default section is the first section created during setup, therefore it
* is recognized as the one with the lowest id.
*
* @return The default content section.
*/
public static ContentSection getDefaultSection() {
ContentSectionCollection sections = getAllSections();
sections.addOrder(ID);
sections.next(); // positions on the first section
ContentSection section = (ContentSection) sections.getDomainObject();
if (sections.isFirst() ) {
sections.close();
s_log.warn("Default section is "+section.getName() );
return section;
} else {
sections.close();
s_log.warn("Section found: "+section.getName()+", but not first." );
return null;
}
}
/**
* Convenience method to retrieve the name of the default content section
* in the system.
*
* Default section is the first section created during setup, therefore it
* is recognized as the one with the lowest id.
*
* @return The default content section name.
*/
public static String getDefaultSectionName() {
return getDefaultSection().getBaseDataObjectType();
}
/**
* Creates a content section of the given name using default values and
* returns it.

View File

@ -37,7 +37,7 @@ public class ContentSectionCollection extends DomainCollection {
/**
* Constructor.
*
**/
*/
public ContentSectionCollection(DataCollection dataCollection) {
super(dataCollection);
}
@ -50,6 +50,7 @@ public class ContentSectionCollection extends DomainCollection {
* (e.g. "primaryURL" in order to sort by section name
* see c.ad.london.util.cmd.SiteMapList as an example ).
*/
@Override
public void addOrder(String order) {
m_dataCollection.addOrder(order);
}
@ -59,6 +60,7 @@ public class ContentSectionCollection extends DomainCollection {
* the collection.
*
*/
@Override
public DomainObject getDomainObject() {
return new ContentSection(m_dataCollection.getDataObject());
}

View File

@ -47,12 +47,17 @@ public class ContentTypeCollection extends DomainCollection {
* Set the order of this Collection. This method needs to be called
* before <code>next()</code> is called on this collection.
*
* @param order: name of the pdl property to use for sorting the collection
* (e.g. "primaryURL" in order to sort by section name
* see c.ad.london.util.cmd.SiteMapList as an example ).
*/
@Override
public void addOrder(String order) {
m_dataCollection.addOrder(order);
}
@Override
public Filter addFilter(String conditions) {
return m_dataCollection.addFilter(conditions);
}

View File

@ -58,7 +58,7 @@ import org.apache.log4j.Logger;
// ccm/admin/sitemap lists them appropriately.
//
// Next Try
// Refactor using legacy compatible web/Application and ApplicationSetup
// Refactor using legacy compatible web/Application and ApplicationSetup DONE
/**
@ -118,47 +118,9 @@ public class Loader extends PackageLoader {
// Nolonger used
// /**
// * Constant string used as key for creating CMS (content-section) as a
// * legacy application.
// */
// private final static String CMS_PACKAGE_KEY = "content-section";
// /**
// * Dispatcher class for CMS (needed to be assigned to a legacy application).
// */
// private final static String CMS_DISPATCHER_CLASS =
// "com.arsdigita.cms.dispatcher.ContentSectionDispatcher";
// /**
// * Constant string used as key for creating Workspace (content-center) as a
// * legacy application.
// */
// public static final String WORKSPACE_PACKAGE_KEY = "content-center";
// private static final String WORKSPACE_INSTANCE_NAME = "Content Center";
// /**
// * Dispatcher class for Workspace (content-center) (needed to be assigned
// * to a legacy application).
// */
// private static final String WORKSPACE_DISPATCHER_CLASS =
// "com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
// // To be updated soon...
// // "com.arsdigita.dispatcher.DefaultPackageDispatcher";
// No longer used, moved to class Service
// /**
// * Name of the CMS service package instance, i.e. its URL.
// */
// private final static String SERVICE_URL = "cms-service";
// /**
// * Constant string used as key for creating service package as a
// * legacy application.
// */
// public final static String SERVICE_PACKAGE_KEY = "cms-service";
/**
*
*/
/** List of classnames of internal base content types (needed in every
* section created), generated while loading those content types in
* loadContentTypeDefinitions(files) for later use in register step. */
private ArrayList m_content_type_list = new ArrayList();
/**
@ -438,13 +400,14 @@ public class Loader extends PackageLoader {
/* Register internal base content types. Paramter is a list of
* class names created by internal content type load method.
* @see loadContentTypeDefinitions(List) */
* @see loadContentTypeDefinitions(List)
* External content types (provided by additional packages) are
* not available at CMS load time and can not processed by Loader.
* Registration of those content types are dealt with in the
* respective Loader or in the CMS workspace GUI.
* For each created section the base types get registered. */
setup.registerContentTypes(m_content_type_list);
// See method doc above. No external content types available at
// cms load time,
// setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
// Section specific categories, usually not used.
// During initial load at install time nor used at all!
// default value is false so no categories get loaded.

View File

@ -106,28 +106,28 @@ public final class LoaderConfig extends AbstractConfig {
// Parameter.REQUIRED,
// "/WEB-INF/resources/content-center-map.xml");
// Update master object if upgrading from old versioning
// XXX: shouldn't we just gut this section (and
// VersioningUpgrader)? It is an upgrade fix from 5.1 or
// earlier, and relying on VersionedACSObject is
// deprecated
// (pboy): Default value is false and this value didn't change for
// a very long period. Class can be excluded from source.
// final boolean updateMaster =
// ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue();
// if (updateMaster) {
// VersioningUpgrader.updateMasterObject();
// }
// Update master object if upgrading from old versioning
// XXX: shouldn't we just gut this section (and
// VersioningUpgrader)? It is an upgrade fix from 5.1 or
// earlier, and relying on VersionedACSObject is
// deprecated
// (pboy): Default value is false and this value didn't change for
// a very long period. Class can be excluded from source.
// final boolean updateMaster =
// ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue();
// if (updateMaster) {
// VersioningUpgrader.updateMasterObject();
// }
// XXX: ItemDispatcher is no longer used. Is the following
// still a valid enterprise.init parameter? Do we need to
// set ContentSectionServlet.s_cacheItems instead of the
// below (which is currently always true), or does this go
// away entirely?
// final boolean cacheItems =
// ((Boolean)m_conf.getParameter(CACHE_ITEMS)).booleanValue();
// s_log.debug("Set cache items to " + cacheItems);
// ItemDispatcher.setCacheItems(cacheItems);
// XXX: ItemDispatcher is no longer used. Is the following
// still a valid enterprise.init parameter? Do we need to
// set ContentSectionServlet.s_cacheItems instead of the
// below (which is currently always true), or does this go
// away entirely?
// final boolean cacheItems =
// ((Boolean)m_conf.getParameter(CACHE_ITEMS)).booleanValue();
// s_log.debug("Set cache items to " + cacheItems);
// ItemDispatcher.setCacheItems(cacheItems);
/**
@ -186,11 +186,13 @@ public final class LoaderConfig extends AbstractConfig {
* Not implemented yet! We need a new parameter type "list" which must have
* multidimensional capabilities.
*/
// private final Parameter
// m_staffGroup = new StringParameter(
// "com.arsdigita.cms.loader.section_staff_group",
// Parameter.REQUIRED,
// null);
/*
private final Parameter
m_staffGroup = new StringParameter(
"com.arsdigita.cms.loader.section_staff_group",
Parameter.REQUIRED,
null);
*/
private List m_staffGroup;
@ -208,32 +210,6 @@ public final class LoaderConfig extends AbstractConfig {
Parameter.REQUIRED,
true);
/**
* List of content types to register in the given content-section.
*
* Example:
* {
* "com.arsdigita.cms.contenttypes.Address",
* "com.arsdigita.cms.contenttypes.Article",
* "com.arsdigita.cms.contenttypes.Contact"
* }
*
* Parameter name "TYPES" in the old initializer code, empty by default in
* the former enterprise.init file.
* When the list is empty and the first default content section is created,
* all installed content types will get registered. This behaviour should
* not be altered without very good reasons.
*
* While loading ccm-cms no external content type packages are available
* because all content types depend on ccm-cms. Therefore this parameter
* can not beused in loader context.
*/
//private final Parameter
// m_contentTypeList = new StringArrayParameter(
// "com.arsdigita.cms.loader.section_ctypes_list",
// Parameter.REQUIRED,
// new String[] {} );
// Page Resolver Class, set autonomously by ContentSection.create() method.
// Item Resolver Class, configurable.
@ -410,22 +386,24 @@ public final class LoaderConfig extends AbstractConfig {
"List of all installed packages")
);
// Currently not a Loader task. There is no way to persist tasks preferences
// on a per section base.
// /**
// * When to generate email alerts: by default, generate email alerts
// * on enable, finish, and rollback (happens on rejection) changes.
// * There are four action types for each task type: enable,
// * disable, finish, and rollback. Note that the values below are
// * based on the task labels, and as such are not globalized.
// */
// private final Parameter
// m_taskAlerts = new StringArrayParameter(
// "com.arsdigita.cms.task_alerts",
// Parameter.REQUIRED, new String[] {
// "Authoring:enable:finish:rollback",
// "Approval:enable:finish:rollback",
// "Deploy:enable:finish:rollback" } );
// Currently not a Loader task. There is no way to persist tasks preferences
// on a per section base.
/**
* When to generate email alerts: by default, generate email alerts
* on enable, finish, and rollback (happens on rejection) changes.
* There are four action types for each task type: enable,
* disable, finish, and rollback. Note that the values below are
* based on the task labels, and as such are not globalized.
*/
/*
private final Parameter
m_taskAlerts = new StringArrayParameter(
"com.arsdigita.cms.task_alerts",
Parameter.REQUIRED, new String[] {
"Authoring:enable:finish:rollback",
"Approval:enable:finish:rollback",
"Deploy:enable:finish:rollback" } );
*/
// ///////////////////////////////////////////////////////////////////////
@ -492,7 +470,6 @@ public final class LoaderConfig extends AbstractConfig {
register(m_itemResolverClass);
register(m_templateResolverClass);
// register(m_contentTypeList);
register(m_useSectionCategories);
register(m_categoryFileList);
@ -684,12 +661,5 @@ public final class LoaderConfig extends AbstractConfig {
public List getDataQueries() {
return dataQueries;
}
/**
* Retrieve the
*/
// public List getContentSectionsContentTypes() {
// String[] contentTypes = (String[]) get(m_contentTypeList);
// return Arrays.asList(contentTypes);
// }
}

View File

@ -22,8 +22,3 @@ com.arsdigita.cms.loader.section_is_public.title=
com.arsdigita.cms.loader.section_is_public.purpose=
com.arsdigita.cms.loader.section_is_public.example=
com.arsdigita.cms.loader.section_is_public.format=[StringArray]
com.arsdigita.cms.loader.section_ctypes_list.title=
com.arsdigita.cms.loader.section_ctypes_list.purpose=
com.arsdigita.cms.loader.section_ctypes_list.example=
com.arsdigita.cms.loader.section_ctypes_list.format=[ boolean]

View File

@ -24,8 +24,6 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager;
//import com.arsdigita.cms.installer.ServiceInstaller;
// import com.arsdigita.cms.installer.WorkspaceInstaller;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelContext;
@ -54,9 +52,6 @@ import java.util.Map;
*/
public class Utilities {
// public final static String CMS_WORKSPACE = WorkspaceInstaller.PACKAGE_KEY;
// public final static String CMS_SERVICE = ServiceInstaller.PACKAGE_KEY;
// Used for caching util lookups
private static HashMap m_cache = new HashMap();
@ -341,7 +336,8 @@ public class Utilities {
* the browser does not cache tha page
*
* @param response The HTTP response
* @deprecated use com.arsdigita.dispatcher.DispatcherHelper.cacheDisable(HttpServletResponse)
* @deprecated use
* com.arsdigita.dispatcher.DispatcherHelper.cacheDisable(HttpServletResponse)
*/
public static void disableBrowserCache(HttpServletResponse response) {
response.addHeader("pragma", "no-cache");