Skip to content

Commit

Permalink
Allowing EUDA's to be seen in flow views and tables
Browse files Browse the repository at this point in the history
- fixing creating a diagram from a euda page

#CTCTOWALTZ-3136
finos#7047
  • Loading branch information
db-waltz committed Apr 11, 2024
1 parent 58bfc9d commit 0ba88b6
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.finos.waltz.service.flow_diagram;

import org.finos.waltz.data.end_user_app.EndUserAppDao;
import org.finos.waltz.model.enduserapp.EndUserApplication;
import org.finos.waltz.service.changelog.ChangeLogService;
import org.finos.waltz.service.data_type.DataTypeService;
import org.finos.waltz.common.DateTimeUtilities;
Expand Down Expand Up @@ -86,6 +88,7 @@ public class FlowDiagramService {
private final PhysicalFlowDao physicalFlowDao;
private final PhysicalSpecificationDao physicalSpecificationDao;
private final ActorDao actorDao;
private final EndUserAppDao endUserAppDao;
private final Random rnd = RandomUtilities.getRandom();
private final FlowDiagramIdSelectorFactory flowDiagramIdSelectorFactory = new FlowDiagramIdSelectorFactory();
private final LogicalFlowIdSelectorFactory logicalFlowIdSelectorFactory = new LogicalFlowIdSelectorFactory();
Expand All @@ -105,6 +108,7 @@ public FlowDiagramService(ChangeLogService changeLogService,
PhysicalFlowDao physicalFlowDao,
PhysicalSpecificationDao physicalSpecificationDao,
ActorDao actorDao,
EndUserAppDao endUserAppDao,
MeasurableDao measurableDao,
ChangeInitiativeDao changeInitiativeDao) {
checkNotNull(changeLogService, "changeLogService cannot be null");
Expand All @@ -118,6 +122,7 @@ public FlowDiagramService(ChangeLogService changeLogService,
checkNotNull(physicalFlowDao, "physicalFlowDao cannot be null");
checkNotNull(physicalSpecificationDao, "physicalSpecificationDao cannot be null");
checkNotNull(actorDao, "actorDao cannot be null");
checkNotNull(endUserAppDao, "endUserAppDao cannot be null");
checkNotNull(measurableDao, "measurableDao cannot be null");
checkNotNull(changeInitiativeDao, "changeInitiativeDao cannot be null");

Expand All @@ -133,6 +138,7 @@ public FlowDiagramService(ChangeLogService changeLogService,
this.physicalFlowDao = physicalFlowDao;
this.physicalSpecificationDao = physicalSpecificationDao;
this.actorDao = actorDao;
this.endUserAppDao = endUserAppDao;
this.measurableDao = measurableDao;
this.changeInitiativeDao = changeInitiativeDao;
}
Expand Down Expand Up @@ -324,6 +330,8 @@ public Long makeNewDiagramForEntity(EntityReference ref, String userId, String t
return makeForApplication(ref, userId, title);
case ACTOR:
return makeForActor(ref, userId, title);
case END_USER_APPLICATION:
return makeForEndUserApplication(ref, userId, title);
case LOGICAL_DATA_FLOW:
return makeForLogicalFlow(ref, userId, title);
case PHYSICAL_FLOW:
Expand All @@ -341,6 +349,25 @@ public Long makeNewDiagramForEntity(EntityReference ref, String userId, String t
}
}


private Long makeForEndUserApplication(EntityReference ref,
String userId,
String providedTitle) {

EndUserApplication endUserApp = endUserAppDao.getById(ref.id());

String title = isEmpty(providedTitle)
? endUserApp.name() + " flows"
: providedTitle;

ArrayList<FlowDiagramEntity> entities = newArrayList(mkDiagramEntity(endUserApp));
ArrayList<FlowDiagramAnnotation> annotations = newArrayList(mkDiagramAnnotation(endUserApp.entityReference(), title));

return mkNewFlowDiagram(title, userId, entities, annotations);

}


private Long makeForLogicalFlow(EntityReference ref, String userId, String providedTitle) {
LogicalFlow logicalFlow = logicalFlowDao.getByFlowId(ref.id());

Expand Down Expand Up @@ -468,7 +495,8 @@ private String mkLayoutData(List<FlowDiagramEntity> entities,
String entityPositionTemplate = "\"%s/%s\": { \"x\": %d, \"y\": %d }";
Set<EntityKind> positionableEntityKinds = SetUtilities.fromArray(
EntityKind.APPLICATION,
EntityKind.ACTOR);
EntityKind.ACTOR,
EntityKind.END_USER_APPLICATION);

Stream<String> entityPositions = entities
.stream()
Expand Down

0 comments on commit 0ba88b6

Please sign in to comment.