use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class ReportGridExtractor method prepareReportRows.
private List<Tuple2<Application, ArrayList<Object>>> prepareReportRows(Set<Tuple2<ReportGridColumnDefinition, Boolean>> colsWithCommentRequirement, ReportGridInstance reportGridInstance) {
Set<ReportGridCell> tableData = reportGridInstance.cellData();
Map<Long, Application> applicationsById = indexById(reportGridInstance.applications());
Map<Long, RatingSchemeItem> ratingsById = indexById(reportGridInstance.ratingSchemeItems());
Map<Long, Collection<ReportGridCell>> tableDataByAppId = groupBy(tableData, ReportGridCell::applicationId);
boolean allowCostsExport = settingsService.getValue(SettingsService.ALLOW_COST_EXPORTS_KEY).map(r -> StringUtilities.isEmpty(r) || Boolean.parseBoolean(r)).orElse(true);
return tableDataByAppId.entrySet().stream().map(r -> {
Long appId = r.getKey();
Application app = applicationsById.getOrDefault(appId, null);
ArrayList<Object> reportRow = new ArrayList<>();
Collection<ReportGridCell> cells = r.getValue();
Map<Tuple3<Long, EntityKind, Long>, ReportGridCell> cellValuesByColumnRefForApp = indexBy(cells, k -> tuple(k.columnEntityId(), k.columnEntityKind(), k.entityFieldReferenceId()));
// find data for columns
colsWithCommentRequirement.forEach(t -> {
ReportGridColumnDefinition colDef = t.v1;
Boolean needsComment = t.v2;
boolean isCostColumn = colDef.columnEntityKind().equals(EntityKind.COST_KIND);
if (!allowCostsExport && isCostColumn) {
reportRow.add("REDACTED");
} else {
ReportGridCell cell = cellValuesByColumnRefForApp.getOrDefault(tuple(colDef.columnEntityId(), colDef.columnEntityKind(), getIdOrDefault(colDef.entityFieldReference(), null)), null);
reportRow.add(getValueFromReportCell(ratingsById, cell));
if (needsComment) {
reportRow.add(getCommentFromCell(cell));
}
}
});
return tuple(app, reportRow);
}).sorted(Comparator.comparing(t -> t.v1.name())).collect(toList());
}
use of org.finos.waltz.model.application.Application in project waltz by finos.
the class LogicalFlowDecoratorRatingsCalculator method lookupVantagePoint.
private EntityReference lookupVantagePoint(Map<Long, Application> targetAppsById, LogicalFlow flow) {
Application targetApp = targetAppsById.get(flow.target().id());
long targetOrgUnitId = targetApp.organisationalUnitId();
return EntityReference.mkRef(EntityKind.ORG_UNIT, targetOrgUnitId);
}
use of org.finos.waltz.model.application.Application in project waltz by finos.
the class FlowDiagramService method makeForApplication.
private Long makeForApplication(EntityReference ref, String userId, String providedTitle) {
Application app = applicationDao.getById(ref.id());
String title = isEmpty(providedTitle) ? app.name() + " flows" : providedTitle;
ArrayList<FlowDiagramEntity> entities = newArrayList(mkDiagramEntity(app));
ArrayList<FlowDiagramAnnotation> annotations = newArrayList(mkDiagramAnnotation(app.entityReference(), title));
return mkNewFlowDiagram(title, userId, entities, annotations);
}
use of org.finos.waltz.model.application.Application in project waltz by finos.
the class FlowClassificationRuleService method logRemoval.
private void logRemoval(long id, String username) {
FlowClassificationRule rule = getById(id);
if (rule == null) {
return;
}
String parentName = getParentEntityName(rule.parentReference());
DataType dataType = dataTypeDao.getById(rule.dataTypeId());
Application app = applicationDao.getById(rule.applicationReference().id());
if (app != null && dataType != null && parentName != null) {
String msg = format("Removed the flow classification rule where %s is a source app for type: %s for %s: %s", app.name(), dataType.name(), rule.parentReference().kind().prettyName(), parentName);
multiLog(username, id, rule.parentReference(), dataType, app, msg, Operation.REMOVE);
}
}
use of org.finos.waltz.model.application.Application in project waltz by finos.
the class FlowClassificationRuleService method logInsert.
private void logInsert(Long ruleId, FlowClassificationRuleCreateCommand command, String username) {
String parentName = getParentEntityName(command.parentReference());
DataType dataType = dataTypeDao.getById(command.dataTypeId());
Application app = applicationDao.getById(command.applicationId());
if (app != null && dataType != null && parentName != null) {
String msg = format("Registered the flow classification rule with %s as the source app for type: %s for %s: %s", app.name(), dataType.name(), command.parentReference().kind().prettyName(), parentName);
multiLog(username, ruleId, command.parentReference(), dataType, app, msg, Operation.ADD);
}
}
Aggregations