List of usage examples for android.content ContentValues getAsInteger
public Integer getAsInteger(String key)
From source file:com.concentricsky.android.khanacademy.data.remote.LibraryUpdaterTask.java
private ChildArrayResults parseChildArray(JsonParser parser, SQLiteDatabase tempDb, String parentTopic_id) throws JsonParseException, IOException { ChildArrayResults result = new ChildArrayResults(); int seq = 0;//from w w w . ja va 2s . c o m JsonToken currentToken = parser.getCurrentToken(); if (currentToken == JsonToken.START_ARRAY) { while (parser.nextValue() == JsonToken.START_OBJECT) { // Otherwise, we will be at END_ARRAY here. ContentValues values = parseObject(parser, tempDb, parentTopic_id, seq++); if (values != null && values.containsKey("kind")) { String kind = values.getAsString("kind"); if ("Topic".equals(kind) && values.containsKey("_id")) { result.childKind = kind; result.childIds.add(values.getAsString("_id")); result.videoCount += values.getAsInteger("video_count"); if (result.thumbId == null && values.containsKey("thumb_id")) { // Return the first available thumb id as this topic's thumb id. result.thumbId = values.getAsString("thumb_id"); } } else if ("Video".equals(kind) && values.containsKey("readable_id")) { result.childKind = kind; result.childIds.add(values.getAsString("readable_id")); result.videoCount += 1; if (result.thumbId == null && values.containsKey("pngurl")) { // Return youtube_id of first video with a thumbnail as this topic's thumbnail id. result.thumbId = values.getAsString("youtube_id"); } } } } } return result; }
From source file:at.bitfire.ical4android.AndroidEvent.java
protected void populateEvent(ContentValues values) { event.summary = values.getAsString(Events.TITLE); event.location = values.getAsString(Events.EVENT_LOCATION); event.description = values.getAsString(Events.DESCRIPTION); final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0; final long tsStart = values.getAsLong(Events.DTSTART); final String duration = values.getAsString(Events.DURATION); String tzId;/*from w w w. j a v a2 s. c o m*/ Long tsEnd = values.getAsLong(Events.DTEND); if (allDay) { event.setDtStart(tsStart, null); if (tsEnd == null) { Dur dur = new Dur(duration); java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart)); tsEnd = dEnd.getTime(); } event.setDtEnd(tsEnd, null); } else { // use the start time zone for the end time, too // because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only tzId = values.getAsString(Events.EVENT_TIMEZONE); event.setDtStart(tsStart, tzId); if (tsEnd != null) event.setDtEnd(tsEnd, tzId); else if (!StringUtils.isEmpty(duration)) event.duration = new Duration(new Dur(duration)); } // recurrence try { String strRRule = values.getAsString(Events.RRULE); if (!StringUtils.isEmpty(strRRule)) event.rRule = new RRule(strRRule); String strRDate = values.getAsString(Events.RDATE); if (!StringUtils.isEmpty(strRDate)) { RDate rDate = (RDate) DateUtils.androidStringToRecurrenceSet(strRDate, RDate.class, allDay); event.getRDates().add(rDate); } String strExRule = values.getAsString(Events.EXRULE); if (!StringUtils.isEmpty(strExRule)) { ExRule exRule = new ExRule(); exRule.setValue(strExRule); event.exRule = exRule; } String strExDate = values.getAsString(Events.EXDATE); if (!StringUtils.isEmpty(strExDate)) { ExDate exDate = (ExDate) DateUtils.androidStringToRecurrenceSet(strExDate, ExDate.class, allDay); event.getExDates().add(exDate); } } catch (ParseException ex) { Log.w(TAG, "Couldn't parse recurrence rules, ignoring", ex); } catch (IllegalArgumentException ex) { Log.w(TAG, "Invalid recurrence rules, ignoring", ex); } if (values.containsKey(Events.ORIGINAL_INSTANCE_TIME)) { // this event is an exception of a recurring event long originalInstanceTime = values.getAsLong(Events.ORIGINAL_INSTANCE_TIME); boolean originalAllDay = false; if (values.containsKey(Events.ORIGINAL_ALL_DAY)) originalAllDay = values.getAsInteger(Events.ORIGINAL_ALL_DAY) != 0; Date originalDate = originalAllDay ? new Date(originalInstanceTime) : new DateTime(originalInstanceTime); if (originalDate instanceof DateTime) ((DateTime) originalDate).setUtc(true); event.recurrenceId = new RecurrenceId(originalDate); } // status if (values.containsKey(Events.STATUS)) switch (values.getAsInteger(Events.STATUS)) { case Events.STATUS_CONFIRMED: event.status = Status.VEVENT_CONFIRMED; break; case Events.STATUS_TENTATIVE: event.status = Status.VEVENT_TENTATIVE; break; case Events.STATUS_CANCELED: event.status = Status.VEVENT_CANCELLED; } // availability event.opaque = values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE; // set ORGANIZER if there's attendee data if (values.getAsInteger(Events.HAS_ATTENDEE_DATA) != 0 && values.containsKey(Events.ORGANIZER)) try { event.organizer = new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null)); } catch (URISyntaxException ex) { Log.e(TAG, "Error when creating ORGANIZER mailto URI, ignoring", ex); } // classification switch (values.getAsInteger(Events.ACCESS_LEVEL)) { case Events.ACCESS_CONFIDENTIAL: case Events.ACCESS_PRIVATE: event.forPublic = false; break; case Events.ACCESS_PUBLIC: event.forPublic = true; } }
From source file:ca.marcmeszaros.papyrus.browser.BooksBrowser.java
/** * Executes the query to loan out the book *///from w w w . j a va2 s. c o m private void loanBook(int mYear, int mMonth, int mDay) { // set the due date Calendar c = Calendar.getInstance(); c.set(mYear, mMonth, mDay); // gets the uri path to the user selected Uri user = loanData.getData(); // gets the user id String id = user.getLastPathSegment(); // prepare the query ContentValues values = new ContentValues(); values.put(PapyrusContentProvider.Loans.FIELD_BOOK_ID, selectedBookID); values.put(PapyrusContentProvider.Loans.FIELD_CONTACT_ID, id); values.put(PapyrusContentProvider.Loans.FIELD_LEND_DATE, System.currentTimeMillis()); values.put(PapyrusContentProvider.Loans.FIELD_DUE_DATE, c.getTimeInMillis()); // insert the entry in the database, and get the new loan id Uri newLoan = resolver.insert(PapyrusContentProvider.Loans.CONTENT_URI, values); int loanID = (int) ContentUris.parseId(newLoan); // Book book = new Book(isbn10, title, author); Loan loan = new Loan(loanID, values.getAsInteger(PapyrusContentProvider.Loans.FIELD_BOOK_ID), values.getAsInteger(PapyrusContentProvider.Loans.FIELD_CONTACT_ID), values.getAsLong(PapyrusContentProvider.Loans.FIELD_LEND_DATE), values.getAsLong(PapyrusContentProvider.Loans.FIELD_DUE_DATE)); // get an alarm manager AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); // create the intent for the alarm Intent intent = new Intent(this, AlarmReceiver.class); // put the loan object into the alarm receiver intent.putExtra("loan", loan); // create the pendingIntent to run when the alarm goes off and be handled by a receiver PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); // set the repeating alarm am.set(AlarmManager.RTC, c.getTimeInMillis(), pendingIntent); Toast.makeText(this, getString(R.string.BooksBrowser_toast_loanSuccessful), Toast.LENGTH_LONG).show(); }
From source file:com.tct.mail.providers.Attachment.java
/** * Create an attachment from a {@link ContentValues} object. * The keys should be {@link AttachmentColumns}. *///from w w w .j a v a 2 s. c o m public Attachment(ContentValues values) { name = values.getAsString(AttachmentColumns.NAME); size = values.getAsInteger(AttachmentColumns.SIZE); uri = parseOptionalUri(values.getAsString(AttachmentColumns.URI)); contentType = values.getAsString(AttachmentColumns.CONTENT_TYPE); state = values.getAsInteger(AttachmentColumns.STATE); destination = values.getAsInteger(AttachmentColumns.DESTINATION); downloadedSize = values.getAsInteger(AttachmentColumns.DOWNLOADED_SIZE); contentUri = parseOptionalUri(values.getAsString(AttachmentColumns.CONTENT_URI)); thumbnailUri = parseOptionalUri(values.getAsString(AttachmentColumns.THUMBNAIL_URI)); previewIntentUri = parseOptionalUri(values.getAsString(AttachmentColumns.PREVIEW_INTENT_URI)); providerData = values.getAsString(AttachmentColumns.PROVIDER_DATA); supportsDownloadAgain = values.getAsBoolean(AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN); type = values.getAsInteger(AttachmentColumns.TYPE); flags = values.getAsInteger(AttachmentColumns.FLAGS); partId = values.getAsString(AttachmentColumns.CONTENT_ID); //TS: wenggangjin 2014-12-10 EMAIL BUGFIX_852100 MOD_S contentId = values.getAsString(AttachmentColumns.CONTENT_ID); //TS: wenggangjin 2014-12-10 EMAIL BUGFIX_852100 MOD_E //TS: zhonghua.tuo 2015-3-3 EMAIL BUGFIX_936728 ADD_S realUri = parseOptionalUri(values.getAsString(AttachmentColumns.REAL_URI)); //TS: zhonghua.tuo 2015-3-3 EMAIL BUGFIX_936728 ADD_E // TS: Gantao 2015-09-19 EMAIL BUGFIX_570084 ADD_S isInline = values.getAsInteger(AttachmentColumns.ISINLINE); // TS: Gantao 2015-09-19 EMAIL BUGFIX_570084 ADD_E }
From source file:com.goliathonline.android.kegbot.io.RemoteKegHandler.java
/** {@inheritDoc} */ @Override/* w w w .j a va 2 s . c o m*/ public ArrayList<ContentProviderOperation> parse(JSONObject parser, ContentResolver resolver) throws JSONException, IOException { final ArrayList<ContentProviderOperation> batch = Lists.newArrayList(); // Walk document, parsing any incoming entries JSONObject result = parser.getJSONObject("result"); JSONObject keg = result.getJSONObject("keg"); JSONObject type = result.getJSONObject("type"); JSONObject image = type.getJSONObject("image"); final String kegId = sanitizeId(keg.getString("id")); final Uri kegUri = Kegs.buildKegUri(kegId); // Check for existing details, only update when changed final ContentValues values = queryKegDetails(kegUri, resolver); final long localUpdated = values.getAsLong(SyncColumns.UPDATED); final long serverUpdated = 500; //entry.getUpdated(); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "found keg " + kegId); Log.v(TAG, "found localUpdated=" + localUpdated + ", server=" + serverUpdated); } // Clear any existing values for this session, treating the // incoming details as authoritative. batch.add(ContentProviderOperation.newDelete(kegUri).build()); final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Kegs.CONTENT_URI); builder.withValue(SyncColumns.UPDATED, serverUpdated); builder.withValue(Kegs.KEG_ID, kegId); // Inherit starred value from previous row if (values.containsKey(Kegs.KEG_STARRED)) { builder.withValue(Kegs.KEG_STARRED, values.getAsInteger(Kegs.KEG_STARRED)); } if (keg.has("status")) builder.withValue(Kegs.STATUS, keg.getString("status")); if (keg.has("volume_ml_remain")) builder.withValue(Kegs.VOLUME_REMAIN, keg.getDouble("volume_ml_remain")); if (keg.has("description")) builder.withValue(Kegs.DESCRIPTION, keg.getString("description")); if (keg.has("type_id")) builder.withValue(Kegs.TYPE_ID, keg.getString("type_id")); if (keg.has("size_id")) builder.withValue(Kegs.SIZE_ID, keg.getInt("size_id")); if (keg.has("percent_full")) builder.withValue(Kegs.PERCENT_FULL, keg.getDouble("percent_full")); if (keg.has("size_name")) builder.withValue(Kegs.SIZE_NAME, keg.getString("size_name")); if (keg.has("spilled_ml")) builder.withValue(Kegs.VOLUME_SPILL, keg.getDouble("spilled_ml")); if (keg.has("size_volume_ml")) builder.withValue(Kegs.VOLUME_SIZE, keg.getDouble("size_volume_ml")); if (type.has("name")) builder.withValue(Kegs.KEG_NAME, type.getString("name")); if (type.has("abv")) builder.withValue(Kegs.KEG_ABV, type.getDouble("abv")); if (image.has("url")) builder.withValue(Kegs.IMAGE_URL, image.getString("url")); // Normal keg details ready, write to provider batch.add(builder.build()); return batch; }
From source file:com.granita.icloudcalsync.resource.LocalCalendar.java
protected void populateEvent(Event e, ContentValues values) { e.setUid(values.getAsString(entryColumnUID())); e.setSummary(values.getAsString(Events.TITLE)); e.setLocation(values.getAsString(Events.EVENT_LOCATION)); e.setDescription(values.getAsString(Events.DESCRIPTION)); final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0; final long tsStart = values.getAsLong(Events.DTSTART); final String duration = values.getAsString(Events.DURATION); String tzId = null;//from w w w.j a va 2s . c o m Long tsEnd = values.getAsLong(Events.DTEND); if (allDay) { e.setDtStart(tsStart, null); if (tsEnd == null) { Dur dur = new Dur(duration); java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart)); tsEnd = dEnd.getTime(); } e.setDtEnd(tsEnd, null); } else { // use the start time zone for the end time, too // because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only tzId = values.getAsString(Events.EVENT_TIMEZONE); e.setDtStart(tsStart, tzId); if (tsEnd != null) e.setDtEnd(tsEnd, tzId); else if (!StringUtils.isEmpty(duration)) e.setDuration(new Duration(new Dur(duration))); } // recurrence try { String strRRule = values.getAsString(Events.RRULE); if (!StringUtils.isEmpty(strRRule)) e.setRrule(new RRule(strRRule)); String strRDate = values.getAsString(Events.RDATE); if (!StringUtils.isEmpty(strRDate)) { RDate rDate = new RDate(); rDate.setValue(strRDate); e.getRdates().add(rDate); } String strExRule = values.getAsString(Events.EXRULE); if (!StringUtils.isEmpty(strExRule)) { ExRule exRule = new ExRule(); exRule.setValue(strExRule); e.setExrule(exRule); } String strExDate = values.getAsString(Events.EXDATE); if (!StringUtils.isEmpty(strExDate)) { // always empty, see https://code.google.com/p/android/issues/detail?id=172411 ExDate exDate = new ExDate(); exDate.setValue(strExDate); e.getExdates().add(exDate); } } catch (ParseException ex) { Log.w(TAG, "Couldn't parse recurrence rules, ignoring", ex); } catch (IllegalArgumentException ex) { Log.w(TAG, "Invalid recurrence rules, ignoring", ex); } if (values.containsKey(Events.ORIGINAL_INSTANCE_TIME)) { // this event is an exception of a recurring event long originalInstanceTime = values.getAsLong(Events.ORIGINAL_INSTANCE_TIME); boolean originalAllDay = values.getAsInteger(Events.ORIGINAL_ALL_DAY) != 0; Date originalDate = originalAllDay ? new Date(originalInstanceTime) : new DateTime(originalInstanceTime); if (originalDate instanceof DateTime) ((DateTime) originalDate).setUtc(true); e.setRecurrenceId(new RecurrenceId(originalDate)); } // status if (values.containsKey(Events.STATUS)) switch (values.getAsInteger(Events.STATUS)) { case Events.STATUS_CONFIRMED: e.setStatus(Status.VEVENT_CONFIRMED); break; case Events.STATUS_TENTATIVE: e.setStatus(Status.VEVENT_TENTATIVE); break; case Events.STATUS_CANCELED: e.setStatus(Status.VEVENT_CANCELLED); } // availability e.setOpaque(values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE); // set ORGANIZER only when there are attendees if (values.getAsInteger(Events.HAS_ATTENDEE_DATA) != 0 && values.containsKey(Events.ORGANIZER)) try { e.setOrganizer(new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null))); } catch (URISyntaxException ex) { Log.e(TAG, "Error when creating ORGANIZER URI, ignoring", ex); } // classification switch (values.getAsInteger(Events.ACCESS_LEVEL)) { case Events.ACCESS_CONFIDENTIAL: case Events.ACCESS_PRIVATE: e.setForPublic(false); break; case Events.ACCESS_PUBLIC: e.setForPublic(true); } }
From source file:at.bitfire.davdroid.resource.LocalCalendar.java
protected void populateEvent(Event e, ContentValues values) { e.setUid(values.getAsString(entryColumnUID())); e.summary = values.getAsString(Events.TITLE); e.location = values.getAsString(Events.EVENT_LOCATION); e.description = values.getAsString(Events.DESCRIPTION); final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0; final long tsStart = values.getAsLong(Events.DTSTART); final String duration = values.getAsString(Events.DURATION); String tzId;/*from w w w . j ava 2 s . com*/ Long tsEnd = values.getAsLong(Events.DTEND); if (allDay) { e.setDtStart(tsStart, null); if (tsEnd == null) { Dur dur = new Dur(duration); java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart)); tsEnd = dEnd.getTime(); } e.setDtEnd(tsEnd, null); } else { // use the start time zone for the end time, too // because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only tzId = values.getAsString(Events.EVENT_TIMEZONE); e.setDtStart(tsStart, tzId); if (tsEnd != null) e.setDtEnd(tsEnd, tzId); else if (!StringUtils.isEmpty(duration)) e.duration = new Duration(new Dur(duration)); } // recurrence try { String strRRule = values.getAsString(Events.RRULE); if (!StringUtils.isEmpty(strRRule)) e.rrule = new RRule(strRRule); String strRDate = values.getAsString(Events.RDATE); if (!StringUtils.isEmpty(strRDate)) { RDate rDate = (RDate) DateUtils.androidStringToRecurrenceSet(strRDate, RDate.class, allDay); e.getRdates().add(rDate); } String strExRule = values.getAsString(Events.EXRULE); if (!StringUtils.isEmpty(strExRule)) { ExRule exRule = new ExRule(); exRule.setValue(strExRule); e.exrule = exRule; } String strExDate = values.getAsString(Events.EXDATE); if (!StringUtils.isEmpty(strExDate)) { ExDate exDate = (ExDate) DateUtils.androidStringToRecurrenceSet(strExDate, ExDate.class, allDay); e.getExdates().add(exDate); } } catch (ParseException ex) { Log.w(TAG, "Couldn't parse recurrence rules, ignoring", ex); } catch (IllegalArgumentException ex) { Log.w(TAG, "Invalid recurrence rules, ignoring", ex); } if (values.containsKey(Events.ORIGINAL_INSTANCE_TIME)) { // this event is an exception of a recurring event long originalInstanceTime = values.getAsLong(Events.ORIGINAL_INSTANCE_TIME); boolean originalAllDay = false; if (values.containsKey(Events.ORIGINAL_ALL_DAY)) originalAllDay = values.getAsInteger(Events.ORIGINAL_ALL_DAY) != 0; Date originalDate = originalAllDay ? new Date(originalInstanceTime) : new DateTime(originalInstanceTime); if (originalDate instanceof DateTime) ((DateTime) originalDate).setUtc(true); e.recurrenceId = new RecurrenceId(originalDate); } // status if (values.containsKey(Events.STATUS)) switch (values.getAsInteger(Events.STATUS)) { case Events.STATUS_CONFIRMED: e.status = Status.VEVENT_CONFIRMED; break; case Events.STATUS_TENTATIVE: e.status = Status.VEVENT_TENTATIVE; break; case Events.STATUS_CANCELED: e.status = Status.VEVENT_CANCELLED; } // availability e.opaque = values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE; // set ORGANIZER if there's attendee data if (values.getAsInteger(Events.HAS_ATTENDEE_DATA) != 0) try { e.organizer = new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null)); } catch (URISyntaxException ex) { Log.e(TAG, "Error when creating ORGANIZER mailto URI, ignoring", ex); } // classification switch (values.getAsInteger(Events.ACCESS_LEVEL)) { case Events.ACCESS_CONFIDENTIAL: case Events.ACCESS_PRIVATE: e.forPublic = false; break; case Events.ACCESS_PUBLIC: e.forPublic = true; } }
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
protected void populateEmailAddress(Contact c, ContentValues row) { ezvcard.property.Email email = new ezvcard.property.Email(row.getAsString(Email.ADDRESS)); switch (row.getAsInteger(Email.TYPE)) { case Email.TYPE_HOME: email.addType(EmailType.HOME);/*from w w w . jav a 2 s . c om*/ break; case Email.TYPE_WORK: email.addType(EmailType.WORK); break; case Email.TYPE_MOBILE: email.addType(Contact.EMAIL_TYPE_MOBILE); break; case Email.TYPE_CUSTOM: String customType = row.getAsString(Email.LABEL); if (StringUtils.isNotEmpty(customType)) email.addType(EmailType.get(labelToXName(customType))); } if (row.getAsInteger(Email.IS_PRIMARY) != 0) email.addType(EmailType.PREF); c.getEmails().add(email); }
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
protected void populateIMPP(Contact c, ContentValues row) { String handle = row.getAsString(Im.DATA); Impp impp = null;/* ww w . jav a 2 s.co m*/ switch (row.getAsInteger(Im.PROTOCOL)) { case Im.PROTOCOL_AIM: impp = Impp.aim(handle); break; case Im.PROTOCOL_MSN: impp = Impp.msn(handle); break; case Im.PROTOCOL_YAHOO: impp = Impp.yahoo(handle); break; case Im.PROTOCOL_SKYPE: impp = Impp.skype(handle); break; case Im.PROTOCOL_QQ: impp = new Impp("qq", handle); break; case Im.PROTOCOL_GOOGLE_TALK: impp = new Impp("google-talk", handle); break; case Im.PROTOCOL_ICQ: impp = Impp.icq(handle); break; case Im.PROTOCOL_JABBER: impp = Impp.xmpp(handle); break; case Im.PROTOCOL_NETMEETING: impp = new Impp("netmeeting", handle); break; case Im.PROTOCOL_CUSTOM: impp = new Impp(row.getAsString(Im.CUSTOM_PROTOCOL), handle); } if (impp != null) { switch (row.getAsInteger(Im.TYPE)) { case Im.TYPE_HOME: impp.addType(ImppType.HOME); break; case Im.TYPE_WORK: impp.addType(ImppType.WORK); break; case Im.TYPE_CUSTOM: String customType = row.getAsString(Im.LABEL); if (StringUtils.isNotEmpty(customType)) impp.addType(ImppType.get(labelToXName(customType))); } c.getImpps().add(impp); } }
From source file:at.bitfire.davdroid.resource.LocalAddressBook.java
protected void populateIMPP(Contact c, ContentValues row) { String handle = row.getAsString(Im.DATA); Impp impp = null;/* w w w. j a v a 2 s. c o m*/ switch (row.getAsInteger(Im.PROTOCOL)) { case Im.PROTOCOL_AIM: impp = Impp.aim(handle); break; case Im.PROTOCOL_MSN: impp = Impp.msn(handle); break; case Im.PROTOCOL_YAHOO: impp = Impp.yahoo(handle); break; case Im.PROTOCOL_SKYPE: impp = Impp.skype(handle); break; case Im.PROTOCOL_QQ: impp = new Impp("qq", handle); break; case Im.PROTOCOL_GOOGLE_TALK: impp = new Impp("google-talk", handle); break; case Im.PROTOCOL_ICQ: impp = Impp.icq(handle); break; case Im.PROTOCOL_JABBER: impp = Impp.xmpp(handle); break; case Im.PROTOCOL_NETMEETING: impp = new Impp("netmeeting", handle); break; case Im.PROTOCOL_CUSTOM: impp = new Impp(row.getAsString(Im.CUSTOM_PROTOCOL), handle); } if (impp != null) { if (row.containsKey(Im.TYPE)) switch (row.getAsInteger(Im.TYPE)) { case Im.TYPE_HOME: impp.addType(ImppType.HOME); break; case Im.TYPE_WORK: impp.addType(ImppType.WORK); break; case Im.TYPE_CUSTOM: String customType = row.getAsString(Im.LABEL); if (StringUtils.isNotEmpty(customType)) impp.addType(ImppType.get(labelToXName(customType))); } c.getImpps().add(impp); } }