Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct ($name, $assocTypes=array(), $allowedTypes=METADATA_PROPERTY_TYPE_STRING, $translated=false, $cardinality=METADATA_PROPERTY_CARDINALITY_ONE, $displayName=null, $validationMessage=null, $mandatory=false) | |
getAllowedTypes () | |
& | getAssocTypes () |
getCardinality () | |
getDisplayName () | |
getId () | |
getMandatory () | |
getName () | |
getTranslated () | |
getValidationMessage () | |
isValid ($value, $locale=null) | |
Static Public Member Functions | |
static | getSupportedCardinalities () |
static | getSupportedTypes () |
Data Fields | |
$_allowedTypes | |
$_assocTypes | |
$_cardinality | |
$_displayName | |
$_mandatory | |
$_name | |
$_translated | |
$_validationMessage | |
Class representing metadata properties. It specifies type and cardinality of a meta-data property (=term, field, ...) and whether the property can be internationalized. It also provides a validator to test whether input conforms to the property specification.
In the DCMI abstract model, this class specifies a property together with its allowed range and cardinality.
We also define the resource types (application entities, association types) that can be described with the property. This allows us to check that only valid resource associations are made. It also allows us to prepare property entry forms or displays for a given resource type and integrate these in the work-flow of the resource. By dynamically adding or removing assoc types, end users will be able to configure the meta-data fields that they wish to make available, persist or enter in their application.
Definition at line 53 of file MetadataProperty.inc.php.
MetadataProperty::__construct | ( | $name, | |
$assocTypes = array() , |
|||
$allowedTypes = METADATA_PROPERTY_TYPE_STRING , |
|||
$translated = false , |
|||
$cardinality = METADATA_PROPERTY_CARDINALITY_ONE , |
|||
$displayName = null , |
|||
$validationMessage = null , |
|||
$mandatory = false |
|||
) |
Constructor
$name | string the unique name of the property within a meta-data schema (can be a property URI) |
$assocTypes | array an array of integers that define the application entities that can be described with this property. |
$allowedTypes | mixed must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING |
$translated | boolean whether the property may have various language versions, default: false |
$cardinality | integer must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE |
$displayName | string |
$validationMessage | string A string that can be displayed in case a user tries to set an invalid value for this property. |
$mandatory | boolean Is this a mandatory property within the schema? |
Definition at line 114 of file MetadataProperty.inc.php.
References getSupportedCardinalities(), and getSupportedTypes().
MetadataProperty::getAllowedTypes | ( | ) |
Get the allowed type
Definition at line 250 of file MetadataProperty.inc.php.
References $_allowedTypes.
Referenced by isValid().
& MetadataProperty::getAssocTypes | ( | ) |
Get the allowed association types (resources that can be described with this property)
Definition at line 242 of file MetadataProperty.inc.php.
References $_assocTypes.
MetadataProperty::getCardinality | ( | ) |
Get the cardinality
Definition at line 266 of file MetadataProperty.inc.php.
References $_cardinality.
MetadataProperty::getDisplayName | ( | ) |
Get the translation id representing the display name of the property.
Definition at line 231 of file MetadataProperty.inc.php.
References $_displayName.
MetadataProperty::getId | ( | ) |
Returns a canonical form of the property name ready to be used as a property id in an external context (e.g. Forms or Templates).
Definition at line 212 of file MetadataProperty.inc.php.
References PKPString\camelize(), and getName().
MetadataProperty::getMandatory | ( | ) |
Is this property mandatory?
Definition at line 282 of file MetadataProperty.inc.php.
References $_mandatory.
MetadataProperty::getName | ( | ) |
Get the name
Definition at line 202 of file MetadataProperty.inc.php.
References $_name.
Referenced by getId().
|
static |
Return supported cardinalities
Definition at line 474 of file MetadataProperty.inc.php.
Referenced by __construct().
|
static |
Return supported meta-data property types
NB: These types are sorted from most specific to most general and will be validated in this order so that we'll always identify more specific types as such (see MetadataProperty::isValid() for more details).
Definition at line 458 of file MetadataProperty.inc.php.
Referenced by __construct(), MetadataSchema\getPropertyNamesByType(), and isValid().
MetadataProperty::getTranslated | ( | ) |
Is this property translated?
Definition at line 258 of file MetadataProperty.inc.php.
References $_translated.
MetadataProperty::getValidationMessage | ( | ) |
Get the validation message
Definition at line 274 of file MetadataProperty.inc.php.
References $_validationMessage.
MetadataProperty::isValid | ( | $value, | |
$locale = null |
|||
) |
Validate a given input against the property specification
The given value must validate against at least one of the allowed types. The first allowed type id will be returned as validation result. If the given value fits none of the allowed types, then we'll return 'false'.
$value | mixed the input to be validated |
$locale | string the locale to be used for validation |
Definition at line 304 of file MetadataProperty.inc.php.
References getAllowedTypes(), DAORegistry\getDAO(), getSupportedTypes(), and ValidatorFactory\make().
array MetadataProperty::$_allowedTypes |
allowed property types
Definition at line 76 of file MetadataProperty.inc.php.
Referenced by getAllowedTypes().
int MetadataProperty::$_assocTypes |
the resource types that can be described with this property
Definition at line 70 of file MetadataProperty.inc.php.
Referenced by getAssocTypes().
integer MetadataProperty::$_cardinality |
property cardinality
Definition at line 88 of file MetadataProperty.inc.php.
Referenced by getCardinality().
string MetadataProperty::$_displayName |
a translation id
Definition at line 64 of file MetadataProperty.inc.php.
Referenced by getDisplayName().
boolean MetadataProperty::$_mandatory |
Definition at line 100 of file MetadataProperty.inc.php.
Referenced by getMandatory().
string MetadataProperty::$_name |
boolean MetadataProperty::$_translated |
flag that defines whether the property can be translated
Definition at line 82 of file MetadataProperty.inc.php.
Referenced by getTranslated().
string MetadataProperty::$_validationMessage |
validation message
Definition at line 94 of file MetadataProperty.inc.php.
Referenced by getValidationMessage().