Example usage for org.joda.time LocalDate fromDateFields

List of usage examples for org.joda.time LocalDate fromDateFields

Introduction

In this page you can find the example usage for org.joda.time LocalDate fromDateFields.

Prototype

@SuppressWarnings("deprecation")
public static LocalDate fromDateFields(Date date) 

Source Link

Document

Constructs a LocalDate from a java.util.Date using exactly the same field values.

Usage

From source file:com.gst.portfolio.loanproduct.domain.LoanProduct.java

License:Apache License

public LocalDate getStartDate() {
    LocalDate startLocalDate = null;
    if (this.startDate != null) {
        startLocalDate = LocalDate.fromDateFields(this.startDate);
    }//  w w w .  j  a v  a2 s. c o m
    return startLocalDate;
}

From source file:com.gst.portfolio.loanproduct.domain.LoanProduct.java

License:Apache License

public LocalDate getCloseDate() {
    LocalDate closeLocalDate = null;
    if (this.closeDate != null) {
        closeLocalDate = LocalDate.fromDateFields(this.closeDate);
    }//from  ww w. java  2 s  . c  o  m
    return closeLocalDate;
}

From source file:com.gst.portfolio.meeting.domain.Meeting.java

License:Apache License

public LocalDate getMeetingDateLocalDate() {
    LocalDate meetingDateLocalDate = null;
    if (this.meetingDate != null) {
        meetingDateLocalDate = LocalDate.fromDateFields(this.meetingDate);
    }//from  w w w  . j a  v  a  2 s.  com
    return meetingDateLocalDate;
}

From source file:com.gst.portfolio.meeting.domain.Meeting.java

License:Apache License

private static boolean isValidMeetingDate(final CalendarInstance calendarInstance, final Date meetingDate,
        final boolean isSkipRepaymentOnFirstMonth, final int numberOfDays) {
    final Calendar calendar = calendarInstance.getCalendar();
    LocalDate meetingDateLocalDate = null;
    if (meetingDate != null) {
        meetingDateLocalDate = LocalDate.fromDateFields(meetingDate);
    }/*from   w  ww. j  a v  a  2 s  . c  o  m*/

    if (meetingDateLocalDate == null || !calendar.isValidRecurringDate(meetingDateLocalDate,
            isSkipRepaymentOnFirstMonth, numberOfDays)) {
        return false;
    }
    return true;
}

From source file:com.gst.portfolio.meeting.service.MeetingWritePlatformServiceJpaRepositoryImpl.java

License:Apache License

private void handleMeetingDataIntegrityIssues(final Date meetingDate,
        final DataIntegrityViolationException dve) {
    final Throwable realCause = dve.getMostSpecificCause();
    if (realCause.getMessage().contains("unique_calendar_instance_id_meeting_date")) {
        final LocalDate meetingDateLocal = LocalDate.fromDateFields(meetingDate);
        throw new PlatformDataIntegrityException("error.msg.meeting.duplicate",
                "A meeting with date '" + meetingDateLocal + "' already exists", meetingDateParamName,
                meetingDateLocal);//www . j  av  a 2s .c o m
    }

    throw new PlatformDataIntegrityException("error.msg.meeting.unknown.data.integrity.issue",
            "Unknown data integrity issue with resource: " + realCause.getMessage());
}

From source file:com.gst.portfolio.savings.domain.DepositAccountOnHoldTransaction.java

License:Apache License

public LocalDate getTransactionDate() {
    LocalDate transactionDate = null;
    if (this.transactionDate != null) {
        transactionDate = LocalDate.fromDateFields(this.transactionDate);
    }/*from   www .j  av  a2s. c o m*/
    return transactionDate;
}

From source file:com.hengyi.japp.execution.domain.Task.java

public boolean isOverTime() {
    return LocalDate.now().isAfter(LocalDate.fromDateFields(getEndDate()));
}

From source file:com.hengyi.japp.execution.service.BackendJobService.java

@Schedule
public void dailyJob() {
    log.info("==============?0?==============");
    Date currentDate = new Date();
    if (LocalDate.fromDateFields(currentDate).isBefore(LocalDate.fromDateFields(applicationStartDate))) {
        return;//from ww  w  . j ava  2s  .  co  m
    }

    for (String id : taskSfsMap.keySet()) {
        cancelScheduleTask(id);
    }
    scheduleAllTask(currentDate);
}

From source file:com.hengyi.japp.execution.Util.java

public static void queryCommand(CriteriaBuilder cb, CriteriaQuery<?> cq, Root<Task> root,
        TaskQueryCommand command) {/*from w  ww  . j a v a2 s  . c  o  m*/
    Predicate p1 = cb.equal(root.get(Task_.charger), command.getOperator());
    ListJoin<Task, Operator> joinFollowers = root.join(Task_.followers, JoinType.LEFT);
    Predicate p2 = cb.equal(joinFollowers.get(Operator_.id), command.getOperator().getId());
    ListJoin<Task, Operator> joinExecutors = root.join(Task_.executors, JoinType.LEFT);
    Predicate p3 = cb.equal(joinExecutors.get(Operator_.id), command.getOperator().getId());
    Predicate p = cb.or(p1, p2, p3);
    if (command.getExecutor() != null) {
        p = cb.and(p, cb.equal(p, cb.isMember(command.getExecutor(), root.get(Task_.executors))));
    }
    if (command.getCustomer() != null) {
        p = cb.and(p, cb.equal(root.get(Task_.customer), command.getCustomer()));
    }
    if (!isBlank(command.getContent())) {
        p = cb.and(p, cb.like(root.get(Task_.content), command.getContentQuery()));
    }
    Collection<TaskType> TaskTypes = command.getTypes();
    if (TaskTypes != null && !TaskTypes.isEmpty()) {
        p = cb.and(p, root.get(Task_.type).in(TaskTypes));
    }
    Collection<TaskStatus> statuses = command.getStatuses();
    if (statuses != null && !statuses.isEmpty()) {
        p = cb.and(p, root.get(Task_.status).in(statuses));
    }
    if (command.getCreateDate() != null) {
        Date createDateStart = LocalDate.fromDateFields(command.getCreateDate()).toDate();
        Date createDateEnd = LocalDate.fromDateFields(command.getCreateDate()).plusDays(1).toDate();
        p = cb.and(p, cb.between(root.get(Task_.logInfo).get(LogInfo_.createDateTime), createDateStart,
                createDateEnd));
        // TODO timestamp date convert
        //p = cb.and(p, cb.equal(root.get(Task_.logInfo).get(LogInfo_.createDateTime).as(java.sql.Date.class), command.getCreateDate()));
    }
    cq.where(p);
}

From source file:com.javahris.springmvc.converter.DatePropertyEditor.java

@Override
public void setAsText(String text) throws IllegalArgumentException {
    Map<String, String[]> parameterMap = webRequest.getParameterMap();

    Integer year = Integer.valueOf(parameterMap.get("birthYear")[0]);
    Integer month = Integer.valueOf(parameterMap.get("birthMonth")[0]);
    Integer day = Integer.valueOf(parameterMap.get("birthDay")[0]);

    try {/*from   w  w w .  j  a v  a 2 s.  c  om*/
        String value = String.format("%1$d-%2$d-%3$d", year, month, day);
        Date date = new SimpleDateFormat("yyyy-MM-dd").parse(value);
        //            setValue(new SimpleDateFormat("yyyy-MM-dd").parse(value));
        setValue(LocalDate.fromDateFields(date));
    } catch (ParseException ex) {
        setValue(null);
    }
}