Java Doc for PropertyDefinition.java in  » 6.0-JDK-Modules » jsr-283 » javax » jcr » nodetype » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » jsr 283 » javax.jcr.nodetype 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.jcr.nodetype.PropertyDefinition

PropertyDefinition
public interface PropertyDefinition extends ItemDefinition(Code)
A property definition. Used in node type definitions.




Method Summary
public  Value[]getDefaultValues()
     Gets the default value(s) of the property.
public  intgetRequiredType()
     Gets the required type of the property.
public  String[]getValueConstraints()
     Gets the array of constraint strings.
public  booleanisMultiple()
     Reports whether this property can have multiple values.



Method Detail
getDefaultValues
public Value[] getDefaultValues()(Code)
Gets the default value(s) of the property. These are the values that the property defined by this PropertyDefinition will be assigned if it is automatically created (that is, if PropertyDefinition.isAutoCreated() returns true).

This method returns an array of Value objects. 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 parameterized (for example, "the current date") and hence not expressable 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. an array of Value objects.




getRequiredType
public int getRequiredType()(Code)
Gets the required type of the property. One 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. an int constant member of PropertyType.




getValueConstraints
public String[] getValueConstraints()(Code)
Gets the array of constraint strings. 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:
    1. "/myapp:products/myapp:televisions"
    2. "/myapp:products/myapp:televisions/"
    3. "/myapp:products/*"
    4. "myapp:products/myapp:televisions"
    5. "../myapp:televisions"
    6. "../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 subtree (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 PropertyDefinition.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 implementaion 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 PropertyDefinition.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. a String array.




isMultiple
public boolean isMultiple()(Code)
Reports whether this property can have multiple values. 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. a boolean




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.