Package org.mifosplatform.portfolio.interestratechart.domain

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


        final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
        @SuppressWarnings("unused")
        final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
                .resource(INTERESTRATE_CHART_RESOURCE_NAME);
        final String currencyCode = this.fromApiJsonHelper.extractStringNamed(currencyCodeParamName, element);
        final InterestRateChart newChart = this.assembleFrom(element, currencyCode);

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


        // assemble chart Slabs
        final Collection<InterestRateChartSlab> newChartSlabs = this.chartSlabAssembler.assembleChartSlabsFrom(element,
                currencyCode);

        final InterestRateChartFields fields = InterestRateChartFields.createNew(name, description, fromDate, toDate);
        final InterestRateChart newChart = InterestRateChart.createNew(fields, newChartSlabs);
        return newChart;
    }
View Full Code Here

        final InterestRateChart newChart = InterestRateChart.createNew(fields, newChartSlabs);
        return newChart;
    }

    public InterestRateChart assembleFrom(final Long interestRateChartId) {
        final InterestRateChart interestRateChart = this.interestRateChartRepositoryWrapper
                .findOneWithNotFoundDetection(interestRateChartId);
        return interestRateChart;
    }
View Full Code Here

        if (command.parameterExists(chartsParamName)) {
            final JsonArray chartsArray = command.arrayOfParameterNamed(chartsParamName);
            if (chartsArray != null) {
                for (int i = 0; i < chartsArray.size(); i++) {
                    final JsonObject interstRateChartElement = chartsArray.get(i).getAsJsonObject();
                    InterestRateChart chart = this.chartAssembler.assembleFrom(interstRateChartElement, currencyCode);
                    charts.add(chart);
                }
            }
        }
        return charts;
View Full Code Here

    @Override
    @Transactional
    public CommandProcessingResult create(JsonCommand command) {
        this.interestRateChartDataValidator.validateForCreate(command.json());

        final InterestRateChart interestRateChart = this.interestRateChartAssembler.assembleFrom(command);

        this.interestRateChartRepository.saveAndFlush(interestRateChart);

        final Long interestRateChartId = interestRateChart.getId();

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

    @Override
    @Transactional
    public CommandProcessingResult update(Long interestRateChartId, JsonCommand command) {
        this.interestRateChartDataValidator.validateUpdate(command.json());
        final Map<String, Object> changes = new LinkedHashMap<>(20);
        final InterestRateChart interestRateChart = this.interestRateChartAssembler.assembleFrom(interestRateChartId);

        interestRateChart.update(command, changes);

        this.interestRateChartRepository.saveAndFlush(interestRateChart);

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

                for (int i = 0; i < array.size(); i++) {
                    final JsonObject chartElement = array.get(i).getAsJsonObject();
                    JsonCommand chartCommand = JsonCommand.fromExistingCommand(command, chartElement);
                    if (chartCommand.parameterExists(idParamName)) {
                        final Long chartId = chartCommand.longValueOfParameterNamed(idParamName);
                        final InterestRateChart chart = this.findChart(chartId);
                        if (chart == null) {
                            baseDataValidator.parameter(idParamName).value(chartId).failWithCode("no.chart.associated.with.id");
                        } else if (chartCommand.parameterExists(deleteParamName)) {
                            if (this.removeChart(chart)) {
                                deletedCharts.put(idParamName, chartId);
                            }
                        } else {
                            chart.update(chartCommand, chartsChanges, baseDataValidator, this.setOfCharts(), this.currency().getCode());
                        }
                    } else {
                        // assemble chart
                        final InterestRateChart newChart = this.chartAssembler.assembleFrom(chartElement, this.currency().getCode());
                        this.addChart(newChart);
                    }
                }
            }
        }
View Full Code Here

        }
    }

    @Override
    public InterestRateChart applicableChart(final LocalDate target) {
        InterestRateChart applicableChart = null;
        if (this.charts != null) {
            for (InterestRateChart chart : this.charts) {
                if (chart.isApplicableChartFor(target)) {
                    applicableChart = chart;
                    break;
View Full Code Here

    public InterestRateChartRepositoryWrapper(final InterestRateChartRepository repository) {
        this.repository = repository;
    }

    public InterestRateChart findOneWithNotFoundDetection(final Long intrestRateChartId) {
        final InterestRateChart interestRateChart = this.repository.findOne(intrestRateChartId);
        if (interestRateChart == null) { throw new InterestRateChartNotFoundException(intrestRateChartId); }
        return interestRateChart;
    }
View Full Code Here

    }

    @Override
    @Transactional
    public CommandProcessingResult deleteChart(Long chartId) {
        final InterestRateChart chart = this.interestRateChartRepository.findOneWithNotFoundDetection(chartId);
        // validate if chart is associated with any accounts

        this.interestRateChartRepository.delete(chart);
        return new CommandProcessingResultBuilder() //
                .withEntityId(chartId) //
View Full Code Here

TOP

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

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.