|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.sconman.ContentType
public class ContentType
A content type represents a kind of Content
.
A content type is defined within the context of a Project
, so each
project has its own content types that can be different from other projects.
Every content has an associated set of file extensions, that relates files to
content types (see getFileExtensions
).
Field Summary | |
---|---|
static int |
ADD_NEW_PERMISSION
Permission to add new contents of this type |
static int |
DELETE_PERMISSION
Permission to delete contents of this type |
static int |
MODIFY_PERMISSION
Permission to modify contents of this type |
static int |
VIEW_PERMISSION
Permission to view contents of this type |
Constructor Summary | |
---|---|
ContentType(Project project)
Creates a new ContentType object. |
Method Summary | |
---|---|
void |
addExtensions(java.lang.String extensions)
Adds a CSV list of file extensions |
Field |
addField(Field field)
Adds a new file to this content type |
void |
addField(java.lang.String id,
java.lang.String type,
int size,
boolean calculated,
boolean internationalized,
boolean unique,
java.lang.String referencedType,
java.lang.String defLocale,
java.lang.String name,
java.lang.String description)
Adds a Field to the Content Type |
void |
addFileExtension(java.lang.String ext)
Adds a new file extension to this content type |
void |
deserializeXML(org.kxml2.io.KXmlParser in)
Deserialize from XML |
Category |
getDefaultCategory()
Returns the default category for this content type |
java.lang.String |
getDefaultExtension()
Returns the defaultExtension |
Field |
getDefaultField()
Returns the default field, that is the first one |
java.lang.String |
getDefaultLocale()
|
java.lang.String |
getDescription()
Returns the content type description in the specified locale |
java.lang.String |
getDescription(java.lang.String locale)
Returns the content type description in the specified locale |
Field |
getField(java.lang.String id)
Returns a field, known its id |
java.util.Collection |
getFields()
Returns all the fields specific to this content type |
static java.util.List |
getFieldTypes()
Contain a List containing Strings who are allowed Field Types. |
java.util.List |
getFileExtensions()
Return all the field extensions associated to this content type |
java.lang.String |
getFileExtensionsAsString()
Returns a CSV list with all the field extensions associated to this content type |
IContentTypeHandler |
getHandler()
Returns the handler to use when indexing content's data. |
java.lang.String |
getId()
Returns the content type id |
java.lang.String |
getName()
Returns the content type id in the specified locale |
java.lang.String |
getName(java.lang.String locale)
Returns the content type id in the specified locale |
Project |
getProject()
Returns the project. |
java.util.List |
getSortedFields()
Return the fields in the xml project order |
boolean |
hasAssociatedFile()
Returns true if the content type has associated files, or false if this content doesn't have an attached file |
boolean |
hasUniqueFields()
|
(package private) boolean |
isSystem()
Return true if it is a system category |
(package private) void |
moveDownField(Field field)
|
(package private) void |
moveUpField(Field field)
|
Content |
newContent()
Creates a new content of this type |
void |
removeField(java.lang.String id)
Removes the specified field |
void |
removeFileExtension(java.lang.String ext)
Removes the specified file extension |
void |
serializeXML(org.kxml2.io.KXmlSerializer out)
Serialize to XML |
void |
setDefaultCategory(Category defaultCategory)
Sets the default category for this content type |
void |
setDefaultCategory(java.lang.String category)
Method setDefaultCategory. |
void |
setDefaultLocale(java.lang.String defaultLocale)
|
void |
setDescription(java.lang.String locale,
java.lang.String description)
Sets the content type description in the specified locale |
void |
setHandler(IContentTypeHandler handler)
Sets the handler to use when indexing content's data. |
void |
setId(java.lang.String id)
Sets the content type id |
void |
setName(java.lang.String locale,
java.lang.String name)
Sets the content type id in the specified locale |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int VIEW_PERMISSION
public static final int MODIFY_PERMISSION
public static final int DELETE_PERMISSION
public static final int ADD_NEW_PERMISSION
Constructor Detail |
---|
ContentType(Project project)
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
boolean isSystem()
public Content newContent()
public java.util.List getFileExtensions()
public java.lang.String getFileExtensionsAsString()
public void addFileExtension(java.lang.String ext)
ext
- The field extensionpublic void removeFileExtension(java.lang.String ext)
ext
- The file extensionpublic java.util.Collection getFields()
Field
objectspublic Field getField(java.lang.String id)
id
- Field id
public void addField(java.lang.String id, java.lang.String type, int size, boolean calculated, boolean internationalized, boolean unique, java.lang.String referencedType, java.lang.String defLocale, java.lang.String name, java.lang.String description) throws SCMException
id
- Identifier of the Fieldtype
- Type of the Field. Must be a valid Type. Use
getFieldTypes()
size
- Size of the Field, -1 to unlimited sizecalculated
- Define if Field is calculatedinternationalized
- Define if Field is internationalizedunique
- Define if Field is UniquereferencedType
- If Field is of Type 'Reference' contains referenced Content
TypedefLocale
- Default locale to store name and descriptionname
- Default Name of Fielddescription
- Default Description of Field
SCMException
public Field addField(Field field) throws SCMException
field
- The field to add
SCMException
public void removeField(java.lang.String id)
field
- The field to removepublic java.lang.String getId()
public void setId(java.lang.String id)
id
- The idpublic java.lang.String getName()
locale
-
public java.lang.String getName(java.lang.String locale)
locale
-
public void setName(java.lang.String locale, java.lang.String name)
locale
- id
- public java.lang.String getDescription()
locale
-
public java.lang.String getDescription(java.lang.String locale)
locale
-
public void setDescription(java.lang.String locale, java.lang.String description)
locale
- description
- public java.lang.String getDefaultLocale()
public void setDefaultLocale(java.lang.String defaultLocale)
defaultLocale
- public Category getDefaultCategory()
public void setDefaultCategory(Category defaultCategory)
defaultCategory
- Default category for this content typepublic Project getProject()
public void addExtensions(java.lang.String extensions)
extensions
- A CSV String with extensions to addpublic boolean hasAssociatedFile()
public void setDefaultCategory(java.lang.String category)
category
- public void setHandler(IContentTypeHandler handler)
handler
- The handler to use when indexing content's data.public IContentTypeHandler getHandler()
public java.lang.String getDefaultExtension()
public boolean hasUniqueFields()
public static java.util.List getFieldTypes()
public void serializeXML(org.kxml2.io.KXmlSerializer out) throws java.io.IOException
IXMLSerializable
serializeXML
in interface IXMLSerializable
out
- The KXmlSerializer to do the output
java.io.IOException
- Thrown if there's an IO problempublic void deserializeXML(org.kxml2.io.KXmlParser in) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
IXMLSerializable
deserializeXML
in interface IXMLSerializable
in
- The KXml pull parser
org.xmlpull.v1.XmlPullParserException
- Thrown if there's an XML problem
java.io.IOException
- Thrown if there's an IO problempublic java.util.List getSortedFields()
public Field getDefaultField()
void moveDownField(Field field)
void moveUpField(Field field)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |