public class

EntityModifier

extends Object
java.lang.Object
   ↳ com.android.contacts.model.EntityModifier

Class Overview

Helper methods for modifying an EntityDelta, such as inserting new rows, or enforcing ContactsSource.

Summary

Public Constructors
EntityModifier()
Public Methods
static boolean canInsert(EntityDelta state, ContactsSource.DataKind kind)
For the given EntityDelta, determine if the given ContactsSource.DataKind could be inserted under specific ContactsSource.
static void ensureKindExists(EntityDelta state, ContactsSource source, String mimeType)
Ensure that at least one of the given ContactsSource.DataKind exists in the given EntityDelta state, and try creating one if none exist.
static ContactsSource.EditType getBestValidType(EntityDelta state, ContactsSource.DataKind kind, boolean includeSecondary, int exactValue)
Find the best ContactsSource.EditType for a potential insert.
static ContactsSource.EditType getCurrentType(ContentValues entry, ContactsSource.DataKind kind)
Find the ContactsSource.EditType that describes the given ContentValues row, assuming the given ContactsSource.DataKind dictates the possible types.
static ContactsSource.EditType getCurrentType(Cursor cursor, ContactsSource.DataKind kind)
Find the ContactsSource.EditType that describes the given Cursor row, assuming the given ContactsSource.DataKind dictates the possible types.
static ContactsSource.EditType getCurrentType(EntityDelta.ValuesDelta entry, ContactsSource.DataKind kind)
Find the ContactsSource.EditType that describes the given EntityDelta.ValuesDelta row, assuming the given ContactsSource.DataKind dictates the possible types.
static ContactsSource.EditType getType(ContactsSource.DataKind kind, int rawValue)
Find the ContactsSource.EditType with the given rawValue.
static int getTypePrecedence(ContactsSource.DataKind kind, int rawValue)
Return the precedence for the the given rawValue, where lower numbers are higher precedence.
static ArrayList<ContactsSource.EditType> getValidTypes(EntityDelta state, ContactsSource.DataKind kind)
For the given EntityDelta and ContactsSource.DataKind, return the list possible ContactsSource.EditType options available based on ContactsSource.
static ArrayList<ContactsSource.EditType> getValidTypes(EntityDelta state, ContactsSource.DataKind kind, ContactsSource.EditType forceInclude)
For the given EntityDelta and ContactsSource.DataKind, return the list possible ContactsSource.EditType options available based on ContactsSource.
static boolean hasEditTypes(ContactsSource.DataKind kind)
Check if the given ContactsSource.DataKind has multiple types that should be displayed for users to pick.
static boolean hasValidTypes(EntityDelta state, ContactsSource.DataKind kind)
static EntityDelta.ValuesDelta insertChild(EntityDelta state, ContactsSource.DataKind kind, ContactsSource.EditType type)
Insert a new child of kind ContactsSource.DataKind into the given EntityDelta, marked with the given ContactsSource.EditType.
static EntityDelta.ValuesDelta insertChild(EntityDelta state, ContactsSource.DataKind kind)
Insert a new child of kind ContactsSource.DataKind into the given EntityDelta.
static boolean isEmpty(EntityDelta.ValuesDelta values, ContactsSource.DataKind kind)
Test if the given EntityDelta.ValuesDelta would be considered "empty" in terms of fieldList.
static void parseExtras(EntityDelta state, ContactsSource.DataKind kind, Bundle extras, String typeExtra, String valueExtra, String valueColumn)
Parse a specific entry from the given Bundle and insert into the given EntityDelta.
static void parseExtras(Context context, ContactsSource source, EntityDelta state, Bundle extras)
Parse the given Bundle into the given EntityDelta state, assuming the extras defined through Intents.
static void trimEmpty(EntitySet set, Sources sources)
Processing to trim any empty EntityDelta.ValuesDelta and EntityDelta from the given EntitySet, assuming the given Sources dictates the structure for various fields.
static void trimEmpty(EntityDelta state, ContactsSource source)
Processing to trim any empty EntityDelta.ValuesDelta rows from the given EntityDelta, assuming the given ContactsSource dictates the structure for various fields.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EntityModifier ()

Public Methods

public static boolean canInsert (EntityDelta state, ContactsSource.DataKind kind)

For the given EntityDelta, determine if the given ContactsSource.DataKind could be inserted under specific ContactsSource.

