diff --git a/src/main/groovy/org/cristalise/dsl/collection/DependencyDelegate.groovy b/src/main/groovy/org/cristalise/dsl/collection/DependencyDelegate.groovy index e56adac..91bf6f4 100644 --- a/src/main/groovy/org/cristalise/dsl/collection/DependencyDelegate.groovy +++ b/src/main/groovy/org/cristalise/dsl/collection/DependencyDelegate.groovy @@ -29,6 +29,7 @@ import org.cristalise.kernel.process.Gateway import groovy.transform.CompileStatic import org.cristalise.kernel.process.resource.BuiltInResources +import org.cristalise.kernel.property.PropertyDescriptionList import org.cristalise.kernel.utils.Logger @@ -57,8 +58,16 @@ class DependencyDelegate { public void Member(Map attrs, Closure cl = null) { assert attrs && attrs.itemPath + String iPathStr ItemPath itemPath = new ItemPath() - String iPathStr = (String)attrs.itemPath + + if (attrs.itemPath instanceof PropertyDescriptionList) { + def propDesc = (PropertyDescriptionList)attrs.itemPath + //FIXME module namespace is hardcoded + iPathStr = "/desc/Property/testns/${propDesc.name}" + } + else + iPathStr = (String)attrs.itemPath assert iPathStr @@ -69,8 +78,8 @@ class DependencyDelegate { Logger.warning "Unable to find the domain path. ${e.localizedMessage}" } - if (iPathStr.startsWith(BuiltInResources.COMP_ACT_DESC_RESOURCE.typeRoot)) - itemPath.path[0] = iPathStr + //NOTE: this is a kind of hack so the DSL + if (!ItemPath.isUUID(iPathStr)) itemPath.path[0] = iPathStr def member = dependency.addMember(itemPath) diff --git a/src/main/groovy/org/cristalise/dsl/entity/ItemDelegate.groovy b/src/main/groovy/org/cristalise/dsl/entity/ItemDelegate.groovy index 473cb6a..ba97185 100644 --- a/src/main/groovy/org/cristalise/dsl/entity/ItemDelegate.groovy +++ b/src/main/groovy/org/cristalise/dsl/entity/ItemDelegate.groovy @@ -31,6 +31,7 @@ import org.cristalise.kernel.entity.imports.ImportDependencyMember import org.cristalise.kernel.entity.imports.ImportItem import org.cristalise.kernel.entity.imports.ImportOutcome import org.cristalise.kernel.lifecycle.CompositeActivityDef +import org.cristalise.kernel.lookup.ItemPath import org.cristalise.kernel.process.resource.BuiltInResources import groovy.transform.CompileStatic @@ -105,13 +106,18 @@ class ItemDelegate extends PropertyDelegate { DependencyMember member = DependencyMember.cast(mem) String itemPath = member.itemPath.stringPath - if (itemPath.contains(BuiltInResources.COMP_ACT_DESC_RESOURCE.typeRoot) && itemPath.startsWith(ENTITY_PATTERN)) + // + if (itemPath.startsWith(ENTITY_PATTERN) && !ItemPath.isUUID(itemPath)) itemPath = itemPath.replaceFirst(ENTITY_PATTERN, StringUtils.EMPTY) ImportDependencyMember imem = new ImportDependencyMember(itemPath) imem.props = member.properties idep.dependencyMemberList << imem } + + if (dependency.getProperties().size() > 0) { + idep.props = dependency.getProperties() + } newItem.dependencyList.add(idep) } diff --git a/src/test/groovy/org/cristalise/dsl/test/collection/CollectionBuilderSpecs.groovy b/src/test/groovy/org/cristalise/dsl/test/collection/CollectionBuilderSpecs.groovy index b58ca1e..9f05819 100644 --- a/src/test/groovy/org/cristalise/dsl/test/collection/CollectionBuilderSpecs.groovy +++ b/src/test/groovy/org/cristalise/dsl/test/collection/CollectionBuilderSpecs.groovy @@ -22,7 +22,6 @@ package org.cristalise.dsl.test.collection import org.cristalise.dsl.collection.DependencyBuilder import org.cristalise.kernel.test.utils.CristalTestSetup; - import spock.lang.Specification @@ -48,7 +47,9 @@ class CollectionBuilderSpecs extends Specification implements CristalTestSetup { then: builder.dependency.properties.size() == 1 builder.dependency.members.list.size() == 1 - + builder.dependency.members.list[0].childUUID +// builder.dependency.members.list[0].childUUID == 'b9415b57-3a4a-4b31-825a-d307d1280ac0' + builder.dependency.members.list[0].properties.size() == 2 builder.dependency.members.list[0].properties['version'] == 0 builder.dependency.members.list[0].properties['toto'] == true