Minor enhancements, added documentation.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2149 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-05-04 15:55:21 +00:00
parent f1a97b0f94
commit 58ad8daf41
11 changed files with 223 additions and 131 deletions

View File

@ -47,13 +47,8 @@ public class FileAttachment extends FileAsset {
public static final String FILE_ATTACHMENTS = "fileAttachments";
public static final String FILE_ORDER = "fileOrder";
private static final FileAttachmentConfig s_config = new FileAttachmentConfig();
static {
s_log.debug("Static initalizer starting...");
s_config.load();
s_log.debug("Static initalizer finished.");
}
private static final FileAttachmentConfig
s_config = FileAttachmentConfig.instanceOf();
public FileAttachment() {

View File

@ -7,35 +7,61 @@ import com.arsdigita.util.parameter.SpecificClassParameter;
import com.arsdigita.util.parameter.BooleanParameter;
import com.arsdigita.util.parameter.Parameter;
import org.apache.log4j.Logger;
public class FileAttachmentConfig extends AbstractConfig {
/** A logger instance to assist debugging. */
private static final Logger s_log = Logger.getLogger(FileAttachmentConfig.class);
/** Singelton config object. */
private static FileAttachmentConfig s_conf;
/**
* Gain a DublinCoreConfig object.
*
* Singelton pattern, don't instantiate a config object using the
* constructor directly!
* @return
*/
public static synchronized FileAttachmentConfig instanceOf() {
if (s_conf == null) {
s_conf = new FileAttachmentConfig();
s_conf.load();
}
return s_conf;
}
// ///////////////////////////////////////////////////////////////////////
//
// set of configuration parameters
/**
* A form which should be used for editing file asset properties.
* Default implementation edits Assets.description property.
*/
Parameter editFormClass;
/**
* Optional parameter if set to TRUE will disply the asset URL instead of
* the description on AttachFile Authroing step. Default: FALSE
*/
Parameter showAssetID;
/**
* Constructor, don't use it directly!
*/
public FileAttachmentConfig() {
editFormClass = new SpecificClassParameter(
Parameter editFormClass = new SpecificClassParameter(
"com.arsdigita.cms.contentassets.file_edit_form",
Parameter.REQUIRED,
FileDescriptionForm.class,
FormSection.class
);
showAssetID = new BooleanParameter(
/**
* Optional parameter if set to TRUE will disply the asset URL instead of
* the description on AttachFile Authroing step. Default: FALSE
*/
Parameter showAssetID = new BooleanParameter(
"com.arsdigita.cms.contentassets.file_show_asset_id",
Parameter.OPTIONAL,
Boolean.FALSE
);
/**
* Constructor, don't use it directly!
*/
public FileAttachmentConfig() {
register(editFormClass);
register(showAssetID);

View File

@ -124,24 +124,16 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
/**
* The label for the authoring step
* @deprecated has to be replaced to provide LabelKey, see ContentAssetInitializer
*/
public GlobalizedMessage getAuthoringStepLabel() {
return FileAttachmentGlobalize.AuthoringStepLabel();
// return new GlobalizedMessage(
// "com.arsdigita.cms.contentassets.file_attachment_label",
// "com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* The description for the authoring step
* @deprecated has to be replaced to provide DesciptionKey, see ContentAssetInitializer
*/
public GlobalizedMessage getAuthoringStepDescription() {
return FileAttachmentGlobalize.AuthoringStepDescription();
// return new GlobalizedMessage(
// "com.arsdigita.cms.contentassets.file_attachment_description",
// "com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**

View File

@ -53,11 +53,9 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
/** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.ItemImageAttachment";
private static final Logger s_log = Logger.getLogger(ItemImageAttachment.class);
private static final ItemImageAttachmentConfig s_config = new ItemImageAttachmentConfig();
static {
s_config.load();
}
private static final ItemImageAttachmentConfig
s_config = ItemImageAttachmentConfig.instanceOf();
private ItemImageAttachment() {
this(BASE_DATA_OBJECT_TYPE);

View File

@ -38,8 +38,33 @@ import org.apache.log4j.Logger;
*/
public final class ItemImageAttachmentConfig extends AbstractConfig {
/** A logger instance to assist debugging. */
private static final Logger s_log = Logger.getLogger(ItemImageAttachmentConfig.class);
/** Singelton config object. */
private static ItemImageAttachmentConfig s_conf;
/**
* Gain a DublinCoreConfig object.
*
* Singelton pattern, don't instantiate a config object using the
* constructor directly!
* @return
*/
public static synchronized ItemImageAttachmentConfig instanceOf() {
if (s_conf == null) {
s_conf = new ItemImageAttachmentConfig();
s_conf.load();
}
return s_conf;
}
// ///////////////////////////////////////////////////////////////////////
//
// set of configuration parameters
// Are the description and title properties available for
// display/editing. These properties are used by the
// ImageGallery content type.

View File

@ -29,14 +29,23 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.runtime.DomainInitEvent;
/**
* Initializes the imagestep content item asset.
*
* @version $Id: ItemImageAttachmentInitializer.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/**
* Constructor, sets its specific manifest file and delegates to super class.
*/
public ItemImageAttachmentInitializer() {
super("ccm-cms-assets-imagestep.pdl.mf");
}
/**
*
* @param ev
*/
@Override
public void init( DomainInitEvent ev ) {
@ -55,74 +64,61 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
}
);
// removeDeprecatedImageSteps();
}
/**
* The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage
*/
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
*
* Returns the path to the XML file defintions for the asset, eg:
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/
// private void removeDeprecatedImageSteps() {
// DataCollection steps = SessionManager.getSession().retrieve
// ( AuthoringStep.BASE_DATA_OBJECT_TYPE );
//
// // Don't use defined constant to reduce dependency on GenericArticle
// steps.addEqualsFilter( "component",
// "com.arsdigita.cms.ui.authoring.ArticleImage" );
//
// while( steps.next() ) {
// DataObject step = steps.getDataObject();
//
// DataCollection kits = SessionManager.getSession().retrieve
// ( AuthoringKitStepAssociation.BASE_DATA_OBJECT_TYPE );
// kits.addEqualsFilter( "stepId", step.get( "id" ) );
//
// while( kits.next() ) {
// DataObject kitStep = kits.getDataObject();
// AuthoringKitStepAssociation kitStepAsso = new AuthoringKitStepAssociation(kitStep);
// // Check whether the content type is (persistence-wise) subtype
// // of com.ad.cms.GenericArticle. This is lame, but I couldn't find a better API to do this:
// AuthoringKit kit = new AuthoringKit (kitStepAsso.getKitID());
// try {
// ObjectType.verifySubtype(GenericArticle.BASE_DATA_OBJECT_TYPE,
// kit.getContentType().getAssociatedObjectType());
// kitStepAsso.delete();
// } catch (PersistenceException pe) {
// // Do nothing, the content type is not subtyping com.arsdigita.cms.GenericArticle
// }
// }
//
// // DomainObjectFactory.newInstance( step ).delete();
// }
// }
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/" +
"cms/contentassets/ItemImageAttachment.xml";
}
/**
* The name of the association between the item
* and the asset, eg 'fileAttachments'.
*/
public String getProperty() {
return "imageAttachments";
}
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
* The class of the authoring kit step
*/
public Class getAuthoringStep() {
return ImageStep.class;
}
/**
* The label for the authoring step
*/
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label",
"com.arsdigita.cms.contentassets.ImageStepResources");
}
/**
* The description for the authoring step
*/
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description",
"com.arsdigita.cms.contentassets.ImageStepResources");
}
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() {
return 1; // XXX config param please
}

View File

@ -18,56 +18,37 @@ package com.arsdigita.cms.contentassets;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.contentassets.ui.NotesStep;
import com.arsdigita.cms.contentassets.ui.NotesSummary;
import com.arsdigita.cms.contenttypes.ContentAssetInitializer;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.domain.DomainObjectTraversal;
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.cms.contentassets.ui.NotesStep;
import com.arsdigita.cms.contentassets.ui.NotesSummary;
import com.arsdigita.runtime.DomainInitEvent;
/**
* Initializes the Notes content item asset at each system startup.
*
* The class just implements all abstract methods of the super class and
* provides some additions to the init(DomainInitEvent) part of the super
* initializer.
*/
public class NotesInitializer extends ContentAssetInitializer {
/**
* Default constructor, sets its specific manifest file and delegates to
* super class.
*/
public NotesInitializer() {
super( "ccm-cms-assets-notes.pdl.mf" );
}
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/Notes.xml";
}
public String getProperty() {
return Note.NOTES;
}
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
public Class getAuthoringStep() {
return NotesStep.class;
}
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_label",
"com.arsdigita.cms.contentassets.NotesResources"
);
}
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_description",
"com.arsdigita.cms.contentassets.NotesResources"
);
}
public int getAuthoringStepSortKey() {
return 3;
}
// public void init( LegacyInitEvent ev ) {
/**
*
* @param ev
*/
@Override
public void init( DomainInitEvent ev ) {
super.init( ev );
@ -81,4 +62,62 @@ public class NotesInitializer extends ContentAssetInitializer {
SimpleXMLGenerator.ADAPTER_CONTEXT );
SimpleEditStep.addAdditionalDisplayComponent(new NotesSummary());
}
/**
* The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage
*/
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
* Returns the path to the XML file defintions for the asset, eg:
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/
public String getTraversalXML() {
return TRAVERSAL_ADAPTER_BASE_DIR + "Notes.xml";
}
/**
* The name of the association between the item
* and the asset, eg 'fileAttachments'.
*/
public String getProperty() {
return Note.NOTES;
}
/**
* The class of the authoring kit step
*/
public Class getAuthoringStep() {
return NotesStep.class;
}
/**
* The label for the authoring step
*/
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_label",
"com.arsdigita.cms.contentassets.NotesResources"
);
}
/**
* The description for the authoring step
*/
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_description",
"com.arsdigita.cms.contentassets.NotesResources"
);
}
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() {
return 3;
}
}

