public class CalendarDataHelper extends Object
| 限定符和类型 | 类 | 说明 |
|---|---|---|
class |
CalendarDataHelper.InstancesDataHelper |
Provides utilities for operating calendar instance data in a certain period of time.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static CalendarDataHelper |
creator(Context context,
Class<? extends CalendarEntity> entityClass) |
A constructor used to create a
CalendarDataHelper object. |
boolean |
delete(int id) |
Deletes the calendar record of a specified ID.
|
int |
delete(DataAbilityPredicates predicates) |
Deletes calendar data based on
predicates. |
boolean |
delete(CalendarEntity entity) |
Deletes specified calendar data.
|
CalendarDataHelper.InstancesDataHelper |
getInstanceDataHelper() |
Creates an
InstancesDataHelper object. |
boolean |
insert(ValuesBucket valuesBucket) |
Inserts a calendar record into the database.
|
CalendarCollection |
query(int id,
String[] columns) |
Queries calendar data in the database based on
ID and columns. |
CalendarCollection |
query(DataAbilityPredicates predicates,
String[] columns) |
Queries calendar data in the database based on
predicates and columns. |
boolean |
release() |
Releases data client resources when the database operation is complete.
|
boolean |
update(ValuesBucket valuesBucket,
DataAbilityPredicates predicates) |
Updates a calendar record in the database.
|
public static CalendarDataHelper creator(Context context, Class<? extends CalendarEntity> entityClass) throws InvalidParameterException
CalendarDataHelper object.context - Indicates the context.entityClass - Indicates the CalendarEntity object or its child object.CalendarDataHelper object.InvalidParameterException - Throws this exception if the input parameter entityClass is invalid.public CalendarCollection query(DataAbilityPredicates predicates, String[] columns) throws DataAbilityRemoteException
predicates and columns.predicates - Indicates the conditions for querying the database.columns - Indicates the fields to obtain.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public CalendarCollection query(int id, String[] columns) throws DataAbilityRemoteException
ID and columns.
id has different representations in different tables.
CalendarEntity, id represents the calendar
ID.Events, id represents the account ID.Instances, id represents the event ID.id - Indicates the ID to be used for query.columns - Indicates the fields to obtain.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public boolean insert(ValuesBucket valuesBucket) throws DataAbilityRemoteException
valuesBucket - Indicates the record to insert.true if the record is inserted; returns false otherwise.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public boolean update(ValuesBucket valuesBucket, DataAbilityPredicates predicates) throws DataAbilityRemoteException
valuesBucket - Indicates the record to update.predicates - Indicates the filter conditions. Applications can query data using exact match, fuzzy match,
or aggregation.true if the record is updated; returns false otherwise.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public int delete(DataAbilityPredicates predicates) throws DataAbilityRemoteException
predicates.predicates - Indicates the conditions used to delete calendar data. If this parameter is null,
no record is deleted.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public boolean delete(CalendarEntity entity) throws DataAbilityRemoteException
entity - Indicates the calendar entity object to delete.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public boolean delete(int id)
throws DataAbilityRemoteException
id - Indicates the ID of the calendar record to delete.true if the calendar record is deleted; returns false otherwise.DataAbilityRemoteException - Throws this exception if a remote process exception occurs.public boolean release()
true if the client resources are released; returns false otherwise.public CalendarDataHelper.InstancesDataHelper getInstanceDataHelper()
InstancesDataHelper object.InstancesDataHelper object.