use of org.mifos.customers.personnel.business.PersonnelLevelEntity in project head by mifos.
the class PersonnelServiceFacadeWebTier method getPersonnelInformationDto.
@Override
public PersonnelInformationDto getPersonnelInformationDto(final Long userId, final String globalNumber) {
PersonnelBO personnel = null;
if (userId != null) {
personnel = personnelDao.findPersonnelById(userId.shortValue());
} else {
personnel = personnelDao.findByGlobalPersonnelNum(globalNumber);
}
if (personnel == null) {
throw new MifosRuntimeException("personnel not found for id" + userId);
}
String displayName = personnel.getDisplayName();
PersonnelStatusEntity personnelStatus = personnel.getStatus();
String statusName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(personnelStatus.getLookUpValue());
ListElement status = new ListElement(new Integer(personnelStatus.getId()), statusName);
boolean locked = personnel.isLocked();
PersonnelDetailsEntity personnelDetailsEntity = personnel.getPersonnelDetails();
Address address = personnelDetailsEntity.getAddress();
AddressDto addressDto = new AddressDto(address.getLine1(), address.getLine2(), address.getLine3(), address.getCity(), address.getState(), address.getCountry(), address.getZip(), address.getPhoneNumber());
Name name = personnelDetailsEntity.getName();
PersonnelDetailsDto personnelDetails = new PersonnelDetailsDto(personnelDetailsEntity.getGovernmentIdNumber(), new DateTime(personnelDetailsEntity.getDob()).toDateMidnight().toDateTime(), personnelDetailsEntity.getMaritalStatus(), personnelDetailsEntity.getGender(), new DateTime(personnelDetailsEntity.getDateOfJoiningMFI()).toDateMidnight().toDateTime(), new DateTime(personnelDetailsEntity.getDateOfJoiningBranch()).toDateMidnight().toDateTime(), new DateTime(personnelDetailsEntity.getDateOfLeavingBranch()).toDateMidnight().toDateTime(), addressDto, name.getFirstName(), name.getMiddleName(), name.getSecondLastName(), name.getLastName(), new DateTime(personnelDetailsEntity.getPersonnel().getPasswordExpirationDate()).toDateMidnight().toDateTime());
String emailId = personnel.getEmailId();
Short preferredLocale = personnel.getPreferredLocale();
String languageName = Localization.getInstance().getDisplayName(preferredLocale);
if (preferredLocale != null) {
languageName = Localization.getInstance().getDisplayName(preferredLocale);
}
PersonnelLevelEntity level = personnel.getLevel();
OfficeBO office = personnel.getOffice();
Integer title = personnel.getTitle();
Set<PersonnelRoleEntity> personnelRoleEntities = personnel.getPersonnelRoles();
Set<ListElement> personnelRoles = new LinkedHashSet<ListElement>();
for (PersonnelRoleEntity entity : personnelRoleEntities) {
ListElement element = new ListElement(entity.getRole().getId().intValue(), entity.getRole().getName());
personnelRoles.add(element);
}
Short personnelId = personnel.getPersonnelId();
String userName = personnel.getUserName();
Set<PersonnelCustomFieldEntity> personnelCustomFields = personnel.getCustomFields();
Set<CustomFieldDto> customFields = new LinkedHashSet<CustomFieldDto>();
for (PersonnelCustomFieldEntity fieldDef : personnelCustomFields) {
customFields.add(new CustomFieldDto(fieldDef.getFieldId(), fieldDef.getFieldValue()));
}
Set<PersonnelNotesEntity> personnelNotesEntity = personnel.getPersonnelNotes();
Set<PersonnelNoteDto> personnelNotes = new LinkedHashSet<PersonnelNoteDto>();
for (PersonnelNotesEntity entity : personnelNotesEntity) {
personnelNotes.add(new PersonnelNoteDto(new DateTime(entity.getCommentDate()), entity.getComment(), entity.getPersonnelName()));
}
return new PersonnelInformationDto(personnel.getPersonnelId().intValue(), personnel.getGlobalPersonnelNum(), displayName, status, locked, personnelDetails, emailId, languageName, preferredLocale.intValue(), level.getId(), office.getOfficeId().intValue(), office.getOfficeName(), title, personnelRoles, personnelId, userName, customFields, personnelNotes, personnel.getPasswordExpirationDate());
}
use of org.mifos.customers.personnel.business.PersonnelLevelEntity in project head by mifos.
the class PersonnelBuilder method build.
public PersonnelBO build() {
final PersonnelBO personnel = new PersonnelBO();
personnel.setUserName(username);
personnel.setStatus(status);
personnel.setPersonnelDetails(null);
personnel.setPreferredLocale(null);
personnel.setLevel(new PersonnelLevelEntity(level));
personnel.setOffice(office);
personnel.setDisplayName(displayName);
personnel.setUserContext(userContext);
personnel.setCreateDetails();
personnel.setPersonnelRoles(personnelRoles);
return personnel;
}
use of org.mifos.customers.personnel.business.PersonnelLevelEntity in project head by mifos.
the class AuditConfiguration method fetchMasterData.
private void fetchMasterData(String entityName, Short localeId, String classPath) throws SystemException {
Class clazz = null;
try {
clazz = Thread.currentThread().getContextClassLoader().loadClass(classPath);
} catch (ClassNotFoundException e) {
throw new SystemException(e);
}
List<MasterDataEntity> masterDataList = legacyMasterDao.findMasterDataEntities(clazz);
for (MasterDataEntity masterDataEntity : masterDataList) {
if (masterDataEntity instanceof PersonnelStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelStatusEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof PersonnelLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelLevelEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof OfficeLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((OfficeLevelEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof OfficeStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((OfficeStatusEntity) masterDataEntity).setName(name);
}
valueMap.put(masterDataEntity.getId().toString(), masterDataEntity.getName());
}
}
use of org.mifos.customers.personnel.business.PersonnelLevelEntity in project head by mifos.
the class FeeServiceFacadeWebTier method listToMap.
private Map<Short, String> listToMap(List<? extends MasterDataEntity> masterDataEntityList) {
Map<Short, String> idNameMap = new HashMap<Short, String>();
for (MasterDataEntity masterDataEntity : masterDataEntityList) {
if (masterDataEntity instanceof PersonnelStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelStatusEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof PersonnelLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelLevelEntity) masterDataEntity).setName(name);
}
idNameMap.put(masterDataEntity.getId(), masterDataEntity.getName());
}
return idNameMap;
}
use of org.mifos.customers.personnel.business.PersonnelLevelEntity in project head by mifos.
the class CollectionSheetServiceFacadeWebTier method convertToPaymentTypesListItemDto.
private List<ListItem<Short>> convertToPaymentTypesListItemDto(final List<? extends MasterDataEntity> paymentTypesList) {
List<ListItem<Short>> paymentTypesDtoList = new ArrayList<ListItem<Short>>();
for (MasterDataEntity paymentType : paymentTypesList) {
if (paymentType instanceof PersonnelStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(paymentType.getLookUpValue());
((PersonnelStatusEntity) paymentType).setName(name);
}
if (paymentType instanceof PersonnelLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(paymentType.getLookUpValue());
((PersonnelLevelEntity) paymentType).setName(name);
}
paymentTypesDtoList.add(new ListItem<Short>(paymentType.getId(), paymentType.getName()));
}
return paymentTypesDtoList;
}
Aggregations