org.outerj.daisy.repository.schema
Interface DocumentType


public interface DocumentType

Describes a type of document in the repository.

A document type has some general properties like a name (which must be unique), and a locale-sensitive label and description. Next to these, a DocumentType is associated with a number of FieldTypes and PartTypes.

The PartTypes and FieldTypes belonging to a DocumentType are ordered collections: the order in which you add them matters. To reorder them, first remove them all and re-add them.

A DocumentType object can be read-only, in which case all state-modifying methods (i.e. all setters and the save method) will throw a RuntimeException. Whether a DocumentType object is read-only or not depends on where you retrieved it from. The purpose of read-only DocumentType objects is for caching, i.e. the same object can be used by multiple users who only which to consult the DocumentType information, but not modify it.


Method Summary
 void addFieldType(FieldType type, boolean required)
          The suplied FieldType should already exist in the repository, i.e.
 void addPartType(PartType partType, boolean required)
          Adds a new PartType to this DocumentType.
 void clearDescriptions()
           
 void clearFieldTypeUses()
           
 void clearLabels()
           
 void clearPartTypeUses()
          Removes all PartTypes.
 java.lang.String getDescription(java.util.Locale locale)
           
 java.lang.String getDescriptionExact(java.util.Locale locale)
           
 java.util.Locale[] getDescriptionLocales()
          Returns the locales for which a description is set.
 org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
          Same as getXml() but includes the XML description of the used Part Types and Field Types in the generated XML.
 FieldTypeUse getFieldTypeUse(long id)
           
 FieldTypeUse[] getFieldTypeUses()
           
 long getId()
           
 java.lang.String getLabel(java.util.Locale locale)
          Gets the label in the given locale, using the usual locale fallback mechanisms if not found in the exactly specified locale, and finally returning the documenttype's name if no label is available.
 java.lang.String getLabelExact(java.util.Locale locale)
           
 java.util.Locale[] getLabelLocales()
           
 java.util.Date getLastModified()
          When was this DocumentType last changed (persistently).
 long getLastModifier()
          Who (which user) last changed this DocumentType (persistently).
 java.lang.String getName()
           
 PartTypeUse getPartTypeUse(long id)
           
 PartTypeUse[] getPartTypeUses()
          Returns the PartTypes contained by this DocumentType.
 long getUpdateCount()
           
 org.outerx.daisy.x10.DocumentTypeDocument getXml()
           
 boolean hasFieldType(long id)
           
 boolean hasPartType(long id)
          Checks if this DocumentType contains the PartType with the given ID.
 boolean isDeprecated()
           
 void save()
           
 void setAllFromXml(org.outerx.daisy.x10.DocumentTypeDocument.DocumentType documentTypeXml)
           
 void setDeprecated(boolean deprecated)
           
 void setDescription(java.util.Locale locale, java.lang.String description)
           
 void setLabel(java.util.Locale locale, java.lang.String label)
           
 void setName(java.lang.String name)
           
 

Method Detail

getId

long getId()

getPartTypeUses

PartTypeUse[] getPartTypeUses()
Returns the PartTypes contained by this DocumentType. This is an ordered collection. The returned array is a newly created copy, thus modifying the order of the PartTypes in the array, or putting other ones in it, won't modify this DocumentType.


addPartType

void addPartType(PartType partType,
                 boolean required)
Adds a new PartType to this DocumentType.

The supplied PartType should already exist in the repository, i.e. it should have an id != -1.

The same PartType can be added only once.

A PartType is always added to the end, after the already existing PartTypes.

Throws:
java.lang.IllegalArgumentException - if the partType's id is -1, or if it is already contained by this DocumentType.

clearPartTypeUses

void clearPartTypeUses()
Removes all PartTypes.


hasPartType

boolean hasPartType(long id)
Checks if this DocumentType contains the PartType with the given ID.


getPartTypeUse

PartTypeUse getPartTypeUse(long id)

getFieldTypeUses

FieldTypeUse[] getFieldTypeUses()

hasFieldType

boolean hasFieldType(long id)

getFieldTypeUse

FieldTypeUse getFieldTypeUse(long id)

addFieldType

void addFieldType(FieldType type,
                  boolean required)
The suplied FieldType should already exist in the repository, i.e. it should have an id != -1.

A FieldType is always added to the end, after the already existing FieldTypes.

The same PartType can only be added once.


clearFieldTypeUses

void clearFieldTypeUses()

getName

java.lang.String getName()

setName

void setName(java.lang.String name)

getDescription

java.lang.String getDescription(java.util.Locale locale)

getDescriptionExact

java.lang.String getDescriptionExact(java.util.Locale locale)

setDescription

void setDescription(java.util.Locale locale,
                    java.lang.String description)
Parameters:
description - if null, the description for this locale will be removed.

clearDescriptions

void clearDescriptions()

getDescriptionLocales

java.util.Locale[] getDescriptionLocales()
Returns the locales for which a description is set.


setLabel

void setLabel(java.util.Locale locale,
              java.lang.String label)
Parameters:
label - if null, the label for this locale will be removed.

getLabel

java.lang.String getLabel(java.util.Locale locale)
Gets the label in the given locale, using the usual locale fallback mechanisms if not found in the exactly specified locale, and finally returning the documenttype's name if no label is available.


getLabelExact

java.lang.String getLabelExact(java.util.Locale locale)

clearLabels

void clearLabels()

getLabelLocales

java.util.Locale[] getLabelLocales()

isDeprecated

boolean isDeprecated()

setDeprecated

void setDeprecated(boolean deprecated)

getLastModified

java.util.Date getLastModified()
When was this DocumentType last changed (persistently). Returns null on newly created DocumentTypes.


getLastModifier

long getLastModifier()
Who (which user) last changed this DocumentType (persistently). Returns -1 on newly created DocumentTypes.


getXml

org.outerx.daisy.x10.DocumentTypeDocument getXml()

getExtendedXml

org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
Same as getXml() but includes the XML description of the used Part Types and Field Types in the generated XML.


setAllFromXml

void setAllFromXml(org.outerx.daisy.x10.DocumentTypeDocument.DocumentType documentTypeXml)

save

void save()
          throws RepositoryException
Throws:
RepositoryException

getUpdateCount

long getUpdateCount()


Copyright © -2012 . All Rights Reserved.