Example usage for org.apache.wicket.util.string Strings isEmpty

List of usage examples for org.apache.wicket.util.string Strings isEmpty

Introduction

In this page you can find the example usage for org.apache.wicket.util.string Strings isEmpty.

Prototype

public static boolean isEmpty(final CharSequence string) 

Source Link

Document

Checks whether the string is considered empty.

Usage

From source file:org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler.java

License:Apache License

/**
 * {@inheritDoc}/*from  w ww .j  a v a2 s.c o m*/
 */
@Override
public boolean deleteItem(Appointment appointment) {

    if (calendar != null && calendar.getSyncType() != SyncType.NONE) {
        HttpDeleteMethod deleteMethod = null;
        try {

            String fullPath;
            if (Strings.isEmpty(appointment.getHref())) {
                // Make sure to set HREF just in case, if calendar exists but no href does.
                fullPath = this.path + appointment.getIcalId() + ".ics";
            } else {
                fullPath = getFullPath(URI.create(this.path), appointment.getHref());
            }

            deleteMethod = new HttpDeleteMethod(fullPath, appointment.getEtag());

            log.info("Deleting at location: {} with ETag: {}", fullPath, appointment.getEtag());

            HttpResponse response = client.execute(deleteMethod, context);

            int status = response.getStatusLine().getStatusCode();
            if (status == SC_NO_CONTENT || status == SC_OK || status == SC_NOT_FOUND) {
                log.info("Successfully deleted appointment with id: " + appointment.getId());
                return true;
            } else {
                // Appointment Not deleted
            }
        } catch (IOException e) {
            log.error("Error executing OptionsMethod during testConnection.", e);
        } catch (Exception e) {
            log.error("Severe Error in executing OptionsMethod during testConnection.", e);
        } finally {
            releaseConnection(deleteMethod);
        }
    }
    return false;
}

From source file:org.apache.openmeetings.service.calendar.caldav.IcalUtils.java

License:Apache License

/**
 * Convenience function to parse date from {@link net.fortuna.ical4j.model.Property} to
 * {@link Date}/*from  w w w .j  av  a 2 s  . c o  m*/
 *
 * @param dt       DATE-TIME Property from which we parse.
 * @param timeZone Timezone of the Date.
 * @return {@link java.util.Date} representation of the iCalendar value.
 */
public Date parseDate(Property dt, TimeZone timeZone) {
    if (dt == null || Strings.isEmpty(dt.getValue())) {
        return null;
    }

    String[] acceptedFormats = { "yyyyMMdd'T'HHmmss", "yyyyMMdd'T'HHmmss'Z'", "yyyyMMdd" };
    Parameter tzid = dt.getParameter(Parameter.TZID);
    if (tzid == null) {
        return parseDate(dt.getValue(), acceptedFormats, timeZone);
    } else {
        return parseDate(dt.getValue(), acceptedFormats, getTimeZone(tzid.getValue()));
    }
}

From source file:org.apache.openmeetings.service.mail.template.AppointmentReminderTemplate.java

License:Apache License

