Example usage for org.joda.time LocalDateTime LocalDateTime

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

Introduction

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

Prototype

public LocalDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour) 

Source Link

Document

Constructs an instance set to the specified date and time using ISOChronology.

Usage

From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemDateTime.java

License:Open Source License

/**
 * Returns this {@link CosemDateTime} as {@link LocalDateTime} if the date
 * and time are specified./*  w  w w. j  a  v a2s  .  c  o  m*/
 *
 * @return this {@link CosemDateTime} as {@link LocalDateTime}, or
 *         {@code null} if not {@link #isLocalDateTimeSpecified()}.
 *
 * @see #isLocalDateTimeSpecified()
 */
public LocalDateTime asLocalDateTime() {
    if (!this.isLocalDateTimeSpecified()) {
        return null;
    }
    if (this.time.isSecondNotSpecified()) {
        return new LocalDateTime(this.date.getYear(), this.date.getMonth(), this.date.getDayOfMonth(),
                this.time.getHour(), this.time.getMinute());
    }
    if (this.time.isHundredthsNotSpecified()) {
        return new LocalDateTime(this.date.getYear(), this.date.getMonth(), this.date.getDayOfMonth(),
                this.time.getHour(), this.time.getMinute(), this.time.getSecond());
    }
    return new LocalDateTime(this.date.getYear(), this.date.getMonth(), this.date.getDayOfMonth(),
            this.time.getHour(), this.time.getMinute(), this.time.getSecond(), this.time.getHundredths() * 10);
}

From source file:com.axelor.apps.crm.service.TargetService.java

License:Open Source License

@Transactional(rollbackOn = { AxelorException.class, Exception.class })
public void update(Target target) {
    User user = target.getUser();//w ww . j  ava2s.  co  m
    Team team = target.getTeam();
    LocalDate fromDate = target.getFromDate();
    LocalDate toDate = target.getToDate();

    LocalDateTime fromDateTime = new LocalDateTime(fromDate.getYear(), fromDate.getMonthOfYear(),
            fromDate.getDayOfMonth(), 0, 0);
    LocalDateTime toDateTime = new LocalDateTime(toDate.getYear(), toDate.getMonthOfYear(),
            toDate.getDayOfMonth(), 23, 59);

    if (user != null) {
        Query q = JPA.em().createQuery(
                "select SUM(op.amount) FROM Opportunity as op WHERE op.user = ?1 AND op.salesStageSelect = 9 AND op.createdOn >= ?2 AND op.createdOn <= ?3 ");
        q.setParameter(1, user);
        q.setParameter(2, fromDateTime);
        q.setParameter(3, toDateTime);

        BigDecimal opportunityAmountWon = (BigDecimal) q.getSingleResult();

        Long callEmittedNumber = eventRepo.all().filter(
                "self.typeSelect = ?1 AND self.user = ?2 AND self.startDateTime >= ?3 AND self.endDateTime <= ?4 AND self.callTypeSelect = 2",
                1, user, fromDateTime, toDateTime).count();

        target.setCallEmittedNumber(callEmittedNumber.intValue());

        Long meetingNumber = eventRepo.all().filter(
                "self.typeSelect = ?1 AND self.user = ?2 AND self.startDateTime >= ?3 AND self.endDateTime <= ?4",
                1, user, fromDateTime, toDateTime).count();

        target.setMeetingNumber(meetingNumber.intValue());

        target.setOpportunityAmountWon(opportunityAmountWon);

        Long opportunityCreatedNumber = opportunityRepo.all()
                .filter("self.user = ?1 AND self.createdOn >= ?2 AND self.createdOn <= ?3", user, fromDateTime,
                        toDateTime)
                .count();

        target.setOpportunityCreatedNumber(opportunityCreatedNumber.intValue());

        Long opportunityCreatedWon = opportunityRepo.all().filter(
                "self.user = ?1 AND self.createdOn >= ?2 AND self.createdOn <= ?3 AND self.salesStageSelect = 9",
                user, fromDateTime, toDateTime).count();

        target.setOpportunityCreatedWon(opportunityCreatedWon.intValue());
    } else if (team != null) {

        Query q = JPA.em().createQuery(
                "select SUM(op.amount) FROM Opportunity as op WHERE op.team = ?1 AND op.salesStageSelect = 9  AND op.createdOn >= ?2 AND op.createdOn <= ?3 ");
        q.setParameter(1, team);
        q.setParameter(2, fromDateTime);
        q.setParameter(3, toDateTime);

        BigDecimal opportunityAmountWon = (BigDecimal) q.getSingleResult();

        Long callEmittedNumber = eventRepo.all().filter(
                "self.typeSelect = ?1 AND self.team = ?2 AND self.startDateTime >= ?3 AND self.endDateTime <= ?4 AND self.callTypeSelect = 2",
                1, team, fromDateTime, toDateTime).count();

        target.setCallEmittedNumber(callEmittedNumber.intValue());

        Long meetingNumber = eventRepo.all().filter(
                "self.typeSelect = ?1 AND self.team = ?2 AND self.startDateTime >= ?3 AND self.endDateTime <= ?4",
                1, team, fromDateTime, toDateTime).count();

        target.setMeetingNumber(meetingNumber.intValue());

        target.setOpportunityAmountWon(opportunityAmountWon);

        Long opportunityCreatedNumber = opportunityRepo.all()
                .filter("self.team = ?1 AND self.createdOn >= ?2 AND self.createdOn <= ?3", team, fromDateTime,
                        toDateTime)
                .count();

        target.setOpportunityCreatedNumber(opportunityCreatedNumber.intValue());

        Long opportunityCreatedWon = opportunityRepo.all().filter(
                "self.team = ?1 AND self.createdOn >= ?2 AND self.createdOn <= ?3 AND self.salesStageSelect = 9",
                team, fromDateTime, toDateTime).count();

        target.setOpportunityCreatedWon(opportunityCreatedWon.intValue());
    }

    targetRepo.save(target);

}

From source file:com.axelor.apps.hr.service.leave.LeaveService.java

License:Open Source License

@Transactional
public void createEvents(LeaveRequest leave) throws AxelorException {
    Employee employee = leave.getUser().getEmployee();
    if (employee == null) {
        throw new AxelorException(
                String.format(I18n.get(IExceptionMessage.LEAVE_USER_EMPLOYEE), leave.getUser().getName()),
                IException.CONFIGURATION_ERROR);
    }//  w w w. j a v a2  s  .  c  o m

    WeeklyPlanning weeklyPlanning = employee.getPlanning();

    if (weeklyPlanning == null) {
        throw new AxelorException(
                String.format(I18n.get(IExceptionMessage.EMPLOYEE_PLANNING), employee.getName()),
                IException.CONFIGURATION_ERROR);
    }

    int startTimeHour = 0;
    int startTimeMin = 0;
    DayPlanning startDay = weeklyPlanningService.findDayPlanning(weeklyPlanning, leave.getDateFrom());
    DayPlanning endDay = weeklyPlanningService.findDayPlanning(weeklyPlanning, leave.getDateTo());
    if (leave.getStartOnSelect() == LeaveRequestRepository.SELECT_MORNING) {
        if (startDay.getMorningFrom() != null) {
            startTimeHour = startDay.getMorningFrom().getHourOfDay();
            startTimeMin = startDay.getMorningFrom().getMinuteOfHour();
        } else {
            startTimeHour = 8;
            startTimeMin = 0;
        }
    } else {
        if (startDay.getAfternoonFrom() != null) {
            startTimeHour = startDay.getAfternoonFrom().getHourOfDay();
            startTimeMin = startDay.getAfternoonFrom().getMinuteOfHour();
        } else {
            startTimeHour = 14;
            startTimeMin = 0;
        }
    }
    LocalDateTime fromDateTime = new LocalDateTime(leave.getDateFrom().getYear(),
            leave.getDateFrom().getMonthOfYear(), leave.getDateFrom().getDayOfMonth(), startTimeHour,
            startTimeMin);

    int endTimeHour = 0;
    int endTimeMin = 0;
    if (leave.getEndOnSelect() == LeaveRequestRepository.SELECT_MORNING) {
        if (endDay.getMorningTo() != null) {
            endTimeHour = endDay.getMorningTo().getHourOfDay();
            endTimeMin = endDay.getMorningTo().getMinuteOfHour();
        } else {
            endTimeHour = 12;
            endTimeMin = 0;
        }
    } else {
        if (endDay.getAfternoonTo() != null) {
            endTimeHour = endDay.getAfternoonTo().getHourOfDay();
            endTimeMin = endDay.getAfternoonTo().getMinuteOfHour();
        } else {
            endTimeHour = 18;
            endTimeMin = 0;
        }
    }
    LocalDateTime toDateTime = new LocalDateTime(leave.getDateTo().getYear(),
            leave.getDateTo().getMonthOfYear(), leave.getDateTo().getDayOfMonth(), endTimeHour, endTimeMin);

    Event event = eventService.createEvent(fromDateTime, toDateTime, leave.getUser(), leave.getComments(),
            EventRepository.TYPE_LEAVE,
            leave.getReason().getLeaveReason() + " " + leave.getUser().getFullName());
    eventRepo.save(event);
}

From source file:com.excilys.sugadroid.services.SugarBeanFactoryImpl.java

License:Open Source License

private Object getSetterParameter(Method m, String value) throws Exception {
    Class<?>[] params = m.getParameterTypes();

    if (params.length != 1) {
        throw new Exception("The setter should have only one parameter");
    }/*  ww w . j av a2  s  .  c  om*/

    Class<?> parameterClass = params[0];

    if (parameterClass.equals(String.class)) {
        return value;
    } else if (parameterClass.equals(LocalDate.class)) {
        StringTokenizer stk = new StringTokenizer(value, "-");
        int year = Integer.parseInt(stk.nextToken());
        int month = Integer.parseInt(stk.nextToken());
        int day = Integer.parseInt(stk.nextToken());
        return new LocalDate(year, month, day);
    } else if (parameterClass.equals(LocalTime.class)) {
        StringTokenizer stk = new StringTokenizer(value, ":");
        int hour = Integer.parseInt(stk.nextToken());
        int minutes = Integer.parseInt(stk.nextToken());
        return new LocalTime(hour, minutes);
    } else if (parameterClass.equals(Integer.class)) {
        return new Integer(value);
    } else if (parameterClass.equals(LocalDateTime.class)) {
        StringTokenizer stk = new StringTokenizer(value, " ");
        String date = stk.nextToken();
        String time = stk.nextToken();
        stk = new StringTokenizer(date, "-");
        int year = Integer.parseInt(stk.nextToken());
        int month = Integer.parseInt(stk.nextToken());
        int day = Integer.parseInt(stk.nextToken());
        stk = new StringTokenizer(time, ":");
        int hour = Integer.parseInt(stk.nextToken());
        int minutes = Integer.parseInt(stk.nextToken());
        return new LocalDateTime(year, month, day, hour, minutes);
    }

    throw new Exception("Unknown type: " + parameterClass.getSimpleName());
}

From source file:com.marand.thinkmed.medications.business.impl.TherapyDisplayProvider.java

License:Open Source License

private String getCalculatedIntervalDisplay(final HourMinuteDto startHourMinute,
        final Integer durationInMinutes, final DateTime therapyEnd) {
    if (startHourMinute != null) {
        final LocalDateTime start = new LocalDateTime(1, 1, 1, startHourMinute.getHour(),
                startHourMinute.getMinute());

        String intervalString = hourMinuteToString(startHourMinute) + "";
        if (durationInMinutes != null) {
            final LocalDateTime end = start.plusMinutes(durationInMinutes);
            final HourMinuteDto endHourMinute = new HourMinuteDto(end.getHourOfDay(), end.getMinuteOfHour());
            intervalString += hourMinuteToString(endHourMinute);
        } else if (therapyEnd != null) {
            final HourMinuteDto endHourMinute = new HourMinuteDto(therapyEnd.getHourOfDay(),
                    therapyEnd.getMinuteOfHour());
            intervalString += hourMinuteToString(endHourMinute);
        } else {//w  w  w.  jav  a2  s .  c o  m
            intervalString += "...";
        }
        return intervalString;
    }
    return null;
}

From source file:com.restservice.serviceLogic.ResultLogic.java

License:Open Source License

/**
 * Request handler for getting the count per hour statistic
 * Additional logic beyond the transactor database connection to insert additional zeros
 * for dates where no count (row) has been returned
 * /*from  w w  w . j a v  a2  s  . c o  m*/
 * @param id
 *            search term index
 * @return envelope containing a status message and a search result count
 *         per date DTO
 * @throws SQLException
 * @throws ExecutionException
 * @throws InterruptedException
 */
public Envelope getCountAndNewsPerHour(Long id, String lang)
        throws SQLException, InterruptedException, ExecutionException {

    SearchTermsPerQueryPerDate countsPerDay;
    Envelope env = new Envelope();

    countsPerDay = transactor.getCountPerHour(id, lang);

    // Fill with zeros
    ArrayList<Integer> newCounts = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDates = new ArrayList<LocalDateTime>();
    if (!countsPerDay.getDates().isEmpty()) {
        ArrayList<LocalDateTime> oldDates = new ArrayList<>();
        for (LocalDateTime curDate : countsPerDay.getDates()) {
            oldDates.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(), curDate.getDayOfMonth(),
                    curDate.getHourOfDay(), 0));
        }

        newDates.add(oldDates.get(0));
        newCounts.add(countsPerDay.getCounts().get(0));
        for (int i = 1; i < oldDates.size(); i++) {
            if (!oldDates.get(i - 1).plusHours(1).equals(oldDates.get(i))) {
                LocalDateTime startDate = oldDates.get(i - 1);
                LocalDateTime endDate = oldDates.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDates.add(oldDates.get(i));
                        newCounts.add(countsPerDay.getCounts().get(i));
                    } else {
                        newCounts.add(0);
                        newDates.add(startDate);
                    }

                }
            } else {
                newDates.add(oldDates.get(i));
                newCounts.add(countsPerDay.getCounts().get(i));
            }
        }
    }

    countsPerDay.setCounts(newCounts);
    countsPerDay.setDates(newDates);
    countsPerDay.updateDateStrings();

    // convert to nice output format
    CountAndNewsPerHour countAndNews = new CountAndNewsPerHour();
    for (Integer index = 0; index < countsPerDay.getCounts().size(); index++) {
        CountPeaksNewsAndDate element = new CountPeaksNewsAndDate();
        element.setRawDate(countsPerDay.getDates().get(index));
        element.setCount(countsPerDay.getCounts().get(index));
        element.setPeak(false);
        countAndNews.getGraph().add(element);
    }
    countAndNews.setQuery(countsPerDay.getQuery());

    // find and marks peaks
    ArrayList<Integer> peakIndices = PeaksUtil.findPeaks24(countAndNews);
    for (Integer peakIndex : peakIndices) {
        countAndNews.getGraph().get(peakIndex).setPeak(true);
    }

    if (peakIndices.size() > 0) {
        // create news fetchers
        HashMap<Integer, Future<ArrayList<NewsItem>>> newsFetchers = new HashMap<Integer, Future<ArrayList<NewsItem>>>();
        ExecutorService executor = Executors.newFixedThreadPool(peakIndices.size());
        for (Integer peakIndex : peakIndices) {
            LocalDateTime date = countAndNews.getGraph().get(peakIndex).getRawDate();
            newsFetchers.put(peakIndex, executor.submit(
                    new TopNewsFetcherThread(id, date.getDayOfMonth(), date.getMonthOfYear(), date.getYear())));
        }
        // retrieve news fetchers results
        executor.shutdown();
        java.util.Iterator<Entry<Integer, Future<ArrayList<NewsItem>>>> iterator = newsFetchers.entrySet()
                .iterator();
        while (iterator.hasNext()) {
            Entry<Integer, Future<ArrayList<NewsItem>>> entry = iterator.next();
            ArrayList<NewsItem> result = entry.getValue().get();
            if (result != null) {
                for (NewsItem newsitem : result) {
                    countAndNews.getGraph().get(entry.getKey()).getNews().add(newsitem.toShortString());
                }
            }
        }
    }

    env.setData(countAndNews);

    return env;
}

