/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MERGERCONTACT_H #define MERGERCONTACT_H #include "datashare_predicates.h" #include "rdb_store.h" #include "result_set.h" namespace OHOS { namespace Contacts { class MergerContacts { public: MergerContacts(); ~MergerContacts(); int ForceContactMerge(std::shared_ptr, std::set); int ContactMerge(std::shared_ptr); int ReContactMerge(std::shared_ptr, const DataShare::DataSharePredicates &); std::shared_ptr SelectCandidate(std::shared_ptr); private: void UpdateIdsByName( std::shared_ptr, std::set, std::set, std::vector> &); std::vector> SelectIdsByName(std::shared_ptr, std::set); void UpdateCandidate(std::shared_ptr, std::vector, std::vector> &); int MergeCircle(std::shared_ptr, std::vector>); std::vector> QueryMergeContacts(std::shared_ptr, int); std::string QueryCandidateName(std::shared_ptr, int); void UpdateRawContacts(std::shared_ptr, int, std::set); void UpdateRawContactsExecute( std::shared_ptr store, int minContactId, std::set Ids); std::set HandleIds(std::shared_ptr, std::set); int DeleteContacts(std::shared_ptr, int, std::set); std::set QueryTargetName(std::shared_ptr, int, std::set); bool isNameMatch(std::shared_ptr, std::set); int ManualMergeOperation(std::shared_ptr store, int minId, std::set handledIds); std::string getUpdateSql(int minId); }; } // namespace Contacts } // namespace OHOS #endif // MERGERCONTACT_H