use of org.mifos.application.master.business.LookUpEntity in project head by mifos.
the class LegacyRolesPermissionsDao method createLookUpValue.
private int createLookUpValue(DynamicLookUpValueCreationTypes type, String lookUpDescription) throws PersistenceException {
LookUpValueEntity anLookUp = new LookUpValueEntity();
LookUpEntity lookUpEntity = getPersistentObject(LookUpEntity.class, Short.valueOf((short) LookUpEntity.ACTIVITY));
String lookupName = SearchUtils.generateLookupName(type.name(), lookUpDescription);
anLookUp.setLookUpName(lookupName);
anLookUp.setLookUpEntity(lookUpEntity);
createOrUpdate(anLookUp);
ApplicationContextProvider.getBean(MessageLookup.class).updateLookupValueInCache(lookupName, lookUpDescription);
int lookUpId = anLookUp.getLookUpId().intValue();
return lookUpId;
}
use of org.mifos.application.master.business.LookUpEntity in project head by mifos.
the class LegacyRolesPermissionsDaoIntegrationTest method testShouldInsertSuccessActivity.
@Test
public void testShouldInsertSuccessActivity() throws Exception {
Session session = StaticHibernateUtil.getSessionTL();
short parentId = 13;
int numberOfActivitiesBefore = session.createQuery("from ActivityEntity r where r.parent.id =" + parentId).list().size();
RoleBO roleBo = (RoleBO) session.load(RoleBO.class, (short) RolesAndPermissionConstants.ADMIN_ROLE);
int adminActivities = roleBo.getActivities().size();
LookUpEntity lookUpEntity = new LookUpEntity();
lookUpEntity.setEntityId((short) LookUpEntity.ACTIVITY);
int lookUpId = legacyRolesPermissionsDao.createActivityForReports(parentId, "abcd");
Assert.assertEquals("abcd", legacyMasterDao.retrieveOneLookUpValueLocaleEntity(Localization.ENGLISH_LOCALE_ID, lookUpId).getLookUpValue());
Assert.assertEquals(legacyRolesPermissionsDao.calculateDynamicActivityId(), (int) legacyRolesPermissionsDao.getActivityEntity(lookUpId).getId() - 1);
int numberOfActivitiesAfter = session.createQuery("from ActivityEntity r where r.parent.id =" + parentId).list().size();
Assert.assertEquals(numberOfActivitiesBefore + 1, numberOfActivitiesAfter);
Assert.assertEquals(adminActivities + 1, roleBo.getActivities().size());
}
use of org.mifos.application.master.business.LookUpEntity 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;
}
use of org.mifos.application.master.business.LookUpEntity in project head by mifos.
the class ApplicationConfigurationDaoHibernate method findLookupValueByEntityType.
@Override
public LookUpEntity findLookupValueByEntityType(final String entityType) {
HashMap<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("entityType", entityType);
LookUpEntity entity = (LookUpEntity) this.genericDao.executeUniqueResultNamedQuery("findLookupEntityByEntityType", queryParameters);
return entity;
}
use of org.mifos.application.master.business.LookUpEntity in project head by mifos.
the class BirtReportsUploadActionStrutsTest 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;
}
Aggregations