1/** 2 * Copyright (c) 2023 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 16import Contact from '../entity/Contact'; 17import ContactBuilder from '../entity/ContactBuilder'; 18import { SearchContacts } from '../contract/SearchContacts'; 19 20export default class SearchContactListItem { 21 static readonly COLUMNS: string[] = [SearchContacts.ID, SearchContacts.ACCOUNT_ID, SearchContacts.CONTACT_ID, 22 SearchContacts.ROW_CONTACT_ID, SearchContacts.SEARCH_NAME, SearchContacts.DISPLAY_NAME, SearchContacts.PHONETIC_NAME, 23 SearchContacts.PHOTO_ID, SearchContacts.PHOTO_FILE_ID, SearchContacts.IS_DELETED, SearchContacts.POSITION, 24 SearchContacts.PHOTO_FIRST_NAME, SearchContacts.SORT_FIRST_LETTER, SearchContacts.CUSTOM_DATA, 25 SearchContacts.DETAIL_INFO, SearchContacts.CONTENT_TYPE, SearchContacts.HAS_PHONE_NUMBER]; 26 readonly id: number; 27 readonly accountId: string; 28 readonly contactId: string; 29 readonly rawContactId: string; 30 readonly searchName: string; 31 readonly displayName: string; 32 readonly phoneticName: string; 33 readonly photoId: string; 34 readonly photoFileId: string; 35 readonly isDeleted: number; 36 readonly position: string; 37 readonly photoFirstName: string; 38 readonly sortFirstLetter: string; 39 readonly customData: string; 40 readonly detailInfo: string; 41 readonly contentType: string; 42 readonly hasPhoneNumber: string; 43 44 constructor(resultSet: any) { 45 this.id = resultSet.getLong(resultSet.getColumnIndex(SearchContacts.ID)); 46 this.accountId = resultSet.getString(resultSet.getColumnIndex(SearchContacts.ACCOUNT_ID)); 47 this.contactId = resultSet.getString(resultSet.getColumnIndex(SearchContacts.CONTACT_ID)); 48 this.rawContactId = resultSet.getString(resultSet.getColumnIndex(SearchContacts.ROW_CONTACT_ID)); 49 this.searchName = resultSet.getString(resultSet.getColumnIndex(SearchContacts.SEARCH_NAME)); 50 this.displayName = resultSet.getString(resultSet.getColumnIndex(SearchContacts.DISPLAY_NAME)); 51 this.phoneticName = resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHONETIC_NAME)); 52 this.photoId = resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHOTO_ID)); 53 this.photoFileId = resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHOTO_FILE_ID)); 54 this.isDeleted = resultSet.getString(resultSet.getColumnIndex(SearchContacts.IS_DELETED)); 55 this.position = resultSet.getString(resultSet.getColumnIndex(SearchContacts.POSITION)); 56 this.photoFirstName = resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHOTO_FIRST_NAME)); 57 this.sortFirstLetter = resultSet.getString(resultSet.getColumnIndex(SearchContacts.SORT_FIRST_LETTER)); 58 this.customData = resultSet.getString(resultSet.getColumnIndex(SearchContacts.CUSTOM_DATA)); 59 this.detailInfo = resultSet.getString(resultSet.getColumnIndex(SearchContacts.DETAIL_INFO)); 60 this.contentType = resultSet.getString(resultSet.getColumnIndex(SearchContacts.CONTENT_TYPE)); 61 this.hasPhoneNumber = resultSet.getString(resultSet.getColumnIndex(SearchContacts.HAS_PHONE_NUMBER)); 62 } 63}