public static void ensureKindExists (EntityDelta state, ContactsSource source, String mimeType)

Ensure that at least one of the given ContactsSource.DataKind exists in the given EntityDelta state, and try creating one if none exist.

public static ContactsSource.EditType getBestValidType (EntityDelta state, ContactsSource.DataKind kind, boolean includeSecondary, int exactValue)

Find the best ContactsSource.EditType for a potential insert. The "best" is the first primary type that doesn't already exist. When all valid types exist, we pick the last valid option.

public static ContactsSource.EditType getCurrentType (ContentValues entry, ContactsSource.DataKind kind)

Find the ContactsSource.EditType that describes the given ContentValues row, assuming the given ContactsSource.DataKind dictates the possible types.

public static ContactsSource.EditType getCurrentType (Cursor cursor, ContactsSource.DataKind kind)

Find the ContactsSource.EditType that describes the given Cursor row, assuming the given ContactsSource.DataKind dictates the possible types.

public static ContactsSource.EditType getCurrentType (EntityDelta.ValuesDelta entry, ContactsSource.DataKind kind)

Find the ContactsSource.EditType that describes the given EntityDelta.ValuesDelta row, assuming the given ContactsSource.DataKind dictates the possible types.

public static ContactsSource.EditType getType (ContactsSource.DataKind kind, int rawValue)

Find the ContactsSource.EditType with the given rawValue.

public static int getTypePrecedence (ContactsSource.DataKind kind, int rawValue)

Return the precedence for the the given rawValue, where lower numbers are higher precedence.

public static ArrayList<ContactsSource.EditType> getValidTypes (EntityDelta state, ContactsSource.DataKind kind)

For the given EntityDelta and ContactsSource.DataKind, return the list possible ContactsSource.EditType options available based on ContactsSource.

public static ArrayList<ContactsSource.EditType> getValidTypes (EntityDelta state, ContactsSource.DataKind kind, ContactsSource.EditType forceInclude)

For the given EntityDelta and ContactsSource.DataKind, return the list possible ContactsSource.EditType options available based on ContactsSource.

Parameters
forceInclude Always include this ContactsSource.EditType in the returned list, even when an otherwise-invalid choice. This is useful when showing a dialog that includes the current type.

public static boolean hasEditTypes (ContactsSource.DataKind kind)

Check if the given ContactsSource.DataKind has multiple types that should be displayed for users to pick.

public static boolean hasValidTypes (EntityDelta state, ContactsSource.DataKind kind)

public static EntityDelta.ValuesDelta insertChild (EntityDelta state, ContactsSource.DataKind kind, ContactsSource.EditType type)

Insert a new child of kind ContactsSource.DataKind into the given EntityDelta, marked with the given ContactsSource.EditType.

public static EntityDelta.ValuesDelta insertChild (EntityDelta state, ContactsSource.DataKind kind)

Insert a new child of kind ContactsSource.DataKind into the given EntityDelta. Tries using the best ContactsSource.EditType found using getBestValidType(EntityDelta, DataKind, boolean, int).

public static boolean isEmpty (EntityDelta.ValuesDelta values, ContactsSource.DataKind kind)

Test if the given EntityDelta.ValuesDelta would be considered "empty" in terms of fieldList.

public static void parseExtras (EntityDelta state, ContactsSource.DataKind kind, Bundle extras, String typeExtra, String valueExtra, String valueColumn)

Parse a specific entry from the given Bundle and insert into the given EntityDelta. Silently skips the insert when missing value or no valid ContactsSource.EditType found.

Parameters
typeExtra Bundle key that holds the incoming rawValue value.
valueExtra Bundle key that holds the incoming value.
valueColumn Column to write value into EntityDelta.ValuesDelta.

public static void parseExtras (Context context, ContactsSource source, EntityDelta state, Bundle extras)

Parse the given Bundle into the given EntityDelta state, assuming the extras defined through Intents.

public static void trimEmpty (EntitySet set, Sources sources)

Processing to trim any empty EntityDelta.ValuesDelta and EntityDelta from the given EntitySet, assuming the given Sources dictates the structure for various fields. This method ignores rows not described by the ContactsSource.

public static void trimEmpty (EntityDelta state, ContactsSource source)

Processing to trim any empty EntityDelta.ValuesDelta rows from the given EntityDelta, assuming the given ContactsSource dictates the structure for various fields. This method ignores rows not described by the ContactsSource.