List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay
public DateTime toDateTimeAtStartOfDay()
From source file:com.gst.organisation.teller.domain.Teller.java
License:Apache License
private Teller(final Office staffOffice, final String name, final String description, final LocalDate startDate, final LocalDate endDate, final TellerStatus status) { this.name = StringUtils.defaultIfEmpty(name, null); this.description = StringUtils.defaultIfEmpty(description, null); if (startDate != null) { this.startDate = startDate.toDateTimeAtStartOfDay().toDate(); }// www.j ava 2 s.c om if (endDate != null) { this.endDate = endDate.toDateTimeAtStartOfDay().toDate(); } if (status != null) { this.status = status.getValue(); } this.office = staffOffice; /* if (StringUtils.isNotBlank(name)) { this.name = name.trim(); } else { this.name = null; } if (StringUtils.isNotBlank(description)) { this.description = description.trim(); } else { this.description = null; } */ }
From source file:com.gst.portfolio.calendar.domain.Calendar.java
License:Apache License
public Calendar(final String title, final String description, final String location, final LocalDate startDate, final LocalDate endDate, final Integer duration, final Integer typeId, final boolean repeating, final String recurrence, final Integer remindById, final Integer firstReminder, final Integer secondReminder, final Date meetingtime) { final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(CALENDAR_RESOURCE_NAME); final CalendarType calendarType = CalendarType.fromInt(typeId); if (calendarType.isCollection() && !repeating) { baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue()) .failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar"); if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }//from w w w.j a v a 2 s . co m } this.title = StringUtils.defaultIfEmpty(title, null); this.description = StringUtils.defaultIfEmpty(description, null); this.location = StringUtils.defaultIfEmpty(location, null); if (null != startDate) { this.startDate = startDate.toDateTimeAtStartOfDay().toDate(); } else { this.startDate = null; } if (null != endDate) { this.endDate = endDate.toDateTimeAtStartOfDay().toDate(); } else { this.endDate = null; } this.duration = duration; this.typeId = typeId; this.repeating = repeating; this.recurrence = StringUtils.defaultIfEmpty(recurrence, null); this.remindById = remindById; this.firstReminder = firstReminder; this.secondReminder = secondReminder; this.meetingtime = meetingtime; }
From source file:com.gst.portfolio.calendar.service.CalendarUtils.java
License:Apache License
private static Date convertToiCal4JCompatibleDate(final LocalDate inputDate) { // Date format in iCal4J is hard coded Date formattedDate = null;//from w w w.j ava2s. com final DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); final String seedDateStr = df.format(inputDate.toDateTimeAtStartOfDay().toDate()); try { formattedDate = new Date(seedDateStr, "yyyy-MM-dd"); } catch (final ParseException e) { e.printStackTrace(); } return formattedDate; }
From source file:com.gst.portfolio.client.domain.Client.java
License:Apache License
private Client(final AppUser currentUser, final ClientStatus status, final Office office, final Group clientParentGroup, final String accountNo, final String firstname, final String middlename, final String lastname, final String fullname, final LocalDate activationDate, final LocalDate officeJoiningDate, final String externalId, final String mobileNo, final Staff staff, final LocalDate submittedOnDate, final Long savingsProductId, final Long savingsAccountId, final LocalDate dateOfBirth, final CodeValue gender, final CodeValue clientType, final CodeValue clientClassification, final Integer legalForm) { if (StringUtils.isBlank(accountNo)) { this.accountNumber = new RandomPasswordGenerator(19).generate(); this.accountNumberRequiresAutoGeneration = true; } else {/* w w w. j a va 2 s. c o m*/ this.accountNumber = accountNo; } this.submittedOnDate = submittedOnDate.toDate(); this.submittedBy = currentUser; this.status = status.getValue(); this.office = office; if (StringUtils.isNotBlank(externalId)) { this.externalId = externalId.trim(); } else { this.externalId = null; } if (StringUtils.isNotBlank(mobileNo)) { this.mobileNo = mobileNo.trim(); } else { this.mobileNo = null; } if (activationDate != null) { this.activationDate = activationDate.toDateTimeAtStartOfDay().toDate(); this.activatedBy = currentUser; } if (officeJoiningDate != null) { this.officeJoiningDate = officeJoiningDate.toDateTimeAtStartOfDay().toDate(); } if (StringUtils.isNotBlank(firstname)) { this.firstname = firstname.trim(); } else { this.firstname = null; } if (StringUtils.isNotBlank(middlename)) { this.middlename = middlename.trim(); } else { this.middlename = null; } if (StringUtils.isNotBlank(lastname)) { this.lastname = lastname.trim(); } else { this.lastname = null; } if (StringUtils.isNotBlank(fullname)) { this.fullname = fullname.trim(); } else { this.fullname = null; } if (clientParentGroup != null) { this.groups = new HashSet<>(); this.groups.add(clientParentGroup); } this.staff = staff; this.savingsProductId = savingsProductId; this.savingsAccountId = savingsAccountId; if (gender != null) { this.gender = gender; } if (dateOfBirth != null) { this.dateOfBirth = dateOfBirth.toDateTimeAtStartOfDay().toDate(); } this.clientType = clientType; this.clientClassification = clientClassification; this.setLegalForm(legalForm); deriveDisplayName(); validate(); }
From source file:com.gst.portfolio.client.domain.ClientNonPerson.java
License:Apache License
private ClientNonPerson(final Client client, final CodeValue constitution, final CodeValue mainBusinessLine, final String incorpNumber, final LocalDate incorpValidityTill, final String remarks) { if (client != null) this.client = client; if (constitution != null) this.constitution = constitution; if (mainBusinessLine != null) this.mainBusinessLine = mainBusinessLine; if (StringUtils.isNotBlank(incorpNumber)) { this.incorpNumber = incorpNumber.trim(); } else {/* w w w. j ava2 s . c o m*/ this.incorpNumber = null; } if (incorpValidityTill != null) { this.incorpValidityTill = incorpValidityTill.toDateTimeAtStartOfDay().toDate(); } if (StringUtils.isNotBlank(remarks)) { this.remarks = remarks.trim(); } else { this.remarks = null; } validate(client); }
From source file:com.gst.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, final boolean recalculatedInterestComponent, final Set<LoanInterestRecalcualtionAdditionalDetails> compoundingDetails) { 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; this.loanCompoundingDetails = compoundingDetails; }
From source file:com.gst.portfolio.loanaccount.domain.LoanTransaction.java
License:Apache License
public static LoanTransaction initiateTransfer(final Office office, final Loan loan, final LocalDate transferDate, final LocalDateTime createdDate, final AppUser appUser) { return new LoanTransaction(loan, office, LoanTransactionType.INITIATE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);// ww w .j a v a 2 s .com }
From source file:com.gst.portfolio.loanaccount.domain.LoanTransaction.java
License:Apache License
public static LoanTransaction approveTransfer(final Office office, final Loan loan, final LocalDate transferDate, final LocalDateTime createdDate, final AppUser appUser) { return new LoanTransaction(loan, office, LoanTransactionType.APPROVE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);/*from w ww. j a v a2s . c o m*/ }
From source file:com.gst.portfolio.loanaccount.domain.LoanTransaction.java
License:Apache License
public static LoanTransaction withdrawTransfer(final Office office, final Loan loan, final LocalDate transferDate, final LocalDateTime createdDate, final AppUser appUser) { return new LoanTransaction(loan, office, LoanTransactionType.WITHDRAW_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);// w w w .j a v a 2 s . c o m }
From source file:com.gst.portfolio.loanaccount.domain.LoanTransaction.java
License:Apache License
private LoanTransaction(final Loan loan, final Office office, final LoanTransactionType type, final BigDecimal amount, final LocalDate date, final String externalId, final LocalDateTime createdDate, final AppUser appUser) { this.loan = loan; this.typeOf = type.getValue(); this.amount = amount; this.dateOf = date.toDateTimeAtStartOfDay().toDate(); this.externalId = externalId; this.office = office; this.submittedOnDate = DateUtils.getDateOfTenant(); this.createdDate = createdDate.toDate(); this.appUser = appUser; }