public class ContentDescriptor extends Object implements Iterable<PropertyDescriptor>, Serializable, com.escenic.module.CanContainModules
Content
may have, and contain convenience methods for obtaining
valid properties for a Content.
This is usually created from a XML representation of a content type.
The following example shows how to programatically create a simple article Content type:
public static final ContentDescriptor ARTICLE = new ContentDescriptor( 1, "ece:poc:Article", "The Internationalized Label", "The Internationalized Description", Arrays.ContentDescriptor is iterable, allowing the collection of Property Descriptors to be the target of "foreach" statements.asList( new PropertyGroup( PropertyGroup.DEFAULT_GROUP_NAME, Arrays. asList( new PropertyDescriptor("displayName", String.class), new PropertyDescriptor("author", String.class), new PropertyDescriptor("content", String.class), new PropertyDescriptor("relations", ContentRelationList.class) ) ) ), false );
Modifier and Type | Class and Description |
---|---|
static class |
ContentDescriptor.Compatibility
The compatibility of changes between two
ContentDescriptor s. |
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<ContentDescriptor,String> |
CONTENT_TYPE |
Constructor and Description |
---|
ContentDescriptor(int pVersion,
URI pId,
String pContentType,
String pLabel,
String pDescription,
List<PropertyGroup> pPropertyGroups,
ContentDescriptor pContentSummaryDescriptor,
boolean pAllowInvalidProperties,
String pTitleDescriptorName,
String pBinaryDescriptorName)
Deprecated.
|
ContentDescriptor(int pVersion,
URI pId,
String pContentType,
String pLabel,
String pDescription,
List<PropertyGroup> pPropertyGroups,
ContentDescriptor pContentSummaryDescriptor,
boolean pAllowInvalidProperties,
String pTitleDescriptorName,
String pBinaryDescriptorName,
List<com.escenic.module.Module> pModules)
Deprecated.
|
ContentDescriptor(int pVersion,
URI pId,
String pContentType,
String pLabel,
String pDescription,
List<PropertyGroup> pPropertyGroups,
String pTitleDescriptorName,
String pBinaryDescriptorName)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ContentDescriptor.Compatibility |
checkCompatibility(ContentDescriptor pNewDescriptor)
Returns the compatibility between this (the old) ContentDescriptor and a new ContentDescriptor.
|
boolean |
equals(Object pThat) |
PropertyDescriptor |
getBinaryProperty() |
String |
getContentType() |
String |
getDescription() |
URI |
getId() |
String |
getLabel() |
com.escenic.module.Module |
getModule(URI pURI,
String pElementName)
The first module instance with the URI and element name as specified, and with no attributes, or
null if
there is no module which matches. |
com.escenic.module.Module |
getModule(URI pURI,
String pElementName,
String pAttributeName,
String pValue)
The first module instance with the URI and element name as specified, and with an attribute value as specified, or
null if there is no module which matches. |
List<com.escenic.module.Module> |
getModules()
Gets all the modules regardless of namespace.
|
List<com.escenic.module.Module> |
getModules(URI pURI)
Return a list of Module instances for the containing element.
|
List<com.escenic.module.Module> |
getModules(URI pURI,
String pElementName)
Return a list of module instances with the URI and element name as specified.
|
List<com.escenic.module.Module> |
getModules(URI pURI,
String pElementName,
String pAttributeName,
String pValue)
Return a list of module instances with the URI and element name as specified, and with an attribute value as
specified.
|
PropertyDescriptor |
getPropertyDescriptor(String pName)
Get the PropertyDescriptor with the given name.
|
List<PropertyDescriptor> |
getPropertyDescriptors() |
PropertyGroup |
getPropertyGroup(String pName) |
List<PropertyGroup> |
getPropertyGroups() |
List<PropertyGroup> |
getPropertyGroups(String pName) |
Link |
getPublication() |
int |
getPublicationId() |
ContentDescriptor |
getSummaryDescriptor() |
PropertyDescriptor |
getTitleProperty() |
int |
getVersion() |
boolean |
hasContentSummaryLists()
Checks if the
ContentDescriptor has a PropertyDescriptor for that
isContentSummaryList(PropertyDescriptor) return true . |
int |
hashCode() |
boolean |
hasModules()
If there are any modules registered, this would return true.
|
boolean |
hasProperty(PropertyDescriptor pPropertyDescriptor)
Check if this
ContentDescriptor has a PropertyDescriptor with the given name. |
boolean |
hasProperty(String pName)
Check if the Content Descriptor has a
Property Descriptor
with the given name. |
boolean |
hasProperty(String pName,
Class pType)
Check if the Content Descriptor has a
Property Descriptor
with the given name and type. |
boolean |
hasPropertyOfType(Class pClazz)
Check if the
ContentDescriptor has a PropertyDescriptor of
the given type. |
boolean |
isAllowInvalidProperties() |
static boolean |
isContentSummaryList(PropertyDescriptor pDescriptor)
Checks if the given
PropertyDescriptor describes a list of ContentSummary elements. |
Iterator<PropertyDescriptor> |
iterator() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final com.google.common.base.Function<ContentDescriptor,String> CONTENT_TYPE
@Deprecated public ContentDescriptor(int pVersion, URI pId, String pContentType, String pLabel, String pDescription, List<PropertyGroup> pPropertyGroups, ContentDescriptor pContentSummaryDescriptor, boolean pAllowInvalidProperties, String pTitleDescriptorName, String pBinaryDescriptorName)
ContentDescriptorBuilder
.@Deprecated public ContentDescriptor(int pVersion, URI pId, String pContentType, String pLabel, String pDescription, List<PropertyGroup> pPropertyGroups, String pTitleDescriptorName, String pBinaryDescriptorName)
ContentDescriptorBuilder
.@Deprecated public ContentDescriptor(int pVersion, URI pId, String pContentType, String pLabel, String pDescription, List<PropertyGroup> pPropertyGroups, ContentDescriptor pContentSummaryDescriptor, boolean pAllowInvalidProperties, String pTitleDescriptorName, String pBinaryDescriptorName, List<com.escenic.module.Module> pModules)
ContentDescriptorBuilder
.public String getContentType()
public String getLabel()
public String getDescription()
public int getVersion()
public URI getId()
public Link getPublication()
public boolean isAllowInvalidProperties()
public List<PropertyDescriptor> getPropertyDescriptors()
public ContentDescriptor getSummaryDescriptor()
public Iterator<PropertyDescriptor> iterator()
iterator
in interface Iterable<PropertyDescriptor>
public boolean hasProperty(String pName)
Property Descriptor
with the given name.pName
- the name of the Property Descriptor to check for.Property Descriptor
with the given name.public boolean hasProperty(PropertyDescriptor pPropertyDescriptor)
ContentDescriptor
has a PropertyDescriptor
with the given name.pPropertyDescriptor
- the Property Descriptor to check for.public boolean hasProperty(String pName, Class pType)
Property Descriptor
with the given name and type.pName
- the name of the Property Descriptor to check for.pType
- the typeProperty Descriptor
with the given name.public boolean hasPropertyOfType(Class pClazz)
ContentDescriptor
has a PropertyDescriptor
of
the given type.pClazz
- the type. May not be null.PropertyDescriptor
of the given type.public boolean hasContentSummaryLists()
ContentDescriptor
has a PropertyDescriptor
for that
isContentSummaryList(PropertyDescriptor)
return true
.true
if isContentSummaryList(PropertyDescriptor)
returns true
for any of
the PropertyDescriptor
s.public static boolean isContentSummaryList(PropertyDescriptor pDescriptor)
PropertyDescriptor
describes a list of ContentSummary
elements.pDescriptor
- the descriptor to check.true
if the PropertyDescriptor
describes a list of ContentSummary
elements.public PropertyDescriptor getPropertyDescriptor(String pName)
pName
- the name of the Property Descriptor
.public List<PropertyGroup> getPropertyGroups()
public PropertyGroup getPropertyGroup(String pName)
public List<PropertyGroup> getPropertyGroups(String pName)
public PropertyDescriptor getTitleProperty()
public PropertyDescriptor getBinaryProperty()
public List<com.escenic.module.Module> getModules()
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
public List<com.escenic.module.Module> getModules(URI pURI)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppublic List<com.escenic.module.Module> getModules(URI pURI, String pElementName)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking forpublic List<com.escenic.module.Module> getModules(URI pURI, String pElementName, String pAttributeName, String pValue)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking forpAttributeName
- The name of the attribute you want to look forpValue
- The value of the attribute you want to look for, or null
if you want an element without this
attribute.public com.escenic.module.Module getModule(URI pURI, String pElementName, String pAttributeName, String pValue)
com.escenic.module.CanContainModules
null
if there is no module which matches.getModule
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking fornull
if no such module exists.public com.escenic.module.Module getModule(URI pURI, String pElementName)
com.escenic.module.CanContainModules
null
if
there is no module which matches.getModule
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking fornull
if no such module exists.public boolean hasModules()
com.escenic.module.CanContainModules
hasModules
in interface com.escenic.module.CanContainModules
true
if any modules exist.public int getPublicationId()
public ContentDescriptor.Compatibility checkCompatibility(ContentDescriptor pNewDescriptor)
ContentDescriptor
s
contentDescriptor1
and contentDescriptor2
, it is possible that
contentDescriptor1.checkCompatibility(contentDescriptor2)
returns
INCOMPATIBLE
, but
contentDescriptor2.checkCompatibility(contentDescriptor1)
returns
UNSUPPORTED
This method is not transitive. That means, for tree ContentDescriptor
s
contentDescriptor1
, contentDescriptor2
and contentDescriptor3
, it is possible that
contentDescriptor1.checkCompatibility(contentDescriptor2)
returns
INCOMPATIBLE
, and
contentDescriptor2.checkCompatibility(contentDescriptor3)
returns
INCOMPATIBLE
, but
contentDescriptor1.checkCompatibility(contentDescriptor3)
returns
UNSUPPORTED
pNewDescriptor
- the new ContentDescriptor; can be null
.null
.© 1998- 2018 Stibo DX