What is the difference between bound property and constraint property




















The auto-created attribute is a boolean. If an item is auto-created but not protected then it must be immediately created in transient space when its parent node is created. If an item is both auto-created and protected, then it should be immediately created in transient space when its parent node is created. Creation of auto-created protected items should not be delayed until save, though doing so does not violate JCR compliance.

In that case the repository must create at least one such child node with the specified name upon parent node creation, though it may create more than one. An auto-created node may itself have auto-created child items, resulting in the automatic creation of a tree of items. However, chaining that produces an infinite loop of item creation is not permitted.

An item may be declared mandatory , meaning that the item must exist before its parent node is saved. A mandatory multi-value property, on the other hand, may have zero or more values. In a repository that supports same-name siblings, a child node definition may specify that a node be both mandatory and allow same-name siblings. In repositories that do not support simple or full versioning this attribute has no effect.

A property definition has all the attributes of a generic item definition as well as the following property-specific attributes:. A property definition must specify a property type. The default values attribute of a property definition defines the values assigned to property if it is auto-created.

If the property is single-valued this attribute will hold a single value. If it is multi-valued this attribute will hold an array of values. A default values setting of null indicates that the property does not have a single static default value. It may have no default value at all or it may have a parameterized default value defined externally to this specification. If the scoped property is not auto-created then this attribute has no effect.

A property definition declares the set of query comparison operators that can be validly applied to a property. The set of operators that can appear in this attribute may be limited by implementation-specific constraints that differ across property types. The full-text searchable flag is a boolean. The query-orderable flag is a boolean. A property definition may impose constraints on the value that the property may hold.

These value constraints are defined by an array of strings, whose format differs depending on the type of the property. Each string in the returned array specifies a constraint on the values of the property. In order to be valid, each value of the property since a property may be multi-valued must independently meet at least one of the constraints. If a property does not exist or, in the case of multi-value properties, contains an empty array, the constraint set is considered to have been met.

Reporting constraint information is optional on a per property instance level. The return of an empty array indicates that there are no expressible constraints, meaning that either there are constraints but they are not expressible in the constraint-string syntax, or constraint discovery is not supported for that property.

Constraint strings have different formats depending on the type of the property in question. The following sections describe the value constraint syntax for each property type.

For a constraint without match-descendants, the constraint is met when the property value is equal to the constraint. The remaining types all have value constraints in the form of inclusive or exclusive ranges specified according to the following pattern:. A missing min or max value indicates no bound in that direction. The meaning of the min and max values themselves differ between types as follows:.

DATE : min and max are dates specifying the allowed date range. Because constraints are returned as an array of disjunctive constraints, in many cases the elements of the array can serve directly as a choice list.

This may, for example, be used by an application to display options to the end user indicating the set of permitted values. A property can be declared multi-valued. An attempt to set a single-value property by passing an array will fail. A child node definition has all the attributes of a generic item definition as well as the following node-specific attributes:. In cases where this attribute specifies more than one required node type, any particular node instance will still have only one assigned primary type, but that type must be a subtype of all of the types specified by this attribute.

Such a situation may arise, for example, in repositories that support multiple inheritance of node types. The default primary type of a child node definition is a JCR name defining the node type that the child node will be given if it is auto-created or created without an explicitly specified node type.

This node type must be the same as or a subclass of each of the required primary node types. If null is returned this indicates that no default primary type is specified and that therefore an attempt to create this node without specifying a node type will fail.

In repositories that do not support same-name siblings this attribute has no effect. Mixin node types are used to add additional properties or child nodes to a given node instance, typically in order to expose some aspect of a specialized repository feature.

Mixin node types apply to specific node instances within a workspace, allowing the repository to decouple support for some repository features from the primary node type assigned to that node. In effect, mixin node types permit per instance node type inheritance.

In a writable repository mixin node types can be assigned to a node during its lifetime, not just upon creation. A mixin node type may have one or more supertypes, which must also be mixin types. Additionally, a mixin node type can serve as a supertype of a primary type. This is typically done to build a mixin-linked feature into a primary node type. For example, if a repository requires all nodes of type xyz:Document to be referenceable it can specify that mix:referenceable as a supertype of xyz:Document.

