Search in sources :

Example 1 with DateParseException

use of com.alexstyl.specialdates.date.DateParseException in project Memento-Calendar by alexstyl.

the class FacebookContactFactory method createContactFrom.

ContactEvent createContactFrom(Map<String, String> map) throws InvalidFacebookContactException {
    try {
        Date date = dateFrom(map);
        DisplayName name = nameFrom(map);
        long uid = idOf(map);
        URI imagePath = FacebookImagePath.INSTANCE.forUid(uid);
        return new ContactEvent(Optional.Companion.<Long>absent(), StandardEventType.BIRTHDAY, date, new Contact(uid, name, imagePath, SOURCE_FACEBOOK));
    } catch (DateParseException | IndexOutOfBoundsException ex) {
        throw new InvalidFacebookContactException(ex);
    }
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) DateParseException(com.alexstyl.specialdates.date.DateParseException) DisplayName(com.alexstyl.specialdates.contact.DisplayName) URI(java.net.URI) Date(com.alexstyl.specialdates.date.Date) Contact(com.alexstyl.specialdates.contact.Contact)

Aggregations

Contact (com.alexstyl.specialdates.contact.Contact)1 DisplayName (com.alexstyl.specialdates.contact.DisplayName)1 ContactEvent (com.alexstyl.specialdates.date.ContactEvent)1 Date (com.alexstyl.specialdates.date.Date)1 DateParseException (com.alexstyl.specialdates.date.DateParseException)1 URI (java.net.URI)1