[
https://jira.jboss.org/jira/browse/DNA-293?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-293:
-----------------------------------
Actually, Section 6.2.4 of JSR-170 describes the Property.getType() method as follows:
"Returns the type of this Property. The type returned is that which was set at
property creation. Note that
for some property p, the type returned by p.getType() may differ from the type
returned by
p.getDefinition.getRequiredType() only in the case where the latter returns UNDEFINED.
The type of
a property instance is never UNDEFINED (it must always have some actual type). See
6.2.5 Property
Types and 6.7.18 Discovery of Constraints on Existing Items."
To me, this means that the PropertyType is set when the Property instance is created, and
should define how the property values are stored on the graph (e.g., any values should be
converted to that type as they're set, as long as the type is the same as the
PropertyDefinition's required type or, if that is UNDEFINED, then any type).
Therefore, when reading the node back in from the DNA graph, I think we should base the
PropertyType on the first value, since we would have chose the kind of value to match the
client-supplied property type. So, changing the implementation to do this.
JcrSession creates Property instances that use the
PropertyType.UNDEFINED, which is not allowed
-----------------------------------------------------------------------------------------------
Key: DNA-293
URL:
https://jira.jboss.org/jira/browse/DNA-293
Project: DNA
Issue Type: Bug
Components: JCR
Affects Versions: 0.3
Reporter: Randall Hauch
Assignee: Randall Hauch
Fix For: 0.4
The "undefined" property type is only allowed in property definitions.
According to the JSR-170 specification (Section, 6.2.5):
"This constant can be used within a property definition (see 6.7.6 Property
Definitions) to specify that the property in
question may be of any type. However, it cannot be the actual type of any property
instance. For example it will
never be returned by Property.getType and (in level 2 implementations) it cannot be
assigned as the type when
creating a new property."
When the property definition has a type of "undefined", then we'll need to
choose what actual type to use. There doesn't appear to be any guidance on this in
the spec (anybody?), so barring that the most logical approach is probably to look at the
first property value.
Note that this is one reason why the DNA graph API was designed with the value factories
to allow (or encourage) the client to convert the property values to the type desired by
the client. Because of this, it doesn't matter so much what type the value actually
is, but rather that it can be converted to the type needed by the user. So this should
make the above assumption (about choosing the property type based upon value) a pretty
decent one.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira