[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [mdt-bpmn2.dev] ItemDefinition's Import is transient ?
|
OK, I'm sold, this should be equivalent to what I'm doing now. Thanks for your explanations and the example guys.
On Fri, Sep 17, 2010 at 02:14, Hille-Doering, Reiner
<reiner.hille-doering@xxxxxxx> wrote:
Excelllent example Henning!
Hi Antoine,
perhaps you could use something like the following (with the former version of
ItemDefinition):
@Test
public void testItemDefinition() throws Exception {
Import imp =
Bpmn2Factory.eINSTANCE.createImport();
imp.setNamespace("urn:test");
imp.setLocation("test.abc");
model.getImports().add(imp);
ItemDefinition item =
Bpmn2Factory.eINSTANCE.createItemDefinition();
item.setId("itemID");
InternalEObject value = new
DynamicEObjectImpl();
final URI uri =
URI.createURI("test.abc#id");
value.eSetProxyURI(uri);
item.setStructureRef(value);
model.getRootElements().add(item);
Resource res =
createWithContentAndLoad("itemDef", model);
ItemDefinition itemNew =
(ItemDefinition) res.getEObject("itemID");
assertNotNull(itemNew.getStructureRef());
// the following only succeeds
if getStructureRef could not resolve the reference to a real object
assertEquals(uri,
((InternalEObject) itemNew.getStructureRef()).eProxyURI());
}
Note that in practical use it won't be as bloated as it seems to be in this
test (to be inserted in XMLSerializationTest). Instead of manually creating a
QName, you create a proxy object (here: value) pointing to the element - that's
all what's different. The QName for serialization is then generated by our
deresolution mechanism.
We still would need some mechanism to handle the resolution problems mentioned
before, but I think that should be possible (e.g. compare URI of resolved
object with proxy URI).
Regards,
Henning
2010/9/16 Antoine Toulme <antoine@xxxxxxxxxxxxxxx>
Basically you're saying EObject is mostly ok for XSD types,
which is not what the spec provisions: it provisions for an element.
In our case, we pass a structure reference that is an
element but not part of a XSD :)
A qname at the very least makes it work for us. We could
have a derived EObject to set the qname, so that people can either set the
qname or set the EObject.
_______________________________________________
mdt-bpmn2.dev mailing list
mdt-bpmn2.dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mdt-bpmn2.dev