A mixin node type cannot be used by itself as the node type of a node. A primary node type is always required. A mixin node type may be part of an inheritance hierarchy. The semantics of inheritance are defined by the following rules. The supertype relation always and only stems from explicit supertypes attribute declarations within the set of node types: For T 1 to be a supertype of T 2 it is not sufficient that the item definitions of T 2 be a superset of the item definitions of T 1.

For that to be the case, T 2 must declare T 1 as a supertype. The subtype relation is the converse of supertype: T 1 is a subtype of T 2 if and only if T 2 is a supertype of T 1. Hence, subtype is also a transitive relation. The is-of-type relation which holds between node instances and node types as in, node N is of type T is transitive across the subtype relation: If N is of type T 2 and T 2 is a subtype of T 1 then N is also of type T 1. This predicate appears in the API as the method Node.

The is of type relation always and only stems from an explicit assignment of a node type to a node: For node N to be of type T it is not sufficient for N to have the child items declared by T. For that to be the case, N must be explicitly assigned the type T , or a subtype of T.

The complete set of node type constraints on a particular node is referred to as that node's effective node type. This consists of the sum of all attributes. The summing of these attributes must conform to the semantics of subtyping defined in this section. The general principle guiding inheritance is to preserve the is-a relation across subtyping. This implies that if T' is a subtype of T and N is a valid instance of T' then:. A method call that depends on the truth of the test N is of type T must not fail solely due to N being of type T'.

If T is a primary type, T' must be a primary type. However, if T is a mixin then T' may be either a mixin or a primary type. If T specifies a primary item I then T' inherits that setting and must not specify a primary item other than I. If T is a registered node type and T' is the definition of a subtype of T that meets the criteria in the preceding sections, then an item definition D' in T' is either additive , overriding or invalid , as determined by the following algorithm:.

If there does not exists a definition D in T with a name and class i. If there does exist a definition D in T with name and class identical to that of D' then D' is overriding if:.

The implementation supports item definition overrides in this instance implementations are free allow or disallow overrides globally or on an instance-by-instance basis. If D is a property definition then D and D' have identical multiple settings and any property values valid against D' would also be valid against D.

If D is a child node definition then D and D' have identical same-name sibling settings. If D is autocreated, mandatory or protected then D' must be, respectively, that as well. If D' is additive then when T' is registered D' becomes part of T' alongside all item definitions inherited from T. If D' overrides D then when T' is registered D' replaces the definition D that would otherwise have been inherited from T.

In fixed node type repositories those without support for mixin assignment or node type registration , adherence to the inheritance rules is simply a matter of ensuring that the correct relations hold among the statically defined node type that the system exposes.

Though there may be more than one definition in the parent node's type that could apply to the child item, the definition that does apply is determined by the implementation and remains constant through the lifetime of the item.

The node type of the root node of each workspace is implementation-determined. There are no restrictions other than those implied by the feature set of the repository. Some of the attributes of the node types defined in this specification may vary across implementations. In the CND notation, variant attributes are indicated with either a question mark for example, protected?

All repositories must supply the base primary node type , nt:base , as a built-in type. It is the only primary node type without supertypes. Since it is mandatory, every node will have this property. It is non-mandatory but is required to be present on any node that has one or more declared mixin types. JCR defines a number of standard application node types designed to support common application-level entities. Nodes of this node type may be used to represent files.

This node type inherits the item definitions of nt:hierarchyNode and requires a single child node called jcr:content. The jcr:content node is used to hold the actual content of the file. This child node is mandatory, but not auto-created. Its node type will be application-dependent and therefore it must be added by the user.

A common approach is to make the jcr:content a node of type nt:resource. The jcr:content child node is also designated as the primary child item of its parent. This allows the content node to reside anywhere in the workspace and to be referenced by multiple nt:linkedFile nodes.

The content node must be referenceable. Nodes of this type may be used to represent folders or directories. This node type inherits the item definitions of nt:hierarchyNode and adds the ability to have any number of other nt:hierarchyNode child nodes with any names.

This means, in particular, that it can have child nodes of types nt:folder , nt:file or nt:linkedFile. This node type may be used to represent the content of a file. In particular, the jcr:content subnode of an nt:file node will often be an nt:resource. This mixin node type can be used to add standardized title and description properties to a node. This mixin node type can be used to add standardized creation information properties to a node. In implementations that make these properties protected, their values are controlled by the repository, which should set them appropriately upon the initial persist of a node with this mixin type.

