phpcr/src/PHPCR/NodeType/PropertyDefinitionTemplateInterface.php

Show: PublicProtectedPrivateinherited
    Table of Contents
    This file is part of the PHPCR API and was originally ported from the Java JCR API to PHP by Karsten Dambekalns for the FLOW3 project.

    Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0
    

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    License
    Apache Software License 2.0  
    Link
    http://phpcr.github.com/  

    \PHPCR\NodeType\PropertyDefinitionTemplateInterface

    Package: Default
    The PropertyDefinitionTemplate interface extends PropertyDefinition with the addition of write methods, enabling the characteristics of a child property definition to be set, after which the PropertyDefinitionTemplate is added to a NodeTypeTemplate.

    See the corresponding get methods for each attribute in PropertyDefinition for the default values assumed when a new empty PropertyDefinitionTemplate is created (as opposed to one extracted from an existing NodeType).

    Parent(s)
    \PHPCR\NodeType\PropertyDefinitionInterface < \PHPCR\NodeType\ItemDefinitionInterface
    Api
     

    Methods

    methodpublicgetAvailableQueryOperators() : array
    inherited

    Returns the set of query comparison operators supported by this property.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::getAvailableQueryOperators()

    This attribute only takes effect if the node type holding the property definition has a queryable setting of true.

    JCR defines the comparison operators \PHPCR\Query\QueryObjectModelConstantsInterface::JCR_OPERATOR_*

    An implementation may define additional comparison operators.

    Note that the set of operators that can appear in this attribute may be limited by implementation-specific constraints that differ across property types. For example, some implementations may permit property definitions to provide JCR_OPERATOR_EQUAL_TO and JCR_OPERATOR_NOT_EQUAL_TO as available operators for BINARY properties while others may not.

    However, in all cases where a JCR-defined operator is potentially available for a given property type, its behavior must conform to the comparison semantics defined in the specification document (see 3.6.5 Comparison of Values).

    Returns
    TypeDescription
    arrayList of query operators.
    Details
    Api
     
    methodpublicgetDeclaringNodeType() : \PHPCR\NodeType\NodeTypeInterface
    inherited

    Gets the node type that contains the declaration of this ItemDefinition.

    Inherited from: \PHPCR\NodeType\ItemDefinitionInterface::getDeclaringNodeType()\PHPCR\NodeType\PropertyDefinitionInterface::getDeclaringNodeType()

    In implementations that support node type registration an ItemDefinition object may be acquired (in the form of a NodeDefinitionTemplate or PropertyDefinitionTemplate) that is not attached to a live NodeType. In such cases this method returns null.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeTypeInterfaceA NodeType object.
    Details
    Api
     
    methodpublicgetDefaultValues() : array
    inherited

    Gets the default value(s) of the property.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::getDefaultValues()

    These are the values that the property defined by this PropertyDefinition will be assigned if it is automatically created (that is, if ItemDefinitionInterface::isAutoCreated() returns true). This method returns an array of values. If the property is multi- valued, then this array represents the full set of values that the property will be assigned upon being auto-created. Note that this could be the empty array. If the property is single-valued, then the array returned will be of size 1.

    If null is returned, then the property has no fixed default value. This does not exclude the possibility that the property still assumes some value automatically, but that value may be parametrized (for example, "the current date") and hence not expressible as a single fixed value. In particular, this must be the case if isAutoCreated returns true and this method returns null.

    Note that to indicate a null value for this attribute in a node type definition that is stored in content, the jcr:defaultValues property is simply removed (since null values for properties are not allowed.

    In implementations that support node type registration, if this PropertyDefinition object is actually a newly-created empty PropertyDefinitionTemplate, then this method will return null.

    Returns
    TypeDescription
    arrayAn array of php values.
    Details
    Api
     
    methodpublicgetName() : string

    If "*", this ItemDefinition defines a residual set of child items. That is, it defines the characteristics of all those child items with names apart from the names explicitly used in other child item definitions.

    In implementations that support node type registration, if this ItemDefinition object is actually a newly-created empty PropertyDefinitionTemplate or NodeDefinitionTemplate, then this method will return null.

    Returns
    TypeDescription
    stringA string denoting the name or "*".
    Details
    Api
     
    methodpublicgetOnParentVersion() : integer

    This governs what occurs (in implementations that support versioning) when the parent node of this item is checked-in. One of:

    • OnParentVersionAction::COPY
    • OnParentVersionAction::VERSION
    • OnParentVersionAction::IGNORE
    • OnParentVersionAction::INITIALIZE
    • OnParentVersionAction::COMPUTE
    • OnParentVersionAction::ABORT

    In implementations that support node type registration, if this ItemDefinition object is actually a newly-created empty PropertyDefinitionTemplateInterface or NodeDefinitionTemplateInterface, then this method will return OnParentVersionAction::COPY.

    Returns
    TypeDescription
    integerAn int constant member of OnParentVersionAction.
    Details
    Api
     
    methodpublicgetRequiredType() : integer
    inherited

    Gets the required type of the property.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::getRequiredType()

    Possible property types of:

    • PropertyType::STRING
    • PropertyType::DATE
    • PropertyType::BINARY
    • PropertyType::DOUBLE
    • PropertyType::DECIMAL
    • PropertyType::LONG
    • PropertyType::BOOLEAN
    • PropertyType::NAME
    • PropertyType::PATH
    • PropertyType::URI
    • PropertyType::REFERENCE
    • PropertyType::WEAKREFERENCE
    • PropertyType::UNDEFINED

    PropertyType::UNDEFINED is returned if this property may be of any type.

    In implementations that support node type registration, if this PropertyDefinition object is actually a newly-created empty PropertyDefinitionTemplate, then this method will return PropertyType::STRING.

    Returns
    TypeDescription
    integerAn integer constant member of PropertyType.
    Details
    Api
     
    methodpublicgetValueConstraints() : array
    inherited

    Gets the array of constraint strings.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::getValueConstraints()

    Each string in the array specifies a constraint on the value of the property. The constraints are OR-ed together, meaning that in order to be valid, the value must meet at least one of the constraints. For example, a constraint array of ["constraint1", "constraint2", "constraint3"] has the interpretation: "the value of this property must meet at least one of constraint1, constraint2 or constraint3".

    Reporting of value constraints is optional. An implementation may return null, indicating that value constraint information is unavailable (though a constraint may still exist).

    Returning an empty array, on the other hand, indicates that value constraint information is available and that no constraints are placed on this value.

    In the case of multi-value properties, the constraint string array returned applies to all the values of the property.

    The constraint strings themselves having differing formats and interpretations depending on the type of the property in question. The following describes the value constraint syntax for each property type:

    STRING and URI: The constraint string is a regular expression pattern. For example the regular expression ".*" means "any string, including the empty string". Whereas a simple literal string (without any RE-specific meta-characters) like "banana" matches only the string "banana".

    PATH: The constraint string is a JCR path with an optional "*" character after the last "/" character. For example, possible constraint strings for a property of type PATH include:

    • "/myapp:products/myapp:televisions"
    • "/myapp:products/myapp:televisions/"
    • "/myapp:products/*"
    • "myapp:products/myapp:televisions"
    • "../myapp:televisions"
    • "../myapp:televisions/*"

    The following principles apply:

    • The "" means "matches descendants" not "matches any subsequent path". For example, /a/ does not match /a/../c. The constraint must match the normalized path.
    • Relative path constraint only match relative path values and absolute path constraints only match absolute path values.
    • A trailing "/" has no effect (hence, 1 and 2, above, are equivalent).
    • The trailing "" character means that the value of the PATH property is restricted to the indicated subgraph (in other words any additional relative path can replace the ""). For example, 3, above would allow /myapp:products/myapp:radios, /myapp:products/myapp:microwaves/X900, and so forth.
    • A constraint without a "*" means that the PATH property is restricted to that precise path. For example, 1, above, would allow only the value /myapp:products/myapp:televisions.
    • The constraint can indicate either a relative path or an absolute path depending on whether it includes a leading "/" character. 1 and 4, above for example, are distinct.
    • The string returned must reflect the namespace mapping in the current Session (i.e., the current state of the namespace registry overlaid with any session-specific mappings). Constraint strings for PATH properties should be stored in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping upon the PropertyDefinitionInterface::getValueConstraints() call.

    NAME: The constraint string is a JCR name in prefix form. For example "myapp:products". No wildcards or other pattern matching are supported. As with PATH properties, the string returned must reflect the namespace mapping in the current Session. Constraint strings for NAME properties should be stored in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping.

    REFERENCE and WEAKREFERENCE: The constraint string is a JCR name in prefix form. This name is interpreted as a node type name and the REFERENCE or WEAKREFERENCE property is restricted to referring only to nodes that have at least the indicated node type. For example, a constraint of "mytype:document" would indicate that the property in question can only refer to nodes that have at least the node type mytype:document (assuming this was the only constraint returned in the array, recall that the array of constraints are to be ORed together). No wildcards or other pattern matching are supported.

    As with PATH properties, the string returned must reflect the namespace mapping in the current Session. Constraint strings for REFERENCE and WEAKREFERENCE properties should be stored by the implementation in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping.

    BOOLEAN: BOOLEAN properties will always report a value constraint consisting of an empty array (meaning no constraint). In implementations that support node type registration any value constraint set on BOOLEAN is ignored and discarded.

    The remaining types all have value constraints in the form of inclusive or exclusive ranges: i.e., "[min, max]", "(min, max)", "(min, max]" or "[min, max)". Where "[" and "]" indicate "inclusive", while "(" and ")" indicate "exclusive". A missing min or max value indicates no bound in that direction. For example [,5] means no minimum but a maximum of 5 (inclusive) while [,] means simply that any value will suffice, The meaning of the min and max values themselves differ between types as follows:

    BINARY: min and max specify the allowed size range of the binary value in bytes.

    DATE: min and max are dates specifying the allowed date range. The date strings must be in the ISO8601-compliant format: YYYY-MM-DDThh:mm:ss.sssTZD.

    LONG, DOUBLE: min and max are numbers.

    In implementations that support node type registration, when specifying that a DATE, LONG or DOUBLE is constrained to be equal to some disjunctive set of constants, a string consisting of just the constant itself, "c" may be used as a shorthand for the standard constraint notation of "[c, c]", where c is the constant. For example, to indicate that particular LONG property is constrained to be one of the values 2, 4, or 8, the constraint string array {"2", "4", "8"} can be used instead of the standard notation, {"[2,2]", "[4,4]", "[8,8]"}. However, even if this shorthand is used on registration, the value returned by PropertyDefinitionInterface::getValueConstraints() will always use the standard notation.

    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.

    In implementations that support node type registration, if this PropertyDefinition object is actually a newly-created empty PropertyDefinitionTemplate, then this method will return null.

    Returns
    TypeDescription
    arraya String array.
    Details
    Api
     
    methodpublicisAutoCreated() : boolean
    inherited

    Reports whether the item is to be automatically created when its parent node is created.

    Inherited from: \PHPCR\NodeType\ItemDefinitionInterface::isAutoCreated()\PHPCR\NodeType\PropertyDefinitionInterface::isAutoCreated()

    If true, then this ItemDefinition will necessarily not be a residual set definition but will specify an actual item name (in other words getName() will not return "*").

    An autocreated non-protected item must be created immediately when its parent node is created in the transient session space. Creation of autocreated non-protected items is never delayed until save.

    An autocreated protected item should be created immediately when its parent node is created in the transient session space. Creation of autocreated protected items should not be delayed until save, though doing so does not violate JCR compliance.

    In implementations that support node type registration, if this ItemDefinition object is actually a newly-created empty PropertyDefinitionTemplate or NodeDefinitionTemplate, then this method will return false.

    Returns
    TypeDescription
    booleanTrue, if the item is automatically created when its parent node is created, else false.
    Details
    Api
     
    methodpublicisFullTextSearchable() : boolean
    inherited

    Determines if this property is full-text searchable.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::isFullTextSearchable()

    Returns true if this property is full-text searchable, meaning that its value is accessible through the full-text search function within a query.

    This attribute only takes effect if the node type holding the property definition has a queryable setting of true.

    Returns
    TypeDescription
    booleanTrue, if this property is full-text searchable, else false.
    Details
    Api
     
    methodpublicisMandatory() : boolean

    A mandatory item is one that, if its parent node exists, must also exist. This means that a mandatory single-value property must have a value (since there is no such thing a null value). In the case of multi-value properties this means that the property must exist, though it can have zero or more values.

    An attempt to save a node that has a mandatory child item without first creating that child item will throw a ConstraintViolationException on save.

    In implementations that support node type registration, if this ItemDefinition object is actually a newly-created empty PropertyDefinitionTemplate or NodeDefinitionTemplate, then this method will return false.

    An item definition cannot be both residual and mandatory.

    Returns
    TypeDescription
    booleanTrue, if the item is mandatory, else false.
    Details
    Api
     
    methodpublicisMultiple() : boolean
    inherited

    Reports whether this property can have multiple values.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::isMultiple()

    Note that the isMultiple flag is special in that a given node type may have two property definitions that are identical in every respect except for the their isMultiple status. For example, a node type can specify two string properties both called X, one of which is multi-valued and the other not. An example of such a node type is nt:unstructured.

    In implementations that support node type registration, if this PropertyDefinition object is actually a newly-created empty PropertyDefinitionTemplate, then this method will return false.

    Returns
    TypeDescription
    booleanTrue, if this property may have multiple values, else false.
    Details
    Api
     
    methodpublicisProtected() : boolean

    In level 2 implementations, a protected item is one that cannot be removed (except by removing its parent) or modified through the the standard write methods of this API (that is, ItemInterface::remove(), NodeInterface::addNode(), NodeInterface::setProperty() and PropertyInterface::setValue()).

    A protected node may be removed or modified (in a level 2 implementation), however, through some mechanism not defined by this specification or as a side-effect of operations other than the standard write methods of the API.

    In implementations that support node type registration, if this ItemDefinition object is actually a newly-created empty PropertyDefinitionTemplateInterface or NodeDefinitionTemplateInterface, then this method will return false.

    Returns
    TypeDescription
    booleanTrue, if the child item is protected, else false.
    Details
    Api
     
    methodpublicisQueryOrderable() : boolean
    inherited

    Report this property is orderable by a query.

    Inherited from: \PHPCR\NodeType\PropertyDefinitionInterface::isQueryOrderable()

    Returns true if this property is query orderable, meaning that query results may be ordered by this property using the order-by clause of a query.

    This attribute only takes effect if the node type holding the property definition has a queryable setting of true.

    Returns
    TypeDescription
    booleanTrue, if this property is query orderable, else false.
    Details
    Api
     
    methodpublicsetAutoCreated(boolean $autoCreated) : void

    Sets the auto-create status of the property.

    Parameters
    NameTypeDescription
    $autoCreatedboolean

    Flag to set the ability to be automatically created.

    Details
    Api
     
    methodpublicsetAvailableQueryOperators(array $operators) : void

    Sets the queryable status of the property.

    Parameters
    NameTypeDescription
    $operatorsarray

    An array of String constants {@link PropertyDefinition::getAvailableQueryOperators()}.

    Details
    Api
     
    methodpublicsetDefaultValues(array $defaultValues) : void

    Sets the default value (or values, in the case of a multi-value property) of the property.

    Parameters
    NameTypeDescription
    $defaultValuesarray

    A List of values in the correct type for this property.

    Details
    Api
     
    methodpublicsetFullTextSearchable(boolean $fullTextSearchable) : void

    Sets the full-text-searchable status of the property.

    Parameters
    NameTypeDescription
    $fullTextSearchableboolean

    The status of the ability to be fulltext-searchable..

    Details
    Api
     
    methodpublicsetMandatory(boolean $mandatory) : void

    Sets the mandatory status of the property.

    Parameters
    NameTypeDescription
    $mandatoryboolean

    The mandatory status of the property.

    Details
    Api
     
    methodpublicsetMultiple(boolean $multiple) : void

    Sets the multi-value status of the property.

    Parameters
    NameTypeDescription
    $multipleboolean

    The status of the ability to store multiple values.

    Details
    Api
     
    methodpublicsetName(string $name) : void

    Sets the name of the property.

    Parameters
    NameTypeDescription
    $namestring

    The name of the property definition template.

    Details
    Api
     
    methodpublicsetOnParentVersion(integer $opv) : void

    Sets the on-parent-version status of the property.

    Parameters
    NameTypeDescription
    $opvinteger

    an int constant member of OnParentVersionAction.

    Details
    Api
     
    methodpublicsetProtected(boolean $protectedStatus) : void

    Sets the protected status of the property.

    Parameters
    NameTypeDescription
    $protectedStatusboolean

    The protection status of the property.

    Details
    Api
     
    methodpublicsetQueryOrderable(boolean $queryOrderable) : void

    Sets the query-orderable status of the property.

    Parameters
    NameTypeDescription
    $queryOrderableboolean

    The status of the ability being query-orderable.

    Details
    Api
     
    methodpublicsetRequiredType(integer $type) : void

    Sets the required type of the property.

    Parameters
    NameTypeDescription
    $typeinteger

    An integer constant member of PropertyType.

    Details
    Api
     
    methodpublicsetValueConstraints(array $constraints) : void

    Sets the value constraints of the property.

    Parameters
    NameTypeDescription
    $constraintsarray

    List of constrains registered on the property.

    Details
    Api
     
    Documentation was generated by phpDocumentor 2.0.0a12.