Example usage for org.joda.time LocalDate LocalDate

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

Introduction

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

Prototype

public LocalDate() 

Source Link

Document

Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Usage

From source file:com.mycollab.module.project.view.user.ProjectUnresolvedTicketsWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsNextWeek() {
    title = UserUIContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_TICKET_NEXT_WEEK);
    searchCriteria = new ProjectTicketSearchCriteria();
    searchCriteria.setIsOpenned(new SearchField());
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    LocalDate now = new LocalDate();
    now = now.plusDays(7);//from  w ww  . ja  va  2 s .com
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();
}

From source file:com.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsThisWeek() {
    title = UserUIContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_TICKET_THIS_WEEK);
    searchCriteria = new ProjectTicketSearchCriteria();
    searchCriteria.setIsOpenned(new SearchField());
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    LocalDate now = new LocalDate();
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();/*from  w w w. j a va 2 s  .c  om*/
}

From source file:com.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsNextWeek() {
    title = UserUIContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_TICKET_NEXT_WEEK);
    searchCriteria = new ProjectTicketSearchCriteria();
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setIsOpenned(new SearchField());
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    LocalDate now = new LocalDate();
    now = now.plusDays(7);/*www.j  ava  2s.  c o m*/
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();
}

From source file:com.rappsantiago.weighttracker.dialog.DatePickerDialogFragment.java

License:Apache License

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LocalDate now = new LocalDate();

    int year = now.getYear();
    int monthOfYear = now.getMonthOfYear();
    int dayOfMonth = now.getDayOfMonth();

    Dialog datePickerDialog = new DatePickerDialog(getActivity(), mOnDateSetListener, year, monthOfYear - 1,
            dayOfMonth);/*from   w  w  w  .jav a2  s .c  o  m*/
    Util.hideSoftKeyboard(getContext(), getActivity().getCurrentFocus());

    return datePickerDialog;
}

From source file:com.rappsantiago.weighttracker.util.Util.java

License:Apache License

public static long getCurrentDateInMillis() {
    LocalDate localDate = new LocalDate();
    return localDate.toDate().getTime();
}

From source file:com.redhat.engineering.jenkins.report.plugin.ReportPluginPortlet.java

License:Open Source License

/**
 * Graph of duration of tests over time.
 *//*from w  w  w  .  ja v a 2  s.  co  m*/
public Graph getSummaryGraph() {
    // The standard equals doesn't work because two LocalDate objects can
    // be differente even if the date is the same (different internal timestamp)
    Comparator<LocalDate> localDateComparator = new Comparator<LocalDate>() {

        @Override
        public int compare(LocalDate d1, LocalDate d2) {
            if (d1.isEqual(d2)) {
                return 0;
            }
            if (d1.isAfter(d2)) {
                return 1;
            }
            return -1;
        }
    };

    // We need a custom comparator for LocalDate objects
    final Map<LocalDate, TestResultAggrSummary> summaries = //new HashMap<LocalDate, TestResultSummary>();
            new TreeMap<LocalDate, TestResultAggrSummary>(localDateComparator);
    LocalDate today = new LocalDate();

    // for each job, for each day, add last build of the day to summary
    for (Job job : getDashboard().getJobs()) {
        Filter filter = job.getAction(ReportPluginProjectAction.class).getInitializedFilter();
        filter.addCombinationFilter(combinationFilter);
        Run run = job.getFirstBuild();

        if (run != null) { // execute only if job has builds
            LocalDate runDay = new LocalDate(run.getTimestamp());
            LocalDate firstDay = (dateRange != 0) ? new LocalDate().minusDays(dateRange) : runDay;

            while (run != null) {
                runDay = new LocalDate(run.getTimestamp());
                Run nextRun = run.getNextBuild();

                if (nextRun != null) {
                    LocalDate nextRunDay = new LocalDate(nextRun.getTimestamp());
                    // skip run before firstDay, but keep if next build is after start date
                    if (!runDay.isBefore(firstDay)
                            || runDay.isBefore(firstDay) && !nextRunDay.isBefore(firstDay)) {
                        // if next run is not the same day, use this test to summarize
                        if (nextRunDay.isAfter(runDay)) {
                            summarize(summaries, run.getAction(ReportPluginBuildAction.class).getTestResults(),
                                    filter, (runDay.isBefore(firstDay) ? firstDay : runDay),
                                    nextRunDay.minusDays(1));
                        }
                    }
                } else {
                    // use this run's test result from last run to today
                    summarize(summaries, run.getAction(ReportPluginBuildAction.class).getTestResults(), filter,
                            (runDay.isBefore(firstDay) ? firstDay : runDay), today);
                }
                run = nextRun;
            }
        }
    }

    return new Graph(-1, getGraphWidth(), getGraphHeight()) {

        protected JFreeChart createGraph() {
            return GraphHelper.createChart(buildDataSet(summaries));
        }
    };
}

From source file:com.stagecents.fnd.api.command.ChangeUserCredentialsCommand.java

License:Open Source License

public ChangeUserCredentialsCommand(UserId userId, String newCredentials, LocalDate changeDate) {
    this.userId = userId;
    this.newCredentials = newCredentials;
    this.changeDate = (changeDate == null) ? new LocalDate() : changeDate;
}

From source file:com.stagecents.fnd.api.service.LocationCommandHandler.java

License:Open Source License

/**
 * Validates that the inactive date is greater than or equal to the session
 * date. If the inactive date is less than the session date then an
 * IllegalArgumentException will be raised and processing terminated.
 * /* w w  w  . j  a  va  2 s  .c  o m*/
 * @param inactiveDate The date the location becomes inactive.
 * @see Aracle hr_loc_bus
 */
private void checkInactiveDate(LocalDate inactiveDate) {
    if (inactiveDate != null) {
        // TODO Replace today with session date
        LocalDate today = new LocalDate();
        if (inactiveDate.isBefore(today)) {
            throw new IllegalArgumentException("inactive date cannot be in the past");
        }
    }
}

From source file:com.stagecents.fnd.api.service.UserCommandHandler.java

License:Open Source License

@CommandHandler
public void disableUser(DisableUserCommand command) {
    LocalDate today = new LocalDate();
    if (!command.getEndDate().isAfter(today)) {
        throw new InvalidUserEndDateException("end date cannot be in the future");
    }//from ww w . ja  v a 2  s . c  o m

    User user = repository.load(command.getUserId());
    user.disableUser(command.getEndDate());
}

From source file:com.stagecents.fnd.domain.Location.java

License:Open Source License

/**
 * Validates that the given inactive date is greater than or equal to the
 * session date. If the inactive date is less than the session date then an
 * IllegalArgumentException will be raised and processing terminated.
 * //  w w w . jav  a2  s  . com
 * @param inactiveDate The inactive date to test
 */
private void validateInactiveDate(LocalDate inactiveDate) {
    if (inactiveDate != null) {
        LocalDate today = new LocalDate();
        if (inactiveDate.isBefore(today)) {
            throw new IllegalArgumentException("inactive date cannot be in the past");
        }
    }
}