use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method tearDown.
@After
public void tearDown() throws Exception {
new DateTimeService().resetToCurrentSystemDateTime();
loanArrearsAgingHelper = null;
loanArrearHelper = null;
MifosConfigurationManager.getInstance().setProperty(AccountingRulesConstants.CURRENCY_ROUNDING_MODE, oldRoundingMode);
StaticHibernateUtil.flushAndClearSession();
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method getNewMeeting.
/**
* Return a new meeting object.
*
* @param frequency DAILY, WEEKLY, MONTHLY
* @param recurAfter 1 means every day/week/month, 2 means every second day/week/month...
* @param meetingType most commonly a CUSTOMER_MEETING
* @param weekday MONDAY, TUESDAY...
*/
public static MeetingBO getNewMeeting(final RecurrenceType frequency, final short recurAfter, final MeetingType meetingType, final WeekDay weekday) {
MeetingBO meeting;
try {
meeting = new MeetingBO(frequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), meetingType);
meeting.setMeetingPlace("Loan Meeting Place");
} catch (Exception e) {
throw new RuntimeException(e);
}
meeting.getMeetingDetails().getMeetingRecurrence().setWeekDay(weekday);
return meeting;
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method createPeriodicRateFee.
public static RateFeeBO createPeriodicRateFee(final String feeName, final FeeCategory feeCategory, final Double rate, final FeeFormula feeFormula, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, final MeetingBO meeting) {
try {
MeetingBO newMeeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
// GLCodeEntity glCode =
// ChartOfAccountsCache.get("31301").getAssociatedGlcode();
GLCodeEntity glCode = new GLCodeEntity((short) 1, "31301");
RateFeeBO fee = new RateFeeBO(userContext, feeName, new CategoryTypeEntity(feeCategory), new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, rate, new FeeFormulaEntity(feeFormula), false, newMeeting);
// [keith] I have no idea why the fee must save itself. Otherwise
// mySQL errors crop up
// when you try to attach the fee to a loan.
fee.save();
// addObject(fee);
return fee;
// return (RateFeeBO) addObject(testObjectPersistence.persist(fee));
// return (RateFeeBO)
// addObject(testObjectPersistence.createFee(fee));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method createSavingsAccount.
/**
* Also see {@link SavingsTestHelper#createSavingsAccount(SavingsOfferingBO, CustomerBO, AccountState, UserContext)}
* which is less elaborate.
*/
public static SavingsBO createSavingsAccount(final String globalNum, final CustomerBO customer, final AccountState state, final Date startDate, final SavingsOfferingBO savingsOffering, UserContext userContext) throws Exception {
userContext = TestUtils.makeUserWithLocales();
SavingsBO savings = new SavingsBO(userContext, savingsOffering, customer, state, savingsOffering.getRecommendedAmount(), getCustomFieldView());
savings.save();
SavingBOTestUtils.setActivationDate(savings, new DateTimeService().getCurrentJavaDateTime());
StaticHibernateUtil.flushSession();
return getObject(SavingsBO.class, savings.getAccountId());
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method createPeriodicAmountFee.
private static FeeBO createPeriodicAmountFee(final String feeName, final FeeCategory feeCategory, final String feeAmnt, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, String categoryLookupValue) {
try {
GLCodeEntity glCode = ChartOfAccountsCache.get("31301").getAssociatedGlcode();
MeetingBO meeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
lookUpValue.setLookUpName(categoryLookupValue);
CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
categoryType.setLookUpValue(lookUpValue);
FeeBO fee = new AmountFeeBO(userContext, feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, TestUtils.createMoney(feeAmnt), false, meeting);
return testObjectPersistence.createFee(fee);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations