// Converts the Contact item to a string format.
Contact.prototype.convertToString = function(format) {
- if (arguments.length) {
- if (!Type.isString(format)) {
- throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR,
- 'Invalid format type');
- }
+ format = format || TypeEnum[0];
- if (TypeEnum.indexOf(format) < 0) {
- throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR,
- 'Invalid format');
- }
- } else {
- console.logd('No format selected. Default VCARD 3.0 has been set');
+ if (!Type.isString(format)) {
+ throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR, 'Invalid format');
+ }
+
+ if (TypeEnum.indexOf(format) < 0) {
+ throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR, 'Invalid format');
}
if (this.id === '') {
AV.isConstructorCall(this, ContactEmailAddress);
var _email = '';
- var _label = '';
+ var _label = null;
var _isDefault = false;
var _types = ['WORK'];
return _label;
},
set: function(v) {
- _label = Converter.toString(v, false);
+ _label = Converter.toString(v, true);
},
enumerable: true
}
AV.isConstructorCall(this, ContactName);
var _displayName = null;
+ var _nicknames = [];
Object.defineProperties(this, {
prefix: {
enumerable: true
},
nicknames: {
- value: [],
- writable: true,
+ get: function() {
+ return _nicknames;
+ },
+ set: function(nicknames) {
+ if (Type.isArray(nicknames)) {
+ _nicknames = nicknames;
+ }
+ },
enumerable: true
},
phoneticFirstName: {
var ContactInstantMessenger = function(imAddress, type) {
AV.isConstructorCall(this, ContactInstantMessenger);
+ var imAddress_ = '';
+ var type_ = 'OTHER';
+
Object.defineProperties(this, {
imAddress: {
- value: Type.isString(imAddress) ? imAddress : null,
- writable: true,
+ get: function() {
+ return imAddress_;
+ },
+ set: function(v) {
+ if (Type.isNullOrUndefined(v)) {
+ return;
+ }
+ imAddress_ = Converter.toString(v, false);
+ },
enumerable: true
},
type: {
- value: (Type.isNullOrUndefined(type) ? ContactInstantMessengerType.OTHER : type),
- writable: true,
+ get: function() {
+ return type_;
+ },
+ set: function(v) {
+ if (Type.isNullOrUndefined(v)) {
+ return;
+ }
+ type_ = Converter.toEnum(v, Object.keys(ContactInstantMessengerType), false);
+ },
enumerable: true
},
label: {
}
});
- if (_editGuard.isEditEnabled()) {
- for (var prop in arguments[0]) {
- if (this.hasOwnProperty(prop)) {
- this[prop] = arguments[0][prop];
- }
- }
- }
+ this.imAddress = imAddress;
+ this.type = type;
};
// exports /////////////////////////////////////////////////////////////////