private AppointmentReminderTemplate(Long langId, Appointment a, TimeZone tz) {
    super(langId, a, tz);

    add(new Label("titleLbl", getString(1158L, langId)));
    add(new Label("title", a.getTitle()));
    add(new WebMarkupContainer("descContainer").add(new Label("descLbl", getString(1152L, langId)))
            .add(new Label("desc", a.getDescription()).setEscapeModelStrings(false))
            .setVisible(!Strings.isEmpty(a.getDescription())));
    add(new Label("startLbl", getString(1153L, langId)));
    add(new Label("start", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
    add(new Label("endLbl", getString(1154L, langId)));
    add(new Label("end", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
}

From source file:org.apache.openmeetings.service.mail.template.CanceledAppointmentTemplate.java

License:Apache License

private CanceledAppointmentTemplate(Long langId, Appointment a, TimeZone tz, String invitorName) {
    super(langId, a, tz);

    add(new Label("titleLbl", getString(1157L, langId)));
    add(new Label("title", a.getTitle()));
    add(new WebMarkupContainer("descContainer").add(new Label("descLbl", getString(1152L, langId)))
            .add(new Label("desc", a.getDescription()).setEscapeModelStrings(false))
            .setVisible(!Strings.isEmpty(a.getDescription())));
    add(new Label("startLbl", getString(1153L, langId)));
    add(new Label("start", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
    add(new Label("endLbl", getString(1154L, langId)));
    add(new Label("end", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
    add(new Label("invitorLbl", getString(1156L, langId)));
    add(new Label("invitor", invitorName));
}

From source file:org.apache.openmeetings.service.mail.template.CreatedAppointmentTemplate.java

License:Apache License

private CreatedAppointmentTemplate(Long langId, Appointment a, TimeZone tz, String invitorName) {
    super(langId, a, tz);

    add(new Label("titleLbl", getString(1151L, langId)));
    add(new Label("title", a.getTitle()));
    add(new WebMarkupContainer("descContainer").add(new Label("descLbl", getString(1152L, langId)))
            .add(new Label("desc", a.getDescription()).setEscapeModelStrings(false))
            .setVisible(!Strings.isEmpty(a.getDescription())));
    add(new Label("startLbl", getString(1153L, langId)));
    add(new Label("start", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
    add(new Label("endLbl", getString(1154L, langId)));
    add(new Label("end", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
    add(new Label("invitorLbl", getString(1156L, langId)));
    add(new Label("invitor", invitorName));
}

From source file:org.apache.openmeetings.service.mail.template.subject.AppointmentTemplate.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();
    add(new Label("title", a.getTitle()));
    add(new WebMarkupContainer("descContainer").add(new Label("descLbl", getString("1152", locale)))
            .add(new Label("desc", a.getDescription()).setEscapeModelStrings(false))
            .setVisible(!Strings.isEmpty(a.getDescription())));
    add(new Label("startLbl", getString("1153", locale)));
    add(new Label("start", format(a.getStart())));
    add(new Label("endLbl", getString("1154", locale)));
    add(new Label("end", format(a.getEnd())));
}

From source file:org.apache.openmeetings.service.mail.template.subject.TestSubjTemplate.java

License:Apache License

private static void checkTemplate(SubjectEmailTemplate t) {
    assertNotNull("Template should be created", t);
    assertFalse("Subject should be not empty", Strings.isEmpty(t.getSubject()));
    assertFalse("Body should be not empty", Strings.isEmpty(t.getEmail()));
}

From source file:org.apache.openmeetings.service.mail.template.TestEmailTemplate.java

License:Apache License

private static void checkTemplate(String eml) {
    Assert.assertFalse("Body should be not empty", Strings.isEmpty(eml));
}

From source file:org.apache.openmeetings.service.mail.template.UpdatedAppointmentTemplate.java

License:Apache License

private UpdatedAppointmentTemplate(Long langId, Appointment a, TimeZone tz, String invitorName) {
    super(langId, a, tz);

    add(new Label("titleLbl", getString(1155L, langId)));
    add(new Label("title", a.getTitle()));
    add(new WebMarkupContainer("descContainer").add(new Label("descLbl", getString(1152L, langId)))
            .add(new Label("desc", a.getDescription()).setEscapeModelStrings(false))
            .setVisible(!Strings.isEmpty(a.getDescription())));
    add(new Label("startLbl", getString(1153L, langId)));
    add(new Label("start", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
    add(new Label("endLbl", getString(1154L, langId)));
    add(new Label("end", CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
    add(new Label("invitorLbl", getString(1156L, langId)));
    add(new Label("invitor", invitorName));
}

From source file:org.apache.openmeetings.service.notifier.TextNotifier.java

License:Apache License

@Override
public void notify(User u, Appointment a, Invitation inv) throws Exception {
    if (u.getAddress() == null || Strings.isEmpty(u.getAddress().getPhone())) {
        log.debug("User has no Phone, skip sending notification");
        return;/*  w  ww .java  2s  .  c om*/
    }
    final String phone = u.getAddress().getPhone();
    String msg = cfgDao.getString(CONFIG_REMINDER_MESSAGE, null);
    if (Strings.isEmpty(msg)) {
        msg = String.format("%s %s", LabelDao.getString("1158", u.getLanguageId()), a.getTitle());
    }
    final String reminderMsg = msg;
    taskExecutor.execute(() -> log.debug("Sending Text to: {}, msg is: {}", phone, reminderMsg));
}