From source file:com.restservice.serviceLogic.ResultLogic.java

License:Open Source License

/**
 * Request handler for getting the count per hour statistic
 * //from   w  w  w .ja  v a2 s  .co m
 * @param id
 *            search term index
 * @param lang
 *            iso language code of the language (all languages are selected
 *            if this parameter is null)
 * 
 * @return envelope containing a status message and the number of
 *         positive/negative tweets per hour
 * @throws SQLException
 */
public Envelope getSentimentPerHour(Long id, String lang) throws SQLException {

    SentimentPerQueryPerDate data;
    Envelope env = new Envelope();

    // TODO: Filling these zeros shouldn't been done three times (twice
    // here and once in getCountPerHour). Fix it! See ticket #86
    data = transactor.getSentimentPerHour(id, lang);

    ArrayList<LocalDateTime> oldDatesPositive = new ArrayList<>();
    ArrayList<Integer> newCountsPositive = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDatesPositive = new ArrayList<LocalDateTime>();
    ArrayList<LocalDateTime> oldDatesNegative = new ArrayList<>();
    ArrayList<Integer> newCountsNegative = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDatesNegative = new ArrayList<LocalDateTime>();

    // Reset minutes, seconds and miliseconds to 0
    if (!data.getPositiveCounts().getDates().isEmpty()) {
        for (LocalDateTime curDate : data.getPositiveCounts().getDates()) {
            oldDatesPositive.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(),
                    curDate.getDayOfMonth(), curDate.getHourOfDay(), 0));
        }
    }
    if (!data.getNegativeCounts().getDates().isEmpty()) {
        for (LocalDateTime curDate : data.getNegativeCounts().getDates()) {
            oldDatesNegative.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(),
                    curDate.getDayOfMonth(), curDate.getHourOfDay(), 0));
        }
    }

    // Get first date from both (positive or negative) and fill the
    // other one with leading zero counts
    if (!oldDatesPositive.isEmpty() && !oldDatesNegative.isEmpty()) {
        // The first positive date is earlier than the first negative
        // date
        if (oldDatesPositive.get(0).compareTo(oldDatesNegative.get(0)) == -1) {
            LocalDateTime curDate = oldDatesPositive.get(0);
            while (!curDate.equals(oldDatesNegative.get(0))) {
                newCountsNegative.add(0);
                newDatesNegative.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
        // The first negative date is earlier than the first positive
        // date
        else if (oldDatesPositive.get(0).compareTo(oldDatesNegative.get(0)) == 1) {
            LocalDateTime curDate = oldDatesNegative.get(0);
            while (!curDate.equals(oldDatesPositive.get(0))) {
                newCountsPositive.add(0);
                newDatesPositive.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
    }

    // Fill hours that have 0 counts for positive tweets
    if (!oldDatesPositive.isEmpty()) {
        newDatesPositive.add(oldDatesPositive.get(0));
        newCountsPositive.add(data.getPositiveCounts().getCounts().get(0));
        for (int i = 1; i < oldDatesPositive.size(); i++) {
            if (!oldDatesPositive.get(i - 1).plusHours(1).equals(oldDatesPositive.get(i))) {
                LocalDateTime startDate = oldDatesPositive.get(i - 1);
                LocalDateTime endDate = oldDatesPositive.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDatesPositive.add(oldDatesPositive.get(i));
                        newCountsPositive.add(data.getPositiveCounts().getCounts().get(i));
                    } else {
                        newCountsPositive.add(0);
                        newDatesPositive.add(startDate);
                    }

                }
            } else {
                newDatesPositive.add(oldDatesPositive.get(i));
                newCountsPositive.add(data.getPositiveCounts().getCounts().get(i));
            }
        }
    }

    // Fill hours that have 0 counts for negative tweets
    if (!oldDatesNegative.isEmpty()) {
        newDatesNegative.add(oldDatesNegative.get(0));
        newCountsNegative.add(data.getNegativeCounts().getCounts().get(0));
        for (int i = 1; i < oldDatesNegative.size(); i++) {
            if (!oldDatesNegative.get(i - 1).plusHours(1).equals(oldDatesNegative.get(i))) {
                LocalDateTime startDate = oldDatesNegative.get(i - 1);
                LocalDateTime endDate = oldDatesNegative.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDatesNegative.add(oldDatesNegative.get(i));
                        newCountsNegative.add(data.getNegativeCounts().getCounts().get(i));
                    } else {
                        newCountsNegative.add(0);
                        newDatesNegative.add(startDate);
                    }

                }
            } else {
                newDatesNegative.add(oldDatesNegative.get(i));
                newCountsNegative.add(data.getNegativeCounts().getCounts().get(i));
            }
        }
    }

    // Fill negative with zeros when only positive exists
    if (!newDatesPositive.isEmpty() && newDatesNegative.isEmpty()) {
        for (LocalDateTime curDate : newDatesPositive) {
            newCountsNegative.add(0);
            newDatesNegative.add(curDate);
        }
    }
    // Fill positive with zeros when only negative exists
    else if (newDatesPositive.isEmpty() && !newDatesNegative.isEmpty()) {
        for (LocalDateTime curDate : newDatesNegative) {
            newCountsPositive.add(0);
            newDatesPositive.add(curDate);
        }
    }

    // Get last date from both (positive or negative) and fill the other
    // one with trailing zero counts
    if (!newDatesPositive.isEmpty() && !newDatesNegative.isEmpty()) {
        // The last positive date is later than the last negative date
        if (newDatesPositive.get(newDatesPositive.size() - 1)
                .compareTo(newDatesNegative.get(newDatesNegative.size() - 1)) == -1) {
            LocalDateTime curDate = newDatesPositive.get(newDatesPositive.size() - 1);
            while (!curDate.equals(newDatesNegative.get(newDatesNegative.size() - 1))) {
                newCountsNegative.add(0);
                newDatesNegative.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
        // The last negative date is later than the last positive date
        else if (newDatesPositive.get(newDatesPositive.size() - 1)
                .compareTo(newDatesNegative.get(newDatesNegative.size() - 1)) == 1) {
            LocalDateTime curDate = newDatesNegative.get(newDatesNegative.size() - 1);
            while (!curDate.equals(newDatesPositive.get(newDatesPositive.size() - 1))) {
                newCountsPositive.add(0);
                newDatesPositive.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
    }

    data.getPositiveCounts().setCounts(newCountsPositive);
    data.getPositiveCounts().setDates(newDatesPositive);
    data.getPositiveCounts().updateDateStrings();

    data.getNegativeCounts().setCounts(newCountsNegative);
    data.getNegativeCounts().setDates(newDatesNegative);
    data.getNegativeCounts().updateDateStrings();

    env.setData(data);

    return env;
}

From source file:control.TimePeriodControl.java

/**
 * Henter alle tidsperioder ind, og sorterer dem fra der endten ligger uden
 * for currentShift's periode eller ikke refererer til samme employee som
 * currentShift./*from  w w w  .  j  av a  2  s.com*/
 *
 * @param currentShift
 * @return Tidsperioder i currentShift's tidsperiode for currentShift's
 * medarbejder.
 * @throws exceptions.ControlException
 */
public ArrayList<TimePeriod> getTimeperiods(TimeInvestment currentShift) throws DatabaseException {
    ArrayList<TimePeriod> timePeriods = new ArrayList<>();
    Employee mie = EmployeeHandler.getInstance().getEmployee(31);
    Room mr2 = RoomHandler.getInstance().getRoom("MR 2");
    Room ctA = RoomHandler.getInstance().getRoom("CT A");
    Room ctB = RoomHandler.getInstance().getRoom("CT B");
    LocalDateTime start = new LocalDateTime(2015, 4, 12, 0, 0);
    LocalDateTime end = new LocalDateTime(2015, 4, 18, 0, 0);

    timePeriods.add(new TimePeriod(start, end, 0, 1, mr2, mie));
    timePeriods.add(new TimePeriod(start, end, 1, 3, ctA, mie));
    timePeriods.add(new TimePeriod(start, end, 1, 3, ctB, mie));

    for (int i = 0; i < timePeriods.size(); i++) {
        boolean shiftInPeriod = Xray.getInstance().isDateInPeriod(currentShift.getStartTime(),
                timePeriods.get(i).getStartTime(), timePeriods.get(i).getEndTime());
        if (!(shiftInPeriod)
                || timePeriods.get(i).getEmployee().getId() != currentShift.getEmployee().getId()) {
            timePeriods.remove(timePeriods.get(i));
            i--;
        }
    }

    return timePeriods;
}

From source file:de.appsolve.padelcampus.utils.BookingUtil.java

public LocalDateTime getLocalDateTime(LocalDate selectedDate, LocalTime startTime) {
    return new LocalDateTime(selectedDate.getYear(), selectedDate.getMonthOfYear(),
            selectedDate.getDayOfMonth(), startTime.getHourOfDay(), startTime.getMinuteOfHour());
}

From source file:ee.ut.soras.ajavtV2.mudel.ajavaljend.arvutus.TimeMLDateTimePoint.java

License:Open Source License

public LocalDateTime getAsLocalDateTime() {
    return new LocalDateTime((this.underlyingDate).getYear(), (this.underlyingDate).getMonthOfYear(),
            (this.underlyingDate).getDayOfMonth(), (this.underlyingTime).getHourOfDay(),
            (this.underlyingTime).getMinuteOfHour());
}