[Common] Changed configuration for common profile build
[platform/core/api/webapi-plugins.git] / src / alarm / alarm_api.js
index b19875c..8b386bb 100755 (executable)
@@ -84,7 +84,7 @@ var _warningLogs = new LogManager();
 
 //class AlarmManager ////////////////////////////////////////////////////
 AlarmManager.prototype.add = function() {
-    var args = AV.validateMethod(arguments, [
+    var args = AV.validateArgs(arguments, [
         {
             name: 'alarm',
             type: AV.Types.PLATFORM_OBJECT,
@@ -134,7 +134,7 @@ AlarmManager.prototype.add = function() {
 };
 
 AlarmManager.prototype.addAlarmNotification = function() {
-    var args = AV.validateMethod(arguments, [
+    var args = AV.validateArgs(arguments, [
         {
             name: 'alarm',
             type: AV.Types.PLATFORM_OBJECT,
@@ -177,7 +177,7 @@ AlarmManager.prototype.addAlarmNotification = function() {
 };
 
 AlarmManager.prototype.remove = function() {
-    var args = AV.validateMethod(arguments, [
+    var args = AV.validateArgs(arguments, [
         {
             name: 'id',
             type: AV.Types.STRING
@@ -200,7 +200,7 @@ AlarmManager.prototype.removeAll = function() {
 };
 
 AlarmManager.prototype.get = function() {
-    var args = AV.validateMethod(arguments, [
+    var args = AV.validateArgs(arguments, [
         {
             name: 'id',
             type: AV.Types.STRING
@@ -222,7 +222,7 @@ AlarmManager.prototype.get = function() {
                 result.period,
                 InternalData_(result)
             );
-        } else {
+        } else if ('AlarmAbsolute' === result.type) {
             var date = new Date(
                 result.year,
                 result.month,
@@ -233,6 +233,8 @@ AlarmManager.prototype.get = function() {
             );
 
             alarm = new tizen.AlarmAbsolute(date, result.second, InternalData_(result));
+        } else {
+            alarm = new Alarm(InternalData_(result));
         }
         _warningLogs.allow();
         return alarm;
@@ -277,7 +279,7 @@ function _prepareDetailInfo(noti) {
 }
 
 AlarmManager.prototype.getAlarmNotification = function() {
-    var args = AV.validateMethod(arguments, [
+    var args = AV.validateArgs(arguments, [
         {
             name: 'id',
             type: AV.Types.STRING
@@ -310,9 +312,11 @@ AlarmManager.prototype.getAll = function() {
         data.forEach(function(i) {
             if ('AlarmRelative' === i.type) {
                 md.push(new tizen.AlarmRelative(i.delay, i.period, InternalData_(i)));
-            } else {
+            } else if ('AlarmAbsolute' === i.type) {
                 var date = new Date(i.year, i.month, i.day, i.hour, i.min, i.sec);
                 md.push(new tizen.AlarmAbsolute(date, i.second, InternalData_(i)));
+            } else {
+                md.push(new Alarm(InternalData_(i)));
             }
         });
         _warningLogs.allow();
@@ -567,7 +571,7 @@ var ProfileAlarm = (function() {
 var _profile = ProfileAlarm.getInstance().profile;
 
 // Notifications feature are available on mobile and wearable profile
-if (_profile != 'mobile' && _profile != 'wearable') {
+if (_profile != 'mobile' && _profile != 'wearable' && _profile != 'common') {
     delete AlarmManager.prototype.addAlarmNotification;
     delete AlarmManager.prototype.getAlarmNotification;
     isAlarmAbsolutePeriodDeprecated = false;