Search in sources :

Example 16 with LookUpValueEntity

use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.

the class BirtAdminDocumentUploadActionStrutsTest method removeReport.

private void removeReport(Short reportId) throws PersistenceException {
    legacyAdminDocumentDao.getSession().clear();
    ReportsBO report = legacyAdminDocumentDao.getPersistentObject(ReportsBO.class, reportId);
    ActivityEntity activityEntity = legacyRolesPermissionsDao.getPersistentObject(ActivityEntity.class, report.getActivityId());
    legacyAdminDocumentDao.delete(report);
    LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
    legacyRolesPermissionsDao.delete(activityEntity);
    legacyRolesPermissionsDao.delete(anLookUp);
    StaticHibernateUtil.flushSession();
}
Also used : ActivityEntity(org.mifos.security.rolesandpermission.business.ActivityEntity) ReportsBO(org.mifos.reports.business.ReportsBO) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 17 with LookUpValueEntity

use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.

the class ReportsCategoryActionStrutsTest method deleteActivityForTest.

private void deleteActivityForTest(ActivityEntity activityEntity) throws PersistenceException {
    LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
    legacyRolesPermissionsDao.delete(activityEntity);
    legacyRolesPermissionsDao.delete(anLookUp);
}
Also used : LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 18 with LookUpValueEntity

use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.

the class LegacyRolesPermissionsDaoIntegrationTest method insertActivityForTest.

private ActivityEntity insertActivityForTest(short activityId) throws PersistenceException {
    LookUpValueEntity anLookUp = new LookUpValueEntity();
    LookUpEntity lookUpEntity = legacyMasterDao.getPersistentObject(LookUpEntity.class, Short.valueOf((short) LookUpEntity.ACTIVITY));
    anLookUp.setLookUpEntity(lookUpEntity);
    ActivityEntity parent = legacyMasterDao.getPersistentObject(ActivityEntity.class, (short) 13);
    ActivityEntity activityEntity = new ActivityEntity(activityId, parent, anLookUp);
    legacyRolesPermissionsDao.createOrUpdate(anLookUp);
    legacyRolesPermissionsDao.createOrUpdate(activityEntity);
    return activityEntity;
}
Also used : ActivityEntity(org.mifos.security.rolesandpermission.business.ActivityEntity) LookUpEntity(org.mifos.application.master.business.LookUpEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 19 with LookUpValueEntity

use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.

the class LegacyMasterDao method addValueListElementForLocale.

/**
     * Create a new list element for a single locale.
     *
     * It would be nicer for this to operate on objects rather than ids, but it
     * is a first step that works.
     */
public LookUpValueEntity addValueListElementForLocale(final Short lookupEnityId, final String newElementText, final String lookUpName) throws PersistenceException {
    LookUpEntity lookUpEntity = getPersistentObject(LookUpEntity.class, lookupEnityId);
    LookUpValueEntity lookUpValueEntity = new LookUpValueEntity();
    lookUpValueEntity.setLookUpEntity(lookUpEntity);
    lookUpValueEntity.setLookUpName(lookUpName);
    createOrUpdate(lookUpValueEntity);
    LookUpValueLocaleEntity lookUpValueLocaleEntity = new LookUpValueLocaleEntity();
    lookUpValueLocaleEntity.setLocaleId(Localization.ENGLISH_LOCALE_ID);
    lookUpValueLocaleEntity.setLookUpValue(newElementText);
    lookUpValueLocaleEntity.setLookUpId(lookUpValueEntity.getLookUpId());
    createOrUpdate(lookUpValueLocaleEntity);
    // MifosConfiguration.getInstance().updateKey(lookUpValueEntity,
    // newElementText);
    ApplicationContextProvider.getBean(MessageLookup.class).updateLookupValueInCache(lookUpValueEntity, newElementText);
    return lookUpValueEntity;
}
Also used : LookUpEntity(org.mifos.application.master.business.LookUpEntity) MessageLookup(org.mifos.application.master.MessageLookup) LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 20 with LookUpValueEntity

use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.

the class LegacyMasterDao method updateValueListElementForLocale.

/**
     * Update the String value of a LookUpValueLocaleEntity.
     *
     * @param lookupValueEntityId
     *            - the database id of the LookUpValueLocaleEntity object
     *            representing a ValueListElement
     */
public void updateValueListElementForLocale(final Integer lookupValueEntityId, final String newValue) throws PersistenceException {
    LookUpValueEntity lookupValueEntity = getPersistentObject(LookUpValueEntity.class, lookupValueEntityId);
    Set<LookUpValueLocaleEntity> lookUpValueLocales = lookupValueEntity.getLookUpValueLocales();
    if (lookUpValueLocales != null) {
        for (LookUpValueLocaleEntity entity : lookUpValueLocales) {
            if (entity.getLookUpId().equals(lookupValueEntityId)) {
                entity.setLookUpValue(newValue);
                createOrUpdate(entity);
                ApplicationContextProvider.getBean(MessageLookup.class).updateLookupValueInCache(lookupValueEntity.getLookUpName(), newValue);
                StaticHibernateUtil.commitTransaction();
                break;
            }
        }
    }
}
Also used : MessageLookup(org.mifos.application.master.MessageLookup) LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

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