Community
Participate
Working Groups
Suppose you have a model containing a list of elements where properties of these elements declare dependencies to other elements in the list. The @DependsOn refreshes work fine if you start from scratch and build up the model, however if you load an existing model, the @DependsOn refreshes are not triggered until you modify the list (adding or removing an element). Test setup that can be used to repro the problem... @GenerateImpl @XmlRootBinding( elementName = "root" ) public interface TestElementRoot extends IModelElement { ModelElementType TYPE = new ModelElementType( TestElementRoot.class ); // *** Children *** @Type( base = TestElementChild.class ) @XmlListBinding( mappings = @XmlListBinding.Mapping( element = "child", type = TestElementChild.class ) ) ListProperty PROP_CHILDREN = new ListProperty( TYPE, "Children" ); ModelElementList<TestElementChild> getChildren(); } @GenerateImpl public interface TestElementChild extends IModelElement { ModelElementType TYPE = new ModelElementType( TestElementChild.class ); // *** Id *** @Required @XmlBinding( path = "id" ) ValueProperty PROP_ID = new ValueProperty( TYPE, "Id" ); Value<String> getId(); void setId( String value ); // *** Reference *** @XmlBinding( path = "reference" ) ValueProperty PROP_REFERENCE = new ValueProperty( TYPE, "Reference" ); Value<String> getReference(); void setReference( String value ); // *** Content *** @DependsOn( { "Reference", "#/Id", "#/Content" } ) @Service( impl = ContentDefaultValueService.class ) @XmlBinding( path = "content" ) ValueProperty PROP_CONTENT = new ValueProperty( TYPE, "Content" ); Value<String> getContent(); void setContent( String value ); } public final class ContentDefaultValueService extends DefaultValueService { @Override public String getDefaultValue() { final TestElementChild element = nearest( TestElementChild.class ); final String ref = element.getReference().getText(); if( ref != null ) { final TestElementRoot root = nearest( TestElementRoot.class ); for( TestElementChild child : root.getChildren() ) { if( child != element && ref.equals( child.getId().getText() ) ) { return child.getContent().getText(); } } } return null; } }
Fixed in 0.3.1 and 0.4 code streams. Test coverage provided by TestModelingMisc0011. In fact, the test suite shows to similar scenarios (testFromEmptyModel and testFromExistingModel). Before the fix, testFromEmptyModel would pass, but testFromExisingModel would fail.
verified with Sapphire build 0.3.1.201109211949
Closed.