use of org.finos.waltz.data.roadmap.RoadmapDao in project waltz by khartec.
the class RoadmapHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
RoadmapDao roadmapDao = ctx.getBean(RoadmapDao.class);
RoadmapService roadmapService = ctx.getBean(RoadmapService.class);
Collection<RoadmapAndScenarioOverview> relns = roadmapService.findRoadmapsAndScenariosByFormalRelationship(mkRef(EntityKind.ORG_UNIT, 2700));
System.out.println(relns);
}
use of org.finos.waltz.data.roadmap.RoadmapDao in project waltz by khartec.
the class RoadmapGenerator method mkScenario.
private void mkScenario(ApplicationContext ctx, long roadmapId) {
ScenarioDao scenarioDao = getScenarioDao(ctx);
RoadmapDao roadmapDao = getRoadmapDao(ctx);
Roadmap roadmap = roadmapDao.getById(roadmapId);
Scenario scenario = scenarioDao.add(roadmapId, "Current", "admin");
mkAxisItems(ctx, scenario, roadmap);
populateScenario(ctx, scenario);
}
use of org.finos.waltz.data.roadmap.RoadmapDao in project waltz by khartec.
the class ScenarioRatingImporter method importScenarioRatings.
public void importScenarioRatings(String filename) throws IOException {
List<Application> allApps = dsl.select().from(APPLICATION).fetch(ApplicationDao.TO_DOMAIN_MAPPER);
assetCodeToApplicationMap = indexBy(a -> ExternalIdValue.orElse(a.assetCode(), null), allApps);
List<ScenarioRatingRow> ratingRows = parseData(filename);
Map<String, Map<String, List<ScenarioRatingRow>>> rowsGroupedByRoadmapByScenario = ratingRows.stream().collect(groupingBy(ScenarioRatingRow::roadmap, groupingBy(ScenarioRatingRow::scenario)));
// get roadmap id
Map<String, Roadmap> roadmapNameToIdMap = getNameToRoadmapMap(roadmapDao);
List<Measurable> measurables = measurableDao.findAll();
rowsGroupedByRoadmapByScenario.forEach((String roadmapName, Map<String, List<ScenarioRatingRow>> scenarioAndRows) -> {
// get roadmap
Roadmap roadmap = roadmapNameToIdMap.get(lower(roadmapName));
checkNotNull(roadmap, "roadmap [" + roadmapName + "] cannot be null");
// get rating scheme
RatingScheme ratingScheme = ratingSchemeDao.getById(roadmap.ratingSchemeId());
checkNotNull(ratingScheme, "ratingScheme cannot be null");
Map<String, RatingSchemeItem> ratingsByName = indexBy(r -> lower(r.name()), ratingScheme.ratings());
// index available scenarios
Map<String, Scenario> scenariosByName = indexBy(s -> lower(s.name()), scenarioDao.findForRoadmapId(roadmap.id().get()));
scenarioAndRows.forEach((scenarioName, rows) -> updateRatingsForScenario(measurables, roadmap, ratingsByName, rows, scenariosByName, scenarioName));
});
}
Aggregations