Example usage for org.joda.time.format DateTimeFormatter print

List of usage examples for org.joda.time.format DateTimeFormatter print

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeFormatter print.

Prototype

public String print(ReadablePartial partial) 

Source Link

Document

Prints a ReadablePartial to a new String.

Usage

From source file:com.sheepdog.mashmesh.servlets.AcceptPickupServlet.java

License:Apache License

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    Objectify rideRequestOfy = OfyService.transactionOfy();

    try {//from   w  w w . ja  v a 2s  .  c o  m
        String rideRequestId = req.getParameter("rideRequestId");
        Preconditions.checkNotNull(rideRequestId);

        RideRequest rideRequest = rideRequestOfy.get(RideRequest.class, Long.parseLong(rideRequestId));
        UserProfile userProfile = (UserProfile) req.getAttribute("userProfile");

        VolunteerProfile volunteerProfile = rideRequest.getPendingVolunteerProfile();

        // Make sure that we're not trying to answer a pickup request meant for someone else.
        if (!volunteerProfile.getUserId().equals(userProfile.getUserId())) {
            resp.setStatus(403);
            // TODO: Explanatory page
            return;
        }

        // TODO: Centralize this logic with the rest of the notification logic
        RideRecord rideRecord = rideRequest.getPendingRideRecord();
        rideRecord.setExportable(true);
        OfyService.ofy().put(rideRecord);

        PickupNotification.sendPatientNotification(rideRequest, userProfile);

        rideRequestOfy.delete(rideRequest);
        rideRequestOfy.getTxn().commit();

        // TODO: Make sure that pickup requests timeout and trigger a rejection.

        DateTimeFormatter dateFormatter = DateTimeFormat.fullDate();
        DateTimeFormatter timeFormatter = DateTimeFormat.shortTime();

        VelocityContext context = new VelocityContext();
        context.put("userProfile", userProfile);
        context.put("isAdmin", UserServiceFactory.getUserService().isUserAdmin());
        context.put("patientProfile", rideRequest.getPatientProfile());
        context.put("appointmentAddress", rideRequest.getAppointmentAddress());
        context.put("appointmentTime", timeFormatter.print(rideRequest.getAppointmentTime()));
        context.put("appointmentDate", dateFormatter.print(rideRequest.getAppointmentTime()));
        context.put("pickupTime", timeFormatter.print(rideRecord.getPickupTime()));

        resp.setContentType("text/html");
        Template template = VelocityUtils.getInstance().getTemplate(ACCEPT_PICKUP_TEMPLATE_PATH);
        template.merge(context, resp.getWriter());
    } catch (MessagingException e) {
        logger.log(Level.SEVERE, "Failed to send patient notification", e);
        resp.setStatus(500);
    } finally {
        if (rideRequestOfy.getTxn().isActive()) {
            rideRequestOfy.getTxn().rollback();
        }
    }
}

From source file:com.sheepdog.mashmesh.util.FusionTableContentWriter.java

License:Apache License

private static String serializeObjectForFusionTables(Object object) {
    if (object instanceof GeoPt) {
        GeoPt geoPt = (GeoPt) object;/* w  ww  .  ja  v  a  2s.co m*/
        return String.format("%f %f", geoPt.getLatitude(), geoPt.getLongitude());
    } else if (object instanceof DateTime) {
        DateTime dateTime = (DateTime) object;
        DateTimeFormatter iso8601Formatter = ISODateTimeFormat.dateTimeNoMillis();
        return iso8601Formatter.print(dateTime);
    } else {
        return object.toString();
    }
}

From source file:com.shekar.msrp.utils.DateUtils.java

License:Apache License

/**
 * Encode a long date to string value in Z format (see RFC 3339)
 * //w  w  w . ja v a2  s. c o m
 * @param date Date in milliseconds
 * @return String
 */
public static String encodeDate(long date) {
    // Apply RFC3339 format using JODA-TIME
    DateTime dateTime = new DateTime(date, DateTimeZone.UTC);
    DateTimeFormatter dateFormatter = ISODateTimeFormat.dateTime();
    String dateString = dateFormatter.print(dateTime);
    System.out.println("Server side date (RFC 3339): " + dateString);
    return dateString;
}

