use of org.mifos.framework.business.EntityMaster in project head by mifos.
the class EntityMasterData method init.
/**
* This method creates a map of entity master table as sets it into the
* servletcontext so that it is available till the application is up.
*
* @throws HibernateProcessException
*/
public void init() throws HibernateProcessException {
Session session = null;
try {
session = StaticHibernateUtil.getSessionTL();
Query query = session.getNamedQuery(NamedQueryConstants.GET_ENTITY_MASTER);
List<EntityMaster> entityMasterData = query.list();
for (EntityMaster entityMaster : entityMasterData) {
entityMap.put(entityMaster.getEntityType(), entityMaster.getId());
}
} catch (HibernateException e) {
logger.error("table entity_master could not be fetched", e);
}
}
use of org.mifos.framework.business.EntityMaster in project head by mifos.
the class QuestionnaireServiceImpl method defineQuestionGroup.
@Override
public QuestionGroupDetail defineQuestionGroup(QuestionGroupDetail questionGroupDetail) throws SystemException {
questionnaireValidator.validateForDefineQuestionGroup(questionGroupDetail);
generateNicknamesForQuestions(questionGroupDetail);
QuestionGroup questionGroup = questionnaireMapper.mapToQuestionGroup(questionGroupDetail);
questionGroupDao.create(questionGroup);
List<EntityMaster> usedSources = new ArrayList<EntityMaster>();
for (Section section : questionGroup.getSections()) {
for (SectionQuestion sectionQuestion : section.getQuestions()) {
usedSources.clear();
for (EventSourceEntity eventSourceEntity : questionGroup.getEventSources()) {
if (!(eventSourceEntity.getSource().getEntityType().equals("Client") || eventSourceEntity.getSource().getEntityType().equals("Loan"))) {
continue;
}
InformationOrder informationOrder = new InformationOrder(null, "additional", sectionQuestion.getId(), eventSourceEntity.getSource().getEntityType(), 999);
if (!sectionQuestion.isShowOnPage()) {
informationOrderService.removeAdditionalQuestionIfExists(informationOrder);
}
if (usedSources.contains(eventSourceEntity.getSource())) {
continue;
}
if (sectionQuestion.isShowOnPage()) {
informationOrderService.addAdditionalQuestionIfNotExists(informationOrder);
}
usedSources.add(eventSourceEntity.getSource());
}
}
}
return questionnaireMapper.mapToQuestionGroupDetail(questionGroup);
}
use of org.mifos.framework.business.EntityMaster in project head by mifos.
the class FieldConfigIntegrationTest method testIsFieldHidden.
@Test
public void testIsFieldHidden() throws HibernateProcessException, PersistenceException {
EntityMasterData.getInstance().init();
List<EntityMaster> entityMasterList = legacyFieldConfigurationDao.getEntityMasterList();
for (EntityMaster entityMaster : entityMasterList) {
fieldConfig.getEntityFieldMap().put(entityMaster.getId(), legacyFieldConfigurationDao.getListOfFields(entityMaster.getId()));
}
Assert.assertEquals(fieldConfig.isFieldHidden("Loan.PurposeOfLoan"), false);
Assert.assertEquals(fieldConfig.isFieldHidden("Group.City"), true);
fieldConfig.getEntityFieldMap().clear();
}
use of org.mifos.framework.business.EntityMaster in project head by mifos.
the class QuestionnaireServiceTest method getEventSources.
private HashSet<EventSourceEntity> getEventSources(String event, String source) {
EventSourceEntity eventSourceEntity = new EventSourceEntity();
EventEntity eventEntity = new EventEntity();
eventEntity.setName(event);
eventSourceEntity.setEvent(eventEntity);
EntityMaster entityMaster = new EntityMaster();
entityMaster.setEntityType(source);
eventSourceEntity.setSource(entityMaster);
HashSet<EventSourceEntity> eventSources = new HashSet<EventSourceEntity>();
eventSources.add(eventSourceEntity);
return eventSources;
}
use of org.mifos.framework.business.EntityMaster in project head by mifos.
the class FieldConfig method init.
/* This method is used to intialize the mandatory and entiyField maps */
public void init() throws HibernateProcessException, PersistenceException {
List<EntityMaster> entityMasterList = legacyFieldConfigurationDao.getEntityMasterList();
for (EntityMaster entityMaster : entityMasterList) {
getEntityFieldMap().put(entityMaster.getId(), legacyFieldConfigurationDao.getListOfFields(entityMaster.getId()));
getEntityMandatoryFieldMap().put(entityMaster.getId(), getMandatoryFieldList(entityMaster.getId()));
}
}
Aggregations