use of org.mifos.dto.screen.UploadedFileDto in project head by mifos.
the class ClientFileServiceFileSystem method readAll.
public List<UploadedFileDto> readAll(Integer clientId) {
List<ClientFileEntity> clientFileEntities = customerDao.getClientAllUploadedFiles(clientId);
List<UploadedFileDto> uploadedFiles = new ArrayList<UploadedFileDto>();
for (ClientFileEntity entity : clientFileEntities) {
FileInfoEntity fileInfo = entity.getFileInfo();
Long uploadFileId = entity.getFileId();
String fileName = fileInfo.getName();
String contentType = fileInfo.getContentType();
Integer fileSize = fileInfo.getSize();
String description = fileInfo.getDescription();
java.util.Date uploadDate = fileInfo.getUploadDate();
uploadedFiles.add(new UploadedFileDto(uploadFileId, fileName, contentType, fileSize, description, uploadDate));
}
return uploadedFiles;
}
use of org.mifos.dto.screen.UploadedFileDto in project head by mifos.
the class LoanFileServiceFileSystem method readAll.
public List<UploadedFileDto> readAll(Integer accountId) {
List<LoanFileEntity> loanFileEntities = loanDao.getLoanAllUploadedFiles(accountId);
List<UploadedFileDto> uploadedFiles = new ArrayList<UploadedFileDto>();
for (LoanFileEntity entity : loanFileEntities) {
FileInfoEntity fileInfo = entity.getFileInfo();
Long uploadFileId = entity.getFileId();
String fileName = fileInfo.getName();
String contentType = fileInfo.getContentType();
Integer fileSize = fileInfo.getSize();
String description = fileInfo.getDescription();
java.util.Date uploadDate = fileInfo.getUploadDate();
uploadedFiles.add(new UploadedFileDto(uploadFileId, fileName, contentType, fileSize, description, uploadDate));
}
return uploadedFiles;
}
use of org.mifos.dto.screen.UploadedFileDto in project head by mifos.
the class PictureFormFile method addFile.
@TransactionDemarcate(joinToken = true)
public ActionForward addFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
FormFile file = actionForm.getSelectedFile();
String fileName = actionForm.getSelectedFile().getFileName();
String fileContentType = actionForm.getSelectedFile().getContentType();
Integer fileSize = actionForm.getSelectedFile().getFileSize();
String fileDescription = actionForm.getSelectedFileDescription();
if (file != null) {
actionForm.getFiles().add(file);
actionForm.getFilesMetadata().add(new UploadedFileDto(fileName, fileContentType, fileSize, fileDescription));
}
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.dto.screen.UploadedFileDto in project head by mifos.
the class ClientCustActionForm method clearMostButNotAllFieldsOnActionForm.
public void clearMostButNotAllFieldsOnActionForm() {
setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
setCustomFields(new ArrayList<CustomFieldDto>());
setFamilyNames(new ArrayList<ClientNameDetailDto>());
setFamilyDetails(new ArrayList<ClientFamilyDetailDto>());
setFamilyRelationship(new ArrayList<Short>());
setFamilyFirstName(new ArrayList<String>());
setFamilyMiddleName(new ArrayList<String>());
setFamilyLastName(new ArrayList<String>());
setFamilySecondLastName(new ArrayList<String>());
setFamilyDateOfBirthDD(new ArrayList<String>());
setFamilyDateOfBirthMM(new ArrayList<String>());
setFamilyDateOfBirthYY(new ArrayList<String>());
setFamilyGender(new ArrayList<Short>());
setFamilyLivingStatus(new ArrayList<Short>());
initializeFamilyMember();
addFamilyMember();
setAddress(new Address());
setDisplayName(null);
setDateOfBirthDD(null);
setDateOfBirthMM(null);
setDateOfBirthYY(null);
setGovernmentId(null);
setMfiJoiningDate(null);
setGlobalCustNum(null);
setCustomerId(null);
setExternalId(null);
setLoanOfficerId(null);
setLoanOfficerName("");
setFormedByPersonnel(null);
setTrained(null);
setTrainedDate(null);
setClientName(new ClientNameDetailDto());
setSpouseName(new ClientNameDetailDto());
setClientDetailView(new ClientPersonalDetailDto());
setNextOrPreview("next");
setQuestionGroups(null);
for (int i = 0; i < getSelectedOfferings().size(); i++) {
getSelectedOfferings().set(i, null);
}
setFiles(new ArrayList<FormFile>());
setFilesMetadata(new ArrayList<UploadedFileDto>());
}
use of org.mifos.dto.screen.UploadedFileDto in project head by mifos.
the class LoanAccountController method submitLoanApplication.
private LoanCreationResultDto submitLoanApplication(Integer accountState, LoanAccountFormBean formBean, LoanAccountQuestionGroupFormBean loanAccountQuestionGroupFormBean, LoanAccountCashFlow loanAccountCashFlow, CashFlowSummaryFormBean cashFlowSummaryFormBean, LoanScheduleFormBean loanScheduleFormBean) {
LocalDate disbursementDate = LoanCreationHelper.translateDisbursementDateToLocalDate(formBean);
RecurringSchedule recurringSchedule = LoanCreationHelper.determineRecurringSchedule(formBean);
List<CreateAccountFeeDto> accountFees = LoanCreationHelper.translateToAccountFeeDtos(formBean);
List<CreateAccountFeeDto> additionalAccountFees = LoanCreationHelper.translateToAdditionalAccountFeeDtos(formBean);
List<CreateAccountPenaltyDto> accountPenalties = LoanCreationHelper.translateToAccountPenaltyDtos(formBean);
accountFees.addAll(additionalAccountFees);
BigDecimal loanAmount = BigDecimal.valueOf(formBean.getAmount().doubleValue());
BigDecimal minAllowedLoanAmount = BigDecimal.valueOf(formBean.getMinAllowedAmount().doubleValue());
BigDecimal maxAllowedLoanAmount = BigDecimal.valueOf(formBean.getMaxAllowedAmount().doubleValue());
CreateLoanAccount loanAccountDetails = new CreateLoanAccount(formBean.getCustomerId(), formBean.getProductId(), accountState, loanAmount, minAllowedLoanAmount, maxAllowedLoanAmount, formBean.getInterestRate().doubleValue(), disbursementDate, null, formBean.getNumberOfInstallments().intValue(), formBean.getMinNumberOfInstallments().intValue(), formBean.getMaxNumberOfInstallments().intValue(), formBean.getGraceDuration().intValue(), formBean.getFundId(), formBean.getLoanPurposeId(), formBean.getCollateralTypeId(), formBean.getCollateralNotes(), formBean.getExternalId(), formBean.isRepaymentScheduleIndependentOfCustomerMeeting(), recurringSchedule, accountFees, accountPenalties);
LoanCreationResultDto loanCreationResultDto = null;
if (formBean.isGlimApplicable()) {
List<GroupMemberAccountDto> memberAccounts = createGroupMemberAccounts(formBean);
BigDecimal totalLoanAmount = BigDecimal.valueOf(formBean.getAmount().doubleValue());
CreateGlimLoanAccount createGroupLoanAccount = new CreateGlimLoanAccount(memberAccounts, totalLoanAmount, loanAccountDetails);
loanCreationResultDto = loanAccountServiceFacade.createGroupLoanWithIndividualMonitoring(createGroupLoanAccount, loanAccountQuestionGroupFormBean.getQuestionGroups(), loanAccountCashFlow);
} else {
if (formBean.isVariableInstallmentsAllowed()) {
List<DateTime> installmentDates = cashFlowSummaryFormBean.getInstallments();
List<Number> totalInstallmentAmounts = cashFlowSummaryFormBean.getInstallmentAmounts();
if (installmentDates.isEmpty()) {
installmentDates = loanScheduleFormBean.getInstallments();
totalInstallmentAmounts = loanScheduleFormBean.getInstallmentAmounts();
}
// api for creating loan with premade loan schedule
loanCreationResultDto = loanAccountServiceFacade.createLoan(loanAccountDetails, loanAccountQuestionGroupFormBean.getQuestionGroups(), loanAccountCashFlow, installmentDates, totalInstallmentAmounts);
} else {
loanCreationResultDto = loanAccountServiceFacade.createLoan(loanAccountDetails, loanAccountQuestionGroupFormBean.getQuestionGroups(), loanAccountCashFlow);
}
}
List<CommonsMultipartFile> formFiles = formBean.getFiles();
List<UploadedFileDto> filesMetadata = formBean.getFilesMetadata();
for (int i = 0; i < formFiles.size(); i++) {
if (formFiles.get(i).getSize() != 0) {
InputStream inputStream;
try {
inputStream = formFiles.get(i).getInputStream();
} catch (IOException e) {
throw new MifosRuntimeException();
}
UploadedFileDto fileMetadata = filesMetadata.get(i);
loanAccountServiceFacade.uploadFile(loanCreationResultDto.getAccountId(), inputStream, fileMetadata);
}
}
return loanCreationResultDto;
}
Aggregations