use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class QuestionnaireServiceFacadeImpl method getAllLinkTypes.
@Override
public Map<String, String> getAllLinkTypes() {
Map<String, String> values = new HashMap<String, String>();
List<LookUpValueEntity> conditionTypes = null;
conditionTypes = questionnaireService.getAllConditions();
for (LookUpValueEntity conditionType : conditionTypes) {
if (conditionType.getLookUpName().equals("QuestionGroupLink.equals"))
values.put(conditionType.getLookUpId().toString(), "Equals");
if (conditionType.getLookUpName().equals("QuestionGroupLink.notEquals"))
values.put(conditionType.getLookUpId().toString(), "Not equals");
if (conditionType.getLookUpName().equals("QuestionGroupLink.greater"))
values.put(conditionType.getLookUpId().toString(), "Greater");
if (conditionType.getLookUpName().equals("QuestionGroupLink.smaller"))
values.put(conditionType.getLookUpId().toString(), "Smaller");
if (conditionType.getLookUpName().equals("QuestionGroupLink.range"))
values.put(conditionType.getLookUpId().toString(), "Range");
if (conditionType.getLookUpName().equals("QuestionGroupLink.dateRange"))
values.put(conditionType.getLookUpId().toString(), "Date range");
if (conditionType.getLookUpName().equals("QuestionGroupLink.before"))
values.put(conditionType.getLookUpId().toString(), "Before");
if (conditionType.getLookUpName().equals("QuestionGroupLink.after"))
values.put(conditionType.getLookUpId().toString(), "After");
}
return values;
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class AccountActionEntityIntegrationTest method testBasics.
@Test
public void testBasics() throws Exception {
AccountActionEntity action = (AccountActionEntity) session.get(AccountActionEntity.class, AccountActionTypes.PAYMENT.getValue());
LookUpValueEntity lookUpValue = action.getLookUpValue();
Assert.assertEquals("AccountAction-Payment", lookUpValue.getLookUpName());
Assert.assertEquals(new Integer(191), lookUpValue.getLookUpId());
LookUpEntity lookUpEntity = lookUpValue.getLookUpEntity();
Assert.assertEquals(LookUpEntity.ACCOUNT_ACTION, lookUpEntity.getEntityId().shortValue());
Assert.assertEquals("AccountAction", lookUpEntity.getEntityType());
Set<LookUpValueLocaleEntity> valueLocales = lookUpValue.getLookUpValueLocales();
Assert.assertEquals(1, valueLocales.size());
LookUpValueLocaleEntity valueLocale = valueLocales.iterator().next();
Assert.assertEquals(1, (int) valueLocale.getLocaleId());
Assert.assertEquals("Payment", ApplicationContextProvider.getBean(MessageLookup.class).lookup(lookUpValue));
Assert.assertEquals("Payment", action.getName());
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class FeeActionStrutsTest method testFailureEditPreviewForRate.
@Test
public void testFailureEditPreviewForRate() throws Exception {
fee = TestObjectFactory.createOneTimeRateFee("One Time Fee", FeeCategory.ALLCUSTOMERS, 12.34, FeeFormula.AMOUNT, FeePayment.UPFRONT, null);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
((RateFeeBO) fee).getFeeFormula().setLookUpValue(lookUpValue);
String feeId = fee.getFeeId().toString();
request.setAttribute("feeModel", TestObjectFactory.getRateBasedFee(feeId, "1", 12.34d, "1"));
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "manage");
addRequestParameter("feeId", feeId);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "editPreview");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
addRequestParameter("rate", "");
actionPerform();
Assert.assertEquals(1, getErrorSize());
Assert.assertEquals("RateAndFormula", 1, getErrorSize(FeeConstants.RATE_OR_AMOUNT));
verifyInputForward();
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class FeeActionStrutsTest method testFailureEditPreviewForAmount.
@Test
public void testFailureEditPreviewForAmount() throws Exception {
fee = TestObjectFactory.createOneTimeAmountFee("One Time Fee", FeeCategory.ALLCUSTOMERS, "12.34", FeePayment.UPFRONT);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
String feeId = fee.getFeeId().toString();
request.setAttribute("feeModel", TestObjectFactory.getAmountBasedFee(feeId, "1", "12.34"));
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "manage");
addRequestParameter("feeId", feeId);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "editPreview");
addRequestParameter("amount", "");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
Assert.assertEquals(1, getErrorSize());
Assert.assertEquals("Fee Amount", 1, getErrorSize(FeeConstants.RATE_OR_AMOUNT));
verifyInputForward();
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class FeeActionStrutsTest method testSuccessfulEditPreview.
@Ignore
@Test
public void testSuccessfulEditPreview() throws Exception {
fee = TestObjectFactory.createOneTimeAmountFee("One Time Fee", FeeCategory.ALLCUSTOMERS, "12.34", FeePayment.UPFRONT);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
String feeId = fee.getFeeId().toString();
request.setAttribute("feeModel", TestObjectFactory.getAmountBasedFee(feeId, "1", "12.34"));
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "manage");
addRequestParameter("feeId", feeId);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "editPreview");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
addRequestParameter("amount", "200.0");
addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString());
actionPerform();
verifyNoActionErrors();
verifyForward(ActionForwards.editPreview_success.toString());
FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
Assert.assertEquals("200.0", actionForm.getAmount());
Assert.assertEquals(FeeStatus.INACTIVE, actionForm.getFeeStatusValue());
Assert.assertNull(actionForm.getRate());
Assert.assertNull(actionForm.getFeeFormula());
}
Aggregations