Search in sources :

Example 11 with Measurable

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();
}
Also used : Measurable(org.finos.waltz.model.measurable.Measurable)

Example 12 with Measurable

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);
}
Also used : Measurable(org.finos.waltz.model.measurable.Measurable) ImmutableMeasurable(org.finos.waltz.model.measurable.ImmutableMeasurable) ImmutableAllocationScheme(org.finos.waltz.model.allocation_scheme.ImmutableAllocationScheme) AllocationScheme(org.finos.waltz.model.allocation_scheme.AllocationScheme) MeasurableCategory(org.finos.waltz.model.measurable_category.MeasurableCategory)

Example 13 with Measurable

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;
}
Also used : Measurable(org.finos.waltz.model.measurable.Measurable)

Example 14 with Measurable

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();
}
Also used : TaxonomyManagementUtilities.validatePrimaryMeasurable(org.finos.waltz.service.taxonomy_management.TaxonomyManagementUtilities.validatePrimaryMeasurable) Measurable(org.finos.waltz.model.measurable.Measurable)

Example 15 with Measurable

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));
}
Also used : Condition(org.jooq.Condition) Measurable(org.finos.waltz.model.measurable.Measurable) ArrayList(java.util.ArrayList)

Aggregations

Measurable (org.finos.waltz.model.measurable.Measurable)26 MeasurableDao (org.finos.waltz.data.measurable.MeasurableDao)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 EntityKind (org.finos.waltz.model.EntityKind)6 Collectors (java.util.stream.Collectors)5 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)5 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)5 DIConfiguration (org.finos.waltz.service.DIConfiguration)5 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)5 IOException (java.io.IOException)4 InputStreamReader (java.io.InputStreamReader)4 Collection (java.util.Collection)4 Map (java.util.Map)4 Checks.checkTrue (org.finos.waltz.common.Checks.checkTrue)4 MapUtilities.indexBy (org.finos.waltz.common.MapUtilities.indexBy)4 StringUtilities.lower (org.finos.waltz.common.StringUtilities.lower)4 ApplicationDao (org.finos.waltz.data.application.ApplicationDao)4 RatingSchemeDAO (org.finos.waltz.data.rating_scheme.RatingSchemeDAO)4 RoadmapDao (org.finos.waltz.data.roadmap.RoadmapDao)4