1 /* 2 * Copyright (C) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_MEDIA_PHOTO_BURST_OPERATIOIN_H 17 #define OHOS_MEDIA_PHOTO_BURST_OPERATIOIN_H 18 19 #include <string> 20 #include <vector> 21 22 #include "medialibrary_rdbstore.h" 23 #include "photo_asset_copy_operation.h" 24 #include "photo_asset_info.h" 25 26 namespace OHOS::Media { 27 class PhotoBurstOperation { 28 public: 29 PhotoBurstOperation &SetTargetPhotoInfo(const PhotoAssetInfo &photoAssetInfo); 30 std::string FindBurstKey(const std::shared_ptr<MediaLibraryRdbStore> &rdbStore); 31 32 private: 33 std::string FindBurstKey( 34 const std::shared_ptr<MediaLibraryRdbStore> &rdbStore, const PhotoAssetInfo &photoAssetInfo); 35 std::string ToString(const std::vector<NativeRdb::ValueObject> &values); 36 std::string GenerateUuid(); 37 std::string FindBurstGroupName(const std::string &displayName); 38 std::string QueryBurstKeyFromDB( 39 const std::shared_ptr<MediaLibraryRdbStore> &rdbStore, const PhotoAssetInfo &photoAssetInfo); 40 41 private: 42 enum { UUID_STR_LENGTH = 37, DISPLAY_NAME_PREFIX_LENGTH = 20 }; 43 const std::string TITLE_KEY_WORDS_OF_BURST = "_BURST"; 44 std::string SQL_PHOTOS_TABLE_QUERY_BURST_KEY = "\ 45 SELECT \ 46 burst_key \ 47 FROM Photos \ 48 WHERE subtype = 4 AND \ 49 COALESCE(burst_key, '') <> '' AND \ 50 COALESCE(date_trashed, 0) = 0 AND \ 51 owner_album_id = ? AND \ 52 display_name LIKE ? \ 53 ORDER BY file_id \ 54 LIMIT 1;"; 55 PhotoAssetInfo photoAssetInfo_; 56 }; 57 } // namespace OHOS::Media 58 #endif // OHOS_MEDIA_PHOTO_BURST_OPERATIOIN_H