use of org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence 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");
}
use of org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence 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);
}
}
use of org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence 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);
}
}
Aggregations