public class IORelation extends Object implements IOAtom, Serializable
IOObjects
. All relations must have the following attributes set:
Category
). Categories are static variables defined in IORelation
.
IOHashKey
that is referred to in the left part of the category name. For example: ArticleInSection has the IOHashKey
of an Article as left.
IOHashKey
that is referred to in the left part of the category name. For example: ArticleInSection has the IOHashKey of an Section as right.
Attributes describing this relation can also be added. In fact, some relations have attributes that are mandatory.
IORelation.Category
is a mandatory attribute and describes to which category group this relation belongs.
For example:
Relations of category ArticleInPool
consists of an article and a pool object. Attributes describing this relation(priority, state, etc) can be found by calling getAttributes()
.
Which attributes that are mandatory depends on the category to which this relation belongs. This is described in more detail in the different methods of the RelationUpdater
.
IOHashKey
,
IORelation.Category
,
RelationUpdater
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IORelation.Category |
IOAtom.ObjectType
Modifier and Type | Field and Description |
---|---|
static IORelation.Category |
ActivePoolInSection
Represents a relation between a section and its active pool.
|
static IORelation.Category |
ArticleHasRelatedArticle
Represents a relation between two articles.
|
static IORelation.Category |
ArticleHasRoleKeeper
Represents a relation between an article and a person.
|
static IORelation.Category |
ArticleInPool
Represents a relation between an article and a pool.
|
static IORelation.Category |
ArticleInSection
Represents a relation between an article and a section.
|
static IORelation.Category |
ArticleInTopic
Represents a relation between an article and a topic.
|
static IORelation.Category |
ArticleRefersToEntity
Represents a reference between an article and an enitity .
|
static IORelation.Category |
PersonCatalogRole
Deprecated.
no longer in use
|
static IORelation.Category |
PersonSectionRole
Represents a relation between a person and a section.
|
static IORelation.Category |
PoolInSection
Represents a relation between a pool and a section.
|
static IORelation.Category |
UserGroupSectionRole
Represents a relation between a group and a section.
|
ID_INVALID, OBJECTTYPE_AGREEMENTINFO, OBJECTTYPE_ARTICLE, OBJECTTYPE_CATALOG, OBJECTTYPE_CATEGORY, OBJECTTYPE_ENTITY, OBJECTTYPE_FORUM, OBJECTTYPE_LAYOUT, OBJECTTYPE_MAX, OBJECTTYPE_MIN, OBJECTTYPE_PERSON, OBJECTTYPE_POOL, OBJECTTYPE_POSTING, OBJECTTYPE_PRESENTATION_FORUM, OBJECTTYPE_PRESENTATION_POSTING, OBJECTTYPE_PRESENTATION_THREAD, OBJECTTYPE_PROFILE, OBJECTTYPE_PUBLICATION, OBJECTTYPE_SECTION, OBJECTTYPE_THREAD, OBJECTTYPE_TOPIC, OBJECTTYPE_UNKNOWN, OBJECTTYPE_USERGROUP
Constructor and Description |
---|
IORelation(IORelation.Category pCategory,
int pId,
IOHashKey pLeft,
IOHashKey pRight,
Map<String,Object> pAttributes) |
IORelation(IORelation.Category pCategory,
IOHashKey pLeft,
IOHashKey pRight) |
IORelation(IORelation.Category pCategory,
IOHashKey pLeft,
IOHashKey pRight,
Map<String,Object> pAttributes) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String key,
Object value)
Adds an attribute to this relation.
|
boolean |
attributeExists(String key)
Checks whether or not the given attribute key is defined for this relation.
|
boolean |
attributeIsInteger(String key)
Checks whether or not the value that belongs to the given attribute key is an
Integer . |
boolean |
attributeIsNumber(String key)
Checks whether or not the value that belongs to the given attribute key is an
int encaptuled
in a String . |
boolean |
attributeIsString(String key)
Checks whether or not the value that belongs to the given attribute key is a
String . |
boolean |
attributeIsType(String key)
Checks whether or not the value that belongs to the given attribute key is a
Type object. |
boolean |
equals(Object obj) |
Object |
getAttribute(Object key)
Retrieves a specific attribute from this relation.
|
Map |
getAttributes()
Retrieves all attributes that belong to this relation.
|
IORelation.Category |
getCategory()
Retrieves the category to which this realtion belongs.
|
int |
getId()
Retrieves the id of this relation.
|
IOHashKey |
getLeft()
Retrieves the left part this relation.
|
IOHashKey |
getRight()
Retrieves the right object of this relation.
|
int |
hashCode() |
void |
setAttribute(String key,
Object value)
Deprecated.
use
addAttribute(java.lang.String, java.lang.Object) instead |
void |
setAttributes(Map<String,Object> attr)
Sets a map of attributes that describes this relation.
|
void |
setCategory(IORelation.Category category)
Sets the category to which this relation should belong.
|
void |
setId(int id)
Sets the id of this relation.
|
void |
setLeft(IOHashKey left)
Sets the left object of this relation.
|
void |
setRight(IOHashKey right)
Sets the right object of this relation.
|
String |
toString() |
boolean |
validate()
Checks whether or not this is a valid relation.
|
public static final IORelation.Category ArticleInSection
public static final IORelation.Category ArticleInPool
public static final IORelation.Category ArticleInTopic
public static final IORelation.Category ArticleRefersToEntity
TypeManager.getTypes(Type.EntityType)
.
Typical String
representations of types are:
public static final IORelation.Category ArticleHasRoleKeeper
public static final IORelation.Category ArticleHasRelatedArticle
public static final IORelation.Category PersonSectionRole
public static final IORelation.Category UserGroupSectionRole
public static final IORelation.Category ActivePoolInSection
public static final IORelation.Category PoolInSection
public static final IORelation.Category PersonCatalogRole
public IORelation(IORelation.Category pCategory, IOHashKey pLeft, IOHashKey pRight)
public IORelation(IORelation.Category pCategory, IOHashKey pLeft, IOHashKey pRight, Map<String,Object> pAttributes)
public void setCategory(IORelation.Category category)
category
- the category to which this relation should belongpublic IORelation.Category getCategory()
public void setId(int id)
id
- the id of this relationpublic int getId()
public void setLeft(IOHashKey left)
ArticleInPool
will always have an article as left object. An IOHashKey
uniquely identifies
this object.left
- an IOHashKey
identifying the left part of this relationIOHashKey
public IOHashKey getLeft()
ArticleInPool
will always have an article as left object. An IOHashKey
uniquely identifies
this object.IOHashKey
identifying the left part of this relationIOHashKey
public void setRight(IOHashKey right)
ArticleInPool
will always have a pool as right object. An IOHashKey
uniquely identifies
this object.right
- an IOHashKey
identifying the right part of this relationIOHashKey
public IOHashKey getRight()
ArticleInPool
will always have a pool as right object. An IOHashKey
uniquely identifies
this object.IOHashKey
public void setAttributes(Map<String,Object> attr)
IORelation
documentation for further details on attributes.attr
- Map
of attributes that describes this relationIORelation
public void setAttribute(String key, Object value)
addAttribute(java.lang.String, java.lang.Object)
insteadpublic void addAttribute(String key, Object value)
IORelation
documentation for further details on attributes.key
- the attribute to set on this relationvalue
- the value of the attribute to set on this relationpublic Map getAttributes()
Map
containing all attributes that belong to this relation; an empty Map
if no attributes are foundpublic Object getAttribute(Object key)
IORelation
documentation for further details on attributes.key
- the key that identifies the attribute to retrieveIORelation
public boolean attributeExists(String key)
key
- the attribute key to check if is defined for this relationpublic boolean attributeIsNumber(String key)
int
encaptuled
in a String
.key
- the attribute to check the value ofint
encaptuled
in a String
; false otherwisepublic boolean attributeIsInteger(String key)
Integer
.key
- the attribute to check the value ofInteger
public boolean attributeIsString(String key)
String
.key
- the attribute to check the value ofString
public boolean attributeIsType(String key)
Type
object.key
- key the attribute to check the value ofType
objectpublic boolean validate()
For example:
Validating relation of type ArticleInSection
checks:
Article
Section
Integer
valueType
value© 1998- 2021 Escenic AS