Class ObjectResolverConstraint
- java.lang.Object
-
- org.nuxeo.ecm.core.schema.types.constraints.AbstractConstraint
-
- org.nuxeo.ecm.core.schema.types.constraints.ObjectResolverConstraint
-
- All Implemented Interfaces:
Serializable
,Constraint
public final class ObjectResolverConstraint extends AbstractConstraint
External references are document field with a simple type whose value refers to an external business entity. This constraints ensure some value is a reference of an existing external entity resolved by the underlying resolver :getResolver()
.- Since:
- 7.1
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.schema.types.constraints.Constraint
Constraint.Description
-
-
Field Summary
-
Fields inherited from interface org.nuxeo.ecm.core.schema.types.constraints.Constraint
MESSAGES_BUNDLE, MESSAGES_DEFAULT_LANG, MESSAGES_KEY
-
-
Constructor Summary
Constructors Constructor Description ObjectResolverConstraint(ObjectResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Constraint.Description
getDescription()
Provides a description of a constraint.String
getErrorMessage(Object invalidValue, Locale locale)
Provides an error message to display when some invalid value does not match existing entity.ObjectResolver
getResolver()
boolean
validate(Object object)
Validates the given object against this constraint.-
Methods inherited from class org.nuxeo.ecm.core.schema.types.constraints.AbstractConstraint
getMessageKey, getMessageString, toString
-
-
-
-
Constructor Detail
-
ObjectResolverConstraint
public ObjectResolverConstraint(ObjectResolver resolver)
-
-
Method Detail
-
getResolver
public ObjectResolver getResolver()
-
validate
public boolean validate(Object object)
Description copied from interface:Constraint
Validates the given object against this constraint.If some object is null. Constraint should return true while validating unless the constraint deals with nullable state.
- Parameters:
object
- the object to validate- Returns:
- true if the object was successfully validated, false otherwise
-
getDescription
public Constraint.Description getDescription()
Description copied from interface:Constraint
Provides a description of a constraint. For example, a constraint which control String format could returnname=PatternMatchingConstraint | parameters= "pattern":"[0-9]+"
- Returns:
- The constraint description.
-
getErrorMessage
public String getErrorMessage(Object invalidValue, Locale locale)
Description copied from interface:Constraint
Provides an error message to display when some invalid value does not match existing entity.- Specified by:
getErrorMessage
in interfaceConstraint
- Overrides:
getErrorMessage
in classAbstractConstraint
- Parameters:
invalidValue
- The invalid value that don't match any entity.locale
- The language in which the message should be generated.- Returns:
- A message in the specified language or
-
-