This mixin node type can be used to provide standardized modification information properties to a node. In implementations that make these properties protected, their values are controlled by the repository, which should set them appropriately upon a significant modification of the subgraph of a node with this mixin. What constitutes a significant modification will depend on the semantics of the various parts of a node's subgraph and is implementation-dependent.

This mixin node type can be used to provide a standardized property that specifies the natural language in which the content of a node is expressed. The value of the jcr:language property should be a language code as defined in RFC 5.

This mixin node type can be used to provide standardized mimetype and encoding properties to a node. If a node of this type has a primary item that is a single-value BINARY property then jcr:mimeType property indicates the media type 6 applicable to the contents of that property and, if that media type is one to which a text encoding applies, the jcr:encoding property indicates the character set 7 used. If a node of this type does not meet the above precondition then the interpretation of the jcr:mimeType and jcr:encoding properties is implementation-dependent.

This node type may be used to represent the location of a JCR item not just within a particular workspace but within the space of all workspaces in all JCR repositories. The jcr:protocol property stores a string holding the protocol through which the target repository is to be accessed. The jcr:host property stores a string holding the host name of the system through which the repository is to be accessed.

The jcr:port property stores a string holding the port number through which the target repository is to be accessed. The semantics of these properties are left undefined but are assumed to be known by the application. The names and descriptions of the properties are not normative and the repository does not enforce any particular semantic interpretation on them. The jcr:repository property stores a string holding the name of the target repository. The jcr:workspace property stores the name of a workspace.

The jcr:path property stores a path to an item. The jcr:id property stores a weak reference to a node. In most cases either the jcr:path or the jcr:id property would be used, but not both, since they may point to different nodes.

If any of the properties other than jcr:path and jcr:id are missing, the address can be interpreted as relative to the current container at the same level as the missing specifier. For example, if no repository is specified, then the address can be interpreted as referring to a workspace and path or id within the current repository. It is often useful for an application to be able to quickly find whether the value of a BINARY property has changed since the last time it was checked.

On creation of a mix:etag node N , or assignment of mix:etag to N , the repository must create a jcr:etag property with an implementation determined value. The value of the jcr:etag property must change immediately on persist of any of the following changes to N :.

Support for unstructured content may be provided by supporting a free-form node type: nt:unstructured. This node type is used to store unstructured content. It allows any number of child nodes or properties with any names.

It also allows multiple nodes having the same name as well as both multi-value and single-value properties with any names. This node type also supports client-orderable child nodes. A repository may expose the definitions of its available node types in content using the node types nt:nodeType , nt:propertyDefinition and nt:childNodeDefinition. This node type is used to store a node type definition. Property and child node definitions within the node type definition are stored as same-name sibling nodes of type nt:propertyDefinition and nt:childNodeDefinition.

This node type used to store a property definition within a node type definition, which itself is stored as an nt:nodeType node. This node type used to store a child node definition within a node type definition, which itself is stored as an nt:nodeType node. The attributes that make up a node type definition may in some cases have no set value for example, some child node definitions may not define a default primary type. To store this information i.

To indicate that a property or child node definition is residual, the value returned by ItemDefinition. As a result, an in-content definition of a residual item will simply not have a jcr:name property.

JCR defines a number of node types in order to support specific repository features. Descriptions of these node types are found in their corresponding feature sections. The following list summarizes the node types and their associated features:. An implementation may provide a variant of a JCR node type as a built-in under certain conditions.

Such a variant must have the same name as the canonically defined type and thus replace it in that implementation's set of available node types.

An implementation may alter the definition of a JCR node type by adding supertypes. These additional supertypes may be either JCR mixin node types or implementation-specific mixin or primary node types.

For example, a repository may require that all nodes of type nt:file be, additionally, mix:versionable. In such a repository the definition of nt:file , when introspected, would report an additional supertype of mix:versionable.

Though the two features may both be employed in the same repository, they differ in that one affects the actual hierarchy of the supported node types, while the other works on a node-by-node basis.

An implementation may make abstract a JCR node type that is not canonically abstract. For example, some implementations might use nt:file as is, whereas others might subtype it in order to introduce implementation specific item definitions. Such implementations would therefore designate nt:file as abstract. An implementation may vary the value of a node type or child definition attribute that is explicitly indicated as a variant in the node type definitions given in this specification.

