Search in sources :

Example 6 with LookUpValueEntity

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;
}
Also used : HashMap(java.util.HashMap) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 7 with LookUpValueEntity

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());
}
Also used : LookUpEntity(org.mifos.application.master.business.LookUpEntity) LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Test(org.junit.Test)

Example 8 with LookUpValueEntity

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();
}
Also used : LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Test(org.junit.Test)

Example 9 with LookUpValueEntity

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();
}
Also used : LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Test(org.junit.Test)

Example 10 with LookUpValueEntity

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());
}
Also used : FeeActionForm(org.mifos.accounts.fees.struts.actionforms.FeeActionForm) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

LookUpValueEntity (org.mifos.application.master.business.LookUpValueEntity)38 Test (org.junit.Test)11 ActivityEntity (org.mifos.security.rolesandpermission.business.ActivityEntity)9 LookUpEntity (org.mifos.application.master.business.LookUpEntity)8 MessageLookup (org.mifos.application.master.MessageLookup)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 PersistenceException (org.mifos.framework.exceptions.PersistenceException)7 ApplicationException (org.mifos.framework.exceptions.ApplicationException)5 SystemException (org.mifos.framework.exceptions.SystemException)5 LookUpValueLocaleEntity (org.mifos.application.master.business.LookUpValueLocaleEntity)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)3 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)3 FeeBO (org.mifos.accounts.fees.business.FeeBO)3 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)3 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)3 FeeActionForm (org.mifos.accounts.fees.struts.actionforms.FeeActionForm)3 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)3 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)3