Skip to content

Commit d53d0f7

Browse files
authored
#4 add discovered aggregates to 'exposed aggregates' list in CML (#5)
1 parent 1abd6ec commit d53d0f7

File tree

16 files changed

+184
-291
lines changed

16 files changed

+184
-291
lines changed

Examples/LakesideMutual/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ sourceCompatibility = 1.8
1010
repositories {
1111
mavenCentral()
1212
mavenLocal()
13+
maven {
14+
url 'https://oss.sonatype.org/content/repositories/snapshots'
15+
}
1316
}
1417

1518
dependencies {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# dependency versions
2-
discoveryLibVersion=1.0.0
2+
discoveryLibVersion=1.1.0-SNAPSHOT
33
lakesideMutualVersion=0.0.1-SNAPSHOT

Examples/LakesideMutual/src-gen/lakesidemutual.cml

Lines changed: 0 additions & 266 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ossReleaseStagingRepository=https://oss.sonatype.org/service/local/staging/deplo
44

55
# dependency versions
66
jUnitVersion=5.5.2
7-
cmlVersion=5.2.0
7+
cmlVersion=5.3.2
88
reflectionsVersion=0.9.11
99
springBootVersion=2.2.0.RELEASE
1010
springWebVersion=5.2.0.RELEASE

src/main/java/org/contextmapper/discovery/cml/ContextMapToCMLConverter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import java.util.HashMap;
2323
import java.util.Map;
24+
import java.util.Optional;
2425

2526
/**
2627
* Converts a {@link org.contextmapper.discovery.model.ContextMap} to the CML {@link org.contextmapper.dsl.contextMappingDSL.ContextMap}
@@ -90,6 +91,12 @@ private UpstreamDownstreamRelationship convert(Relationship relationship) {
9091
UpstreamDownstreamRelationship upstreamDownstreamRelationship = ContextMappingDSLFactory.eINSTANCE.createUpstreamDownstreamRelationship();
9192
upstreamDownstreamRelationship.setUpstream(this.boundedContextMap.get(relationship.getUpstream().getName()));
9293
upstreamDownstreamRelationship.setDownstream(this.boundedContextMap.get(relationship.getDownstream().getName()));
94+
for (org.contextmapper.discovery.model.Aggregate aggregate : relationship.getExposedAggregates()) {
95+
Optional<Aggregate> cmlAggregate = upstreamDownstreamRelationship.getUpstream().getAggregates().stream().filter(a -> a.getName().equals(aggregate.getName())).findFirst();
96+
if (cmlAggregate.isPresent())
97+
upstreamDownstreamRelationship.getUpstreamExposedAggregates().add(cmlAggregate.get());
98+
}
99+
upstreamDownstreamRelationship.setExposedAggregatesComment("// " + relationship.getExposedAggregatesComment());
93100
return upstreamDownstreamRelationship;
94101
}
95102

src/main/java/org/contextmapper/discovery/model/Attribute.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ public String getCollectionType() {
9090
return collectionType;
9191
}
9292

93-
/**
94-
* Returns whether the reference attribute is a collection of references or not.
95-
*
96-
* @return true, if the reference attribute is a collection of references. false otherwise.
97-
*/
98-
public boolean isCollection() {
99-
return collectionType == null || "".equals(collectionType);
100-
}
101-
10293
@Override
10394
public boolean equals(Object object) {
10495
if (!(object instanceof Attribute))

src/main/java/org/contextmapper/discovery/model/BoundedContext.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ public void addAggregates(Set<Aggregate> aggregates) {
8484
this.aggregates.addAll(aggregates);
8585
}
8686

87+
/**
88+
* Adds an Aggregate to the Bounded Context.
89+
*
90+
* @param aggregate the Aggregate to be added to the Bounded Context
91+
*/
92+
public void addAggregate(Aggregate aggregate) {
93+
this.aggregates.add(aggregate);
94+
}
95+
8796
/**
8897
* Gets the Aggregates of the Bounded Context.
8998
*

src/main/java/org/contextmapper/discovery/model/Reference.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,6 @@ public String getCollectionType() {
8989
return collectionType;
9090
}
9191

92-
/**
93-
* Returns whether the reference attribute is a collection of references or not.
94-
*
95-
* @return true, if the reference attribute is a collection of references. false otherwise.
96-
*/
97-
public boolean isCollection() {
98-
return collectionType == null || "".equals(collectionType);
99-
}
100-
10192
@Override
10293
public boolean equals(Object object) {
10394
if (!(object instanceof Reference))

0 commit comments

Comments
 (0)