Package org.mifosplatform.portfolio.interestratechart.domain

Examples of org.mifosplatform.portfolio.interestratechart.domain.InterestRateChartSlab


    public InterestRateChartSlabRepositoryWrapper(final InterestRateChartSlabRepository repository) {
        this.repository = repository;
    }

    public InterestRateChartSlab findOneWithNotFoundDetection(final Long chartSlabId) {
        final InterestRateChartSlab chartSlab = this.repository.findOne(chartSlabId);
        if (chartSlab == null) { throw new InterestRateChartSlabNotFoundException(chartSlabId); }
        return chartSlab;
    }
View Full Code Here


    @Override
    @Transactional
    public CommandProcessingResult create(JsonCommand command) {
        this.interestRateChartSlabDataValidator.validateCreate(command.json());

        final InterestRateChartSlab interestRateChartSlab = this.interestRateChartSlabAssembler.assembleFrom(command);

        this.chartSlabRepository.save(interestRateChartSlab);

        final Long interestRateChartId = interestRateChartSlab.getId();

        return new CommandProcessingResultBuilder() //
                .withCommandId(command.commandId()) //
                .withEntityId(interestRateChartId) //
                .build();
View Full Code Here

    @Override
    @Transactional
    public CommandProcessingResult update(Long chartSlabId, Long interestRateChartId, JsonCommand command) {
        this.interestRateChartSlabDataValidator.validateUpdate(command.json());
        final Map<String, Object> changes = new LinkedHashMap<>(20);
        final InterestRateChartSlab updateChartSlabs = this.interestRateChartSlabAssembler.assembleFrom(chartSlabId,
                interestRateChartId);
        final Locale locale = command.extractLocale();
        updateChartSlabs.update(command, changes,locale);

        this.chartSlabRepository.saveAndFlush(updateChartSlabs);

        return new CommandProcessingResultBuilder() //
                .withCommandId(command.commandId()) //
View Full Code Here

    }

    @Override
    @Transactional
    public CommandProcessingResult deleteChartSlab(Long chartSlabId, Long interestRateChartId) {
        final InterestRateChartSlab deleteChartSlabs = this.interestRateChartSlabAssembler.assembleFrom(chartSlabId,
                interestRateChartId);
        this.chartSlabRepository.delete(deleteChartSlabs);
        return new CommandProcessingResultBuilder() //
                .withEntityId(chartSlabId) //
                .build();
View Full Code Here

        final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
        final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
                .resource(INTERESTRATE_CHART_SLAB_RESOURCE_NAME);

        final InterestRateChartSlab newChartSlab = assembleChartSlabs(chart, elementObject, currencyCode, locale);
        // validate chart Slabs
        newChartSlab.slabFields().validateChartSlabPlatformRules(command, baseDataValidator, locale);
        chart.validateChartSlabs(baseDataValidator);

        throwExceptionIfValidationWarningsExist(dataValidationErrors);
        return newChartSlab;
    }
View Full Code Here

        final BigDecimal amountRangeTo = this.fromApiJsonHelper.extractBigDecimalNamed(amountRangeToParamName, element, locale);
        final BigDecimal annualInterestRate = this.fromApiJsonHelper.extractBigDecimalNamed(annualInterestRateParamName, element, locale);

        final InterestRateChartSlabFields slabFields = InterestRateChartSlabFields.createNew(description, periodType, fromPeriod, toPeriod,
                amountRangeFrom, amountRangeTo, annualInterestRate, currencyCode);
        InterestRateChartSlab interestRateChartSlab = InterestRateChartSlab.createNew(slabFields, interestRateChart);
        this.incentiveAssembler.assembleIncentivesFrom(element, interestRateChartSlab, locale);
        return interestRateChartSlab;

    }
View Full Code Here

    }

    public InterestRateChartSlab assembleFrom(final Long chartSlabId, final Long chartId) {
        final InterestRateChart chart = this.interestRateChartRepositoryWrapper.findOneWithNotFoundDetection(chartId);
        final InterestRateChartSlab interestRateChartSlab = chart.findChartSlab(chartSlabId);

        if (interestRateChartSlab == null) throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId);

        return interestRateChartSlab;
    }
View Full Code Here

            final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
            if (topLevelJsonElement.has(chartSlabs) && topLevelJsonElement.get(chartSlabs).isJsonArray()) {
                final JsonArray array = topLevelJsonElement.get(chartSlabs).getAsJsonArray();
                for (int i = 0; i < array.size(); i++) {
                    final JsonObject interstRateChartElement = array.get(i).getAsJsonObject();
                    final InterestRateChartSlab chartSlab = this.assembleChartSlabs(null, interstRateChartElement, currencyCode, locale);
                    interestRateChartSlabsSet.add(chartSlab);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.mifosplatform.portfolio.interestratechart.domain.InterestRateChartSlab

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.