From source file:com.smict.person.data.DoctorData.java

/**
 * Add doctor's workday depend on month pattern.
 * @author anubissmile/*from  ww w  . j a  v  a  2 s. c om*/
 * @param DoctorModel docModel
 * @param DoctTimeModel docTimeModel
 * @return int rec | Count of record that get affected.
 */
public int addDoctorWorkdayPattern(DoctorModel docModel, DoctTimeModel docTimeModel) {
    DateUtil dt = new DateUtil();
    int key = 0;
    String[] workMonth;
    List<String> insertVal = new ArrayList<String>();
    DateTime firstOfMonth, endOfMonth, nowDate;
    DateTimeFormatter dayName = DateTimeFormat.forPattern("E");
    DateTimeFormatter fullDateTime = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
    DateTimeFormatter fullDate = DateTimeFormat.forPattern("yyyy-MM-dd");
    String day, fullDay;
    String startDateTime, endDateTime;
    int workMinutes;

    /**
     * Loop month.
     */
    for (String month : docTimeModel.getWork_month()) {
        /**
         * Convert BE. to AD.
         */
        workMonth = month.split("-");
        workMonth[1] = String.valueOf(Integer.parseInt(workMonth[1]) - 543);

        /**
         * Make first date of month.
         */
        nowDate = firstOfMonth = DateTime.parse(workMonth[1] + "-" + workMonth[0] + "-" + "01");
        System.out.println(firstOfMonth);

        /**
         * Find Maximum date of month.   
         */
        endOfMonth = firstOfMonth.dayOfMonth().withMaximumValue();
        System.out.println(endOfMonth);

        /**
         * Loop day
         */
        while (Days.daysBetween(nowDate, endOfMonth).getDays() >= 0) {
            /**
             * Get day name.
             */
            day = dayName.print(nowDate);
            fullDay = fullDate.print(nowDate);
            System.out.print(day.concat(" | "));
            System.out.print(fullDay.concat(" | "));
            System.out.println(nowDate);

            /**
             * Fetch time range by day
             */
            //Mon
            // ('1', '2017-06-01 05:23:24', '2017-06-01 15:23:24', '25', '431', '0', '0000-00-00 00:00:01', '0000-00-00 00:00:01')
            if ((day.equals("Mon") || day.equals("."))
                    && (!docTimeModel.getTime_in_mon().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_mon().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_mon().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_mon().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_mon().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_mon().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Tue
            if ((day.equals("Tue") || day.equals("."))
                    && (!docTimeModel.getTime_in_tue().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_tue().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_tue().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_tue().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_tue().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_tue().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Wed
            if ((day.equals("Wed") || day.equals("."))
                    && (!docTimeModel.getTime_in_wed().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_wed().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_wed().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_wed().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_wed().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_wed().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Thu
            if ((day.equals("Thu") || day.equals("."))
                    && (!docTimeModel.getTime_in_thu().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_thu().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_thu().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_thu().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_thu().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_thu().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Fri
            if ((day.equals("Fri") || day.equals("."))
                    && (!docTimeModel.getTime_in_fri().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_fri().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_fri().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_fri().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_fri().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_fri().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Sat
            if ((day.equals("Sat") || day.equals("."))
                    && (!docTimeModel.getTime_in_sat().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_sat().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_sat().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_sat().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_sat().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_sat().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            //Sun
            if ((day.equals("Sun") || day.equals("."))
                    && (!docTimeModel.getTime_in_sun().get(key).equals("00:00")
                            || !docTimeModel.getTime_out_sun().get(key).equals("00:00"))) {
                workMinutes = Minutes.minutesBetween(LocalTime.parse(docTimeModel.getTime_in_sun().get(key)),
                        LocalTime.parse(docTimeModel.getTime_out_sun().get(key))).getMinutes();
                startDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_in_sun().get(key)).concat(":00");
                endDateTime = fullDate.print(nowDate).toString().concat(" ")
                        .concat(docTimeModel.getTime_out_sun().get(key)).concat(":00");
                insertVal.add(" ('" + docModel.getDoctorID() + "', '" + startDateTime + "', '" + endDateTime
                        + "', '" + workMinutes + "', '" + docModel.getBranch_id()
                        + "', '0', '1', '0000-00-00 00:00:01', '0000-00-00 00:00:01') ");
                nowDate = nowDate.plusDays(1);
                continue;
            }

            /**
             * Plus one day.
             */
            nowDate = nowDate.plusDays(1);
        }

        ++key;
    }

    String SQL = StringUtils.join(insertVal, ", ");
    SQL = "INSERT INTO `doctor_workday` " + "(`doctor_id`, `start_datetime`, " + "`end_datetime`, `work_hour`, "
            + "`branch_id`, `branch_room_id`, " + "`checkin_status`, `checkin_datetime`, `checkout_datetime`) "
            + "VALUES ".concat(SQL);

    agent.connectMySQL();
    agent.begin();
    int rec = agent.exeUpdate(SQL);
    agent.commit();
    agent.disconnectMySQL();

    return rec;
}

From source file:com.solidfire.core.serialization.DateTimeAdapter.java

License:Open Source License

/**
 * Writes a DateTime object./*from w  w  w.  jav  a 2  s . c o m*/
 *
 * @param writer the JSON writer to write to.
 * @param value  the DateTime object to write.
 * @throws IOException
 */
@Override
public void write(JsonWriter writer, DateTime value) throws IOException {
    if (value == null) {
        writer.nullValue();
    } else {
        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
        writer.value(fmt.print(value.withZone(DateTimeZone.UTC)));
    }
}

From source file:com.sonicle.webtop.calendar.bol.js.JsEvent.java

License:Open Source License

public JsEvent(EventInstance event, String ownerPid) {
    DateTimeZone eventTz = DateTimeZone.forID(event.getTimezone());
    DateTimeFormatter ymdhmsZoneFmt = DateTimeUtils.createYmdHmsFormatter(eventTz);

    id = event.getKey();//from  www  . j  a  v a  2 s.  c  om
    eventId = event.getEventId();
    calendarId = event.getCalendarId();

    startDate = ymdhmsZoneFmt.print(event.getStartDate());
    endDate = ymdhmsZoneFmt.print(event.getEndDate());
    timezone = event.getTimezone();
    allDay = event.getAllDay();

    title = event.getTitle();
    description = event.getDescription();
    location = event.getLocation();
    isPrivate = event.getIsPrivate();
    busy = event.getBusy();
    reminder = EventInstance.Reminder.getMinutes(event.getReminder());
    activityId = event.getActivityId();
    masterDataId = event.getMasterDataId();
    statMasterDataId = event.getStatMasterDataId();
    causalId = event.getCausalId();
    rrule = event.getRecurrenceRule();

    /*
    Recur recur = ICal4jUtils.parseRRule(rrule);
    if (ICal4jUtils.recurHasUntilDate(recur)) {
       DateTime newUntil = ICal4jUtils.fromICal4jDateUTC(recur.getUntil()).withZoneRetainFields(eventTz);
       ICal4jUtils.setRecurUntilDate(recur, newUntil);
       rrule = recur.toString();
    }
    */

    LocalDate rrs = null;
    if (event.getRecurrenceStartDate() != null) {
        rrs = event.getRecurrenceStartDate();
    } else {
        rrs = event.getStartDate().withZone(eventTz).toLocalDate();
    }
    rstart = DateTimeUtils.print(DateTimeUtils.createYmdFormatter(), rrs);

    attendees = new ArrayList<>();
    for (EventAttendee att : event.getAttendees()) {
        Attendee jsa = new Attendee();
        jsa.attendeeId = att.getAttendeeId();
        jsa.recipient = att.getRecipient();
        jsa.recipientType = EnumUtils.toSerializedName(att.getRecipientType());
        jsa.recipientRole = EnumUtils.toSerializedName(att.getRecipientRole());
        jsa.responseStatus = EnumUtils.toSerializedName(att.getResponseStatus());
        jsa.notify = att.getNotify();
        attendees.add(jsa);
    }

    attachments = new ArrayList<>();
    for (EventAttachment att : event.getAttachments()) {
        Attachment jsa = new Attachment();
        jsa.id = att.getAttachmentId();
        //jsatt.lastModified = DateTimeUtils.printYmdHmsWithZone(att.getRevisionTimestamp(), profileTz);
        jsa.name = att.getFilename();
        jsa.size = att.getSize();
        attachments.add(jsa);
    }

    // Read-only fields
    _recurringInfo = EnumUtils.toSerializedName(event.getRecurInfo());
    _profileId = ownerPid;
}

From source file:com.sonicle.webtop.calendar.bol.js.JsPletEvents.java

License:Open Source License

public JsPletEvents(ShareRootCalendar root, ShareFolderCalendar folder, SchedEventInstance event,
        DateTimeZone profileTz) {/*from   ww w .j  av  a 2  s  .c om*/
    DateTimeFormatter ymdhmsZoneFmt = DateTimeUtils.createYmdHmsFormatter(profileTz);
    final Calendar calendar = folder.getCalendar();

    id = event.getKey();
    eventId = event.getEventId();
    calendarId = event.getCalendarId();
    calendarName = calendar.getName();
    calendarColor = calendar.getColor();

    // Source field is already in UTC, we need only to display it
    // in the timezone choosen by user in his settings.
    // Formatter will be instantiated specifying desired timezone.
    startDate = ymdhmsZoneFmt.print(event.getStartDate());
    endDate = ymdhmsZoneFmt.print(event.getEndDate());
    timezone = event.getTimezone();
    isAllDay = event.getAllDay();

    title = event.getTitle();
    location = event.getLocation();

    _owner = (root instanceof MyShareRootCalendar) ? "" : root.getDescription();
    _frights = folder.getElementsPerms().toString();
    _erights = folder.getElementsPerms().toString();
}

From source file:com.sonicle.webtop.calendar.bol.js.JsSchedulerEvent.java

License:Open Source License

public JsSchedulerEvent(ShareRootCalendar root, ShareFolderCalendar folder, CalendarPropSet folderProps,
        SchedEventInstance event, UserProfileId profileId, DateTimeZone profileTz) {
    DateTimeFormatter ymdhmsZoneFmt = DateTimeUtils.createYmdHmsFormatter(profileTz);
    Calendar calendar = folder.getCalendar();

    // Determine if keep event data private
    boolean keepDataPrivate = false;
    if (event.getIsPrivate()) {
        if (!calendar.getProfileId().equals(profileId)) {
            keepDataPrivate = true;/*from w w w.jav  a  2s. co m*/
        }
    }

    id = event.getKey();
    eventId = event.getEventId();
    originalEventId = event.getEventId();
    calendarId = event.getCalendarId();

    CalendarUtils.EventBoundary eventBoundary = CalendarUtils.getInternalEventBoundary(event.getAllDay(),
            event.getStartDate(), event.getEndDate(), event.getDateTimeZone());
    isAllDay = eventBoundary.allDay;
    startDate = ymdhmsZoneFmt.print(eventBoundary.start);
    endDate = ymdhmsZoneFmt.print(eventBoundary.end);
    timezone = event.getTimezone();

    // Source field is already in UTC, we need only to display it
    // in the timezone choosen by user in his settings.
    // Formatter will be instantiated specifying desired timezone.
    /*
    if (event.getAllDay()) {
       startDate = ymdhmsZoneFmt.print(event.getStartDate());
       int days = CalendarUtils.calculateLengthInDays(event.getStartDate(), event.getEndDate());
       DateTime newEnd = event.getStartDate().plusDays(days).withTimeAtStartOfDay();
       endDate = ymdhmsZoneFmt.print(newEnd);
    } else {
       startDate = ymdhmsZoneFmt.print(event.getStartDate());
       endDate = ymdhmsZoneFmt.print(event.getEndDate());
    }
    timezone = event.getTimezone();
    isAllDay = event.getAllDay();
    */

    title = (keepDataPrivate) ? "***" : event.getTitle();
    color = calendar.getColor();
    if (folderProps != null)
        color = folderProps.getColorOrDefault(color);
    location = (keepDataPrivate) ? "" : event.getLocation();
    isPrivate = event.getIsPrivate();
    reminder = (event.getReminder() == null) ? -1 : event.getReminder().getValue();
    //TODO: gestire eventi readonly...(utenti admin devono poter editare)
    isReadOnly = keepDataPrivate || calendar.isProviderRemote();
    hideData = keepDataPrivate;
    hasTz = !event.getDateTimeZone().getID().equals(profileTz.getID())
            && !DateTimeUtils.isTimeZoneCompatible(event.getDateTimeZone(), profileTz, event.getStartDate());
    hasAtts = event.hasAttendees();
    isNtf = event.hasNotifyableAttendees();
    isRecurring = event.isEventRecurring();
    isBroken = event.isEventBroken();
    hasCmts = !StringUtils.isBlank(event.getDescription());

    folderName = calendar.getName();
    _owner = (root instanceof MyShareRootCalendar) ? "" : root.getDescription();
    _rights = folder.getElementsPerms().toString();
    _profileId = calendar.getProfileId().toString();
}

From source file:com.sonicle.webtop.calendar.bol.js.JsSchedulerEvent.java

License:Open Source License

public JsSchedulerEvent(ShareRootCalendar rootFolder, ShareFolderCalendar folder, CalendarPropSet folderProps,
        VVEventInstance event, UserProfileId profileId, DateTimeZone profileTz) {
    DateTimeFormatter ymdhmsZoneFmt = DateTimeUtils.createYmdHmsFormatter(profileTz);
    Calendar calendar = folder.getCalendar();

    // Determine if keep event data private
    boolean keepDataPrivate = false;
    if (event.getIsPrivate()) {
        if (!calendar.getProfileId().equals(profileId)) {
            keepDataPrivate = true;//from  ww  w. j  a v  a  2 s .  c  o  m
        }
    }

    id = event.getKey();
    eventId = event.getEventId();
    originalEventId = event.getEventId();
    calendarId = event.getCalendarId();

    // Source field is already in UTC, we need only to display it
    // in the timezone choosen by user in his settings.
    // Formatter will be instantiated specifying desired timezone.
    startDate = ymdhmsZoneFmt.print(event.getStartDate());
    endDate = ymdhmsZoneFmt.print(event.getEndDate());
    timezone = event.getTimezone();
    isAllDay = event.getAllDay();

    title = (keepDataPrivate) ? "***" : event.getTitle();
    color = calendar.getColor();
    if (folderProps != null)
        color = folderProps.getColorOrDefault(color);
    location = (keepDataPrivate) ? "" : event.getLocation();
    isPrivate = event.getIsPrivate();
    reminder = (event.getReminder() == null) ? -1 : event.getReminder();
    //TODO: gestire eventi readonly...(utenti admin devono poter editare)
    isReadOnly = event.getReadOnly() || keepDataPrivate;
    hasTz = !event.getDateTimeZone().getID().equals(profileTz.getID())
            && !DateTimeUtils.isTimeZoneCompatible(event.getDateTimeZone(), profileTz, event.getStartDate());
    hasAtts = event.hasAttendees();
    isNtf = event.hasNotifyableAttendees();
    isRecurring = event.isEventRecurring();
    isBroken = event.isEventBroken();
    hasCmts = !StringUtils.isBlank(event.getDescription());

    folderName = calendar.getName();
    _owner = (rootFolder instanceof MyShareRootCalendar) ? "" : rootFolder.getDescription();
    _rights = folder.getElementsPerms().toString();
    _profileId = calendar.getProfileId().toString();
}

From source file:com.sonicle.webtop.calendar.CalendarManager.java

License:Open Source License

public ArrayList<String> generateTimeSpans(int minRange, LocalDate fromDate, LocalDate toDate,
        LocalTime fromTime, LocalTime toTime, DateTimeZone tz) {
    ArrayList<String> hours = new ArrayList<>();
    DateTimeFormatter ymdhmZoneFmt = DateTimeUtils.createYmdHmFormatter(tz);

    DateTime instant = new DateTime(tz).withDate(fromDate).withTime(fromTime).withSecondOfMinute(0)
            .withMillisOfSecond(0);// ww w.  j  av a 2 s  .c o  m
    DateTime boundaryInstant = new DateTime(tz).withDate(toDate).withTime(toTime).withSecondOfMinute(0)
            .withMillisOfSecond(0);
    while (instant.compareTo(boundaryInstant) < 0) {
        hours.add(ymdhmZoneFmt.print(instant));
        instant = instant.plusMinutes(minRange);
    }

    return hours;
}