use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.
the class CollectionSheetServiceFacadeWebTier method loadAllActiveBranchesAndSubsequentDataIfApplicable.
@Override
public CollectionSheetEntryFormDto loadAllActiveBranchesAndSubsequentDataIfApplicable(final UserContext userContext) {
final Short branchId = userContext.getBranchId();
final Short centerHierarchyExists = ClientRules.getCenterHierarchyExists() ? Constants.YES : Constants.NO;
List<OfficeDetailsDto> activeBranches = new ArrayList<OfficeDetailsDto>();
List<ListItem<Short>> paymentTypesDtoList = new ArrayList<ListItem<Short>>();
List<CustomerDto> customerList = new ArrayList<CustomerDto>();
List<PersonnelDto> loanOfficerList = new ArrayList<PersonnelDto>();
Short reloadFormAutomatically = Constants.YES;
final Short backDatedTransactionAllowed = Constants.NO;
try {
final List<PaymentTypeEntity> paymentTypesList = legacyMasterDao.findMasterDataEntitiesWithLocale(PaymentTypeEntity.class);
paymentTypesDtoList = convertToPaymentTypesListItemDto(paymentTypesList);
activeBranches = officePersistence.getActiveOffices(branchId);
if (activeBranches.size() == 1) {
loanOfficerList = legacyPersonnelDao.getActiveLoanOfficersInBranch(PersonnelConstants.LOAN_OFFICER, branchId, userContext.getId(), userContext.getLevelId());
if (loanOfficerList.size() == 1) {
Short customerLevel;
if (centerHierarchyExists.equals(Constants.YES)) {
customerLevel = Short.valueOf(CustomerLevel.CENTER.getValue());
} else {
customerLevel = Short.valueOf(CustomerLevel.GROUP.getValue());
}
customerList = customerPersistence.getActiveParentList(loanOfficerList.get(0).getPersonnelId(), customerLevel, branchId);
if (customerList.size() == 1) {
reloadFormAutomatically = Constants.YES;
}
reloadFormAutomatically = Constants.NO;
}
}
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
return new CollectionSheetEntryFormDto(activeBranches, paymentTypesDtoList, loanOfficerList, customerList, reloadFormAutomatically, centerHierarchyExists, backDatedTransactionAllowed);
}
use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.
the class ClientServiceFacadeWebTier method retreiveClientDetailsForRemovalFromGroup.
@Override
public ClientRemovalFromGroupDto retreiveClientDetailsForRemovalFromGroup(String globalCustNum) {
try {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
ClientBO client = this.customerDao.findClientBySystemId(globalCustNum);
client.updateDetails(userContext);
client.checkIfClientIsATitleHolder();
List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
boolean isActive = client.isActive();
Short loanOfficerId = client.getPersonnel().getPersonnelId();
CenterCreation clientDetails = new CenterCreation(client.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(clientDetails);
return new ClientRemovalFromGroupDto(client.getGlobalCustNum(), isActive, isCenterHierarchyExists, loanOfficerId, loanOfficers, activeBranches);
} catch (CustomerException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.
the class OfficeServiceFacadeWebTier method retrieveOfficeDetailsForEdit.
@Override
public OfficeDetailsForEdit retrieveOfficeDetailsForEdit(String officeLevel) {
List<OfficeDetailsDto> parents = new ArrayList<OfficeDetailsDto>();
if (StringUtils.isNotBlank(officeLevel)) {
parents = retrieveActiveParentOffices(Short.valueOf(officeLevel));
}
try {
List<OfficeDetailsDto> configuredOfficeLevels = new OfficePersistence().getActiveLevels();
for (OfficeDetailsDto officeDetailsDto : configuredOfficeLevels) {
String levelName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(officeDetailsDto.getLevelNameKey());
officeDetailsDto.setLevelName(levelName);
}
List<OfficeDetailsDto> statusList = new OfficePersistence().getStatusList();
for (OfficeDetailsDto officeDetailsDto : statusList) {
officeDetailsDto.setLevelName(ApplicationContextProvider.getBean(MessageLookup.class).lookup(officeDetailsDto.getLevelNameKey()));
}
return new OfficeDetailsForEdit(parents, statusList, configuredOfficeLevels);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.
the class OfficeServiceFacadeWebTier method retrieveActiveParentOffices.
@Override
public List<OfficeDetailsDto> retrieveActiveParentOffices(Short officeLevelId) {
OfficeLevel Level = OfficeLevel.getOfficeLevel(officeLevelId);
try {
List<OfficeDetailsDto> officeParents = new OfficePersistence().getActiveParents(Level);
for (OfficeDetailsDto officeDetailsDto : officeParents) {
String levelName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(officeDetailsDto.getLevelNameKey());
officeDetailsDto.setLevelName(levelName);
}
return officeParents;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.
the class ProductDtoComparator method toLegacyDto.
@Override
public CollectionSheetEntryGridDto toLegacyDto(final CollectionSheetDto collectionSheet, final CollectionSheetFormEnteredDataDto formEnteredDataDto, final List<CustomValueListElementDto> attendanceTypesList, final MifosCurrency currency) {
final CollectionSheetEntryDto collectionSheetEntryViewHierarchy = createEntryViewHierarchyFromCollectionSheetData(collectionSheet.getCollectionSheetCustomer(), currency);
final PersonnelDto loanOfficer = formEnteredDataDto.getLoanOfficer();
final OfficeDetailsDto office = formEnteredDataDto.getOffice();
final ListItem<Short> paymentType = formEnteredDataDto.getPaymentType();
final Date meetingDate = formEnteredDataDto.getMeetingDate();
final String receiptId = formEnteredDataDto.getReceiptId();
final Date receiptDate = formEnteredDataDto.getReceiptDate();
final List<ProductDto> loanProductDtos = createListOfLoanProducts(collectionSheet.getCollectionSheetCustomer());
final List<ProductDto> savingProductDtos = createListOfSavingProducts(collectionSheet.getCollectionSheetCustomer());
final CollectionSheetEntryGridDto translatedGridDto = new CollectionSheetEntryGridDto(collectionSheetEntryViewHierarchy, loanOfficer, office, paymentType, meetingDate, receiptId, receiptDate, loanProductDtos, savingProductDtos, attendanceTypesList);
return translatedGridDto;
}
Aggregations