[ 
http://issues.apache.org/jira/browse/TUSCANY-115?page=comments#action_12437860 
] 
            
Frank Budinsky commented on TUSCANY-115:
----------------------------------------

Hi Raymond. Sorry it has taken so long to get to this. I guess I really am 
overworked :-)

After looking carefully at this issue, I realized that the problem is more 
subtle. 

Even though SDO doesn't expose DocumentRoot classes, the underlying EMF 
implementation requires global properties to be isMany false, because there can 
only be one root element in a document. Since global elements are defined in 
the DocumentRoot (the object used to hold actual root element in the document) 
it needs to be isMany false for things to work. Of course, that would be a 
silly reason to return the "wrong answer" to SDO clients, but the truth of the 
matter is that there is no right or wrong answer for SDO clients in this case. 
As I told you before, isMany = true would seem to be the conservative answer 
for SDO global properties, but the real "right answer" is that it may be isMany 
or not, depending on the context. For example, if it's used for open content in 
an object that only has an xsd:any with maxOccurs = 1, then isMany is false. If 
the xsd:any has maxOccurs > 1 then isMany should be true. So, the answer from 
property.isMany() will be wrong in one case or the other. 

In EMF, this problem is handled by providing a special utility method:

FeatureMapUtil.isMany(Ebject object, EStructuralFeature feature);

This method returns whether or not the property isMany in the specific object's 
context.

So, for SDO, we could do the same kind of thing by adding a utility method in 
Tuscany:

SDOUtil.isMany(Property property, DataObject context)

Would that work for you?

> Property.isMany() returns false instead of true for global properties
> ---------------------------------------------------------------------
>
>                 Key: TUSCANY-115
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-115
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-Mx
>            Reporter: Raymond Feng
>             Fix For: Java-Mx
>
>
> I have this global element defined in the XSD:
>       <element name="comment1" type="string"/>
>         Property c1 = xsdHelper.getGlobalProperty("http://complex";, 
> "comment1", true);
>         boolean isMany = c1.isMany(); // returns false. According to Frank, 
> it should return true instead

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to