Class ConstrainedProperty
- All Implemented Interfaces:
Cloneable
ConstrainedProperty
object makes it possible to easily
define all constraints for a named property of a bean.
The property name refers to the actual name of the bean property.
However, this sometimes doesn't correspond to its conceptual usage. It can
be handy to receive constraint violation reports with another conceptual
name: the subject name. Notice that this corresponds to the subject that is
used in a ValidationError
. If no subject name is specified, the
property name will be used instead.
It's possible to add constraints to a ConstrainedProperty instance through regular setters, but chainable setters are also available to make it possible to easily define a series of constraints, for example:
ConstrainedProperty constrained = new ConstrainedProperty("password") .maxLength(8) .notNull(true);
Constrained properties are typically added to a Constrained
bean
in its constructor. These are the static constraints that will be set for
each and every instance of the bean. You'll however most of the time use
the MetaData
class that provides the activateMetaData
method which initializes
the constraints on a need-to-have basis. This dramatically reduces memory
usage since otherwise all constraints will be initialized for every bean
instance, even though you don't use them, for example:
public class Credentials extends MetaData { private String login_ = null; private String password_ = null; private String language_ = null; public Credentials() { } public activateMetaData() { addConstraint(new ConstrainedProperty("login").maxLength(6).notNull(true)); addConstraint(new ConstrainedProperty("password").maxLength(8).notNull(true)); addConstraint(new ConstrainedProperty("language").notNull(true)); } public void setLogin(String login) { login_ = login; } public String getLogin() { return login_; } public void setPassword(String password) { password_ = password; } public String getPassword() { return password_; } public void setLanguage(String language) { language_ = language; } public String getLanguage() { return language_; } }
It's however also possible to add constraints to a single bean instance whenever they can't be determined beforehand. These are then dynamic constraints than can be populated at runtime, for example:
Credentials credentials = new Credentials(); credentials.addConstraint(new ConstrainedProperty("language").inList(new String[] {"nl", "fr", "en"}));
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
class
class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected List<ConstrainedPropertyListener>
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionConstrainedProperty
(String propertyName) Creates a newConstrainedProperty
for the specified property name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ConstrainedPropertyListener listener) Adds a new listener.autoRetrieved
(boolean autoRetrieved) Sets whether the content data of this property should be retrieved automatically from the back-end.clone()
constraint
(String name, Object constraintData) Sets the data of a particular constraint in a generic fashion.contentAttribute
(String name, boolean value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, byte value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, char value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, double value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, float value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, int value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, long value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, short value) Sets a named content attribute for this property that will be converted internally to aString
value.contentAttribute
(String name, String value) Sets a named content attribute for this property.defaultValue
(boolean value) defaultValue
(Object value) displayedRaw
(boolean displayedRaw) editable
(boolean editable) email
(boolean email) fragment
(boolean fragment) Sets whether the content data of this property is a fragment.Retrieves the cached loaded content data.getConstraint
(String name) Retrieves the value of a particular constraint in a generic fashionRetrieves the map of all the constraints.Retrieves the map of named content attributes for this property.String[]
int
Retrieves the mime type of the property.int
getName()
Retrieves the name of this property.Retrieves the reference object to which the property value can't be equal.Retrieves the ordinal restriction of this property.int
Retrieves the position in which the property should be displayed.int
Retrieves the property name.Retrieves the repository where the content data of this property will be stored.int
getScale()
Retrieves the subject name.Retrieves the content transformer of this property.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Indicates whether the property has a mime type.boolean
boolean
hasName()
Indicates whether this property has a name.boolean
Indicates whether this property has an ordinal restricting column.boolean
Indicates whether the position of the property is set.boolean
boolean
Indicates whether this property will be stored in another repository than the default repository.boolean
hasScale()
boolean
Indicates whether this property has a content transformer.identifier
(boolean identifier) Set whether the property value is an identifier.inList
(byte... inList) inList
(char... inList) inList
(double... inList) inList
(float... inList) inList
(int... inList) inList
(long... inList) inList
(short... inList) inList
(Collection inList) boolean
Indicates whether the content data of this property is automatically retrieved from the back-end.boolean
boolean
boolean
isEmail()
boolean
boolean
Indicates whether the content data of this property is a fragment.boolean
Retrieves whether the property is an identifier.boolean
isInList()
boolean
boolean
isListed()
Retrieves whether the property should be included in data lists.boolean
Retrieves whether the property value can be empty.boolean
Retrieves whether the property can't be equal to a specific reference value.boolean
Retrieves whether the property value can benull
.boolean
Indicates whether this property has to be used as an ordinal.boolean
boolean
isRange()
boolean
isSameAs()
boolean
isSaved()
boolean
isSparse()
boolean
isUnique()
Retrieves whether the property value has to be unique.boolean
isUrl()
listed
(boolean listed) Sets whether the property should be included in data lists.manyToMany
(Class klass) manyToMany
(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) manyToMany
(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) manyToManyAssociation
(Class klass, String property) manyToManyAssociation
(String property) manyToOne
(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) manyToOne
(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) manyToOneAssociation
(Class klass, String property) manyToOneAssociation
(String property) boolean
maxLength
(int maxLength) Sets the mime type of the property.minLength
(int minLength) Sets the name of the content data of this property.notEmpty
(boolean notEmpty) Set whether the property value can be empty.notEqual
(boolean reference) Set that the property value can't be equal to a specifiedboolean
reference value.Set that the property value can't be equal to a specifiedObject
reference value.notNull
(boolean notNull) Set whether the property value can benull
.ordinal
(boolean ordinal) Sets whether this property has to be used as an ordinal.Sets whether this property has to be used as an ordinal with a restricting column.persistent
(boolean persistent) position
(int position) Sets the position in which the property should be displayed.precision
(int precision) rangeBegin
(byte value) rangeBegin
(char value) rangeBegin
(double value) rangeBegin
(float value) rangeBegin
(int value) rangeBegin
(long value) rangeBegin
(short value) rangeBegin
(Comparable value) rangeEnd
(byte value) rangeEnd
(char value) rangeEnd
(double value) rangeEnd
(float value) rangeEnd
(int value) rangeEnd
(long value) rangeEnd
(short value) rangeEnd
(Comparable value) boolean
removeListener
(ConstrainedPropertyListener listener) Removes a listener.repository
(String repository) Sets the repository where the content data of this property will be stored.saved
(boolean saved) scale
(int scale) void
setAutoRetrieved
(boolean autoRetrieved) Sets whether the content data of this property should be retrieved automatically from the back-end.void
setCachedLoadedData
(Object data) Sets the cached loaded data.void
setConstraint
(String name, Object constraintData) Sets the data of a particular constraint in a generic fashion.void
setDefaultValue
(Object value) void
setDisplayedRaw
(boolean displayedRaw) void
setEditable
(boolean editable) void
setEmail
(boolean email) void
void
setFragment
(boolean fragment) Sets whether the content data of this property is a fragment.void
setIdentifier
(boolean identifier) Set whether the property value is an identifier.void
setInList
(byte... inList) void
setInList
(char... inList) void
setInList
(double... inList) void
setInList
(float... inList) void
setInList
(int... inList) void
setInList
(long... inList) void
setInList
(short... inList) void
void
setInList
(Collection inList) void
setListed
(boolean listed) Sets whether the property should be included in data lists.void
void
setManyToMany
(Class klass) void
setManyToMany
(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) void
setManyToMany
(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) void
void
setManyToManyAssociation
(Class klass, String property) void
setManyToManyAssociation
(String property) void
void
setManyToOne
(Class klass) void
setManyToOne
(Class klass, String columnReference) void
setManyToOne
(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) void
setManyToOne
(String table, String columnReference) void
setManyToOne
(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) void
void
setManyToOneAssociation
(Class klass, String property) void
setManyToOneAssociation
(String property) void
setMaxDate
(Date maxDate) void
setMaxLength
(int maxLength) void
setMimeType
(MimeType mimeType) Sets the mime type of the property.void
setMinDate
(Date minDate) void
setMinLength
(int minLength) void
Sets the name of the content data of this property.void
setNotEmpty
(boolean notEmpty) Set whether the property value can be empty.void
setNotEqual
(boolean reference) Set that the property value can't be equal to a specifiedboolean
reference value.void
setNotEqual
(Object reference) Set that the property value can't be equal to a specifiedObject
reference value.void
setNotNull
(boolean notNull) Set whether the property value can benull
.void
setOrdinal
(boolean ordinal) Sets whether this property has to be used as an ordinal.void
setOrdinal
(boolean ordinal, String restriction) Sets whether this property has to be used as an ordinal with a restricting column.void
setPersistent
(boolean persistent) void
setPosition
(int position) Sets the position in which the property should be displayed.void
setPrecision
(int precision) void
setRangeBegin
(Comparable rangeBegin) void
setRangeEnd
(Comparable rangeEnd) void
void
setRepository
(String repository) Sets the repository where the content data of this property will be stored.void
void
setSaved
(boolean saved) void
setScale
(int scale) void
setSparse
(boolean sparse) void
setSubjectName
(String name) Sets the subject name.void
setTransformer
(ContentTransformer<?> transformer) Sets a content transformer for this property.void
setUnique
(boolean unique) Set whether the property value has to be unique.void
setUrl
(boolean url) sparse
(boolean sparse) subjectName
(String name) Sets the subject name.transformer
(ContentTransformer<?> transformer) Sets a content transformer for this property.unique
(boolean unique) Set whether the property value has to be unique.url
(boolean url)
-
Field Details
-
NOT_NULL
- See Also:
-
NOT_EMPTY
- See Also:
-
NOT_EQUAL
- See Also:
-
UNIQUE
- See Also:
-
IDENTIFIER
- See Also:
-
EDITABLE
- See Also:
-
PERSISTENT
- See Also:
-
SAVED
- See Also:
-
DISPLAYED_RAW
- See Also:
-
MIN_LENGTH
- See Also:
-
MAX_LENGTH
- See Also:
-
SCALE
- See Also:
-
REGEXP
- See Also:
-
EMAIL
- See Also:
-
URL
- See Also:
-
MIN_DATE
- See Also:
-
MAX_DATE
- See Also:
-
IN_LIST
- See Also:
-
RANGE_BEGIN
- See Also:
-
RANGE_END
- See Also:
-
DEFAULT_VALUE
- See Also:
-
SAME_AS
- See Also:
-
MANY_TO_ONE
- See Also:
-
MANY_TO_ONE_ASSOCIATION
- See Also:
-
MANY_TO_MANY
- See Also:
-
MANY_TO_MANY_ASSOCIATION
- See Also:
-
FORMAT
- See Also:
-
SPARSE
- See Also:
-
LISTED
- See Also:
-
POSITION
- See Also:
-
MIMETYPE
- See Also:
-
AUTO_RETRIEVED
- See Also:
-
FRAGMENT
- See Also:
-
NAME
- See Also:
-
REPOSITORY
- See Also:
-
ORDINAL
- See Also:
-
ORDINAL_RESTRICTION
- See Also:
-
CONTENT_ATTRIBUTES
- See Also:
-
TRANSFORMER
- See Also:
-
CACHED_LOADED_DATA
- See Also:
-
constraints_
-
listeners_
-
-
Constructor Details
-
ConstrainedProperty
Creates a newConstrainedProperty
for the specified property name.- Parameters:
propertyName
- the name of the property that has to be constrained- Since:
- 1.0
-
-
Method Details
-
addListener
Adds a new listener.Listeners will be notified when events occur that are specified in the
ConstrainedPropertyListener
interface.- Parameters:
listener
- the listener instance that will be added- Since:
- 1.0
-
removeListener
Removes a listener.Once the listener has been removed, it will not receive any events anymore.
- Parameters:
listener
- the listener instance that will be removed- Returns:
true
when the listener could be found and has been removed; orfalse
when the listener wasn't registered before- Since:
- 1.0
-
subjectName
Sets the subject name.- Parameters:
name
- the subject name- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
-
setSubjectName
Sets the subject name.- Parameters:
name
- the subject name- Since:
- 1.0
-
getSubjectName
Retrieves the subject name.- Returns:
- the subject name; or
the property name if no subject was specified.
- Since:
- 1.0
-
getPropertyName
Retrieves the property name.- Returns:
- the property name
- Since:
- 1.0
-
notNull
Set whether the property value can benull
.Note that this has different meanings in different contexts:
- for values in java this is only applicable to object references
as primitive values are never
null
, - for values that are stored in a database, it's applicable to every column.
- Parameters:
notNull
-true
when the value can't benull
; orfalse
when the value can benull
.- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
- See Also:
- for values in java this is only applicable to object references
as primitive values are never
-
setNotNull
public void setNotNull(boolean notNull) Set whether the property value can benull
.- Since:
- 1.0
- See Also:
-
isNotNull
public boolean isNotNull()Retrieves whether the property value can benull
.- Returns:
true
when the value can't benull
; orfalse
when the value can benull
.- Since:
- 1.0
- See Also:
-
notEmpty
Set whether the property value can be empty.Note that this has different meanings for different datatypes
- for textual types this is an empty string, ie. "",
- for numeric types this is 0 (zero).
- Parameters:
notEmpty
-true
when the value can't be empty; orfalse
when the value can be empty.- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
- See Also:
-
setNotEmpty
public void setNotEmpty(boolean notEmpty) Set whether the property value can be empty.- Since:
- 1.0
- See Also:
-
isNotEmpty
public boolean isNotEmpty()Retrieves whether the property value can be empty.- Returns:
true
when the value can't be empty; orfalse
when the value can be empty.- Since:
- 1.0
- See Also:
-
notEqual
Set that the property value can't be equal to a specifiedboolean
reference value.- Parameters:
reference
- the reference value it will be checked against- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
- See Also:
-
notEqual
Set that the property value can't be equal to a specifiedObject
reference value.- Since:
- 1.0
- See Also:
-
setNotEqual
public void setNotEqual(boolean reference) Set that the property value can't be equal to a specifiedboolean
reference value.- Since:
- 1.0
- See Also:
-
setNotEqual
Set that the property value can't be equal to a specifiedObject
reference value.- Since:
- 1.0
- See Also:
-
isNotEqual
public boolean isNotEqual()Retrieves whether the property can't be equal to a specific reference value.- Returns:
true
when the value can't be equal; orfalse
when the value can be equal.- Since:
- 1.0
- See Also:
-
getNotEqual
Retrieves the reference object to which the property value can't be equal.- Returns:
- the requested reference object instance; or
null
when the property has no notEqual constraint. - Since:
- 1.0
- See Also:
-
unique
Set whether the property value has to be unique.Note that this is only applicable to contexts where a collection of the data is stored and that uniqueness can apply against the other entries. In a singular context, uniqueness is always guaranteed.
- Parameters:
unique
-true
when the value has to be unique; orfalse
when it doesn't have to be.- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
- See Also:
-
setUnique
public void setUnique(boolean unique) Set whether the property value has to be unique.- Since:
- 1.0
- See Also:
-
isUnique
public boolean isUnique()Retrieves whether the property value has to be unique.- Returns:
true
when the value has to be unique; orfalse
it doesn't have to be.- Since:
- 1.0
- See Also:
-
identifier
Set whether the property value is an identifier.Note that this is only applicable to contexts where a collection of the data is stored and that identification can apply against the other entries. In a singular context, identification is meaningless.
- Parameters:
identifier
-true
when the value is an identifier; orfalse
when it isn't.- Returns:
- this
ConstrainedProperty
- Since:
- 1.0
- See Also:
-
setIdentifier
public void setIdentifier(boolean identifier) Set whether the property value is an identifier.- Since:
- 1.0
- See Also:
-
isIdentifier
public boolean isIdentifier()Retrieves whether the property is an identifier.- Returns:
true
when the property is an identifier; orfalse
it isn't.- Since:
- 1.0
- See Also:
-
editable
-
setEditable
public void setEditable(boolean editable) -
isEditable
public boolean isEditable() -
persistent
-
setPersistent
public void setPersistent(boolean persistent) -
isPersistent
public boolean isPersistent() -
saved
-
setSaved
public void setSaved(boolean saved) -
isSaved
public boolean isSaved() -
displayedRaw
-
setDisplayedRaw
public void setDisplayedRaw(boolean displayedRaw) -
isDisplayedRaw
public boolean isDisplayedRaw() -
hasLimitedLength
public boolean hasLimitedLength() -
hasMixLength
public boolean hasMixLength() -
hasMaxLength
public boolean hasMaxLength() -
minLength
-
setMinLength
public void setMinLength(int minLength) -
getMinLength
public int getMinLength() -
maxLength
-
setMaxLength
public void setMaxLength(int maxLength) -
getMaxLength
public int getMaxLength() -
hasPrecision
public boolean hasPrecision() -
precision
-
setPrecision
public void setPrecision(int precision) -
getPrecision
public int getPrecision() -
hasScale
public boolean hasScale() -
scale
-
setScale
public void setScale(int scale) -
getScale
public int getScale() -
regexp
-
setRegexp
-
getRegexp
-
matchesRegexp
public boolean matchesRegexp() -
email
-
setEmail
public void setEmail(boolean email) -
isEmail
public boolean isEmail() -
url
-
setUrl
public void setUrl(boolean url) -
isUrl
public boolean isUrl() -
minDate
-
setMinDate
-
getMinDate
-
maxDate
-
setMaxDate
-
getMaxDate
-
isLimitedDate
public boolean isLimitedDate() -
inList
-
setInList
-
inList
-
setInList
public void setInList(int... inList) -
inList
-
setInList
public void setInList(byte... inList) -
inList
-
setInList
public void setInList(char... inList) -
inList
-
setInList
public void setInList(short... inList) -
inList
-
setInList
public void setInList(long... inList) -
inList
-
setInList
public void setInList(float... inList) -
inList
-
setInList
public void setInList(double... inList) -
inList
-
setInList
-
getInList
-
isInList
public boolean isInList() -
rangeBegin
-
rangeBegin
-
rangeBegin
-
rangeBegin
-
rangeBegin
-
rangeBegin
-
rangeBegin
-
rangeBegin
-
setRangeBegin
-
getRangeBegin
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
rangeEnd
-
setRangeEnd
-
getRangeEnd
-
isRange
public boolean isRange() -
defaultValue
-
defaultValue
-
setDefaultValue
-
getDefaultValue
-
hasDefaultValue
public boolean hasDefaultValue() -
sameAs
-
setSameAs
-
getSameAs
-
isSameAs
public boolean isSameAs() -
setManyToOne
public void setManyToOne() -
setManyToOne
-
setManyToOne
-
setManyToOne
-
setManyToOne
public void setManyToOne(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
setManyToOne
public void setManyToOne(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
getManyToOne
-
manyToOne
-
manyToOne
-
manyToOne
-
manyToOne
-
manyToOne
public ConstrainedProperty manyToOne(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
manyToOne
public ConstrainedProperty manyToOne(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
hasManyToOne
public boolean hasManyToOne() -
setManyToOneAssociation
public void setManyToOneAssociation() -
setManyToOneAssociation
-
setManyToOneAssociation
-
getManyToOneAssociation
-
manyToOneAssociation
-
manyToOneAssociation
-
manyToOneAssociation
-
hasManyToOneAssociation
public boolean hasManyToOneAssociation() -
setManyToMany
public void setManyToMany() -
setManyToMany
-
setManyToMany
public void setManyToMany(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
setManyToMany
public void setManyToMany(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
getManyToMany
-
manyToMany
-
manyToMany
-
manyToMany
public ConstrainedProperty manyToMany(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
manyToMany
public ConstrainedProperty manyToMany(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete) -
hasManyToMany
public boolean hasManyToMany() -
setManyToManyAssociation
public void setManyToManyAssociation() -
setManyToManyAssociation
-
setManyToManyAssociation
-
getManyToManyAssociation
-
manyToManyAssociation
-
manyToManyAssociation
-
manyToManyAssociation
-
hasManyToManyAssociation
public boolean hasManyToManyAssociation() -
format
-
setFormat
-
getFormat
-
isFormatted
public boolean isFormatted() -
sparse
-
setSparse
public void setSparse(boolean sparse) -
isSparse
public boolean isSparse() -
listed
Sets whether the property should be included in data lists.This is not actually used by the CMF itself, but is very useful when integrating with automatic user interface generation libraries.
- Parameters:
listed
-true
if the property should be listed; orfalse
if it shouldn't- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setListed
public void setListed(boolean listed) Sets whether the property should be included in data lists.- Parameters:
listed
-true
if the property should be listed; orfalse
if it shouldn't- Since:
- 1.0
- See Also:
-
isListed
public boolean isListed()Retrieves whether the property should be included in data lists.- Returns:
true
if the property should be listed; orfalse
if it shouldn't- Since:
- 1.0
- See Also:
-
position
Sets the position in which the property should be displayed.This is not actually used by the CMF itself, but is very useful when integrating with automatic user interface generation libraries.
- Parameters:
position
- an integer value with the position; or-1
if the property shouldn't be positioned- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setPosition
public void setPosition(int position) Sets the position in which the property should be displayed.- Parameters:
position
- an integer value with the position; or-1
if the property shouldn't be positioned- Since:
- 1.0
- See Also:
-
hasPosition
public boolean hasPosition()Indicates whether the position of the property is set.- Returns:
true
if the property has a position; orfalse
if it hasn't- Since:
- 1.0
- See Also:
-
getPosition
public int getPosition()Retrieves the position in which the property should be displayed.- Returns:
- an integer value with the position; or
-1
if the property shouldn't be positioned - Since:
- 1.0
- See Also:
-
mimeType
Sets the mime type of the property.Setting this constraint will make the
ContentQueryManager
automatically store the data in this property in the content management back-end. This column will not be stored in a regular database table. All this is handled transparently and automatically.- Parameters:
mimeType
- theMimeType
of the property- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setMimeType
Sets the mime type of the property.- Parameters:
mimeType
- theMimeType
of the property- Since:
- 1.0
- See Also:
-
hasMimeType
public boolean hasMimeType()Indicates whether the property has a mime type.- Returns:
true
if the property has a mime type; orfalse
if it hasn't- Since:
- 1.0
- See Also:
-
getMimeType
Retrieves the mime type of the property.- Returns:
- the mime type of the property; or
null
if the property has no mime type - Since:
- 1.0
- See Also:
-
autoRetrieved
Sets whether the content data of this property should be retrieved automatically from the back-end.This is only useful when the property also has a mime type constraint.
It's not recommended to enable this constraint for large data since everything will be stored in memory, only use this for text snippets or something relatively small.
- Parameters:
autoRetrieved
-true
if the data should be automatically retrieved; orfalse
otherwise- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setAutoRetrieved
public void setAutoRetrieved(boolean autoRetrieved) Sets whether the content data of this property should be retrieved automatically from the back-end.- Parameters:
autoRetrieved
-true
if the data should be automatically retrieved; orfalse
otherwise- Since:
- 1.0
- See Also:
-
isAutoRetrieved
public boolean isAutoRetrieved()Indicates whether the content data of this property is automatically retrieved from the back-end.- Returns:
true
if the data should be automatically retrieved; orfalse
otherwise- Since:
- 1.0
- See Also:
-
fragment
Sets whether the content data of this property is a fragment.This is only useful when the property also has a mime type constraint. A fragment means that it's not a complete document or a file, but rather a small part that is intended to be used within a larger document. For example a HTML snippet. This information is for example important when validating the data.
- Parameters:
fragment
-true
if the content is a fragment; orfalse
otherwise- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setFragment
public void setFragment(boolean fragment) Sets whether the content data of this property is a fragment.- Parameters:
fragment
-true
if the content is a fragment; orfalse
otherwise- Since:
- 1.0
- See Also:
-
isFragment
public boolean isFragment()Indicates whether the content data of this property is a fragment.- Returns:
true
if the content is a fragment; orfalse
otherwise- Since:
- 1.0
- See Also:
-
name
Sets the name of the content data of this property.This is only useful when the property also has a mime type constraint.
- Parameters:
name
- the name- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setName
Sets the name of the content data of this property.- Parameters:
name
- the name- Since:
- 1.0
- See Also:
-
getName
Retrieves the name of this property.- Returns:
null
if the content data has no name; orthe name of the content
- Since:
- 1.0
- See Also:
-
hasName
public boolean hasName()Indicates whether this property has a name.- Returns:
true
if the property has a name; orfalse
otherwise- Since:
- 1.0
- See Also:
-
repository
Sets the repository where the content data of this property will be stored.This is only useful when the property also has a mime type constraint.
- Parameters:
repository
- the repository- Returns:
- the current
CmrProperty
instance - Since:
- 1.0
- See Also:
-
setRepository
Sets the repository where the content data of this property will be stored.- Parameters:
repository
- the repository- Since:
- 1.0
- See Also:
-
getRepository
Retrieves the repository where the content data of this property will be stored.- Returns:
null
if no repository has been specified; orthe name of the repository
- Since:
- 1.0
- See Also:
-
hasRepository
public boolean hasRepository()Indicates whether this property will be stored in another repository than the default repository.- Returns:
true
if the property will be stored in another repository; orfalse
otherwise- Since:
- 1.0
- See Also:
-
ordinal
Sets whether this property has to be used as an ordinal.The value of this property will be handled in the back-end by an
OrdinalManager
. It will also enable themove
,up
anddown
methods in theContentQueryManager
to easily reorder data rows in the back-end.- Parameters:
ordinal
-true
if this property is an ordinal; orfalse
otherwise- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
ordinal
Sets whether this property has to be used as an ordinal with a restricting column.- Parameters:
ordinal
-true
if this property is an ordinal; orfalse
otherwiserestriction
- the name of the restricting column- Returns:
- the current
ConstrainedProperty
instance - Since:
- 1.0
- See Also:
-
setOrdinal
public void setOrdinal(boolean ordinal) Sets whether this property has to be used as an ordinal.- Parameters:
ordinal
-true
if this property is an ordinal; orfalse
otherwise- Since:
- 1.0
- See Also:
-
setOrdinal
Sets whether this property has to be used as an ordinal with a restricting column.- Parameters:
ordinal
-true
if this property is an ordinal; orfalse
otherwiserestriction
- the name of the restricting column- Since:
- 1.0
- See Also:
-
isOrdinal
public boolean isOrdinal()Indicates whether this property has to be used as an ordinal.- Returns:
true
if this property is an ordinal; orfalse
otherwise- Since:
- 1.0
- See Also:
-
hasOrdinalRestriction
public boolean hasOrdinalRestriction()Indicates whether this property has an ordinal restricting column.- Returns:
true
if this property has an ordinal restricting column; orfalse
otherwise- Since:
- 1.0
- See Also:
-
getOrdinalRestriction
Retrieves the ordinal restriction of this property.- Returns:
- the name of the ordinal restricting column; or
null
if no ordinal restricting column has been defined - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property that will be converted internally to aString
value.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
contentAttribute
Sets a named content attribute for this property.This is only useful when the property also has a mime type constraint.
A content attribute provides additional metadata about how you want to store the content data after loading, this can for example be image dimensions.
- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
getContentAttributes
Retrieves the map of named content attributes for this property.- Returns:
- the map of named content attributes; or
null
if no attributes are present - Since:
- 1.0
- See Also:
-
transformer
Sets a content transformer for this property.This is only useful when the property also has a mime type constraint.
- Parameters:
transformer
- the content transformer- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
setTransformer
Sets a content transformer for this property.- Parameters:
transformer
- the content transformer- Since:
- 1.0
- See Also:
-
hasTransformer
public boolean hasTransformer()Indicates whether this property has a content transformer.- Returns:
true
if this property has a content transformer; orfalse
otherwise- Since:
- 1.0
- See Also:
-
getTransformer
Retrieves the content transformer of this property.- Returns:
- the requested content transformer; or
null
if no content transformer has been defined - Since:
- 1.0
- See Also:
-
setCachedLoadedData
Sets the cached loaded data.This is used internally and should never be used explicitly by a developer.
- Parameters:
data
- the loaded data- Since:
- 1.0
- See Also:
-
getCachedLoadedData
Retrieves the cached loaded content data.- Returns:
- the cached loaded content data; or
null
if no loaded content data has been cached - Since:
- 1.0
- See Also:
-
setConstraint
Sets the data of a particular constraint in a generic fashion.Note that it's not recommended to use this to set any of the standard constraints since none of the additional logic and checks are executed.
-
constraint
Sets the data of a particular constraint in a generic fashion.Note that it's not recommended to use this to set any of the standard constraints since none of the additional logic and checks are executed.
- Returns:
- the current
Content
instance - Since:
- 1.0
- See Also:
-
getConstraint
Retrieves the value of a particular constraint in a generic fashion- Returns:
- the data of a particular constraint; or
null
if nothing has been registered for that constraint - Since:
- 1.0
- See Also:
-
getConstraints
Retrieves the map of all the constraints.- Returns:
- the map with all the registered constraints
- Since:
- 1.0
- See Also:
-
clone
-