• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { Contacts } from '../contract/Contacts';
18import { RawContacts } from '../contract/RawContacts';
19import ContactBuilder from '../entity/ContactBuilder';
20import { Data } from '../contract/Data';
21
22export default class ContactUsuallyListItem {
23  static readonly COLUMNS: string[] = [Data.RAW_CONTACT_ID, Contacts.QUICK_SEARCH_KEY, RawContacts.DISPLAY_NAME,
24  RawContacts.SORT_FIRST_LETTER, RawContacts.PHOTO_FIRST_NAME, Contacts.COMPANY, Contacts.POSITION,
25  RawContacts.FAVORITE_ORDER, Data.DETAIL_INFO, Data.CONTENT_TYPE];
26  readonly id: number;
27  readonly displayName: string;
28  readonly sortFirstLetter: string;
29  readonly photoFirstName: string;
30  readonly quickSearchKey: string;
31  readonly company: string;
32  readonly position: string;
33  readonly favoriteOrder: string;
34  readonly detailInfo: string;
35  readonly contentType: string;
36
37  constructor(resultSet: any) {
38    this.id = resultSet.getLong(resultSet.getColumnIndex(Data.RAW_CONTACT_ID));
39    this.displayName = resultSet.getString(resultSet.getColumnIndex(RawContacts.DISPLAY_NAME));
40    this.sortFirstLetter = resultSet.getString(resultSet.getColumnIndex(RawContacts.SORT_FIRST_LETTER));
41    this.photoFirstName = resultSet.getString(resultSet.getColumnIndex(RawContacts.PHOTO_FIRST_NAME));
42    this.quickSearchKey = resultSet.getString(resultSet.getColumnIndex(Contacts.QUICK_SEARCH_KEY));
43    this.company = resultSet.getString(resultSet.getColumnIndex(Contacts.COMPANY));
44    this.position = resultSet.getString(resultSet.getColumnIndex(Contacts.POSITION));
45    this.favoriteOrder = resultSet.getString(resultSet.getColumnIndex(RawContacts.FAVORITE_ORDER));
46    this.detailInfo = resultSet.getString(resultSet.getColumnIndex(Data.DETAIL_INFO));
47    this.contentType = resultSet.getString(resultSet.getColumnIndex(Data.CONTENT_TYPE));
48  }
49
50//  createContact() {
51//    return new Contact(new ContactBuilder(this.id));
52//  }
53}