View File

@ -0,0 +1,2 @@
com.arsdigita.cms.contentassets.notes_authoring_step_label=Notes
com.arsdigita.cms.contentassets.notes_authoring_step_description=Attach notes to an item

View File

@ -36,8 +36,8 @@ import org.apache.log4j.Logger;
* This content type represents a Link content type for linking
* ContentItems and external links.
*
* @version $Revision: #4 $ $Date: 2004/03/30 $
* @author Scott Seago (sseago@redhat.com)
* @version $Revision: #4 $ $Date: 2004/03/30 $
*/
public class RelatedLink extends Link {

View File

@ -20,61 +20,80 @@ import com.arsdigita.cms.ContentPage;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Initializer
* Initializes the RelatedLink content item asset at each system startup.
*
* @author Rafael H. Schloming <rhs@mit.edu>
* @version $Revision: #4 $ $Date: 2004/03/30 $
* @version $Id: RelatedLinkInitializer.java 287 2005-02-22 00:29:02Z sskracic $
**/
*/
public class RelatedLinkInitializer extends ContentAssetInitializer {
protected RelatedLinkInitializer(final String manifestFile) {
super(manifestFile);
}
/**
*
* Default constructor, sets its specific manifest file and delegates to
* super class.
*/
public RelatedLinkInitializer() {
super("ccm-cms-assets-relatedlink.pdl.mf");
}
/**
* Constructor.
*/
protected RelatedLinkInitializer(final String manifestFile) {
super(manifestFile);
}
/**
*
* @return
* The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage
*/
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/" +
"cms/contentassets/RelatedLink.xml";
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
*
* @return
* Returns the path to the XML file defintions for the asset, eg:
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/
public String getTraversalXML() {
return TRAVERSAL_ADAPTER_BASE_DIR + "RelatedLink.xml";
}
/**
* The name of the association between the item
* and the asset, eg 'fileAttachments'.
*/
public String getProperty() {
return "links";
}
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
* The class of the authoring kit step
*/
public Class getAuthoringStep() {
return RelatedLinkPropertiesStep.class;
}
/**
* The label for the authoring step
*/
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_label",
"com.arsdigita.cms.contentassets.RelatedLinkResources");
}
/**
* The description for the authoring step
*/
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_description",
"com.arsdigita.cms.contentassets.RelatedLinkResources");
}
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() {
return 1; // XXX config param please
}