Search in sources :

Example 46 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class LoanOfferingBO method update.

public void update(final Short userId, final String prdOfferingName, final String prdOfferingShortName, final ProductCategoryBO prdCategory, final PrdApplicableMasterEntity prdApplicableMaster, final Date startDate, final Date endDate, final String description, final PrdStatus status, final GracePeriodTypeEntity gracePeriodType, final InterestTypesEntity interestTypes, final Short gracePeriodDuration, final Double maxInterestRate, final Double minInterestRate, final Double defInterestRate, final boolean loanCounter, final boolean intDedDisbursement, final boolean prinDueLastInst, final List<FundBO> funds, final List<FeeBO> fees, final List<PenaltyBO> penalties, final Short recurAfter, final RecurrenceType recurrenceType, final LoanPrdActionForm loanPrdActionForm, boolean waiverInterest, Set<QuestionGroupReference> questionGroups) throws ProductDefinitionException {
    logger.debug("Updating loan Offering :" + prdOfferingName);
    super.update(userId, prdOfferingName, prdOfferingShortName, prdCategory, prdApplicableMaster, startDate, endDate, description, status);
    validateForUpdate(gracePeriodType, gracePeriodDuration, interestTypes, maxInterestRate, minInterestRate, defInterestRate, loanCounter, intDedDisbursement, prinDueLastInst, funds, fees, recurAfter);
    setUpdateDetails(userId);
    setGracePeriodTypeAndDuration(intDedDisbursement, gracePeriodType, gracePeriodDuration);
    this.interestTypes = interestTypes;
    this.maxInterestRate = maxInterestRate;
    this.minInterestRate = minInterestRate;
    this.defInterestRate = defInterestRate;
    setLoanCounter(loanCounter);
    setWaiverInterest(waiverInterest);
    setIntDedDisbursement(intDedDisbursement);
    setPrinDueLastInst(prinDueLastInst);
    populateLoanAmountAndInstall(loanPrdActionForm);
    setMeetingDetails(startDate, recurAfter, recurrenceType);
    setFunds(funds);
    setFees(fees);
    setPenalties(penalties);
    mergeQuestionGroups(questionGroups);
    try {
        new LoanPrdPersistence().createOrUpdate(this);
    } catch (PersistenceException e) {
        throw new ProductDefinitionException(e);
    }
    logger.debug("Loan Offering updated:" + prdOfferingName);
}
Also used : LoanPrdPersistence(org.mifos.accounts.productdefinition.persistence.LoanPrdPersistence) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 47 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class PrdOfferingBO method update.

public void update(final Short userId, final String prdOfferingName, final String prdOfferingShortName, final ProductCategoryBO prdCategory, final PrdApplicableMasterEntity prdApplicableMaster, final Date startDate, final Date endDate, final String description, final PrdStatus status) throws ProductDefinitionException {
    vaildate(prdOfferingName, prdOfferingShortName, prdCategory, prdApplicableMaster, startDate);
    validateStartDateForUpdate(startDate);
    validateEndDateAgainstCurrentDate(startDate, endDate);
    if (!prdOfferingName.equals(this.prdOfferingName)) {
        validateDuplicateProductOfferingName(prdOfferingName);
    }
    if (!prdOfferingShortName.equals(this.prdOfferingShortName)) {
        validateDuplicateProductOfferingShortName(prdOfferingShortName);
    }
    this.prdOfferingName = prdOfferingName;
    this.prdOfferingShortName = prdOfferingShortName;
    this.prdCategory = prdCategory;
    this.prdApplicableMaster = prdApplicableMaster;
    this.startDate = startDate;
    this.endDate = endDate;
    this.description = description;
    try {
        this.prdStatus = new PrdOfferingPersistence().getPrdStatus(status);
    } catch (PersistenceException pe) {
        throw new ProductDefinitionException(pe);
    }
    logger.debug("creating product offering done");
}
Also used : PrdOfferingPersistence(org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 48 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class PrdOfferingBO method validateDuplicateProductOfferingName.

private void validateDuplicateProductOfferingName(final String productOfferingName) throws ProductDefinitionException {
    logger.debug("Checking for duplicate product offering name");
    try {
        PrdOfferingPersistence prdOfferingPersistence = new PrdOfferingPersistence();
        Integer count = prdOfferingPersistence.getProductOfferingNameCount(productOfferingName);
        if (!count.equals(0)) {
            throw new ProductDefinitionException(ProductDefinitionConstants.DUPLPRDINSTNAME);
        }
    } catch (PersistenceException e) {
        throw new ProductDefinitionException(e);
    }
}
Also used : PrdOfferingPersistence(org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 49 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class PrdOfferingBO method getPrdStatus.

private PrdStatusEntity getPrdStatus(final Date startDate, final ProductTypeEntity prdType) throws ProductDefinitionException {
    logger.debug("getting the Product status for prdouct offering with start date :" + startDate + " and product Type :" + prdType.getProductTypeID());
    PrdStatus prdStatus = null;
    if (!prdType.getProductTypeID().equals(ProductType.LOAN.getValue()) && startDate.compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) == 0) {
        prdStatus = getActivePrdStatus(prdType);
    } else if (prdType.getProductTypeID().equals(ProductType.LOAN.getValue()) && startDate.compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) <= 0) {
        prdStatus = getActivePrdStatus(prdType);
    } else {
        prdStatus = getInActivePrdStatus(prdType);
    }
    try {
        logger.debug("getting the Product status for product status :" + prdStatus);
        return new PrdOfferingPersistence().getPrdStatus(prdStatus);
    } catch (PersistenceException e) {
        throw new ProductDefinitionException(e);
    }
}
Also used : PrdOfferingPersistence(org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) PrdStatus(org.mifos.accounts.productdefinition.util.helpers.PrdStatus)

Example 50 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class ProductCategoryBO method updateProductCategory.

/**
     * @deprecated use service facade or appropriate test factory method
     */
@Deprecated
public void updateProductCategory(final String productCategoryName, final String productCategoryDesc, final PrdCategoryStatusEntity prdCategoryStatus) throws ProductDefinitionException {
    logger.debug("Updating product category name");
    validateDuplicateProductCategoryName(productCategoryName, productCategoryID);
    this.productCategoryName = productCategoryName;
    this.productCategoryDesc = productCategoryDesc;
    this.prdCategoryStatus = prdCategoryStatus;
    try {
        getLegacyProductCategoryDao().createOrUpdate(this);
    } catch (PersistenceException e) {
        throw new ProductDefinitionException(e);
    }
    logger.debug("Updating product category done");
}
Also used : ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Aggregations

ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)65 Test (org.junit.Test)51 Date (java.sql.Date)50 Money (org.mifos.framework.util.helpers.Money)49 MeetingBO (org.mifos.application.meeting.business.MeetingBO)15 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)13 PersistenceException (org.mifos.framework.exceptions.PersistenceException)9 ArrayList (java.util.ArrayList)5 InterestTypesEntity (org.mifos.application.master.business.InterestTypesEntity)5 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)4 PrdApplicableMasterEntity (org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)4 PrdStatusEntity (org.mifos.accounts.productdefinition.business.PrdStatusEntity)4 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)4 PrdOfferingPersistence (org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 GracePeriodTypeEntity (org.mifos.accounts.productdefinition.business.GracePeriodTypeEntity)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)2 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)2 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)2