Examples of Loan


Examples of org.mifosplatform.portfolio.loanaccount.domain.Loan

    }

    @Transactional
    @Override
    public CommandProcessingResult deleteCollateral(final Long loanId, final Long collateralId, final Long commandId) {
        final Loan loan = this.loanRepository.findOne(loanId);
        if (loan == null) { throw new LoanNotFoundException(loanId); }
        final LoanCollateral collateral = this.collateralRepository.findByLoanIdAndId(loanId, collateralId);
        if (collateral == null) { throw new CollateralNotFoundException(loanId, collateralId); }

        /**
         * Collaterals may be deleted only when the loan associated with them
         * are yet to be approved
         **/
        if (!loan.status().isSubmittedAndPendingApproval()) { throw new CollateralCannotBeDeletedException(
                LOAN_COLLATERAL_CANNOT_BE_DELETED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanId, collateralId); }

        loan.getCollateral().remove(collateral);
        this.collateralRepository.delete(collateral);

        return new CommandProcessingResultBuilder().withCommandId(commandId).withLoanId(loanId).withEntityId(collateralId).build();
    }
View Full Code Here

Examples of org.switchyard.quickstarts.demos.library.types.Loan

    public Integer getQuantity(Book book) {
        return book != null ? getQuantity(book.getIsbn()) : ZERO;
    }

    public Loan attemptLoan(String isbn, String loanId) {
        Loan loan = new Loan();
        loan.setId(loanId);
        Book book = getBook(isbn);
        if (book != null) {
            synchronized (librarian) {
                int quantity = getQuantity(book);
                if (quantity > 0) {
                    quantity--;
                    isbns_to_quantities.put(isbn, quantity);
                    loan.setApproved(true);
                    loan.setNotes("Happy reading! Remaining copies: " + quantity);
                    loan.setBook(book);
                } else {
                    loan.setApproved(false);
                    loan.setNotes("Book has no copies available.");
                }
            }
        } else {
            loan.setApproved(false);
            loan.setNotes("No book matching isbn: " + isbn);
        }
        return loan;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.