Hi Amita, thanks for looking at this. I'm a bit surprised, on digging a little way in, that the enumeration Property is isMany==false. I'll dig a bit further, but I had expected to be able to find the Property named enumeration and get a list of entries.
Kelvin. On 11/12/2007, Amita Vadhavkar <[EMAIL PROTECTED]> wrote: > > Hi, > I tried TUSCANY-1360 related to enumeration facet. Below is the summary of > what was > discussed so far and a few questions. > > ------------------------------------------------------------------------------------------------------------------------------------- > 1) One way to do this is - > public static List<String> getEnumerationFacet(Type type) { > return ExtendedMetaData.INSTANCE.getEnumerationFacet((EDataType)type); > } > > which works very straight forward and gives a list of enums. > > ------------------------------------------------------------------------------------------------------------------------------------- > 2) Another way is - > Do type.getInstanceProperties() and find the Property called > "enumeration". > > Where, getInstanceProperties() calls > DataObjectUtil.getMetaObjectInstanceProperties(EModelElement metaObject) > in which for the given metaObject its annotations and details of each > annotations are traversed. Each > Annotation Detail is mapped to EStringToStringMapEntryImpl entry like > below > - > > EStringToStringMapEntryImpl entry = > (EStringToStringMapEntryImpl)iter.next(); //iter is Iterator over > current > Annotation's Details > String propertyName = entry.getTypedKey(); > > Property globalProperty = getGlobalProperty(hc, propertyURI, > propertyName); > if (globalProperty != null) > { > result.add(globalProperty); > } > > Result is a UniqueEList which is returned at the end. > > Here, when entry.getTypedKey() is "enumeration", entry.getTypedValue() > gives > a String having space separated enums > > e.g. for > <simpleType name="ExampleRating"> > <restriction base="string"> > <enumeration value=""/> > <enumeration value="Good"/> > <enumeration value="Bad"/> > </restriction> > </simpleType> > > it gives," Good Bad" > > As we see in Property globalProperty = getGlobalProperty(hc, propertyURI, > propertyName); the TypedKey information is > used when forming Property with name "enumeration", but the TypedValue > information is not stored in the Property. > Same thing will be applicable for other facets like MinLenght, > MaxExclusive.... > > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Questions: > > Thus, the question I have is, in case of following 2), what will be the > way > to preserve the mapping (key-value) > information available about facets from EMF in the formed Property? And > what > will be better approach for TUSCANY-1360 > and as such for any other facets? > > Regards, > Amita >