public ArrayList<ContentValues> getContentValues() { ArrayList<ContentValues> values = Lists.newArrayList(); for (ArrayList<ValuesDelta> mimeEntries : mEntries.values()) { for (ValuesDelta entry : mimeEntries) { if (!entry.isDelete()) { values.add(entry.getCompleteValues()); } } } return values; }
/** * Merge the "after" values from the given {@link ValuesDelta}, * discarding any existing "after" state. This is typically used when * re-parenting changes onto an updated {@link Entity}. */ public static ValuesDelta mergeAfter(ValuesDelta local, ValuesDelta remote) { // Bail early if trying to merge delete with missing local if (local == null && (remote.isDelete() || remote.isTransient())) return null; // Create local version if none exists yet if (local == null) local = new ValuesDelta(); if (!local.beforeExists()) { // Any "before" record is missing, so take all values as "insert" local.mAfter = remote.getCompleteValues(); } else { // Existing "update" with only "after" values local.mAfter = remote.mAfter; } return local; }
/** * Return the AccountType that this raw-contact belongs to. */ public AccountType getRawContactAccountType(Context context) { ContentValues entityValues = getValues().getCompleteValues(); String type = entityValues.getAsString(RawContacts.ACCOUNT_TYPE); String dataSet = entityValues.getAsString(RawContacts.DATA_SET); return AccountTypeManager.getInstance(context).getAccountType(type, dataSet); }