List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay
public DateTime toDateTimeAtStartOfDay()
From source file:org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment.java
License:Apache License
public LoanRepaymentScheduleInstallment(final Loan loan, final Integer installmentNumber, final LocalDate fromDate, final LocalDate dueDate, final BigDecimal principal, final BigDecimal interest, final BigDecimal feeCharges, final BigDecimal penaltyCharges, boolean recalculatedInterestComponent) { this.loan = loan; this.installmentNumber = installmentNumber; this.fromDate = fromDate.toDateTimeAtStartOfDay().toDate(); this.dueDate = dueDate.toDateTimeAtStartOfDay().toDate(); this.principal = defaultToNullIfZero(principal); this.interestCharged = defaultToNullIfZero(interest); this.feeChargesCharged = defaultToNullIfZero(feeCharges); this.penaltyCharges = defaultToNullIfZero(penaltyCharges); this.obligationsMet = false; this.recalculatedInterestComponent = recalculatedInterestComponent; }
From source file:org.apache.fineract.portfolio.loanproduct.domain.LoanProduct.java
License:Apache License
public LoanProduct(final Fund fund, final LoanTransactionProcessingStrategy transactionProcessingStrategy, final String name, final String shortName, final String description, final MonetaryCurrency currency, final BigDecimal defaultPrincipal, final BigDecimal defaultMinPrincipal, final BigDecimal defaultMaxPrincipal, final BigDecimal defaultNominalInterestRatePerPeriod, final BigDecimal defaultMinNominalInterestRatePerPeriod, final BigDecimal defaultMaxNominalInterestRatePerPeriod, final PeriodFrequencyType interestPeriodFrequencyType, final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod, final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final boolean considerPartialPeriodInterest, final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfInstallments, final Integer defaultMinNumberOfInstallments, final Integer defaultMaxNumberOfInstallments, final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance, final List<Charge> charges, final AccountingRuleType accountingRuleType, final boolean includeInBorrowerCycle, final LocalDate startDate, final LocalDate closeDate, final String externalId, final boolean useBorrowerCycle, final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations, final boolean multiDisburseLoan, final Integer maxTrancheCount, final BigDecimal outstandingLoanBalance, final Integer graceOnArrearsAgeing, final Integer overdueDaysForNPA, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType, final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationDetails productInterestRecalculationDetails, final Integer minimumDaysBetweenDisbursalAndFirstRepayment, final boolean holdGuarantorFunds, final LoanProductGuaranteeDetails loanProductGuaranteeDetails, final BigDecimal principalThresholdForLastInstallment, final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, final boolean canDefineEmiAmount, final Integer installmentAmountInMultiplesOf, final LoanProductConfigurableAttributes loanProductConfigurableAttributes, Boolean isLinkedToFloatingInterestRates, FloatingRate floatingRate, BigDecimal interestRateDifferential, BigDecimal minDifferentialLendingRate, BigDecimal maxDifferentialLendingRate, BigDecimal defaultDifferentialLendingRate, Boolean isFloatingInterestRateCalculationAllowed, final Boolean isVariableInstallmentsAllowed, final Integer minimumGapBetweenInstallments, final Integer maximumGapBetweenInstallments) { this.fund = fund; this.transactionProcessingStrategy = transactionProcessingStrategy; this.name = name.trim(); this.shortName = shortName.trim(); if (StringUtils.isNotBlank(description)) { this.description = description.trim(); } else {/*from www. j av a2 s . c o m*/ this.description = null; } if (charges != null) { this.charges = charges; } this.isLinkedToFloatingInterestRate = isLinkedToFloatingInterestRates == null ? false : isLinkedToFloatingInterestRates; if (isLinkedToFloatingInterestRate) { this.floatingRates = new LoanProductFloatingRates(floatingRate, this, interestRateDifferential, minDifferentialLendingRate, maxDifferentialLendingRate, defaultDifferentialLendingRate, isFloatingInterestRateCalculationAllowed); } this.allowVariabeInstallments = isVariableInstallmentsAllowed == null ? false : isVariableInstallmentsAllowed; if (allowVariabeInstallments) { this.variableInstallmentConfig = new LoanProductVariableInstallmentConfig(this, minimumGapBetweenInstallments, maximumGapBetweenInstallments); } this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, considerPartialPeriodInterest, repayEvery, repaymentFrequencyType, defaultNumberOfInstallments, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod, inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType.getValue(), daysInYearType.getValue(), isInterestRecalculationEnabled); this.loanProductRelatedDetail.validateRepaymentPeriodWithGraceSettings(); this.loanProductMinMaxConstraints = new LoanProductMinMaxConstraints(defaultMinPrincipal, defaultMaxPrincipal, defaultMinNominalInterestRatePerPeriod, defaultMaxNominalInterestRatePerPeriod, defaultMinNumberOfInstallments, defaultMaxNumberOfInstallments); if (accountingRuleType != null) { this.accountingRule = accountingRuleType.getValue(); } this.includeInBorrowerCycle = includeInBorrowerCycle; this.useBorrowerCycle = useBorrowerCycle; if (startDate != null) { this.startDate = startDate.toDateTimeAtStartOfDay().toDate(); } if (closeDate != null) { this.closeDate = closeDate.toDateTimeAtStartOfDay().toDate(); } this.externalId = externalId; this.borrowerCycleVariations = loanProductBorrowerCycleVariations; for (LoanProductBorrowerCycleVariations borrowerCycleVariations : this.borrowerCycleVariations) { borrowerCycleVariations.updateLoanProduct(this); } if (loanProductConfigurableAttributes != null) { this.loanConfigurableAttributes = loanProductConfigurableAttributes; loanConfigurableAttributes.updateLoanProduct(this); } this.loanProducTrancheDetails = new LoanProductTrancheDetails(multiDisburseLoan, maxTrancheCount, outstandingLoanBalance); this.overdueDaysForNPA = overdueDaysForNPA; this.productInterestRecalculationDetails = productInterestRecalculationDetails; this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment; this.holdGuaranteeFunds = holdGuarantorFunds; this.loanProductGuaranteeDetails = loanProductGuaranteeDetails; this.principalThresholdForLastInstallment = principalThresholdForLastInstallment; this.accountMovesOutOfNPAOnlyOnArrearsCompletion = accountMovesOutOfNPAOnlyOnArrearsCompletion; this.canDefineInstallmentAmount = canDefineEmiAmount; this.installmentAmountInMultiplesOf = installmentAmountInMultiplesOf; }
From source file:org.apache.isis.objectstore.jdo.applib.service.audit.AuditingServiceJdoRepository.java
License:Apache License
private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) { return dt != null ? new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis()) : null;/*from w w w.j a v a2 s. c o m*/ }
From source file:org.archfirst.common.datetime.LocalDateAdapter.java
License:Apache License
public XMLGregorianCalendar marshal(LocalDate val) throws Exception { try {//w w w . j av a 2s. com GregorianCalendar calendar = val.toDateTimeAtStartOfDay().toGregorianCalendar(); return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); } catch (DatatypeConfigurationException e) { throw new IllegalArgumentException(); } }
From source file:org.codeqinvest.codechanges.scm.svn.DefaultSvnRevisionsRetriever.java
License:Open Source License
/** * {@inheritDoc}/*from w ww . j ava 2 s . c om*/ */ @Override @Cacheable("svnRevisions") public DailyRevisions retrieveRevisions(ScmConnectionSettings connectionSettings, LocalDate day) throws SVNException { log.info("Retrieve revisions on day {} for {}", day, connectionSettings); final SVNRepository repository = SvnRepositoryFactory.create(connectionSettings); final LocalDateTime startTime = day.toDateTimeAtStartOfDay().toLocalDateTime(); final long startRevision = repository.getDatedRevision(startTime.toDate()); final long endRevision = repository.getDatedRevision(startTime.withTime(23, 59, 59, 999).toDate()); final Multimap<String, SvnFileRevision> revisions = ArrayListMultimap.create(); repository.log(null, startRevision, endRevision, true, true, new ISVNLogEntryHandler() { @Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { for (SVNLogEntryPath logEntryPath : logEntry.getChangedPaths().values()) { if (logEntryPath.getCopyPath() != null) { revisions.put(logEntryPath.getPath(), new SvnFileRevision(logEntry.getRevision(), logEntryPath.getCopyPath(), logEntryPath.getPath())); } else { revisions.put(logEntryPath.getPath(), new SvnFileRevision(logEntry.getRevision(), logEntryPath.getPath(), logEntryPath.getPath())); } } } }); log.info("Found {} changes for day {} with connection {}", revisions.values().size(), day, connectionSettings); return new DailyRevisions(day, revisions); }
From source file:org.datanucleus.store.types.jodatime.converters.JodaLocalDateSqlDateConverter.java
License:Open Source License
public Date toDatastoreType(LocalDate ld) { if (ld == null) { return null; }//from w ww .ja v a 2 s. c om return new Date(ld.toDateTimeAtStartOfDay().getMillis()); }
From source file:org.fenixedu.academic.domain.student.SeparationCyclesManagement.java
License:Open Source License
private void markOldRegistrationWithConcludedState(final StudentCurricularPlan oldStudentCurricularPlan) { if (oldStudentCurricularPlan.getRegistration().hasState(RegistrationStateType.CONCLUDED)) { return;//from w ww . ja v a 2s . co m } LocalDate stateDate = new LocalDate(); if (stateDate.isAfter(getExecutionYear().getEndDateYearMonthDay())) { stateDate = getExecutionYear().getEndDateYearMonthDay().toLocalDate(); } final RegistrationState state = RegistrationState.createRegistrationState( oldStudentCurricularPlan.getRegistration(), null, stateDate.toDateTimeAtStartOfDay(), RegistrationStateType.CONCLUDED); state.setResponsiblePerson(null); }
From source file:org.fenixedu.academic.service.services.accounting.PostingRulesManager.java
License:Open Source License
@Atomic public static void createDEAStandaloneGratuityPostingRule(StandaloneInstallmentBean bean, DegreeCurricularPlan degreeCurricularPlan) { DegreeCurricularPlanServiceAgreementTemplate dcpSAT = degreeCurricularPlan.getServiceAgreementTemplate(); if (dcpSAT != null) { YearMonthDay startDate = bean.getStartDate(); LocalDate startLocalDate = new LocalDate(startDate.getYear(), startDate.getMonthOfYear(), startDate.getDayOfMonth()); BigDecimal ectsForYear = bean.getEctsForYear(); BigDecimal gratuityFactor = bean.getGratuityFactor(); BigDecimal ectsFactor = bean.getEctsFactor(); new StandaloneEnrolmentGratuityPR(startLocalDate.toDateTimeAtStartOfDay(), null, dcpSAT, ectsForYear, gratuityFactor, ectsFactor); } else {//from w w w . ja va 2 s .co m throw new DomainException( "StandaloneEnrolmentGratuityPR.DegreeCurricularPlanServiceAgreementTemplate.cannot.be.null"); } }
From source file:org.fenixedu.academic.ui.spring.service.AccountingReportService.java
License:Open Source License
public Spreadsheet report(LocalDate start, LocalDate end) { DateTime startDateTime = start.toDateTimeAtStartOfDay(); DateTime endDateTime = end.toDateTimeAtStartOfDay(); final Map<LocalDate, List<AccountingTransactionDetail>> dateTransactionsMap = Bennu.getInstance() .getAccountingTransactionDetailsSet().stream().filter(atd -> isFor(atd, startDateTime, endDateTime)) .filter(atd -> !atd.getTransaction().isAdjustingTransaction()) .collect(Collectors.groupingBy(atd -> atd.getWhenRegistered().toLocalDate())); final Table<LocalDate, PaymentMethod, Money> table = HashBasedTable.create(); dateTransactionsMap.forEach((localDate, accountingTransactionDetails) -> { Map<PaymentMethod, Money> paymentMethodMoneyMap = accountingTransactionDetails.stream() .collect(Collectors.toMap(AccountingTransactionDetail::getPaymentMethod, atd -> atd.getTransaction().getAmountWithAdjustment(), Money::add)); paymentMethodMoneyMap//from www . j a va 2s . c om .forEach((paymentMethod, totalMoney) -> table.put(localDate, paymentMethod, totalMoney)); }); final Spreadsheet spreadsheet = new Spreadsheet( BundleUtil.getString(Bundle.ACCOUNTING, "label.transaction.report.summary")); final List<PaymentMethod> sortedPaymentMethods = Bennu.getInstance().getPaymentMethodSet().stream() .sorted(Comparator.comparing(PaymentMethod::getName)).collect(Collectors.toList()); spreadsheet.setHeader(0, BundleUtil.getString(Bundle.ACCOUNTING, "label.transaction.report.whenRegistered")); for (int i = 0; i < sortedPaymentMethods.size(); i++) { spreadsheet.setHeader(i + 1, sortedPaymentMethods.get(i).getLocalizedName()); } table.rowMap().entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)).forEach(entry -> { final LocalDate localDate = entry.getKey(); final Map<PaymentMethod, Money> paymentMethodMoneyMap = entry.getValue(); Spreadsheet.Row sheetRow = spreadsheet.addRow(); sheetRow.setCell(0, localDate.toString(DATE_PATTERN)); paymentMethodMoneyMap.forEach((paymentMethod, money) -> { sheetRow.setCell(sortedPaymentMethods.indexOf(paymentMethod) + 1, money.toPlainString()); }); }); final Spreadsheet[] holder = new Spreadsheet[1]; holder[0] = spreadsheet; dateTransactionsMap.keySet().stream().sorted(Comparator.reverseOrder()).forEach(date -> { Spreadsheet dateSheet = holder[0].addSpreadsheet(date.toString(DATE_PATTERN).replaceAll("/", "_")); fill(dateSheet, dateTransactionsMap.get(date)); holder[0] = dateSheet; }); return spreadsheet; }
From source file:org.fenixedu.qubdocs.ui.manage.LooseEvaluationBeanController.java
License:Open Source License
@Atomic public void createLooseEvaluation(org.fenixedu.academic.domain.Enrolment enrolment, org.joda.time.LocalDate availableDate, org.joda.time.LocalDate examDate, org.fenixedu.academic.domain.Grade grade, org.fenixedu.academic.domain.EvaluationSeason type) { final EnrolmentEvaluation evaluation = new EnrolmentEvaluation(enrolment, type); evaluation.edit(Authenticate.getUser().getPerson(), grade, availableDate.toDateTimeAtStartOfDay().toDate(), examDate.toDateTimeAtStartOfDay().toDate()); evaluation.confirmSubmission(Authenticate.getUser().getPerson(), ""); }