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_ATTACHMENTS = "fileAttachments";
public static final String FILE_ORDER = "fileOrder"; public static final String FILE_ORDER = "fileOrder";
private static final FileAttachmentConfig s_config = new FileAttachmentConfig(); private static final FileAttachmentConfig
s_config = FileAttachmentConfig.instanceOf();
static {
s_log.debug("Static initalizer starting...");
s_config.load();
s_log.debug("Static initalizer finished.");
}
public FileAttachment() { public FileAttachment() {

View File

@ -7,36 +7,62 @@ import com.arsdigita.util.parameter.SpecificClassParameter;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.BooleanParameter;
import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.Parameter;
import org.apache.log4j.Logger;
public class FileAttachmentConfig extends AbstractConfig { 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. * A form which should be used for editing file asset properties.
* Default implementation edits Assets.description property. * Default implementation edits Assets.description property.
*/ */
Parameter editFormClass; Parameter editFormClass = new SpecificClassParameter(
/**
* 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(
"com.arsdigita.cms.contentassets.file_edit_form", "com.arsdigita.cms.contentassets.file_edit_form",
Parameter.REQUIRED, Parameter.REQUIRED,
FileDescriptionForm.class, FileDescriptionForm.class,
FormSection.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", "com.arsdigita.cms.contentassets.file_show_asset_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
Boolean.FALSE Boolean.FALSE
); );
/**
* Constructor, don't use it directly!
*/
public FileAttachmentConfig() {
register(editFormClass); register(editFormClass);
register(showAssetID); register(showAssetID);
loadInfo(); loadInfo();

View File

@ -124,24 +124,16 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The label for the authoring step * The label for the authoring step
* @deprecated has to be replaced to provide LabelKey, see ContentAssetInitializer
*/ */
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return FileAttachmentGlobalize.AuthoringStepLabel(); return FileAttachmentGlobalize.AuthoringStepLabel();
// return new GlobalizedMessage(
// "com.arsdigita.cms.contentassets.file_attachment_label",
// "com.arsdigita.cms.contentassets.FileAttachmentResources");
} }
/** /**
* The description for the authoring step * The description for the authoring step
* @deprecated has to be replaced to provide DesciptionKey, see ContentAssetInitializer
*/ */
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return FileAttachmentGlobalize.AuthoringStepDescription(); 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 */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.ItemImageAttachment"; 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 Logger s_log = Logger.getLogger(ItemImageAttachment.class);
private static final ItemImageAttachmentConfig s_config = new ItemImageAttachmentConfig();
static { private static final ItemImageAttachmentConfig
s_config.load(); s_config = ItemImageAttachmentConfig.instanceOf();
}
private ItemImageAttachment() { private ItemImageAttachment() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);

View File

@ -38,8 +38,33 @@ import org.apache.log4j.Logger;
*/ */
public final class ItemImageAttachmentConfig extends AbstractConfig { public final class ItemImageAttachmentConfig extends AbstractConfig {
/** A logger instance to assist debugging. */
private static final Logger s_log = Logger.getLogger(ItemImageAttachmentConfig.class); 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 // Are the description and title properties available for
// display/editing. These properties are used by the // display/editing. These properties are used by the
// ImageGallery content type. // ImageGallery content type.

View File

@ -29,14 +29,23 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.DomainInitEvent;
/** /**
* Initializes the imagestep content item asset.
*
* @version $Id: ItemImageAttachmentInitializer.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ItemImageAttachmentInitializer.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class ItemImageAttachmentInitializer extends ContentAssetInitializer { public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/**
* Constructor, sets its specific manifest file and delegates to super class.
*/
public ItemImageAttachmentInitializer() { public ItemImageAttachmentInitializer() {
super("ccm-cms-assets-imagestep.pdl.mf"); super("ccm-cms-assets-imagestep.pdl.mf");
} }
/**
*
* @param ev
*/
@Override @Override
public void init( DomainInitEvent ev ) { 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() { public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/" + return "/WEB-INF/traversal-adapters/com/arsdigita/" +
"cms/contentassets/ItemImageAttachment.xml"; "cms/contentassets/ItemImageAttachment.xml";
} }
/**
* The name of the association between the item
* and the asset, eg 'fileAttachments'.
*/
public String getProperty() { public String getProperty() {
return "imageAttachments"; return "imageAttachments";
} }
public String getBaseType() { /**
return ContentPage.BASE_DATA_OBJECT_TYPE; * The class of the authoring kit step
} */
public Class getAuthoringStep() { public Class getAuthoringStep() {
return ImageStep.class; return ImageStep.class;
} }
/**
* The label for the authoring step
*/
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label", return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label",
"com.arsdigita.cms.contentassets.ImageStepResources"); "com.arsdigita.cms.contentassets.ImageStepResources");
} }
/**
* The description for the authoring step
*/
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description", return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description",
"com.arsdigita.cms.contentassets.ImageStepResources"); "com.arsdigita.cms.contentassets.ImageStepResources");
} }
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() { public int getAuthoringStepSortKey() {
return 1; // XXX config param please 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.ContentPage;
import com.arsdigita.cms.ContentType; 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.contenttypes.ContentAssetInitializer;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.domain.DomainObjectTraversal; import com.arsdigita.domain.DomainObjectTraversal;
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.cms.contentassets.ui.NotesStep;
import com.arsdigita.cms.contentassets.ui.NotesSummary;
import com.arsdigita.runtime.DomainInitEvent; 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 { public class NotesInitializer extends ContentAssetInitializer {
/**
* Default constructor, sets its specific manifest file and delegates to
* super class.
*/
public NotesInitializer() { public NotesInitializer() {
super( "ccm-cms-assets-notes.pdl.mf" ); super( "ccm-cms-assets-notes.pdl.mf" );
} }
public String getTraversalXML() { /**
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/Notes.xml"; *
} * @param ev
*/
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 ) {
@Override @Override
public void init( DomainInitEvent ev ) { public void init( DomainInitEvent ev ) {
super.init( ev ); super.init( ev );
@ -81,4 +62,62 @@ public class NotesInitializer extends ContentAssetInitializer {
SimpleXMLGenerator.ADAPTER_CONTEXT ); SimpleXMLGenerator.ADAPTER_CONTEXT );
SimpleEditStep.addAdditionalDisplayComponent(new NotesSummary()); 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 * This content type represents a Link content type for linking
* ContentItems and external links. * ContentItems and external links.
* *
* @version $Revision: #4 $ $Date: 2004/03/30 $
* @author Scott Seago (sseago@redhat.com) * @author Scott Seago (sseago@redhat.com)
* @version $Revision: #4 $ $Date: 2004/03/30 $
*/ */
public class RelatedLink extends Link { public class RelatedLink extends Link {

View File

@ -20,61 +20,80 @@ import com.arsdigita.cms.ContentPage;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* Initializer * Initializes the RelatedLink content item asset at each system startup.
* *
* @author Rafael H. Schloming <rhs@mit.edu> * @author Rafael H. Schloming <rhs@mit.edu>
* @version $Revision: #4 $ $Date: 2004/03/30 $ * @version $Revision: #4 $ $Date: 2004/03/30 $
* @version $Id: RelatedLinkInitializer.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: RelatedLinkInitializer.java 287 2005-02-22 00:29:02Z sskracic $
**/ */
public class RelatedLinkInitializer extends ContentAssetInitializer { 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() { public RelatedLinkInitializer() {
super("ccm-cms-assets-relatedlink.pdl.mf"); super("ccm-cms-assets-relatedlink.pdl.mf");
} }
/** /**
* * Constructor.
* @return
*/ */
public String getTraversalXML() { protected RelatedLinkInitializer(final String manifestFile) {
return "/WEB-INF/traversal-adapters/com/arsdigita/" + super(manifestFile);
"cms/contentassets/RelatedLink.xml"; }
/**
* 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:
* @return * /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() { public String getProperty() {
return "links"; return "links";
} }
public String getBaseType() { /**
return ContentPage.BASE_DATA_OBJECT_TYPE; * The class of the authoring kit step
} */
public Class getAuthoringStep() { public Class getAuthoringStep() {
return RelatedLinkPropertiesStep.class; return RelatedLinkPropertiesStep.class;
} }
/**
* The label for the authoring step
*/
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_label", return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_label",
"com.arsdigita.cms.contentassets.RelatedLinkResources"); "com.arsdigita.cms.contentassets.RelatedLinkResources");
} }
/**
* The description for the authoring step
*/
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_description", return new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_description",
"com.arsdigita.cms.contentassets.RelatedLinkResources"); "com.arsdigita.cms.contentassets.RelatedLinkResources");
} }
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() { public int getAuthoringStepSortKey() {
return 1; // XXX config param please return 1; // XXX config param please
} }