1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.contacts.common.model.dataitem; 18 19import android.content.ContentValues; 20import android.provider.ContactsContract; 21import android.provider.ContactsContract.CommonDataKinds.StructuredName; 22import android.provider.ContactsContract.Contacts.Data; 23 24/** 25 * Represents a structured name data item, wrapping the columns in 26 * {@link ContactsContract.CommonDataKinds.StructuredName}. 27 */ 28public class StructuredNameDataItem extends DataItem { 29 30 public StructuredNameDataItem() { 31 super(new ContentValues()); 32 getContentValues().put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); 33 } 34 35 /* package */ StructuredNameDataItem(ContentValues values) { 36 super(values); 37 } 38 39 public String getDisplayName() { 40 return getContentValues().getAsString(StructuredName.DISPLAY_NAME); 41 } 42 43 public void setDisplayName(String name) { 44 getContentValues().put(StructuredName.DISPLAY_NAME, name); 45 } 46 47 public String getGivenName() { 48 return getContentValues().getAsString(StructuredName.GIVEN_NAME); 49 } 50 51 public String getFamilyName() { 52 return getContentValues().getAsString(StructuredName.FAMILY_NAME); 53 } 54 55 public String getPrefix() { 56 return getContentValues().getAsString(StructuredName.PREFIX); 57 } 58 59 public String getMiddleName() { 60 return getContentValues().getAsString(StructuredName.MIDDLE_NAME); 61 } 62 63 public String getSuffix() { 64 return getContentValues().getAsString(StructuredName.SUFFIX); 65 } 66 67 public String getPhoneticGivenName() { 68 return getContentValues().getAsString(StructuredName.PHONETIC_GIVEN_NAME); 69 } 70 71 public String getPhoneticMiddleName() { 72 return getContentValues().getAsString(StructuredName.PHONETIC_MIDDLE_NAME); 73 } 74 75 public String getPhoneticFamilyName() { 76 return getContentValues().getAsString(StructuredName.PHONETIC_FAMILY_NAME); 77 } 78 79 public String getFullNameStyle() { 80 return getContentValues().getAsString(StructuredName.FULL_NAME_STYLE); 81 } 82 83 public String getPhoneticNameStyle() { 84 return getContentValues().getAsString(StructuredName.PHONETIC_NAME_STYLE); 85 } 86 87 public void setPhoneticFamilyName(String name) { 88 getContentValues().put(StructuredName.PHONETIC_FAMILY_NAME, name); 89 } 90 91 public void setPhoneticMiddleName(String name) { 92 getContentValues().put(StructuredName.PHONETIC_MIDDLE_NAME, name); 93 } 94 95 public void setPhoneticGivenName(String name) { 96 getContentValues().put(StructuredName.PHONETIC_GIVEN_NAME, name); 97 } 98} 99