Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-bpmn2.dev] ItemDefinition's Import is transient ?

Excelllent example Henning!

 

Von: mdt-bpmn2.dev-bounces@xxxxxxxxxxx [mailto:mdt-bpmn2.dev-bounces@xxxxxxxxxxx] Im Auftrag von Henning Heitkötter
Gesendet: Freitag, 17. September 2010 11:12
An: BPMN2 Developers Mailing List
Betreff: Re: [mdt-bpmn2.dev] ItemDefinition's Import is transient ?

 

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.

 

Thanks,

 

Antoine

 


Back to the top