Package org.mifosplatform.infrastructure.codes.domain

Examples of org.mifosplatform.infrastructure.codes.domain.Code


            this.context.authenticatedUser();

            this.fromApiJsonDeserializer.validateForCreate(command.json());

            final Long codeId = command.entityId();
            final Code code = this.codeRepository.findOne(codeId);
            if (code == null) {
                throw new CodeNotFoundException(codeId);
            }
            final CodeValue codeValue = CodeValue.fromJson(code, command);
            this.codeValueRepository.save(codeValue);

            return new CommandProcessingResultBuilder() //
                    .withCommandId(command.commandId()) //
                    .withEntityId(code.getId()) //
                    .withSubEntityId(codeValue.getId())//
                    .build();
        } catch (final DataIntegrityViolationException dve) {
            handleCodeValueDataIntegrityIssues(command, dve);
            return new CommandProcessingResultBuilder() //
View Full Code Here


    public CommandProcessingResult deleteCodeValue(final Long codeId, final Long codeValueId) {

        try {
            this.context.authenticatedUser();

            final Code code = this.codeRepository.findOne(codeId);
            if (code == null) { throw new CodeNotFoundException(codeId); }

            final CodeValue codeValueToDelete = this.codeValueRepositoryWrapper.findOneWithNotFoundDetection(codeValueId);

            final boolean removed = code.remove(codeValueToDelete);
            if (removed) {
                this.codeRepository.saveAndFlush(code);
            }

            return new CommandProcessingResultBuilder() //
View Full Code Here

        try {
            this.context.authenticatedUser();

            this.fromApiJsonDeserializer.validateForCreate(command.json());

            final Code code = Code.fromJson(command);
            this.codeRepository.save(code);

            return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(code.getId()).build();
        } catch (final DataIntegrityViolationException dve) {
            handleCodeDataIntegrityIssues(command, dve);
            return CommandProcessingResult.empty();
        }
    }
View Full Code Here

        try {
            this.context.authenticatedUser();

            this.fromApiJsonDeserializer.validateForUpdate(command.json());

            final Code code = retrieveCodeBy(codeId);
            final Map<String, Object> changes = code.update(command);

            if (!changes.isEmpty()) {
                this.codeRepository.save(code);
            }
View Full Code Here

    @CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
    public CommandProcessingResult deleteCode(final Long codeId) {

        this.context.authenticatedUser();

        final Code code = retrieveCodeBy(codeId);
        if (code.isSystemDefined()) { throw new SystemDefinedCodeCannotBeChangedException(); }

        try {
            this.codeRepository.delete(code);
            this.codeRepository.flush();
        } catch (final DataIntegrityViolationException e) {
View Full Code Here

        }
        return new CommandProcessingResultBuilder().withEntityId(codeId).build();
    }

    private Code retrieveCodeBy(final Long codeId) {
        final Code code = this.codeRepository.findOne(codeId);
        if (code == null) { throw new CodeNotFoundException(codeId.toString()); }
        return code;
    }
View Full Code Here

TOP

Related Classes of org.mifosplatform.infrastructure.codes.domain.Code

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.