public boolean isPrimary() { final Long isPrimary = getAsLong(ContactsContract.Data.IS_PRIMARY); return isPrimary == null ? false : isPrimary != 0; }
public boolean isSuperPrimary() { final Long isSuperPrimary = getAsLong(ContactsContract.Data.IS_SUPER_PRIMARY); return isSuperPrimary == null ? false : isSuperPrimary != 0; }
public Long getGroupRowId() { return getAsLong(ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID); }
public Long getId() { return getAsLong(mIdColumn); }
/** * Find the {@link EditType} that describes the given * {@link ValuesDelta} row, assuming the given {@link DataKind} dictates * the possible types. */ public static EditType getCurrentType(ValuesDelta entry, DataKind kind) { final Long rawValue = entry.getAsLong(kind.typeColumn); if (rawValue == null) return null; return getType(kind, rawValue.intValue()); }
public Long getRawContactId() { return getValues().getAsLong(RawContacts._ID); }
/** * Search all contained {@link RawContactDelta} for the first one with an * existing {@link RawContacts#_ID} value. Usually used when creating * {@link AggregationExceptions} during an update. */ public long findRawContactId() { for (RawContactDelta delta : this) { final Long rawContactId = delta.getValues().getAsLong(RawContacts._ID); if (rawContactId != null && rawContactId >= 0) { return rawContactId; } } return -1; }
/** * Find {@link RawContacts#_ID} of the requested {@link RawContactDelta}. */ public Long getRawContactId(int index) { if (index >= 0 && index < this.size()) { final RawContactDelta delta = this.get(index); final ValuesDelta values = delta.getValues(); if (values.isVisible()) { return values.getAsLong(RawContacts._ID); } } return null; }
private Builder buildAssertHelper() { final boolean isContactInsert = mValues.isInsert(); ContentProviderOperation.Builder builder = null; if (!isContactInsert) { // Assert version is consistent while persisting changes final Long beforeId = mValues.getId(); final Long beforeVersion = mValues.getAsLong(RawContacts.VERSION); if (beforeId == null || beforeVersion == null) return builder; builder = ContentProviderOperation.newAssertQuery(mContactsQueryUri); builder.withSelection(RawContacts._ID + "=" + beforeId, null); builder.withValue(RawContacts.VERSION, beforeVersion); } return builder; }
private Builder buildSplitContactDiffHelper(int index1, int index2, int[] backRefs) { final Builder builder = ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI); builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_SEPARATE); Long rawContactId1 = get(index1).getValues().getAsLong(RawContacts._ID); int backRef1 = backRefs[index1]; if (rawContactId1 != null && rawContactId1 >= 0) { builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId1); } else if (backRef1 >= 0) { builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1, backRef1); } else { return null; } Long rawContactId2 = get(index2).getValues().getAsLong(RawContacts._ID); int backRef2 = backRefs[index2]; if (rawContactId2 != null && rawContactId2 >= 0) { builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId2); } else if (backRef2 >= 0) { builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, backRef2); } else { return null; } return builder; }