use of org.finos.waltz.model.measurable.Measurable in project waltz by khartec.
the class UpdateMeasurableConcreteFlagCommandProcessor method preview.
public TaxonomyChangePreview preview(TaxonomyChangeCommand cmd) {
doBasicValidation(cmd);
Measurable m = validatePrimaryMeasurable(measurableService, cmd);
ImmutableTaxonomyChangePreview.Builder preview = ImmutableTaxonomyChangePreview.builder().command(ImmutableTaxonomyChangeCommand.copyOf(cmd).withPrimaryReference(m.entityReference()));
boolean newValue = getConcreteParam(cmd, true);
if (hasNoChange(m.concrete(), newValue, "Concrete Flag")) {
return preview.build();
}
if (!newValue) {
addToPreview(preview, findCurrentRatingMappings(measurableRatingService, cmd), Severity.WARNING, "Current app mappings exist to item, these will be invalid when the item becomes non-concrete");
}
return preview.build();
}
use of org.finos.waltz.model.measurable.Measurable in project waltz by khartec.
the class AllocationHarness method setup.
private static Tuple4<Application, MeasurableCategory, List<Measurable>, AllocationScheme> setup(DSLContext dsl, AllocationSchemeService schemesService, MeasurableService measurableService, MeasurableCategoryDao categoryDao, ApplicationService applicationService) {
deleteAll(dsl);
Application app = mkApp(dsl, applicationService);
MeasurableCategory category = mkCategory(dsl, categoryDao);
List<Measurable> measurables = mkMeasurables(measurableService, category);
AllocationScheme scheme = mkScheme(schemesService, category);
return Tuple.tuple(app, category, measurables, scheme);
}
use of org.finos.waltz.model.measurable.Measurable in project waltz by khartec.
the class MoveMeasurableCommandProcessor method validate.
private Measurable validate(TaxonomyChangeCommand cmd) {
doBasicValidation(cmd);
long categoryId = cmd.changeDomain().id();
Measurable m = validateMeasurableInCategory(measurableService, cmd.primaryReference().id(), categoryId);
Long destinationId = getDestination(cmd);
if (destinationId != null) {
validateMeasurableInCategory(measurableService, destinationId, categoryId);
}
return m;
}
use of org.finos.waltz.model.measurable.Measurable in project waltz by khartec.
the class UpdateMeasurableExternalIdCommandProcessor method preview.
public TaxonomyChangePreview preview(TaxonomyChangeCommand cmd) {
doBasicValidation(cmd);
Measurable m = validatePrimaryMeasurable(measurableService, cmd);
return ImmutableTaxonomyChangePreview.builder().command(ImmutableTaxonomyChangeCommand.copyOf(cmd).withPrimaryReference(m.entityReference())).build();
}
use of org.finos.waltz.model.measurable.Measurable in project waltz by khartec.
the class MeasurableSearchDao method search.
@Override
public List<Measurable> search(EntitySearchOptions options) {
List<String> terms = mkTerms(lower(options.searchQuery()));
if (terms.isEmpty()) {
return emptyList();
}
Condition externalIdCondition = mkStartsWithTermSearch(MEASURABLE.EXTERNAL_ID, terms);
Condition nameCondition = mkBasicTermSearch(MEASURABLE.NAME, terms);
Condition entityLifecycleCondition = MEASURABLE.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses());
List<Measurable> measurablesViaExternalId = dsl.select(MEASURABLE.fields()).from(MEASURABLE).where(externalIdCondition).and(entityLifecycleCondition).orderBy(MEASURABLE.EXTERNAL_ID).limit(options.limit()).fetch(MeasurableDao.TO_DOMAIN_MAPPER);
List<Measurable> measurablesViaName = dsl.select(MEASURABLE.fields()).from(MEASURABLE).where(nameCondition).and(entityLifecycleCondition).orderBy(MEASURABLE.NAME).limit(options.limit()).fetch(MeasurableDao.TO_DOMAIN_MAPPER);
List<Measurable> measurablesViaFullText = searcher.searchFullText(dsl, options);
return new ArrayList<>(orderedUnion(measurablesViaExternalId, measurablesViaName, measurablesViaFullText));
}
Aggregations