use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class LegacyMasterDaoIntegrationTest method foundStringInCustomValueList.
private boolean foundStringInCustomValueList(final String CustomValueListName, final String searchString) throws Exception {
List<ValueListElement> salutations = legacyMasterDao.findValueListElements(CustomValueListName);
boolean foundString = false;
for (ValueListElement entity : salutations) {
if (entity.getName().compareTo(searchString) == 0) {
foundString = true;
}
}
return foundString;
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class LegacyMasterDaoIntegrationTest method testUpdateValueListElement.
@Test
public void testUpdateValueListElement() throws Exception {
// get a CustomValueListElementDto (as a BusinessActivityEntity)
List<ValueListElement> salutations = legacyMasterDao.findValueListElements(MasterConstants.SALUTATION);
ValueListElement first = salutations.get(0);
Integer id = first.getId();
String originalName = first.getName();
// update it
final String UPDATED_NAME = "Mister";
first.setName(UPDATED_NAME);
// save it
legacyMasterDao.updateValueListElementForLocale(id, UPDATED_NAME);
StaticHibernateUtil.flushSession();
// get the element back
// and verify that it has the new value
salutations.clear();
salutations = legacyMasterDao.findValueListElements(MasterConstants.SALUTATION);
for (ValueListElement entity : salutations) {
if (entity.getId() == id) {
Assert.assertEquals(entity.getName(), UPDATED_NAME);
}
}
// restore it
legacyMasterDao.updateValueListElementForLocale(id, originalName);
StaticHibernateUtil.flushSession();
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class LegacyMasterDaoIntegrationTest method findValueListElementId.
private Integer findValueListElementId(final LegacyMasterDao legacyMasterDao, final String CustomValueListName, final String searchString) throws Exception {
List<ValueListElement> salutations = legacyMasterDao.findValueListElements(CustomValueListName);
Integer elementId = null;
for (ValueListElement entity : salutations) {
if (entity.getName().compareTo(searchString) == 0) {
elementId = entity.getId();
}
}
return elementId;
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class HomePageController method showPopulatedForm.
@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("customerSearch")
public ModelAndView showPopulatedForm(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("customerSearch") CustomerSearchFormBean customerSearchFormBean) throws MifosException, PersistenceException {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "home", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
Short userId = (short) user.getUserId();
UserDetailDto userDetails = this.centerServiceFacade.retrieveUsersDetails(userId);
modelAndView.addObject("customerSearch", customerSearchFormBean);
boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
if (sitePreferenceHelper.isMobile(request)) {
List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
modelAndView.addObject("availibleClientGenders", availibleClientGenders);
HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
modelAndView.addObject("availibleCustomerStates", customerStates);
}
if (userDetails.isLoanOfficer()) {
loadLoanOfficerCustomersHierarchyForSelectedDay(userId, modelAndView, customerSearchFormBean);
modelAndView.addObject("isLoanOfficer", true);
} else {
modelAndView.addObject("isLoanOfficer", false);
}
return modelAndView;
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class PersonAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
PersonActionForm actionform = (PersonActionForm) form;
actionform.clear();
PersonnelBO personnelInSession = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
PersonnelBO personnel = this.personnelDao.findPersonnelById(personnelInSession.getPersonnelId());
List<ValueListElement> titles = this.customerDao.retrieveTitles();
List<ValueListElement> genders = this.customerDao.retrieveGenders();
List<ValueListElement> maritalStatuses = this.customerDao.retrieveMaritalStatuses();
List<ValueListElement> languages = Localization.getInstance().getLocaleForUI();
List<RoleBO> roles = legacyRolesPermissionsDao.getRoles();
List<PersonnelLevelEntity> personnelLevels = this.customerDao.retrievePersonnelLevels();
for (PersonnelLevelEntity personnelLevelEntity : personnelLevels) {
String messageTextLookup = ApplicationContextProvider.getBean(MessageLookup.class).lookup(personnelLevelEntity.getLookUpValue().getPropertiesKey());
personnelLevelEntity.setName(messageTextLookup);
}
SessionUtils.setCollectionAttribute(PersonnelConstants.TITLE_LIST, titles, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.PERSONNEL_LEVEL_LIST, personnelLevels, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.GENDER_LIST, genders, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.MARITAL_STATUS_LIST, maritalStatuses, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.LANGUAGE_LIST, languages, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.ROLES_LIST, roles, request);
SessionUtils.setCollectionAttribute(PersonnelConstants.ROLEMASTERLIST, roles, request);
List<CustomFieldDefinitionEntity> customFieldDefs = new ArrayList<CustomFieldDefinitionEntity>();
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, customFieldDefs, request);
UserContext userContext = getUserContext(request);
List<PersonnelStatusEntity> statuses = legacyMasterDao.findMasterDataEntitiesWithLocale(PersonnelStatusEntity.class);
for (PersonnelStatusEntity personnelStatusEntity : statuses) {
String messageTextLookup = ApplicationContextProvider.getBean(MessageLookup.class).lookup(personnelStatusEntity.getLookUpValue().getPropertiesKey());
personnelStatusEntity.setName(messageTextLookup);
}
SessionUtils.setCollectionAttribute(PersonnelConstants.STATUS_LIST, statuses, request);
OfficeBO loggedInOffice = this.officeDao.findOfficeById(userContext.getBranchId());
List<OfficeDetailsDto> officeHierarchy = new OfficePersistence().getChildOffices(loggedInOffice.getSearchId());
SessionUtils.setCollectionAttribute(PersonnelConstants.OFFICE_LIST, officeHierarchy, request);
actionform.setPersonnelId(personnel.getPersonnelId().toString());
if (personnel.getOffice() != null) {
actionform.setOfficeId(personnel.getOffice().getOfficeId().toString());
}
if (personnel.getTitle() != null) {
actionform.setTitle(personnel.getTitle().toString());
}
if (personnel.getLevel() != null) {
actionform.setLevel(personnel.getLevelEnum().getValue().toString());
}
if (personnel.getStatus() != null) {
actionform.setStatus(personnel.getStatus().getId().toString());
}
actionform.setLoginName(personnel.getUserName());
actionform.setGlobalPersonnelNum(personnel.getGlobalPersonnelNum());
actionform.setCustomFields(new ArrayList<CustomFieldDto>());
if (personnel.getPersonnelDetails() != null) {
PersonnelDetailsEntity personnelDetails = personnel.getPersonnelDetails();
actionform.setFirstName(personnelDetails.getName().getFirstName());
actionform.setMiddleName(personnelDetails.getName().getMiddleName());
actionform.setSecondLastName(personnelDetails.getName().getSecondLastName());
actionform.setLastName(personnelDetails.getName().getLastName());
if (personnelDetails.getGender() != null) {
actionform.setGender(personnelDetails.getGender().toString());
}
if (personnelDetails.getMaritalStatus() != null) {
actionform.setMaritalStatus(personnelDetails.getMaritalStatus().toString());
}
actionform.setAddress(personnelDetails.getAddress());
if (personnelDetails.getDateOfJoiningMFI() != null) {
actionform.setDateOfJoiningMFI(DateUtils.makeDateAsSentFromBrowser(personnelDetails.getDateOfJoiningMFI()));
}
if (personnelDetails.getDob() != null) {
actionform.setDob(DateUtils.makeDateAsSentFromBrowser(personnelDetails.getDob()));
}
}
actionform.setEmailId(personnel.getEmailId());
if (personnel.getPreferredLocale() != null) {
actionform.setPreferredLocale(personnel.getPreferredLocale());
}
if (personnel.getPasswordExpirationDate() != null) {
actionform.setPasswordExpirationDate(DateUtils.makeDateAsSentFromBrowser(personnel.getPasswordExpirationDate()));
}
List<RoleBO> selectList = new ArrayList<RoleBO>();
for (PersonnelRoleEntity personnelRole : personnel.getPersonnelRoles()) {
selectList.add(personnelRole.getRole());
}
SessionUtils.setCollectionAttribute(PersonnelConstants.PERSONNEL_ROLES_LIST, selectList, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, personnel, request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
Aggregations