List of usage examples for android.content ContentValues getAsString
public String getAsString(String key)
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
protected void populateNote(Contact c, ContentValues row) { c.setNote(row.getAsString(Note.NOTE)); }
From source file:edu.mit.mobile.android.locast.sync.SyncEngine.java
/** * Loads the an item from a JSONObject into a SyncStatus object. * * Sets {@link SyncStatus#remoteCVs}, {@link SyncStatus#remoteModifiedTime}, * {@link SyncStatus#remoteJson}, {@link SyncStatus#remote} * * @param jo// ww w .j a v a 2 s.co m * @param syncMap * @param serverTime * @return * @throws JSONException * @throws IOException * @throws NetworkProtocolException */ private SyncStatus loadItemFromJsonObject(JSONObject jo, SyncMap syncMap, long serverTime) throws JSONException, IOException, NetworkProtocolException { final ContentValues cv = JsonSyncableItem.fromJSON(mContext, null, jo, syncMap); final String remoteUri = cv.getAsString(JsonSyncableItem._PUBLIC_URI); final long remoteModified = cv.getAsLong(JsonSyncableItem._SERVER_MODIFIED_DATE); // the status starts out based on this knowledge and gets filled in // as the sync progresses final SyncStatus syncStatus = new SyncStatus(remoteUri, SyncState.REMOTE_ONLY); syncStatus.remoteModifiedTime = remoteModified; syncStatus.remoteCVs = cv; syncStatus.remoteJson = jo; syncStatus.remote = remoteUri; return syncStatus; }
From source file:at.bitfire.davdroid.resource.LocalAddressBook.java
protected void populateURL(Contact c, ContentValues row) { c.getURLs().add(row.getAsString(Website.URL)); }
From source file:at.bitfire.davdroid.resource.LocalAddressBook.java
private void populateStructuredName(Contact c, ContentValues row) { c.displayName = row.getAsString(StructuredName.DISPLAY_NAME); c.prefix = row.getAsString(StructuredName.PREFIX); c.givenName = row.getAsString(StructuredName.GIVEN_NAME); c.middleName = row.getAsString(StructuredName.MIDDLE_NAME); c.familyName = row.getAsString(StructuredName.FAMILY_NAME); c.suffix = row.getAsString(StructuredName.SUFFIX); c.phoneticGivenName = row.getAsString(StructuredName.PHONETIC_GIVEN_NAME); c.phoneticMiddleName = row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME); c.phoneticFamilyName = row.getAsString(StructuredName.PHONETIC_FAMILY_NAME); }
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
private void populateStructuredName(Contact c, ContentValues row) { c.setDisplayName(row.getAsString(StructuredName.DISPLAY_NAME)); c.setPrefix(row.getAsString(StructuredName.PREFIX)); c.setGivenName(row.getAsString(StructuredName.GIVEN_NAME)); c.setMiddleName(row.getAsString(StructuredName.MIDDLE_NAME)); c.setFamilyName(row.getAsString(StructuredName.FAMILY_NAME)); c.setSuffix(row.getAsString(StructuredName.SUFFIX)); c.setPhoneticGivenName(row.getAsString(StructuredName.PHONETIC_GIVEN_NAME)); c.setPhoneticMiddleName(row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME)); c.setPhoneticFamilyName(row.getAsString(StructuredName.PHONETIC_FAMILY_NAME)); }
From source file:at.bitfire.davdroid.resource.LocalAddressBook.java
protected void populateOrganization(Contact c, ContentValues row) { String company = row.getAsString(Organization.COMPANY), department = row.getAsString(Organization.DEPARTMENT), title = row.getAsString(Organization.TITLE), role = row.getAsString(Organization.JOB_DESCRIPTION); if (StringUtils.isNotEmpty(company) || StringUtils.isNotEmpty(department)) { ezvcard.property.Organization org = new ezvcard.property.Organization(); if (StringUtils.isNotEmpty(company)) org.addValue(company);// w w w . j av a 2 s .com if (StringUtils.isNotEmpty(department)) org.addValue(department); c.organization = org; } if (StringUtils.isNotEmpty(title)) c.jobTitle = title; if (StringUtils.isNotEmpty(role)) c.jobDescription = role; }
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
protected void populateOrganization(Contact c, ContentValues row) { String company = row.getAsString(Organization.COMPANY), department = row.getAsString(Organization.DEPARTMENT), title = row.getAsString(Organization.TITLE), role = row.getAsString(Organization.JOB_DESCRIPTION); if (StringUtils.isNotEmpty(company) || StringUtils.isNotEmpty(department)) { ezvcard.property.Organization org = new ezvcard.property.Organization(); if (StringUtils.isNotEmpty(company)) org.addValue(company);/*from ww w . ja va 2s . co m*/ if (StringUtils.isNotEmpty(department)) org.addValue(department); c.setOrganization(org); } if (StringUtils.isNotEmpty(title)) c.setJobTitle(title); if (StringUtils.isNotEmpty(role)) c.setJobDescription(role); }
From source file:com.granita.icloudcalsync.resource.LocalAddressBook.java
protected void populateURL(Contact c, ContentValues row) throws RemoteException { c.getURLs().add(row.getAsString(Website.URL)); }
From source file:at.bitfire.davdroid.resource.LocalAddressBook.java
protected void populateSipAddress(Contact c, ContentValues row) { try {/* ww w . j a va 2s.c o m*/ Impp impp = new Impp("sip:" + row.getAsString(SipAddress.SIP_ADDRESS)); if (row.containsKey(SipAddress.TYPE)) switch (row.getAsInteger(SipAddress.TYPE)) { case SipAddress.TYPE_HOME: impp.addType(ImppType.HOME); break; case SipAddress.TYPE_WORK: impp.addType(ImppType.WORK); break; case SipAddress.TYPE_CUSTOM: String customType = row.getAsString(SipAddress.LABEL); if (StringUtils.isNotEmpty(customType)) impp.addType(ImppType.get(labelToXName(customType))); } c.getImpps().add(impp); } catch (IllegalArgumentException e) { Log.e(TAG, "Illegal SIP URI", e); } }
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 .j a va 2 s. c om 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); } }