diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index a96e080645cfeb834ea238d257c9f9fd470d7710..bf6c77587e6f3d3abcad0537a19d0a438f9361e7 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -431,10 +431,11 @@ export declare interface LifecycleData { * @param valueBucket Indicates the data to update. This parameter can be null. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by * default. - * @return Returns the number of data records updated. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. * @return - */ - async update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): number; + update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Queries one or more data records in the database. This method should be implemented by a Data ability. @@ -447,9 +448,11 @@ export declare interface LifecycleData { * the processing logic when this parameter is null. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be queried by * default. - * @return Returns the queried data. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): ResultSet; + query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Deletes one or more data records. This method should be implemented by a Data ability. @@ -460,20 +463,11 @@ export declare interface LifecycleData { * @param uri Indicates the database table storing the data to delete. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by * default. - * @return Returns the number of data records deleted. - */ - async delete?(uri: string, predicates: dataAbility.DataAbilityPredicates): number; - - /** - * Performs batch operations on the database. This method should be implemented by a Data ability. - * - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap AAFwk - * @param ops Indicates the data operation list, which can contain multiple operations on the database. - * @return Returns the result of each operation, in array. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async executeBatch?(ops: Array): Array; + delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Converts the given {@code uri} that refer to the Data ability into a normalized URI. A normalized URI can be @@ -484,9 +478,11 @@ export declare interface LifecycleData { * @since 7 * @sysCap AAFwk * @param uri Indicates the uri to normalize. - * @return Returns the normalized uri if the Data ability supports URI normalization; + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - normalizeUri?(uri: string): string; + normalizeUri?(uri: string, callback: AsyncCallback): void; /** * Inserts multiple data records into the database. This method should be implemented by a Data ability. @@ -496,9 +492,11 @@ export declare interface LifecycleData { * @sysCap AAFwk * @param uri Indicates the position where the data is to insert. * @param valueBuckets Indicates the data to insert. - * @return Returns the number of data records inserted. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async batchInsert?(uri: string, valueBuckets: Array): number; + batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; /** * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. @@ -508,11 +506,11 @@ export declare interface LifecycleData { * @since 7 * @sysCap AAFwk * @param uri Indicates the uri to denormalize. - * @return Returns the denormalized {@code uri} object if the denormalization is successful; returns the original - * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by - * the original {@code uri} cannot be found in the current environment. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - denormalizeUri?(uri: string): string; + denormalizeUri?(uri: string, callback: AsyncCallback): void; /** * Inserts a data record into the database. This method should be implemented by a Data ability. @@ -522,9 +520,11 @@ export declare interface LifecycleData { * @sysCap AAFwk * @param uri Indicates the position where the data is to insert. * @param valueBucket Indicates the data to insert. - * @return Returns the index of the newly inserted data record. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async insert?(uri: string, valueBucket: rdb.ValuesBucket): number; + insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; /** * Opens a file. This method should be implemented by a Data ability. @@ -537,9 +537,11 @@ export declare interface LifecycleData { * whatever data is currently in the file), "wt" for write access that truncates any existing file, * "wa" for write-only access to append to any existing data, "rw" for read and write access on any * existing data, or "rwt" for read and write access that truncates any existing file. - * @return Returns the file descriptor. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async openFile?(uri: string, mode: string): number; + openFile?(uri: string, mode: string, callback: AsyncCallback): void; /** * Obtains the MIME type of files. This method should be implemented by a Data ability. @@ -553,22 +555,11 @@ export declare interface LifecycleData { *

1. "*/*": Obtains all types supported by a Data ability. *

2. "image/*": Obtains files whose main type is image of any subtype. *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data - */ - getFileTypes?(uri: string, mimeTypeFilter: string): Array; - - /** - * Defines a method in this Data ability (implementation depending on child classes). - * - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap AAFwk - * @param method Indicates the method name. - * @param arg Indicates the parameter transferred by the method. - * @param extras Indicates the parameter transferred by the method. - * @return Returns the result of the method. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - async call?(method: string, arg: string, extras: PacMap): PacMap; + getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; /** * Called to carry {@code AbilityInfo} to this ability after the ability is initialized. @@ -591,7 +582,9 @@ export declare interface LifecycleData { * @since 7 * @sysCap AAFwk * @param uri Indicates the uri of the data. - * @return Returns the MIME type that matches the data specified by {@code uri}. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the resylt to framework. + * @return - */ - getType?(uri: string): string; + getType?(uri: string, callback: AsyncCallback): void; }