use of org.finos.waltz.data.GenericSelector in project waltz by khartec.
the class InvolvementService method findPeopleByGenericEntitySelector.
public List<Person> findPeopleByGenericEntitySelector(IdSelectionOptions selectionOptions) {
checkNotNull(selectionOptions, "selectionOptions cannot be null");
GenericSelector genericSelector = genericSelectorFactory.apply(selectionOptions);
return involvementDao.findPeopleByGenericEntitySelector(genericSelector);
}
use of org.finos.waltz.data.GenericSelector in project waltz by khartec.
the class FlowDiagramEntityService method findForEntitySelector.
public List<FlowDiagramEntity> findForEntitySelector(IdSelectionOptions options) {
checkNotNull(options, "options cannot be null");
GenericSelector selector = genericSelectorFactory.apply(options);
return flowDiagramEntityDao.findForEntitySelector(selector.kind(), selector.selector());
}
use of org.finos.waltz.data.GenericSelector in project waltz by khartec.
the class ComplexityService method getComplexitySummaryForSelector.
public ComplexitySummary getComplexitySummaryForSelector(Long complexityKindId, EntityKind targetKind, IdSelectionOptions options, int limit) {
GenericSelector genericSelector = genericSelectorFactory.applyForKind(targetKind, options);
Set<Complexity> topComplexities = complexityDao.findTopComplexityScoresForKindAndSelector(complexityKindId, genericSelector, limit);
Tuple2<BigDecimal, BigDecimal> averageAndTotalScore = complexityDao.getAverageAndTotalScoreByKindAndSelector(complexityKindId, genericSelector);
Tuple2<Integer, Integer> mappedAndMissingCountsForKindBySelector = complexityDao.getMappedAndMissingCountsForKindBySelector(complexityKindId, genericSelector);
ComplexityKind complexityKind = complexityKindService.getById(complexityKindId);
return ImmutableComplexitySummary.builder().complexityKind(complexityKind).topComplexityScores(topComplexities).average(averageAndTotalScore.v1.setScale(2, ROUND_HALF_UP)).total(averageAndTotalScore.v2).mappedCount(mappedAndMissingCountsForKindBySelector.v1).missingCount(mappedAndMissingCountsForKindBySelector.v2).build();
}
use of org.finos.waltz.data.GenericSelector in project waltz by khartec.
the class SurveyRunService method generateSurveyInstanceRecipients.
public List<SurveyInstanceRecipient> generateSurveyInstanceRecipients(InstancesAndRecipientsCreateCommand command) {
SurveyRun surveyRun = surveyRunDao.getById(command.surveyRunId());
checkNotNull(surveyRun, "surveyRun " + command.surveyRunId() + " not found");
SurveyTemplate surveyTemplate = surveyTemplateDao.getById(surveyRun.surveyTemplateId());
checkNotNull(surveyTemplate, "surveyTemplate " + surveyRun.surveyTemplateId() + " not found");
GenericSelector genericSelector = genericSelectorFactory.applyForKind(surveyTemplate.targetEntityKind(), surveyRun.selectionOptions());
Map<EntityReference, List<Person>> entityRefToPeople = involvementDao.findPeopleByEntitySelectorAndInvolvement(surveyTemplate.targetEntityKind(), genericSelector.selector(), surveyRun.involvementKindIds());
return entityRefToPeople.entrySet().stream().flatMap(e -> e.getValue().stream().map(p -> ImmutableSurveyInstanceRecipient.builder().surveyInstance(ImmutableSurveyInstance.builder().surveyEntity(e.getKey()).surveyRunId(surveyRun.id().get()).status(SurveyInstanceStatus.NOT_STARTED).dueDate(command.dueDate()).approvalDueDate(command.approvalDueDate()).owningRole(command.owningRole()).build()).person(p).build())).distinct().collect(toList());
}
use of org.finos.waltz.data.GenericSelector in project waltz by khartec.
the class EntityCostExtractor method registerCostsForSelector.
private void registerCostsForSelector(String costsForSelectorPath) {
post(costsForSelectorPath, (request, response) -> {
IdSelectionOptions idSelectionOptions = WebUtilities.readIdSelectionOptionsFromBody(request);
EntityKind targetKind = WebUtilities.getKind(request);
GenericSelector genericSelector = genericSelectorFactory.applyForKind(targetKind, idSelectionOptions);
SelectJoinStep<Record1<Integer>> latestYear = DSL.select(DSL.max(COST.YEAR)).from(COST);
SelectSeekStep2<Record, String, Long> qry = dsl.select(COST.ENTITY_ID.as("Entity ID"), COST.ENTITY_KIND.as("Entity Kind")).select(ENTITY_NAME_FIELD.as("Name")).select(COST_KIND.NAME.as("Kind"), COST_KIND.DESCRIPTION.as("Kind Description")).select(COST.YEAR.as("Year"), COST.AMOUNT.as("Amount"), COST.PROVENANCE.as("Provenance")).from(COST).innerJoin(COST_KIND).on(COST.COST_KIND_ID.eq(COST_KIND.ID)).where(COST.ENTITY_ID.in(genericSelector.selector()).and(COST.ENTITY_KIND.eq(genericSelector.kind().name()))).and(COST.YEAR.eq(latestYear)).orderBy(ENTITY_NAME_FIELD.as("Name"), COST.COST_KIND_ID);
return writeExtract(mkFilename(idSelectionOptions.entityReference()), qry, request, response);
});
}
Aggregations