diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java index 991b7755d..03da35fcb 100755 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/ContentSectionPage.java @@ -78,9 +78,6 @@ import org.librecms.contentsection.privileges.AdminPrivileges; */ public class ContentSectionPage extends CMSPage implements ActionListener { - private static final Logger LOGGER = LogManager.getLogger( - ContentSectionPage.class); - /** * The URL parameter that can be passed in in order to set the current * folder. This is used in getting back to the correct level of folder @@ -127,6 +124,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener { */ public static final int CONTENTTYPES_TAB = 6; public static final int USER_ADMIN_TAB = 7; + private TabbedPane m_tabbedPane; private FolderAdminPane m_folderPane; //ToDo NG private BrowsePane m_browsePane; diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/ContentTypesManager.java b/ccm-cms/src/main/java/org/librecms/contenttypes/ContentTypesManager.java index 54d0932a8..3915dd250 100644 --- a/ccm-cms/src/main/java/org/librecms/contenttypes/ContentTypesManager.java +++ b/ccm-cms/src/main/java/org/librecms/contenttypes/ContentTypesManager.java @@ -18,8 +18,11 @@ */ package org.librecms.contenttypes; +import com.arsdigita.util.UncheckedWrapperException; + import org.libreccm.modules.CcmModule; import org.librecms.contentsection.ContentItem; +import org.librecms.contentsection.ContentType; import java.util.Arrays; import java.util.Collections; @@ -210,11 +213,67 @@ public class ContentTypesManager { /** * Retrieves a list of all content types currently available on the system. - * + * * @return A list of all available content types. */ public List getAvailableContentTypes() { return Collections.unmodifiableList(availableContentTypes); } + /** + * Get the {@link ContentTypeInfo} for a specific type. + * + * @param contentTypeClass The class representing the content type. + * + * @return A {@link ContentTypeInfo} describing the content type. + */ + public ContentTypeInfo getContentTypeInfo( + final Class contentTypeClass) { + + return createContentTypeInfo(contentTypeClass); + } + + /** + * Convenient method for getting the {@link ContentTypeInfo} about a + * specific content type. + * + * @param contentTypeClass The name of the class representing the content + * type. + * + * @return A {@link ContentTypeInfo} describing the content type. + */ + @SuppressWarnings("unchecked") + public ContentTypeInfo getContentTypeInfo(final String contentTypeClass) { + final Class clazz; + try { + clazz = Class.forName(contentTypeClass); + } catch (ClassNotFoundException ex) { + throw new IllegalArgumentException(String.format( + "There is not class \"%s\".", contentTypeClass), + ex); + } + + if (!clazz.isAssignableFrom(ContentItem.class)) { + throw new IllegalArgumentException(String.format( + "Class \"%s\" is not a subclass of \"%s\".", + contentTypeClass, + ContentItem.class.getName())); + } + + return getContentTypeInfo((Class) clazz); + } + + /** + * Convenient method for getting the {@link ContentTypeInfo} about a + * specific content type. + * + * @param contentType The content type (from a content section} representing + * the content type. + * + * @return A {@link ContentTypeInfo} describing the content type. + */ + public ContentTypeInfo getContentTypeInfo(final ContentType contentType) { + return getContentTypeInfo(contentType.getContentItemClass()); + } + }