18779efd5Sopenharmony_ci/** 28779efd5Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 38779efd5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48779efd5Sopenharmony_ci * you may not use this file except in compliance with the License. 58779efd5Sopenharmony_ci * You may obtain a copy of the License at 68779efd5Sopenharmony_ci * 78779efd5Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88779efd5Sopenharmony_ci * 98779efd5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108779efd5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118779efd5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128779efd5Sopenharmony_ci * See the License for the specific language governing permissions and 138779efd5Sopenharmony_ci * limitations under the License. 148779efd5Sopenharmony_ci */ 158779efd5Sopenharmony_ci 168779efd5Sopenharmony_ciimport { Data } from '../contract/Data'; 178779efd5Sopenharmony_ciimport DataType from '../contract/DataType'; 188779efd5Sopenharmony_ci 198779efd5Sopenharmony_ci/** 208779efd5Sopenharmony_ci * Contact data 218779efd5Sopenharmony_ci */ 228779efd5Sopenharmony_ciexport class DataItem { 238779efd5Sopenharmony_ci readonly values: Map<string, any>; 248779efd5Sopenharmony_ci constructor(values: Map<string, any>) { 258779efd5Sopenharmony_ci this.values = values; 268779efd5Sopenharmony_ci } 278779efd5Sopenharmony_ci 288779efd5Sopenharmony_ci static fromResultSet(resultSet: any): DataItem{ 298779efd5Sopenharmony_ci let contentValues: Map<string, any> = new Map(); 308779efd5Sopenharmony_ci contentValues.set(Data.ID, resultSet.getLong(resultSet.getColumnIndex(Data.ID))); 318779efd5Sopenharmony_ci contentValues.set(Data.TYPE_ID, resultSet.getLong(resultSet.getColumnIndex(Data.TYPE_ID))); 328779efd5Sopenharmony_ci contentValues.set(Data.RAW_CONTACT_ID, resultSet.getLong(resultSet.getColumnIndex(Data.RAW_CONTACT_ID))); 338779efd5Sopenharmony_ci contentValues.set(Data.READ_ONLY, resultSet.getLong(resultSet.getColumnIndex(Data.READ_ONLY)) > 0 ? true : false); 348779efd5Sopenharmony_ci contentValues.set(Data.DETAIL_INFO, resultSet.getString(resultSet.getColumnIndex(Data.DETAIL_INFO))); 358779efd5Sopenharmony_ci contentValues.set(Data.FAMILY_NAME, resultSet.getString(resultSet.getColumnIndex(Data.FAMILY_NAME))); 368779efd5Sopenharmony_ci contentValues.set(Data.MIDDLE_NAME_PHONETIC, resultSet.getString(resultSet.getColumnIndex(Data.MIDDLE_NAME_PHONETIC))); 378779efd5Sopenharmony_ci contentValues.set(Data.IS_PREFERRED_NUMBER, resultSet.getLong(resultSet.getColumnIndex(Data.IS_PREFERRED_NUMBER))); 388779efd5Sopenharmony_ci contentValues.set(Data.GIVEN_NAME, resultSet.getString(resultSet.getColumnIndex(Data.GIVEN_NAME))); 398779efd5Sopenharmony_ci contentValues.set(Data.GIVEN_NAME_PHONETIC, resultSet.getString(resultSet.getColumnIndex(Data.GIVEN_NAME_PHONETIC))); 408779efd5Sopenharmony_ci contentValues.set(Data.ALIAS_DETAIL_INTO, resultSet.getString(resultSet.getColumnIndex(Data.ALIAS_DETAIL_INTO))); 418779efd5Sopenharmony_ci contentValues.set(Data.PHONETIC_NAME, resultSet.getString(resultSet.getColumnIndex(Data.PHONETIC_NAME))); 428779efd5Sopenharmony_ci contentValues.set(Data.POSITION, resultSet.getString(resultSet.getColumnIndex(Data.POSITION))); 438779efd5Sopenharmony_ci contentValues.set(Data.CITY, resultSet.getString(resultSet.getColumnIndex(Data.CITY))); 448779efd5Sopenharmony_ci contentValues.set(Data.COUNTRY, resultSet.getString(resultSet.getColumnIndex(Data.COUNTRY))); 458779efd5Sopenharmony_ci contentValues.set(Data.NEIGHBORHOOD, resultSet.getString(resultSet.getColumnIndex(Data.NEIGHBORHOOD))); 468779efd5Sopenharmony_ci contentValues.set(Data.POBOX, resultSet.getString(resultSet.getColumnIndex(Data.POBOX))); 478779efd5Sopenharmony_ci contentValues.set(Data.POSTCODE, resultSet.getString(resultSet.getColumnIndex(Data.POSTCODE))); 488779efd5Sopenharmony_ci contentValues.set(Data.REGION, resultSet.getString(resultSet.getColumnIndex(Data.REGION))); 498779efd5Sopenharmony_ci contentValues.set(Data.STREET, resultSet.getString(resultSet.getColumnIndex(Data.STREET))); 508779efd5Sopenharmony_ci contentValues.set(Data.ALPHA_NAME, resultSet.getString(resultSet.getColumnIndex(Data.ALPHA_NAME))); 518779efd5Sopenharmony_ci contentValues.set(Data.OTHER_LAN_LAST_NAME, resultSet.getString(resultSet.getColumnIndex(Data.OTHER_LAN_LAST_NAME))); 528779efd5Sopenharmony_ci contentValues.set(Data.OTHER_LAN_FIRST_NAME, resultSet.getString(resultSet.getColumnIndex(Data.OTHER_LAN_FIRST_NAME))); 538779efd5Sopenharmony_ci contentValues.set(Data.LAN_STYLE, resultSet.getString(resultSet.getColumnIndex(Data.LAN_STYLE))); 548779efd5Sopenharmony_ci contentValues.set(Data.CUSTOM_DATA, resultSet.getString(resultSet.getColumnIndex(Data.CUSTOM_DATA))); 558779efd5Sopenharmony_ci contentValues.set(Data.BLOB_DATA, resultSet.getString(resultSet.getColumnIndex(Data.BLOB_DATA))); 568779efd5Sopenharmony_ci contentValues.set(Data.EXTEND1, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND1))); 578779efd5Sopenharmony_ci contentValues.set(Data.EXTEND2, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND2))); 588779efd5Sopenharmony_ci contentValues.set(Data.EXTEND3, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND3))); 598779efd5Sopenharmony_ci contentValues.set(Data.EXTEND4, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND4))); 608779efd5Sopenharmony_ci contentValues.set(Data.EXTEND5, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND5))); 618779efd5Sopenharmony_ci contentValues.set(Data.EXTEND6, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND6))); 628779efd5Sopenharmony_ci contentValues.set(Data.EXTEND7, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND7))); 638779efd5Sopenharmony_ci contentValues.set(Data.SYN_1, resultSet.getString(resultSet.getColumnIndex(Data.SYN_1))); 648779efd5Sopenharmony_ci contentValues.set(Data.SYN_2, resultSet.getString(resultSet.getColumnIndex(Data.SYN_2))); 658779efd5Sopenharmony_ci contentValues.set(Data.SYN_3, resultSet.getString(resultSet.getColumnIndex(Data.SYN_3))); 668779efd5Sopenharmony_ci contentValues.set(Data.FAVORITE, resultSet.getString(resultSet.getColumnIndex(Data.FAVORITE))); 678779efd5Sopenharmony_ci return new DataItem(contentValues); 688779efd5Sopenharmony_ci } 698779efd5Sopenharmony_ci 708779efd5Sopenharmony_ci getId() { 718779efd5Sopenharmony_ci return this.values.get(Data.ID); 728779efd5Sopenharmony_ci } 738779efd5Sopenharmony_ci 748779efd5Sopenharmony_ci getContentTypeId() { 758779efd5Sopenharmony_ci return this.values.get(Data.TYPE_ID); 768779efd5Sopenharmony_ci } 778779efd5Sopenharmony_ci 788779efd5Sopenharmony_ci getData() { 798779efd5Sopenharmony_ci return this.values.get(DataType.DATA); 808779efd5Sopenharmony_ci } 818779efd5Sopenharmony_ci 828779efd5Sopenharmony_ci getLabelId() { 838779efd5Sopenharmony_ci return this.values.get(DataType.LABEL_ID); 848779efd5Sopenharmony_ci } 858779efd5Sopenharmony_ci 868779efd5Sopenharmony_ci getLabelName() { 878779efd5Sopenharmony_ci return this.values.get(DataType.LABEL_NAME); 888779efd5Sopenharmony_ci } 898779efd5Sopenharmony_ci 908779efd5Sopenharmony_ci getFavorite() { 918779efd5Sopenharmony_ci return this.values.get(DataType.FAVORITE); 928779efd5Sopenharmony_ci } 938779efd5Sopenharmony_ci}