in service/src/main/java/org/apache/fineract/cn/individuallending/internal/command/handler/IndividualLoanCommandHandler.java [208:249]
public IndividualLoanCommandEvent process(final ImportCommand command) throws InterruptedException {
final String productIdentifier = command.getProductIdentifier();
final String caseIdentifier = command.getCaseIdentifier();
final DataContextOfAction dataContextOfAction = dataContextService.checkedGetDataContext(
productIdentifier, caseIdentifier, command.getImportParameters().getCaseAccountAssignments());
IndividualLendingPatternFactory.checkActionCanBeExecuted(Case.State.valueOf(dataContextOfAction.getCustomerCaseEntity().getCurrentState()), Action.IMPORT);
checkIfTasksAreOutstanding(dataContextOfAction, Action.IMPORT);
final DesignatorToAccountIdentifierMapper designatorToAccountIdentifierMapper
= new DesignatorToAccountIdentifierMapper(dataContextOfAction);
createAccounts(dataContextOfAction, designatorToAccountIdentifierMapper, command.getImportParameters().getCurrentBalances());
final CaseEntity customerCase = dataContextOfAction.getCustomerCaseEntity();
recordCommand(
command.getImportParameters().getStartOfTerm(),
customerCase.getId(),
Action.DISBURSE,
Optional.empty());
recordCommand(
command.getImportParameters().getCreatedOn(),
customerCase.getId(),
Action.IMPORT,
Optional.empty());
final LocalDate startOfTerm = DateConverter.fromIsoString(command.getImportParameters().getStartOfTerm()).toLocalDate();
final LocalDateTime endOfTerm = ScheduledActionHelpers.getRoughEndDate(startOfTerm, dataContextOfAction.getCaseParameters())
.atTime(LocalTime.MIDNIGHT);
customerCase.setStartOfTerm(startOfTerm.atTime(LocalTime.MIDNIGHT));
customerCase.setEndOfTerm(endOfTerm);
customerCase.setCurrentState(Case.State.ACTIVE.name());
caseRepository.save(customerCase);
final CaseParametersEntity caseParameters = dataContextOfAction.getCaseParametersEntity();
caseParameters.setPaymentSize(command.getImportParameters().getPaymentSize());
caseParametersRepository.save(caseParameters);
return new IndividualLoanCommandEvent(productIdentifier, caseIdentifier, command.getImportParameters().getCreatedOn());
}