For example, any node type defined in this specification may be either queryable or non-queryable, depending on the implementation. Also, the protected and OPV settings of the properties of the metadata mixins mix:title , mix:created , mix:lastModified , mix:language and mix:mimeType are also variant. An external node type is one defined outside this specification. An implementation must not allow external node types with node type names in the nt , mix , jcr or xml namespaces.

An implementation may allow external node types which have item definitions in the jcr namespace. Such an item definition must only reuse an item definition from a JCR-defined node type. Any jcr namespaced item definition in an external node type must be used for a purpose equivalent to its JCR use. A repository may support referenceable nodes. To be referenceable a node must be of type mix:referenceable. This node type adds an auto-created, mandatory, protected STRING property to the node, called jcr:uuid , which exposes the identifier of the node.

The identifier of a referenceable node must be a referenceable identifier. A reference property is a property that holds the referenceable identifier of a referenceable node and therefore serves as a pointer to that node. Given a property P with value V in workspace W:. In a repository that exposes version storage in content, such as one that supports full versioning , an exception is made to the referential integrity rule when the REFERENCE property in question is part of the frozen state of a version stored in version storage.

Every node has an identifier, where an identifier is a string which is the most stable available. A referenceable node, however, must have a referenceable identifier , which is subject to a number of further constraints:. As with any identifier, a referenceable node's identifier must be assigned at the latest when the node is first persisted.

However, the jcr:uuid property of the node must be created immediately upon the node becoming referenceable, which may be upon node creation or upon a later mixin addition. Consequently, the value of the jcr:uuid property before the first persist is not guaranteed to be the identifier of the node. The identifier is immutable during the lifetime of the node, that is, until the node is deleted though a remove operation.

In particular, the identifier is immutable across move and clone operations. Note that non-referenceable identifiers are not required to be immutable across these operations. As in the non-referenceable case, the referenceable identifier is not immutable across copy operations.

This operation results in the creation of a new node with a new identifier. These are the minimum requirements for a referenceable identifier, but implementations are free to exceed these requirements. The ability to address the same piece of data via more than one path is a common feature of many content storage systems.

In JCR this feature is supported through shareable nodes. Two or more shareable nodes in the same workspace may belong to a shared set. Each node within that set has its own unique path within the workspace but all share exactly the same set of child nodes and properties. This means that while the shared nodes are distinct from a path perspective, they are effectively the same node for purposes of operations that access their common subgraph.

In order to be shareable, a node must of type mix:shareable :. Given two distinct shareable nodes A and B where A shares with B , the following facts hold:. The following example shows a method with a user-defined constraint that checks for a predefined email address pattern, such as a corporate email account:. For a built-in constraint, a default implementation is available.

A user-defined or custom constraint needs a validation implementation. In the preceding example, the ValidEmail custom constraint needs an implementation class. Any validation failures are gracefully handled and can be displayed by the h:messages tag. Any managed bean that contains Bean Validation annotations automatically gets validation constraints placed on the fields on a JavaServer Faces application's web pages.

Previous Page Next Page. AssertTrue boolean isActive; DecimalMax The value of the field or property must be a decimal value lower than or equal to the number in the value element.

DecimalMax " DecimalMin "5. Future Date eventDate; Max The value of the field or property must be an integer value lower than or equal to the number in the value element. Max 10 int quantity; Min The value of the field or property must be an integer value greater than or equal to the number in the value element. Min 5 int quantity; NotNull The value of the field or property must not be null.

NotNull String username; Null The value of the field or property must be null. Null String unusedString; Past The value of the field or property must be a date in the past. Past Date birthday; Pattern The value of the field or property must match the regular expression defined in the regexp element. The value of the field or property must be false. For more information about a SysML diagram or item - click it.

Constraint Block. Allocate - the Allocate is owned jointly by the Constraint Parameter and the associated item. The access permissions you have to an Allocate are determined by the access permissions you have to the item that is allocated from - you require write access to both items to create or delete an Allocate.

Binding Connector - the Binding Connector is owned jointly by the Constraint Parameter and the associated item. The access permissions you have to a Refine relationship are determined by the access permissions you have to the refined item.



0コメント

  • 1000 / 1000