|
|
|
@ -32,6 +32,9 @@ import com.arsdigita.persistence.OID;
|
|
|
|
import com.arsdigita.persistence.SessionManager;
|
|
|
|
import com.arsdigita.persistence.SessionManager;
|
|
|
|
import com.arsdigita.util.UncheckedWrapperException;
|
|
|
|
import com.arsdigita.util.UncheckedWrapperException;
|
|
|
|
import com.arsdigita.web.Web;
|
|
|
|
import com.arsdigita.web.Web;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
|
|
|
|
@ -42,15 +45,22 @@ import java.util.ArrayList;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.util.StringTokenizer;
|
|
|
|
import java.util.StringTokenizer;
|
|
|
|
|
|
|
|
import javax.xml.parsers.ParserConfigurationException;
|
|
|
|
|
|
|
|
import javax.xml.parsers.SAXParser;
|
|
|
|
|
|
|
|
import javax.xml.parsers.SAXParserFactory;
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
|
|
import org.xml.sax.Attributes;
|
|
|
|
|
|
|
|
import org.xml.sax.SAXException;
|
|
|
|
|
|
|
|
import org.xml.sax.helpers.DefaultHandler;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <p>A Content Type defines the characteristics of a content item. Content
|
|
|
|
* <p>
|
|
|
|
* management resources are registered to a content type, including
|
|
|
|
* A Content Type defines the characteristics of a content item. Content management resources are
|
|
|
|
* the {@link com.arsdigita.cms.AuthoringKit Authoring Kit}, and
|
|
|
|
* registered to a content type, including the {@link com.arsdigita.cms.AuthoringKit Authoring Kit},
|
|
|
|
* {@link com.arsdigita.cms.Template templates}.</p>
|
|
|
|
* and {@link com.arsdigita.cms.Template templates}.</p>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* <p>Each content type is associated with a {@link
|
|
|
|
* <p>
|
|
|
|
|
|
|
|
* Each content type is associated with a {@link
|
|
|
|
* com.arsdigita.domain.DomainObject domain object} and a {@link
|
|
|
|
* com.arsdigita.domain.DomainObject domain object} and a {@link
|
|
|
|
* com.arsdigita.persistence.DataObject data object} type.</p>
|
|
|
|
* com.arsdigita.persistence.DataObject data object} type.</p>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -60,26 +70,32 @@ import org.apache.log4j.Logger;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class ContentType extends ACSObject {
|
|
|
|
public class ContentType extends ACSObject {
|
|
|
|
|
|
|
|
|
|
|
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
|
|
|
/**
|
|
|
|
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
|
|
|
* Internal logger instance to faciliate debugging. Enable logging output by editing
|
|
|
|
* and set com.arsdigita.cms.ui.authoring.NewItemForm=DEBUG by uncommenting
|
|
|
|
* /WEB-INF/conf/log4j.properties int hte runtime environment and set
|
|
|
|
* or adding the line. */
|
|
|
|
* com.arsdigita.cms.ui.authoring.NewItemForm=DEBUG by uncommenting or adding the line.
|
|
|
|
|
|
|
|
*/
|
|
|
|
private static final Logger s_log = Logger.getLogger(ContentType.class);
|
|
|
|
private static final Logger s_log = Logger.getLogger(ContentType.class);
|
|
|
|
|
|
|
|
|
|
|
|
public static final String BASE_DATA_OBJECT_TYPE =
|
|
|
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.ContentType";
|
|
|
|
"com.arsdigita.cms.ContentType";
|
|
|
|
/**
|
|
|
|
/** The path content types are expected to store their type definition
|
|
|
|
* The path content types are expected to store their type definition file (usually
|
|
|
|
* file (usually [domainObjectBaseName].xml by convention). Any content
|
|
|
|
* [domainObjectBaseName].xml by convention). Any content item should use this location unless
|
|
|
|
* item should use this location unless there are good reasons for a
|
|
|
|
* there are good reasons for a different location.
|
|
|
|
* different location. */
|
|
|
|
*/
|
|
|
|
public static final String CONTENTTYPE_DEFINITIONFILE_PATH =
|
|
|
|
public static final String CONTENTTYPE_DEFINITIONFILE_PATH = "/WEB-INF/content-types/";
|
|
|
|
"/WEB-INF/content-types/";
|
|
|
|
|
|
|
|
public static final String OBJECT_TYPE = "associatedObjectType";
|
|
|
|
public static final String OBJECT_TYPE = "associatedObjectType";
|
|
|
|
/** The name or title of the content type, e.g. "File Storage Item" */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The name or title of the content type, e.g. "File Storage Item"
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static final String LABEL = "label";
|
|
|
|
public static final String LABEL = "label";
|
|
|
|
/** A short description of the type, what is is meant to do / to use for. */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A short description of the type, what is is meant to do / to use for.
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static final String DESCRIPTION = "description";
|
|
|
|
public static final String DESCRIPTION = "description";
|
|
|
|
/** Fully qualified name of the (main) domain class (and main entry point)*/
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Fully qualified name of the (main) domain class (and main entry point)
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static final String CLASSNAME = "className";
|
|
|
|
public static final String CLASSNAME = "className";
|
|
|
|
public static final String MODE = "mode";
|
|
|
|
public static final String MODE = "mode";
|
|
|
|
public static final String AUTHORING_KIT = "authoringKit";
|
|
|
|
public static final String AUTHORING_KIT = "authoringKit";
|
|
|
|
@ -90,32 +106,31 @@ public class ContentType extends ACSObject {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Default constructor. This creates a new folder.
|
|
|
|
* Default constructor. This creates a new folder.
|
|
|
|
**/
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
public ContentType() {
|
|
|
|
public ContentType() {
|
|
|
|
super(BASE_DATA_OBJECT_TYPE);
|
|
|
|
super(BASE_DATA_OBJECT_TYPE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructor. The contained <code>DataObject</code> is retrieved
|
|
|
|
* Constructor. The contained <code>DataObject</code> is retrieved from the persistent storage
|
|
|
|
* from the persistent storage mechanism with an <code>OID</code>
|
|
|
|
* mechanism with an <code>OID</code> specified by <i>oid</i>.
|
|
|
|
* specified by <i>oid</i>.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param oid The <code>OID</code> for the retrieved
|
|
|
|
* @param oid The <code>OID</code> for the retrieved <code>DataObject</code>.
|
|
|
|
* <code>DataObject</code>.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
*/
|
|
|
|
public ContentType(OID oid) throws DataObjectNotFoundException {
|
|
|
|
public ContentType(OID oid) throws DataObjectNotFoundException {
|
|
|
|
super(oid);
|
|
|
|
super(oid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructor. The contained <code>DataObject</code> is retrieved
|
|
|
|
* Constructor. The contained <code>DataObject</code> is retrieved from the persistent storage
|
|
|
|
* from the persistent storage mechanism with an <code>OID</code>
|
|
|
|
* mechanism with an <code>OID</code> specified by <i>id</i> and
|
|
|
|
* specified by <i>id</i> and
|
|
|
|
|
|
|
|
* <code>ContentType.BASE_DATA_OBJECT_TYPE</code>.
|
|
|
|
* <code>ContentType.BASE_DATA_OBJECT_TYPE</code>.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param id The <code>id</code> for the retrieved
|
|
|
|
* @param id The <code>id</code> for the retrieved <code>DataObject</code>.
|
|
|
|
* <code>DataObject</code>.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
*/
|
|
|
|
public ContentType(BigDecimal id) throws DataObjectNotFoundException {
|
|
|
|
public ContentType(BigDecimal id) throws DataObjectNotFoundException {
|
|
|
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
|
|
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -129,8 +144,8 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @return the base PDL object type for this item. Child classes should
|
|
|
|
* @return the base PDL object type for this item. Child classes should override this method to
|
|
|
|
* override this method to return the correct value
|
|
|
|
* return the correct value
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String getBaseDataObjectType() {
|
|
|
|
public String getBaseDataObjectType() {
|
|
|
|
@ -146,10 +161,9 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns the object type of the items of this content type. (For example:
|
|
|
|
* Returns the object type of the items of this content type. (For example: If I create a
|
|
|
|
* If I create a ContentType "foo". Then a I create an item "bar"
|
|
|
|
* ContentType "foo". Then a I create an item "bar" of type foo. This associated object type is
|
|
|
|
* of type foo. This associated object type is the same as
|
|
|
|
* the same as bar.getObjectType())
|
|
|
|
* bar.getObjectType())
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return The data object type representation of this content type
|
|
|
|
* @return The data object type representation of this content type
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -167,17 +181,15 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetches the label for the content type. The label is a globalized
|
|
|
|
* Fetches the label for the content type. The label is a globalized notation displayed to the
|
|
|
|
* notation displayed to the user to identify the content type. As an
|
|
|
|
* user to identify the content type. As an example a content type named "Article" (as in
|
|
|
|
* example a content type named "Article" (as in getName()) will be
|
|
|
|
* getName()) will be displayed in an english environment as the label "Article", in German as
|
|
|
|
* displayed in an english environment as the label "Article", in
|
|
|
|
* "Artikel", etc.
|
|
|
|
* German as "Artikel", etc.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* The label is retrieved from content type's resources. The message uses
|
|
|
|
* The label is retrieved from content type's resources. The message uses some convention to
|
|
|
|
* some convention to retrieve the message key and resource bundle.
|
|
|
|
* retrieve the message key and resource bundle.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Client classes may overwrite the method to provide a label from a
|
|
|
|
* Client classes may overwrite the method to provide a label from a different source.
|
|
|
|
* diffrent source.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return The (globalized) label.
|
|
|
|
* @return The (globalized) label.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -216,24 +228,15 @@ public class ContentType extends ACSObject {
|
|
|
|
// use it.
|
|
|
|
// use it.
|
|
|
|
if (this.getClass().getClassLoader().getResource(bundleResourcePath) != null) {
|
|
|
|
if (this.getClass().getClassLoader().getResource(bundleResourcePath) != null) {
|
|
|
|
// Property file exists, use it!
|
|
|
|
// Property file exists, use it!
|
|
|
|
String bundleName = objectTypeName.concat("Resources");
|
|
|
|
final String bundleName = objectTypeName.concat("Resources");
|
|
|
|
// Create the globalized label
|
|
|
|
// Create the globalized label
|
|
|
|
label = new GlobalizedMessage(labelKey, bundleName);
|
|
|
|
label = new GlobalizedMessage(labelKey, bundleName);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
final InputStream defFile = Thread.currentThread().getContextClassLoader()
|
|
|
|
|
|
|
|
.getResourceAsStream(typeResourcePath);
|
|
|
|
|
|
|
|
|
|
|
|
// No property file found, try to use the item's definition file
|
|
|
|
// No property file found, try to use the item's definition file
|
|
|
|
if (this.getClass().getClassLoader()
|
|
|
|
if (defFile == null) {
|
|
|
|
.getResource(typeResourcePath)!=null) {
|
|
|
|
|
|
|
|
// item definition file found. use it's
|
|
|
|
|
|
|
|
// determine the bundle from attribute "descriptionBundle"
|
|
|
|
|
|
|
|
// which should provide an item specific description (but
|
|
|
|
|
|
|
|
// unfortunately due to lazy programmers not always does).
|
|
|
|
|
|
|
|
// As a proper example:
|
|
|
|
|
|
|
|
// /WEB-INF/content-types/com.arsditita.cms.contenttypes.Event.xml
|
|
|
|
|
|
|
|
String bundleName = "REPLACE ME"; // REPLACE ME!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
label = new GlobalizedMessage(labelKey, bundleName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Giving up!
|
|
|
|
// Giving up!
|
|
|
|
|
|
|
|
|
|
|
|
// As a fall back use the (not globalized) "name" of the type as
|
|
|
|
// As a fall back use the (not globalized) "name" of the type as
|
|
|
|
@ -242,6 +245,33 @@ public class ContentType extends ACSObject {
|
|
|
|
// not. But GlobalizedMessage displays the key if it could not be
|
|
|
|
// not. But GlobalizedMessage displays the key if it could not be
|
|
|
|
// found in a resource file.
|
|
|
|
// found in a resource file.
|
|
|
|
label = new GlobalizedMessage(getName());
|
|
|
|
label = new GlobalizedMessage(getName());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// item definition file found. use it's
|
|
|
|
|
|
|
|
// determine the bundle from attribute "descriptionBundle"
|
|
|
|
|
|
|
|
// which should provide an item specific description (but
|
|
|
|
|
|
|
|
// unfortunately due to lazy programmers not always does).
|
|
|
|
|
|
|
|
// As a proper example:
|
|
|
|
|
|
|
|
// /WEB-INF/content-types/com.arsditita.cms.contenttypes.Event.xml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
final SAXParserFactory parserFactory = SAXParserFactory.newInstance();
|
|
|
|
|
|
|
|
final SAXParser parser = parserFactory.newSAXParser();
|
|
|
|
|
|
|
|
final BundleName bundleName = new BundleName();
|
|
|
|
|
|
|
|
parser.parse(defFile, bundleName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//String bundleName = "REPLACE ME"; // REPLACE ME!
|
|
|
|
|
|
|
|
if (bundleName.getName() == null) {
|
|
|
|
|
|
|
|
return new GlobalizedMessage(getName());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
label = new GlobalizedMessage(labelKey, bundleName.getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (ParserConfigurationException ex) {
|
|
|
|
|
|
|
|
label = new GlobalizedMessage(getName());
|
|
|
|
|
|
|
|
} catch (SAXException ex) {
|
|
|
|
|
|
|
|
label = new GlobalizedMessage(getName());
|
|
|
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
|
|
|
label = new GlobalizedMessage(getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -249,12 +279,35 @@ public class ContentType extends ACSObject {
|
|
|
|
return label;
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class BundleName extends DefaultHandler {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BundleName() {
|
|
|
|
|
|
|
|
//Nothing
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
|
|
|
|
return name;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void startElement(final String namespaceURI,
|
|
|
|
|
|
|
|
final String localName,
|
|
|
|
|
|
|
|
final String qName,
|
|
|
|
|
|
|
|
final Attributes attributes) {
|
|
|
|
|
|
|
|
if ("ctd:authoring-step".equals(qName)) {
|
|
|
|
|
|
|
|
name = attributes.getValue("labelBundle");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetches the name for the content type. The name is a fixed String, which
|
|
|
|
* Fetches the name for the content type. The name is a fixed String, which 'names' a content
|
|
|
|
* 'names' a content type and is not localizible. It is stored in the
|
|
|
|
* type and is not localizible. It is stored in the database and a symbolic name for the formal
|
|
|
|
* database and a symbolic name for the formal ID. It may contain any
|
|
|
|
* ID. It may contain any characters but is preferable an english term. Examples are "FAQ item"
|
|
|
|
* characters but is preferable an english term. Examples are "FAQ item" or
|
|
|
|
* or "Article" or "Multipart Article". It has to be unique system-wide.
|
|
|
|
* "Article" or "Multipart Article". It has to be unique system-wide.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return The name (ie. may be used as a non-localized label)
|
|
|
|
* @return The name (ie. may be used as a non-localized label)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -264,11 +317,11 @@ public class ContentType extends ACSObject {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Sets the name for this content type. The name is a fixed String.
|
|
|
|
* Sets the name for this content type. The name is a fixed String.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @see getName() for additional details.
|
|
|
|
* @see getName() for additional details.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* The name is stored in the database. In the database this property is
|
|
|
|
* The name is stored in the database. In the database this property is stored under 'label',
|
|
|
|
* stored under 'label', when globliation was not an issue.
|
|
|
|
* when globliation was not an issue. The Method is primarly used in the initial loading step.
|
|
|
|
* The Method is primarly used in the initial loading step.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param name The name
|
|
|
|
* @param name The name
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -313,36 +366,32 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <p>An internal content type is one that is not user-defined and maintained
|
|
|
|
* <p>
|
|
|
|
* internally. A content type should be made internal under the following
|
|
|
|
* An internal content type is one that is not user-defined and maintained internally. A content
|
|
|
|
* two conditions:</p>
|
|
|
|
* type should be made internal under the following two conditions:</p>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* <ol>
|
|
|
|
* <ol>
|
|
|
|
* <li>The object type needs to take advantage of content type services
|
|
|
|
* <li>The object type needs to take advantage of content type services (i.e., versioning,
|
|
|
|
* (i.e., versioning, categorization, lifecycle, workflow) that are
|
|
|
|
* categorization, lifecycle, workflow) that are already implemented in CMS.</li>
|
|
|
|
* already implemented in CMS.</li>
|
|
|
|
* <li>The content type cannot be explicitly registered to a content section.</li>
|
|
|
|
* <li>The content type cannot be explicitly registered to a content
|
|
|
|
|
|
|
|
* section.</li>
|
|
|
|
|
|
|
|
* </ol>
|
|
|
|
* </ol>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* <p>The {@link com.arsdigita.cms.Template} content type is one such
|
|
|
|
* <p>
|
|
|
|
* internal content type.</p>
|
|
|
|
* The {@link com.arsdigita.cms.Template} content type is one such internal content type.</p>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE
|
|
|
|
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE otherwise.
|
|
|
|
* otherwise.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Boolean isInternal() {
|
|
|
|
public Boolean isInternal() {
|
|
|
|
return "I".equalsIgnoreCase((String) get(MODE));
|
|
|
|
return "I".equalsIgnoreCase((String) get(MODE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <p>A hidden content type is one that is not user-defined but not meant
|
|
|
|
* <p>
|
|
|
|
* to be used directly (p. ex. GenericArticle). in contrast they provide
|
|
|
|
* A hidden content type is one that is not user-defined but not meant to be used directly (p.
|
|
|
|
* some basic features for different kind of content type to be extended
|
|
|
|
* ex. GenericArticle). in contrast they provide some basic features for different kind of
|
|
|
|
* from. Also, they are legit perents for UDCTs.
|
|
|
|
* content type to be extended from. Also, they are legit perents for UDCTs.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE
|
|
|
|
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE otherwise.
|
|
|
|
* otherwise.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Boolean isHidden() {
|
|
|
|
public Boolean isHidden() {
|
|
|
|
return "H".equalsIgnoreCase((String) get(MODE));
|
|
|
|
return "H".equalsIgnoreCase((String) get(MODE));
|
|
|
|
@ -380,21 +429,18 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create an authoring kit to this content type. To save this authoring
|
|
|
|
* Create an authoring kit to this content type. To save this authoring kit, you need to call
|
|
|
|
* kit, you need to call <code>save()</code> method on the
|
|
|
|
* <code>save()</code> method on the returned AuthoringKit.
|
|
|
|
* returned AuthoringKit.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public AuthoringKit createAuthoringKit() {
|
|
|
|
public AuthoringKit createAuthoringKit() {
|
|
|
|
return createAuthoringKit(null);
|
|
|
|
return createAuthoringKit(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create an authoring kit to this content type. To save this authoring
|
|
|
|
* Create an authoring kit to this content type. To save this authoring kit, you need to call
|
|
|
|
* kit, you need to call <code>save()</code> method on the
|
|
|
|
* <code>save()</code> method on the returned AuthoringKit.
|
|
|
|
* returned AuthoringKit.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param createComponent the create component class associated with
|
|
|
|
* @param createComponent the create component class associated with the authoring kit
|
|
|
|
* the authoring kit
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public AuthoringKit createAuthoringKit(String createComponent) {
|
|
|
|
public AuthoringKit createAuthoringKit(String createComponent) {
|
|
|
|
|
|
|
|
|
|
|
|
@ -412,22 +458,20 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetch the item creation form id of the Java domain object implementation.
|
|
|
|
* Fetch the item creation form id of the Java domain object implementation. applies to
|
|
|
|
* applies to user-defined types
|
|
|
|
* user-defined types
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return The id of the persistent form used to create an item
|
|
|
|
* @return The id of the persistent form used to create an item of this content type
|
|
|
|
* of this content type
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public BigDecimal getItemFormID() {
|
|
|
|
public BigDecimal getItemFormID() {
|
|
|
|
return (BigDecimal) get(ITEM_FORM_ID);
|
|
|
|
return (BigDecimal) get(ITEM_FORM_ID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Sets the item creation form id of the Java domain object implementation.
|
|
|
|
* Sets the item creation form id of the Java domain object implementation. applies to
|
|
|
|
* applies to user-defined types
|
|
|
|
* user-defined types
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param itemFormID The id of the persistent form used to create an item
|
|
|
|
* @param itemFormID The id of the persistent form used to create an item of this content type
|
|
|
|
* of this content type
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setItemFormID(BigDecimal itemFormID) {
|
|
|
|
public void setItemFormID(BigDecimal itemFormID) {
|
|
|
|
set(ITEM_FORM_ID, itemFormID);
|
|
|
|
set(ITEM_FORM_ID, itemFormID);
|
|
|
|
@ -436,8 +480,8 @@ public class ContentType extends ACSObject {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Retrieve the persistent form of this content type
|
|
|
|
* Retrieve the persistent form of this content type
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return the persistent form used to create or edit content items
|
|
|
|
* @return the persistent form used to create or edit content items of this type (only applies
|
|
|
|
* of this type (only applies to user-defined types)
|
|
|
|
* to user-defined types)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public PersistentForm getItemForm() throws DataObjectNotFoundException {
|
|
|
|
public PersistentForm getItemForm() throws DataObjectNotFoundException {
|
|
|
|
|
|
|
|
|
|
|
|
@ -547,6 +591,7 @@ public class ContentType extends ACSObject {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the list of descendants
|
|
|
|
* Get the list of descendants
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getDescendants() {
|
|
|
|
public String getDescendants() {
|
|
|
|
@ -555,6 +600,7 @@ public class ContentType extends ACSObject {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Remove a descendant from the list of descendants
|
|
|
|
* Remove a descendant from the list of descendants
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param descendant ID to be removed
|
|
|
|
* @param descendant ID to be removed
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void delDescendants(BigDecimal descendant) {
|
|
|
|
public void delDescendants(BigDecimal descendant) {
|
|
|
|
@ -585,11 +631,11 @@ public class ContentType extends ACSObject {
|
|
|
|
// Fetching/Finding content types.
|
|
|
|
// Fetching/Finding content types.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//////////////////////////////////////
|
|
|
|
//////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Find the content type with the associated with the object type.
|
|
|
|
* Find the content type with the associated with the object type.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param objType The fully-qualified name of the data object type
|
|
|
|
* @param objType The fully-qualified name of the data object type
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return The content type associated with the object type
|
|
|
|
* @return The content type associated with the object type
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static ContentType findByAssociatedObjectType(String objType)
|
|
|
|
public static ContentType findByAssociatedObjectType(String objType)
|
|
|
|
@ -613,8 +659,7 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetches a collection of all content types, including internal content
|
|
|
|
* Fetches a collection of all content types, including internal content types.
|
|
|
|
* types.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return A collection of all content types
|
|
|
|
* @return A collection of all content types
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -623,11 +668,10 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetches a collection of all content types, including internal content
|
|
|
|
* Fetches a collection of all content types, including internal content types.
|
|
|
|
* types.
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param hidden If false, fetch all content types, ecluding hidden content types
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param hidden If false, fetch all content types, ecluding hidden
|
|
|
|
|
|
|
|
* content types
|
|
|
|
|
|
|
|
* @return A collection of all content types
|
|
|
|
* @return A collection of all content types
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static ContentTypeCollection getAllContentTypes(boolean hidden) {
|
|
|
|
public static ContentTypeCollection getAllContentTypes(boolean hidden) {
|
|
|
|
@ -644,10 +688,8 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param internal If false, fetch all content types, excluding internal
|
|
|
|
* @param internal If false, fetch all content types, excluding internal content types.
|
|
|
|
* content types.
|
|
|
|
* @param hidden If false, fetch all content types, excluding hidden content types.
|
|
|
|
* @param hidden If false, fetch all content types, excluding hidden
|
|
|
|
|
|
|
|
* content types.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private static ContentTypeCollection getAllContentTypes(boolean internal, boolean hidden) {
|
|
|
|
private static ContentTypeCollection getAllContentTypes(boolean internal, boolean hidden) {
|
|
|
|
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
|
|
|
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
|
|
|
@ -664,8 +706,8 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fetches a collection of content types that have been registered
|
|
|
|
* Fetches a collection of content types that have been registered to at least one content
|
|
|
|
* to at least one content section, excluding internal content types.
|
|
|
|
* section, excluding internal content types.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return A collection of registered content types
|
|
|
|
* @return A collection of registered content types
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -679,6 +721,7 @@ public class ContentType extends ACSObject {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param ct
|
|
|
|
* @param ct
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static ContentTypeCollection getDescendantsOf(ContentType ct) {
|
|
|
|
public static ContentTypeCollection getDescendantsOf(ContentType ct) {
|
|
|
|
@ -710,8 +753,7 @@ public class ContentType extends ACSObject {
|
|
|
|
private static List s_xsl = new ArrayList();
|
|
|
|
private static List s_xsl = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Registers an XSL file against a content type.
|
|
|
|
* Registers an XSL file against a content type. NB this interface is liable to change.
|
|
|
|
* NB this interface is liable to change.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param type the content type
|
|
|
|
* @param type the content type
|
|
|
|
* @param path the path relative to the server root
|
|
|
|
* @param path the path relative to the server root
|
|
|
|
@ -721,8 +763,7 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Unregisters an XSL file against a content type.
|
|
|
|
* Unregisters an XSL file against a content type. NB this interface is liable to change.
|
|
|
|
* NB this interface is liable to change.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param type the content type
|
|
|
|
* @param type the content type
|
|
|
|
* @param path the path relative to the server root
|
|
|
|
* @param path the path relative to the server root
|
|
|
|
@ -733,8 +774,7 @@ public class ContentType extends ACSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Gets an iterator of java.net.URL objects for
|
|
|
|
* Gets an iterator of java.net.URL objects for all registered XSL files.
|
|
|
|
* all registered XSL files.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -777,6 +817,7 @@ public class ContentType extends ACSObject {
|
|
|
|
public void remove() {
|
|
|
|
public void remove() {
|
|
|
|
m_inner.remove();
|
|
|
|
m_inner.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -815,5 +856,7 @@ public class ContentType extends ACSObject {
|
|
|
|
public int hashCode() {
|
|
|
|
public int hashCode() {
|
|
|
|
return m_path.hashCode() + m_type.hashCode();
|
|
|
|
return m_path.hashCode() + m_type.hashCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|