Skip to content

Commit

Permalink
#4 add discovered aggregates to 'exposed aggregates' list in CML (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-ka authored Nov 13, 2019
1 parent 1abd6ec commit d53d0f7
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 291 deletions.
3 changes: 3 additions & 0 deletions Examples/LakesideMutual/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ sourceCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion Examples/LakesideMutual/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# dependency versions
discoveryLibVersion=1.0.0
discoveryLibVersion=1.1.0-SNAPSHOT
lakesideMutualVersion=0.0.1-SNAPSHOT
266 changes: 0 additions & 266 deletions Examples/LakesideMutual/src-gen/lakesidemutual.cml

This file was deleted.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ossReleaseStagingRepository=https://oss.sonatype.org/service/local/staging/deplo

# dependency versions
jUnitVersion=5.5.2
cmlVersion=5.2.0
cmlVersion=5.3.2
reflectionsVersion=0.9.11
springBootVersion=2.2.0.RELEASE
springWebVersion=5.2.0.RELEASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ public String getCollectionType() {
return collectionType;
}

/**
* Returns whether the reference attribute is a collection of references or not.
*
* @return true, if the reference attribute is a collection of references. false otherwise.
*/
public boolean isCollection() {
return collectionType == null || "".equals(collectionType);
}

@Override
public boolean equals(Object object) {
if (!(object instanceof Attribute))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ public void addAggregates(Set<Aggregate> aggregates) {
this.aggregates.addAll(aggregates);
}

/**
* Adds an Aggregate to the Bounded Context.
*
* @param aggregate the Aggregate to be added to the Bounded Context
*/
public void addAggregate(Aggregate aggregate) {
this.aggregates.add(aggregate);
}

/**
* Gets the Aggregates of the Bounded Context.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ public String getCollectionType() {
return collectionType;
}

/**
* Returns whether the reference attribute is a collection of references or not.
*
* @return true, if the reference attribute is a collection of references. false otherwise.
*/
public boolean isCollection() {
return collectionType == null || "".equals(collectionType);
}

@Override
public boolean equals(Object object) {
if (!(object instanceof Reference))
Expand Down
Loading

0 comments on commit d53d0f7

Please sign in to comment.