var Calendar = function(accountId, name, type) {
var _data;
- AV.isConstructorCall(this, Calendar);
+ validator_.isConstructorCall(this, Calendar);
if (arguments[0] instanceof InternalCalendar) {
_data = arguments[0];
} else {
- var _accountId = Converter.toLong(accountId);
- var _name = Converter.toString(name);
- var _type = Converter.toString(type);
+ var _accountId = converter_.toLong(accountId);
+ var _name = converter_.toString(name);
+ var _type = converter_.toString(type);
if (arguments.length < 3) {
_data = new InternalCalendar();
Object.defineProperties(this, {
accountId: {
- value: Converter.toLong(_data.accountId),
+ value: converter_.toLong(_data.accountId),
writable: false,
enumerable: true
},
id: {
get: function() {
- return Converter.toString(_data.id, true);
+ return converter_.toString(_data.id, true);
},
set: function(v) {
if (v instanceof InternalCalendar) {
if (!parseInt(id) || parseInt(id) <= 0) {
throw new tizen.WebAPIException(tizen.WebAPIException.NOT_FOUND_ERR);
}
- args = AV.validateArgs(arguments, [{
+ args = validator_.validateArgs(arguments, [{
name: 'id',
- type: AV.Types.STRING
+ type: types_.STRING
}]);
} else {
- args = AV.validateArgs(arguments, [{
+ args = validator_.validateArgs(arguments, [{
name: 'id',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: tizen.CalendarEventId
}]);
}
};
Calendar.prototype.add = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'item',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: [CalendarEvent, CalendarTask]
}
]);
};
Calendar.prototype.addBatch = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'items',
- type: AV.Types.ARRAY,
+ type: types_.ARRAY,
values: (this.type === CalendarType.EVENT)
? tizen.CalendarEvent : tizen.CalendarTask
}, {
name: 'successCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
}, {
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
}
};
Calendar.prototype.update = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'item',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: [tizen.CalendarEvent, tizen.CalendarTask]
},
{
name: 'updateAllInstances',
- type: AV.Types.BOOLEAN,
+ type: types_.BOOLEAN,
optional: true,
nullable: true
}
item: tmp,
type: this.type,
updateAllInstances: (args.has.updateAllInstances)
- ? Converter.toBoolean(args.updateAllInstances, true)
+ ? converter_.toBoolean(args.updateAllInstances, true)
: true
});
};
Calendar.prototype.updateBatch = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'items',
- type: AV.Types.ARRAY,
+ type: types_.ARRAY,
values: (this.type === CalendarType.EVENT)
? tizen.CalendarEvent : tizen.CalendarTask
},
{
name: 'successCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
},
{
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
},
{
name: 'updateAllInstances',
- type: AV.Types.BOOLEAN,
+ type: types_.BOOLEAN,
optional: true,
nullable: true
}
type: this.type,
items: tmp,
updateAllInstances: (args.has.updateAllInstances)
- ? Converter.toBoolean(args.updateAllInstances, true)
+ ? converter_.toBoolean(args.updateAllInstances, true)
: true
}, callback);
if (!parseInt(id) || parseInt(id) <= 0) {
throw new tizen.WebAPIException(tizen.WebAPIException.NOT_FOUND_ERR);
}
- args = AV.validateArgs(arguments, [{
+ args = validator_.validateArgs(arguments, [{
name: 'id',
- type: AV.Types.STRING
+ type: types_.STRING
}]);
} else {
- args = AV.validateArgs(arguments, [{
+ args = validator_.validateArgs(arguments, [{
name: 'id',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: tizen.CalendarEventId
}]);
}
};
Calendar.prototype.removeBatch = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'ids',
- type: AV.Types.ARRAY,
+ type: types_.ARRAY,
values: (this.type === CalendarType.EVENT)
? tizen.CalendarEventId : undefined
},
{
name: 'successCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
},
{
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
}
};
Calendar.prototype.find = function(successCallback, errorCallback, filter, sortMode) {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'successCallback',
- type: AV.Types.FUNCTION
+ type: types_.FUNCTION
},
{
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
},
{
name: 'filter',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: [tizen.AttributeFilter, tizen.AttributeRangeFilter, tizen.CompositeFilter],
optional: true,
nullable: true
},
{
name: 'sortMode',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: tizen.SortMode,
optional: true,
nullable: true
};
C.filter = function (arr, filter) {
- if (T.isNullOrUndefined(arr))
+ if (type_.isNullOrUndefined(arr))
return arr;
if (filter instanceof tizen.AttributeFilter ||
filter instanceof tizen.AttributeRangeFilter ||
if (type === 'EVENT') {
item = new CalendarEventId(items[i].id, null);
} else {
- item = Converter.toString(items[i].id);
+ item = converter_.toString(items[i].id);
}
} else {
item = _itemConverter.toTizenObject(items[i], items[i].isAllDay);
var action = actions[i];
var callback = 'onitems' + action;
- if (event.hasOwnProperty(action) && T.isArray(event[action]) && event[action].length) {
+ if (event.hasOwnProperty(action) && type_.isArray(event[action]) && event[action].length) {
// invoke listeners for unified calendars
if (_listeners.hasOwnProperty(type)) {
}
Calendar.prototype.addChangeListener = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'successCallback',
- type: AV.Types.LISTENER,
+ type: types_.LISTENER,
values: ['onitemsadded', 'onitemsupdated', 'onitemsremoved']
}]);
};
Calendar.prototype.removeChangeListener = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'watchId',
- type: AV.Types.LONG
+ type: types_.LONG
}
]);
- var watchId = Converter.toString(args.watchId);
+ var watchId = converter_.toString(args.watchId);
var calendarId = (this.isUnified) ? this.type : this.id;
if (!_listeners[calendarId] || !_listeners[calendarId][watchId]) {
delete _listeners[calendarId][watchId];
- if (T.isEmptyObject(_listeners[calendarId])) {
+ if (type_.isEmptyObject(_listeners[calendarId])) {
delete _listeners[calendarId];
}
- if (T.isEmptyObject(_listeners)) {
+ if (type_.isEmptyObject(_listeners)) {
var result;
// @todo consider listener unregister when we are not listening on this.type of calendar
};
var CalendarAlarm = function(time, method, description) {
- AV.isConstructorCall(this, CalendarAlarm);
+ validator_.isConstructorCall(this, CalendarAlarm);
var _absoluteDate = time instanceof tizen.TZDate && !this.before ? time : null;
var _before = time instanceof tizen.TimeDuration && !this.absoluteDate ? time : null;
- var _method = Converter.toEnum(method, Object.keys(AlarmMethod), false);
- var _description = (description) ? Converter.toString(description, true) : '';
+ var _method = converter_.toEnum(method, Object.keys(AlarmMethod), false);
+ var _description = (description) ? converter_.toString(description, true) : '';
Object.defineProperties(this, {
absoluteDate: {
if (v === null) {
return;
}
- _method = Converter.toEnum(v, Object.keys(AlarmMethod), false);
+ _method = converter_.toEnum(v, Object.keys(AlarmMethod), false);
},
enumerable: true
},
return _description;
},
set: function(v) {
- _description = Converter.toString(v, true);
+ _description = converter_.toString(v, true);
},
enumerable: true
}
return _name;
},
set: function(v) {
- _name = Converter.toString(v, true);
+ _name = converter_.toString(v, true);
},
enumerable: true
},
if (v === null) {
return;
}
- _role = Converter.toEnum(v, Object.keys(AttendeeRole), false);
+ _role = converter_.toEnum(v, Object.keys(AttendeeRole), false);
},
enumerable: true
},
if (v === null) {
return;
}
- _status = Converter.toEnum(v, Object.keys(AttendeeStatus), false);
+ _status = converter_.toEnum(v, Object.keys(AttendeeStatus), false);
},
enumerable: true
},
return _RSVP;
},
set: function(v) {
- _RSVP = Converter.toBoolean(v);
+ _RSVP = converter_.toBoolean(v);
},
enumerable: true
},
if (v === null) {
return;
}
- _type = Converter.toEnum(v, Object.keys(AttendeeType), false);
+ _type = converter_.toEnum(v, Object.keys(AttendeeType), false);
},
enumerable: true
},
return _group;
},
set: function(v) {
- _group = Converter.toString(v, true);
+ _group = converter_.toString(v, true);
},
enumerable: true
},
return _delegatorURI;
},
set: function(v) {
- _delegatorURI = Converter.toString(v, true);
+ _delegatorURI = converter_.toString(v, true);
},
enumerable: true
},
return _delegateURI;
},
set: function(v) {
- _delegateURI = Converter.toString(v, true);
+ _delegateURI = converter_.toString(v, true);
},
enumerable: true
},
};
var CalendarAttendee = function(uri, attendeeInitDict) {
- AV.isConstructorCall(this, CalendarAttendee);
+ validator_.isConstructorCall(this, CalendarAttendee);
CalendarAttendeeInit.call(this, attendeeInitDict);
if (v === null) {
return;
}
- _uri = Converter.toString(v, true);
+ _uri = converter_.toString(v, true);
},
enumerable: true
}
};
var CalendarEventId = function(uid, rid) {
- AV.isConstructorCall(this, CalendarEventId);
+ validator_.isConstructorCall(this, CalendarEventId);
var _uid = null;
if (v === null) {
return;
}
- _uid = Converter.toString(v, true);
+ _uid = converter_.toString(v, true);
},
enumerable: true
},
rid: {
- value: (rid) ? Converter.toString(rid, true) : null,
+ value: (rid) ? converter_.toString(rid, true) : null,
writable: true,
enumerable: true
}
function _validateAlarms(v) {
var valid = false;
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
for (var i = 0; i < v.length; i++) {
if (!(v[i] instanceof tizen.CalendarAlarm)) {
return false;
function _validateAttendees(v) {
var valid = false;
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
for (var i = 0; i < v.length; i++) {
if (!(v[i] instanceof tizen.CalendarAttendee)) {
return false;
function _validateCategories(v) {
var valid = false;
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
for (var i = 0; i < v.length; i++) {
- if (!(T.isString(v[i]))) {
+ if (!(type_.isString(v[i]))) {
return false;
}
}
if (v instanceof Object) {
_id = new CalendarEventId(v.uid, v.rid);
} else {
- _id = Converter.toString(v, true);
+ _id = converter_.toString(v, true);
}
}
},
return _description;
},
set: function(v) {
- _description = v ? Converter.toString(v, true) : _description;
+ _description = v ? converter_.toString(v, true) : _description;
},
enumerable: true
},
return _summary;
},
set: function(v) {
- _summary = v ? Converter.toString(v, true) : _summary;
+ _summary = v ? converter_.toString(v, true) : _summary;
},
enumerable: true
},
return _isAllDay;
},
set: function(v) {
- _isAllDay = v ? Converter.toBoolean(v) : _isAllDay;
+ _isAllDay = v ? converter_.toBoolean(v) : _isAllDay;
},
enumerable: true
},
return _location;
},
set: function(v) {
- _location = v ? Converter.toString(v) : _location;
+ _location = v ? converter_.toString(v) : _location;
},
enumerable: true
},
return _organizer;
},
set: function(v) {
- _organizer = v ? Converter.toString(v) : _organizer;
+ _organizer = v ? converter_.toString(v) : _organizer;
},
enumerable: true
},
return _visibility;
},
set: function(v) {
- _visibility = v ? Converter.toEnum(v, Object.keys(CalendarItemVisibility), false) :
+ _visibility = v ? converter_.toEnum(v, Object.keys(CalendarItemVisibility), false) :
_visibility;
},
enumerable: true
return;
}
if (this instanceof tizen.CalendarEvent) {
- _status = v ? Converter.toEnum(v, Object.keys(CalendarItemStatus).slice(0, 3), false) :
+ _status = v ? converter_.toEnum(v, Object.keys(CalendarItemStatus).slice(0, 3), false) :
CalendarItemStatus.CONFIRMED;
} else {
- _status = v ? Converter.toEnum(v, Object.keys(CalendarItemStatus).slice(2), false) :
+ _status = v ? converter_.toEnum(v, Object.keys(CalendarItemStatus).slice(2), false) :
CalendarItemStatus.NEEDS_ACTION;
}
},
if (v === null) {
return;
}
- _priority = v ? Converter.toEnum(v, Object.keys(CalendarItemPriority), false) :
+ _priority = v ? converter_.toEnum(v, Object.keys(CalendarItemPriority), false) :
_status;
},
enumerable: true
};
CalendarItem.prototype.convertToString = function() {
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'format',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarTextFormat)
}
]);
if (v === null) {
return;
}
- _progress = (T.isNumber(v) && (v >= 0 || v <= 100)) ? v : _progress;
+ _progress = (type_.isNumber(v) && (v >= 0 || v <= 100)) ? v : _progress;
},
enumerable: true
}
};
var CalendarTask = function(taskInitDict, format) {
- AV.isConstructorCall(this, CalendarTask);
+ validator_.isConstructorCall(this, CalendarTask);
- if (T.isString(taskInitDict) && Object.keys(CalendarTextFormat).indexOf(format) > -1) {
+ if (type_.isString(taskInitDict) && Object.keys(CalendarTextFormat).indexOf(format) > -1) {
CalendarTaskInit.call(this, _convertFromStringToItem(taskInitDict));
} else {
CalendarTaskInit.call(this, taskInitDict);
};
var CalendarEvent = function(eventInitDict, format) {
- AV.isConstructorCall(this, CalendarEvent);
+ validator_.isConstructorCall(this, CalendarEvent);
- if (T.isString(eventInitDict) && Object.keys(CalendarTextFormat).indexOf(format) > -1) {
+ if (type_.isString(eventInitDict) && Object.keys(CalendarTextFormat).indexOf(format) > -1) {
CalendarEventInit.call(this, _convertFromStringToItem(eventInitDict));
} else {
CalendarEventInit.call(this, eventInitDict);
'The event is not recurring.');
}
- var args = AV.validateArgs(arguments, [
+ var args = validator_.validateArgs(arguments, [
{
name: 'startDate',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: tizen.TZDate
},
{
name: 'endDate',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: tizen.TZDate
},
{
name: 'successCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
nullable: true
},
{
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
}
};
CalendarManager.prototype.getCalendars = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'type',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarType)
},
{
name: 'successCallback',
- type: AV.Types.FUNCTION
+ type: types_.FUNCTION
},
{
name: 'errorCallback',
- type: AV.Types.FUNCTION,
+ type: types_.FUNCTION,
optional: true,
nullable: true
}]);
CalendarManager.prototype.getUnifiedCalendar = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'type',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarType)
}]);
CalendarManager.prototype.getDefaultCalendar = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'type',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarType)
}
]);
CalendarManager.prototype.getCalendar = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'type',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarType)
},
{
name: 'id',
- type: AV.Types.STRING
+ type: types_.STRING
}
]);
CalendarManager.prototype.addCalendar = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'calendar',
- type: AV.Types.PLATFORM_OBJECT,
+ type: types_.PLATFORM_OBJECT,
values: Calendar
}]);
CalendarManager.prototype.removeCalendar = function() {
- var args = AV.validateArgs(arguments, [{
+ var args = validator_.validateArgs(arguments, [{
name: 'type',
- type: AV.Types.ENUM,
+ type: types_.ENUM,
values: Object.keys(CalendarType)
},
{
name: 'id',
- type: AV.Types.STRING
+ type: types_.STRING
}
]);
var _exceptions = [];
function _validateDaysOfTheWeek(v) {
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
var allowedValues = Object.keys(ByDayValue);
for (var i = 0; i < v.length; ++i) {
if (allowedValues.indexOf(v[i]) < 0) {
function _validateSetPositions(v) {
var valid = false;
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
for (var i = 0; i < v.length; i++) {
v[i] = parseInt(v[i]);
if (isNaN(v[i]) || (v[i] < -366 || v[i] > 366 || v[i] === 0)) {
function _validateExceptions(v) {
var valid = false;
- if (T.isArray(v)) {
+ if (type_.isArray(v)) {
for (var i = 0; i < v.length; i++) {
if (!(v[i] instanceof tizen.TZDate)) {
return false;
return _interval;
},
set: function(v) {
- _interval = (T.isNumber(v) && v > 0) ? v : _interval;
+ _interval = (type_.isNumber(v) && v > 0) ? v : _interval;
},
enumerable: true
},
return _occurrenceCount;
},
set: function(v) {
- if (T.isNumber(v) && v >= -1) {
+ if (type_.isNumber(v) && v >= -1) {
_occurrenceCount = v;
}
},
};
var CalendarRecurrenceRule = function(frequency, ruleInitDict) {
- AV.isConstructorCall(this, CalendarRecurrenceRule);
+ validator_.isConstructorCall(this, CalendarRecurrenceRule);
CalendarRecurrenceRuleInit.call(this, ruleInitDict);
if (v === null) {
return;
}
- _frequency = Converter.toEnum(v, Object.keys(RecurrenceRuleFrequency), false);
+ _frequency = converter_.toEnum(v, Object.keys(RecurrenceRuleFrequency), false);
},
enumerable: true
}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var _common = xwalk.utils;
-var T = _common.type;
-var Converter = _common.converter;
-var AV = _common.validator;
+var utils_ = xwalk.utils;
+var type_ = utils_.type;
+var converter_ = utils_.converter;
+var validator_ = utils_.validator;
+var types_ = validator_.Types;
var native_ = new xwalk.utils.NativeManager(extension);