Update change log and spec for wrt-plugins-tizen_0.4.11
authorKisub Song <kisubs.song@samsung.com>
Sun, 24 Mar 2013 03:32:00 +0000 (12:32 +0900)
committerKisub Song <kisubs.song@samsung.com>
Sun, 24 Mar 2013 04:08:07 +0000 (13:08 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue#] N/A
[Problem] Tizen - AbstractFilter array did not support Array.isArray()
[Cause] AbstractFilterArray did not use JSArray
[Solution] Reimplemented AbstractFiilterArray to JSArray

[Issue#] N/A
[Problem] Tizen - Could not distinguish the constructor and object
[Cause] Used object as constructor
[Solution] Fixed attaching method to tizen object

[Issue#] Content - can not update geolocation.
[Problem] the geolocation data is different with private object
[Cause] N/A
[Solution] set/get property is control by parent object

[Issue#] N/A
[Problem] Filesystem - Privilege should be checked before checking parameters.
[Cause] N/A
[Solution] add simple privilege check.

[Issue#] TDIS-4710
[Problem] Messaging - findMessages with body filter fails
[Cause] findMessages is supports only body.plainBody
[Solution] change filter validators

[Issue#] N/A
[Problem] Contact - crash at inserting failure, can't add groupIds
[Cause] internal bugs
[Solution] modify codes

[Issue#] ORANGE-245
[Problem] Download
[Cause] N/A
[Solution] Add new feature about http header field and network type selection.

[Issue#] N/A
[Problem] Messaging - isArray is not supported for to, cc and bcc attribute
[Cause] isArray is not supported for to, cc and bcc attribute
[Solution] isArray is supported for to, cc and bcc attribute

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

Change-Id: Id4f1a8420c49fa12e4469fdf1c5ce77d589032fb

44 files changed:
CMakeLists.txt
packaging/wrt-plugins-tizen.spec
src/Common/ArgumentValidationChecker.cpp [deleted file]
src/Common/ArgumentValidationChecker.h [deleted file]
src/Common/CMakeLists.txt
src/Common/MultiCallbackUserData.cpp
src/Common/MultiCallbackUserData.h
src/Contact/AddressBook.cpp
src/Contact/Contact.cpp
src/Contact/Contact.h
src/Contact/ContactConverter.cpp
src/Contact/ContactObjectA2PConverter.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactPhoneNumber.cpp
src/Content/ContentExif.cpp [new file with mode: 0755]
src/Content/ContentExif.h [new file with mode: 0755]
src/Content/ContentManager.cpp
src/Content/IContentManager.cpp
src/Content/IContentManager.h
src/Content/JSContentManager.cpp
src/Content/JSContentManager.h
src/Content/JSImage.cpp
src/Content/JSVideo.cpp
src/Content/plugin_config.cpp
src/Content/plugin_config.h
src/Filesystem/JSFile.cpp
src/Filesystem/JSFilesystemManager.cpp
src/Messaging/CMakeLists.txt
src/Messaging/messageDB/MessageStorageReader.cpp
src/Tizen/CMakeLists.txt
src/Tizen/FilterConverter.cpp
src/Tizen/JSAbstractFilterArray.cpp [deleted file]
src/Tizen/JSAbstractFilterArray.h [deleted file]
src/Tizen/JSAttributeFilter.cpp
src/Tizen/JSAttributeFilter.h
src/Tizen/JSAttributeRangeFilter.cpp
src/Tizen/JSAttributeRangeFilter.h
src/Tizen/JSCompositeFilter.cpp
src/Tizen/JSCompositeFilter.h
src/Tizen/JSSimpleCoordinates.cpp
src/Tizen/JSSimpleCoordinates.h
src/Tizen/JSSortMode.cpp
src/Tizen/JSSortMode.h
src/Tizen/plugin_initializer.cpp

index e7061e2..35a819d 100755 (executable)
@@ -6,13 +6,13 @@ PROJECT(wrt-plugins-tizen)
 # -----------------------------------------------------------------------------
 INCLUDE(FindPkgConfig)
 
-PKG_SEARCH_MODULE(webkit2 REQUIRED ewebkit2)
-PKG_SEARCH_MODULE(dpl REQUIRED dpl-efl)
-PKG_SEARCH_MODULE(dpl-event REQUIRED dpl-event-efl)
-PKG_SEARCH_MODULE(wrt-plugins-types REQUIRED wrt-plugins-types)
-PKG_SEARCH_MODULE(wrt-deviceapis-commons REQUIRED wrt-plugins-commons)
-PKG_SEARCH_MODULE(wrt-deviceapis-commons-javascript REQUIRED wrt-plugins-commons-javascript)
-PKG_SEARCH_MODULE(wrt-plugins-widgetdb REQUIRED wrt-plugins-widgetdb)
+PKG_CHECK_MODULES(webkit2 REQUIRED ewebkit2)
+PKG_CHECK_MODULES(dpl REQUIRED dpl-efl)
+PKG_CHECK_MODULES(dpl-event REQUIRED dpl-event-efl)
+PKG_CHECK_MODULES(wrt-plugins-types REQUIRED wrt-plugins-types)
+PKG_CHECK_MODULES(wrt-deviceapis-commons REQUIRED wrt-plugins-commons)
+PKG_CHECK_MODULES(wrt-deviceapis-commons-javascript REQUIRED wrt-plugins-commons-javascript)
+PKG_CHECK_MODULES(wrt-plugins-widgetdb REQUIRED wrt-plugins-widgetdb)
 
 INCLUDE_DIRECTORIES(
   ${webkit2_INCLUDE_DIRS}
index 25a0eb2..b7fe3aa 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.10
+Version:    0.4.11
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
diff --git a/src/Common/ArgumentValidationChecker.cpp b/src/Common/ArgumentValidationChecker.cpp
deleted file mode 100755 (executable)
index 1f23103..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2013 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "ArgumentValidationChecker.h"
-#include "JSTizenException.h"
-
-
-#include <dlog.h>
-#include <stdarg.h>
-
-#undef LOG_TAG
-#define LOG_TAG "TIZEN_DEVICEAPI"
-
-using namespace std;
-
-namespace DeviceAPI {
-namespace Common {
-
-
-void ArgumentValidationChecker::check(JSContextRef ctx, int argumentCount, const JSValueRef arguments [ ], int convertedArgumentCount, JSValueRef convertedArguments [ ], Option option, ...){
-    va_list var_args;
-    va_start (var_args, option);
-    Option opt = option;
-    int index = 0;
-    while( opt != END){
-        Type type = static_cast<Type>(va_arg(var_args, int));
-        JSObjectRef testObject = NULL;
-        bool nullable = ((opt & NULLABLE) == NULLABLE );
-        JSValueRef jsException = NULL;
-
-        if( index >= convertedArgumentCount ){
-            LOGE("invalid argument check code");
-            va_end (var_args);
-            return;
-        }
-        
-        if( argumentCount <= index ){
-            if( !nullable ) 
-                convertedArguments[index] = JSValueMakeUndefined(ctx);
-            else
-                convertedArguments[index] = JSValueMakeNull(ctx);
-            testObject = NULL;
-        }else{
-            convertedArguments[index] = arguments[index];
-            if( JSValueIsObject(ctx, arguments[index]) )
-                testObject = JSValueToObject(ctx, arguments[index], NULL);
-            else
-                testObject = NULL;
-        }
-
-        if( JSValueIsNull(ctx, convertedArguments[index]) && nullable){
-            if( type == ArgumentValidationChecker::UserDefine)
-                va_arg(var_args, JSClassRef);
-            if( type == ArgumentValidationChecker::SelfCheck)
-                va_arg(var_args, SelfChecker);
-
-            opt = static_cast<Option>(va_arg (var_args, int));
-            index++;
-            continue;
-        }
-
-
-        switch( type ){
-            case ArgumentValidationChecker::Float:
-            case ArgumentValidationChecker::Long:
-            {
-                double testValue = JSValueToNumber(ctx, convertedArguments[index], &jsException );
-                if( jsException != NULL )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "Could not converting to number", index);
-                if( ArgumentValidationChecker::Float == type && testValue != testValue )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "Converted value is nan", index);
-                break;
-            }
-            case ArgumentValidationChecker::String:
-            {
-                JSStringRef convertedstr = JSValueToStringCopy(ctx, convertedArguments[index], &jsException);
-                if( jsException != NULL){
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "Could not converting to string", index);
-                }
-                JSStringRelease(convertedstr);
-                break;
-            }
-            case ArgumentValidationChecker::Boolean:
-                //Boolean can convert from any types.
-                break;
-            case ArgumentValidationChecker::Function:
-                if( testObject == NULL || !JSObjectIsFunction(ctx, testObject) )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "argument is not function", index);
-                break;
-            case ArgumentValidationChecker::Object:
-                if( testObject == NULL )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "argument is not object", index);
-                break;
-            case ArgumentValidationChecker::Array:
-                if( !JSIsArrayValue(ctx, convertedArguments[index])){
-                    JSObjectRef jsArray = JSCreateArrayObject(ctx, 0, NULL);
-                    JSSetArrayElement(ctx, jsArray, 0, convertedArguments[index]);
-                    convertedArguments[index] = jsArray;
-                 }
-                break;
-            case ArgumentValidationChecker::UserDefine:
-            {
-                JSClassRef classType = va_arg(var_args, JSClassRef);
-                if( !JSValueIsObjectOfClass(ctx, convertedArguments[index],classType) )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "argument is not wanted object", index);
-                break;
-            }
-            case ArgumentValidationChecker::SelfCheck:
-            {
-                SelfChecker checker = va_arg(var_args, SelfChecker);
-                if( !checker(convertedArguments[index]) )
-                    throw ArgumentValidationException(JSTizenException::TYPE_MISMATCH_ERROR, "argument is not wanted object", index);
-                break;
-            }
-        }
-        
-        opt = static_cast<Option>(va_arg (var_args, int));
-        index++;
-    }    
-    va_end (var_args);
-}
-
-
-}
-}
diff --git a/src/Common/ArgumentValidationChecker.h b/src/Common/ArgumentValidationChecker.h
deleted file mode 100755 (executable)
index 3a277cf..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2013 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _WRTPLUGINS_TIZEN_ARGUMENTVALIDATIONCHECKER_
-#define _WRTPLUGINS_TIZEN_ARGUMENTVALIDATIONCHECKER_
-
-#include <string>
-#include <JavaScriptCore/JavaScript.h>
-
-namespace DeviceAPI {
-namespace Common{
-
-class ArgumentValidationException{
-public:
-    std::string mTizenException;
-    std::string mMessage;
-    int mInvalidArgumentIndex;
-    ArgumentValidationException(const std::string tizenException ,const  std::string message):mTizenException(tizenException),mMessage(message),mInvalidArgumentIndex(-1){}
-    ArgumentValidationException(const std::string tizenException ,const  std::string message, int index):mTizenException(tizenException),mMessage(message),mInvalidArgumentIndex(index){}
-};
-
-
-
-class ArgumentValidationChecker{
-    public : 
-        typedef bool (* SelfChecker)(JSValueRef value);
-
-        /**
-         * @brief Argument Validation options
-         * MANDATORY - Must existed
-         * OPTIONAL - Can be omitted
-         * NULLABLE - Can be use NULL value
-         * END - Variable argument terminator symbol
-         */
-        enum Option { MANDATORY = 0x01 , OPTIONAL = 0x02, NULLABLE = 0x04, END = 0x00 };
-        
-        enum Type { Float, Long, String, Function, Boolean, Object, Array, UserDefine, SelfCheck };
-
-       /**
-        * @brief check argment validation
-        *
-        * @remarks 
-        * Option phase instruction
-        *
-        * OPTIONS => OPTION, OPTIONS | OPTION,"END"
-        * OPTION => FIRST, SECOND
-        * FIRST => "MANDATORY"  | "OPTIONAL" NULLABLE
-        * NULLABLE => "|NULLABLE" | ""
-        * SECOND => "Float" | "Long" | "String" | "Function" | "Boolean" | "Object" | "Array" | "UserDefine", CLASSREF | "SelfCheck", CHECKFUN
-        * CLASSREF => ,JSClassRef
-        * CHECKFUN => ,SelfChecker
-        *
-        * @param[in] ctx       Context
-        * @param[in] oirginArgumentCount  Number of passed arguments count
-        * @param[in] originArguments   Passed arguments
-        * @param[in] convertedArgumentCount   Number of argument count in spec
-        * @param[out] convertedArguments   Converted arguments in proper types
-        * @param[in] option Argument options
-        *
-        */
-        static void check(JSContextRef ctx, int oirginArgumentCount , const JSValueRef originArguments[], int convertedArgumentCount , JSValueRef convertedArguments[], Option option,  ...);
-};
-
-}
-}
-
-#endif //_WRTPLUGINS_TIZEN_ARGUMENTVALIDATIONCHECKER_
-
index 60875d3..1b91a0e 100644 (file)
@@ -1,18 +1,17 @@
 SET(SRCS
-       JSTizenException.cpp
-       TizenExceptionData.cpp
-       JSTizenExceptionFactory.cpp
-       JSWebAPIError.cpp
-       ArgumentValidationChecker.cpp
-       CallbackUserData.cpp
-       GlobalContextManager.cpp
-       ArgumentValidator.cpp
-       JSUtil.cpp
-       PlatformException.cpp
-       MultiCallbackUserData.cpp
-       JSWebAPIErrorFactory.cpp
-       JSWebAPIError2.cpp
-       WebAPIError.cpp
+  JSTizenException.cpp
+  TizenExceptionData.cpp
+  JSTizenExceptionFactory.cpp
+  JSWebAPIError.cpp
+  CallbackUserData.cpp
+  GlobalContextManager.cpp
+  ArgumentValidator.cpp
+  JSUtil.cpp
+  PlatformException.cpp
+  MultiCallbackUserData.cpp
+  JSWebAPIErrorFactory.cpp
+  JSWebAPIError2.cpp
+  WebAPIError.cpp
 )
 
 ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
index 1ac5cfa..f078178 100755 (executable)
 
 #include "MultiCallbackUserData.h"
 #include "GlobalContextManager.h"
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "TIZEN_DEVICEAPI"
+#include "PlatformException.h"
+#include "Logger.h"
+#include "JSUtil.h"
 
 using namespace std;
 
 namespace DeviceAPI {
 namespace Common {
 
-MultiCallbackUserData::MultiCallbackUserData(JSContextRef globalCtx): mContext(globalCtx){
+MultiCallbackUserData::MultiCallbackUserData(JSContextRef globalCtx): mContext(globalCtx), mObject(NULL){
+}
+
+MultiCallbackUserData::MultiCallbackUserData(JSContextRef globalCtx, JSObjectRef object): mContext(globalCtx), mObject(object){
+    if( mObject )
+        JSValueProtect(mContext, mObject);
 }
 
 MultiCallbackUserData::~MultiCallbackUserData(){
     if( !GlobalContextManager::getInstance()->isAliveGlobalContext(mContext)){
+        //Remove Callback functions in Native Map
         CallbackMapT::iterator itr;
         for( itr = mCallbacks.begin() ; itr != mCallbacks.end() ; ++itr){
             JSObjectRef t = itr->second;
             if( t != NULL )
                 JSValueUnprotect(mContext, t);
         }
+
+        //Remove Callback Object
+        if( mObject ){
+            JSValueUnprotect(mContext, mObject);
+            mObject = NULL;
+        }
     }
 }
 
 void MultiCallbackUserData::setCallback(const string &key, JSObjectRef callback){
+
+    // Callback Object Case
+    if( mObject ){
+        JSUtil::setProperty(mContext, mObject, key.c_str(), callback, kJSPropertyAttributeNone);
+        return;
+    }
+
+    // Callback function Case
     CallbackMapT::iterator itr;
     itr = mCallbacks.find(key);
     if( itr != mCallbacks.end() && itr->second != NULL){
@@ -63,6 +81,40 @@ void MultiCallbackUserData::invokeCallback(const std::string &key, int count, JS
         return;
     }
 
+    // Callback Object case
+    if( mObject ){
+        try{
+            // Getting callback value
+            JSValueRef callbackValue = JSUtil::getProperty(mContext, mObject, key.c_str());
+
+            // Testing existing
+            if( JSValueIsUndefined(mContext, callbackValue) ){
+                LOGE("There is no such callback[%s]", key.c_str());
+                return;
+            }
+
+            JSObjectRef callbackObject = JSUtil::JSValueToObject(mContext, callbackValue);
+
+            // Testing type validation
+            if( !JSObjectIsFunction( mContext, callbackObject) ){
+                LOGE("%s is not function", key.c_str());
+                return;
+            }
+
+            JSValueRef exception = NULL;
+            JSObjectCallAsFunction(mContext, callbackObject, NULL, count, obj, &exception);
+
+            // check Exception in function call
+            if( exception != NULL ){
+                throw UnknownException(mContext, exception);
+            }
+        }catch( const BasePlatformException& err){
+            LOGE("Error in Callback invoke - %s:%s", err.getName().c_str(), err.getMessage().c_str());
+        }
+        return;
+    }
+
+    // Callback function case
     CallbackMapT::iterator itr;
     itr = mCallbacks.find(key);
     if( itr == mCallbacks.end()){
index 1cdc462..d71a2ca 100755 (executable)
@@ -28,6 +28,7 @@ namespace Common{
 class MultiCallbackUserData{
     public:
         MultiCallbackUserData(JSContextRef globalCtx);
+        MultiCallbackUserData(JSContextRef globalCtx, JSObjectRef object);
         virtual ~MultiCallbackUserData();
         JSContextRef getContext();
         void setCallback(const std::string &key, JSObjectRef callback);
@@ -38,6 +39,7 @@ class MultiCallbackUserData{
        
     private:
         JSContextRef mContext;
+        JSObjectRef mObject;
         typedef std::map<const std::string, JSObjectRef> CallbackMapT;
         std::map<const std::string, JSObjectRef> mCallbacks;
 };
index b1ad951..ac545af 100755 (executable)
@@ -169,6 +169,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event)
        int errorCode = 0;
        int id = 0;
        contacts_record_h contacts_record = NULL;
+       contacts_record_h get_contacts_record = NULL;
        ContactPtr contact(NULL);
 
        Try
@@ -237,13 +238,12 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event)
                        ThrowMsg(PlatformException, "Error during executing contacts_db_insert_record()");
                }
 
-               contacts_record = NULL;
-               errorCode = contacts_db_get_record(_contacts_contact._uri, contactId, &contacts_record);
-               if(errorCode != CONTACTS_ERROR_NONE || contacts_record == NULL)
+               errorCode = contacts_db_get_record(_contacts_contact._uri, contactId, &get_contacts_record);
+               if(errorCode != CONTACTS_ERROR_NONE || get_contacts_record == NULL)
                        ThrowMsg(PlatformException, "No contact just inserted  (id:" << contactId << ")");
 
                ContactObjectP2AConverterPtr contactObjConverterForInserted(
-                               new ContactObjectP2AConverter(contacts_record, false));
+                               new ContactObjectP2AConverter(get_contacts_record, false));
                ContactPtr insertedContact = contactObjConverterForInserted->getAbstractContact();
                contact->copy(insertedContact);
 
@@ -263,8 +263,8 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event)
                event->setExceptionCode(ExceptionCodes::UnknownException);
        }
 
-       if(contacts_record != NULL)
-               contacts_record_destroy(contacts_record, true);
+       if(get_contacts_record != NULL)
+               contacts_record_destroy(get_contacts_record, true);
 }
 
 void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event)
index 4a2c84b..7769b32 100755 (executable)
@@ -44,11 +44,40 @@ Contact::Contact()
 {
 //     LogDebug("entered");
 
+       m_numbersJSObjIsSet = false;
+       m_emailsJSObjIsSet = false;
+       m_anniversariesJSObjIsSet = false;
+       m_urlsJSObjIsSet = false;
+       m_addressesJSObjIsSet = false;
+       m_organizationsJSObjIsSet = false;
        m_notesJSObjIsSet = false;
        m_groupIdsJSObjIsSet = false;
-       m_context = NULL;
+
+       m_numbersObj = NULL;
+       m_numbersJSValue = NULL;
+
+       m_emailsObj = NULL;
+       m_emailsJSValue = NULL;
+
+       m_anniversariesObj = NULL;
+       m_anniversariesJSValue = NULL;
+
+       m_urlsObj = NULL;
+       m_urlsJSValue = NULL;
+
+       m_addressesObj = NULL;
+       m_addressesJSValue = NULL;
+
+       m_organizationsObj = NULL;
+       m_organizationsJSValue = NULL;
+
        m_groupIdsObj = NULL;
        m_groupIdsJSValue = NULL;
+       m_notesObj = NULL;
+       m_notesJSValue = NULL;
+
+       m_context = NULL;
+
 }
 
 Contact::~Contact()
@@ -56,6 +85,42 @@ Contact::~Contact()
        if (m_platformContactObjectList != NULL)
                contacts_list_destroy(m_platformContactObjectList, true);
 
+       if(numbersJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getNumbersJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(EmailsJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getEmailsJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(anniversariesJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getAnniversariesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(urlsJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getUrlsJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(addressesJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getAddressesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(organizationsJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getOrganizationsJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
        if(groupIdsJSObjIsSet()){
                JSContextRef contextRef = getContext();
                JSObjectRef tempJSObject = getGroupIdsJSObj();
@@ -142,6 +207,132 @@ void Contact::setContactFromString(const std::string &vObjectStr)
        m_platformContactObjectList = contacts_list;
 }
 
+void Contact::setNumbersJSObj(bool value, JSObjectRef initObj)
+{
+       m_numbersJSObjIsSet = value;
+       m_numbersObj = initObj;
+}
+
+bool Contact::numbersJSObjIsSet() const
+{
+       return m_numbersJSObjIsSet;
+}
+
+JSObjectRef Contact::getNumbersJSObj()
+{
+       return m_numbersObj;
+}
+
+JSValueRef Contact::getNumbersJSValue()
+{
+       return m_numbersJSValue;
+}
+
+void Contact::setEmailsJSObj(bool value, JSObjectRef initObj)
+{
+       m_emailsJSObjIsSet = value;
+       m_emailsObj = initObj;
+}
+
+bool Contact::EmailsJSObjIsSet() const
+{
+       return m_emailsJSObjIsSet;
+}
+
+JSObjectRef Contact::getEmailsJSObj()
+{
+       return m_emailsObj;
+}
+
+JSValueRef Contact::getEmailsJSValue()
+{
+       return m_emailsJSValue;
+}
+
+void Contact::setAnniversariesJSObj(bool value, JSObjectRef initObj)
+{
+       m_anniversariesJSObjIsSet = value;
+       m_anniversariesObj = initObj;
+}
+
+bool Contact::anniversariesJSObjIsSet() const
+{
+       return m_anniversariesJSObjIsSet;
+}
+
+JSObjectRef Contact::getAnniversariesJSObj()
+{
+       return m_anniversariesObj;
+}
+
+JSValueRef Contact::getAnniversariesJSValue()
+{
+       return m_anniversariesJSValue;
+}
+
+void Contact::setUrlsJSObj(bool value, JSObjectRef initObj)
+{
+       m_urlsJSObjIsSet = value;
+       m_urlsObj = initObj;
+}
+
+bool Contact::urlsJSObjIsSet() const
+{
+       return m_urlsJSObjIsSet;
+}
+
+JSObjectRef Contact::getUrlsJSObj()
+{
+       return m_urlsObj;
+}
+
+JSValueRef Contact::getUrlsJSValue()
+{
+       return m_urlsJSValue;
+}
+
+void Contact::setAddressesJSObj(bool value, JSObjectRef initObj)
+{
+       m_addressesJSObjIsSet = value;
+       m_addressesObj = initObj;
+}
+
+bool Contact::addressesJSObjIsSet() const
+{
+       return m_addressesJSObjIsSet;
+}
+
+JSObjectRef Contact::getAddressesJSObj()
+{
+       return m_addressesObj;
+}
+
+JSValueRef Contact::getAddressesJSValue()
+{
+       return m_addressesJSValue;
+}
+
+void Contact::setOrganizationsJSObj(bool value, JSObjectRef initObj)
+{
+       m_organizationsJSObjIsSet = value;
+       m_organizationsObj = initObj;
+}
+
+bool Contact::organizationsJSObjIsSet() const
+{
+       return m_organizationsJSObjIsSet;
+}
+
+JSObjectRef Contact::getOrganizationsJSObj()
+{
+       return m_organizationsObj;
+}
+
+JSValueRef Contact::getOrganizationsJSValue()
+{
+       return m_organizationsJSValue;
+}
+
 void Contact::setNotesJSObj(bool value, JSObjectRef initObj)
 {
        m_notesJSObjIsSet = value;
index 1f797e2..60fb416 100755 (executable)
@@ -45,6 +45,36 @@ public:
 
        contacts_record_h getPlatformContactObject() const { return m_platformContactObject; };
 
+       void setNumbersJSObj(bool value, JSObjectRef initObj);
+       bool numbersJSObjIsSet() const;
+       JSObjectRef getNumbersJSObj();
+       JSValueRef getNumbersJSValue();
+
+       void setEmailsJSObj(bool value, JSObjectRef initObj);
+       bool EmailsJSObjIsSet() const;
+       JSObjectRef getEmailsJSObj();
+       JSValueRef getEmailsJSValue();
+
+       void setAnniversariesJSObj(bool value, JSObjectRef initObj);
+       bool anniversariesJSObjIsSet() const;
+       JSObjectRef getAnniversariesJSObj();
+       JSValueRef getAnniversariesJSValue();
+
+       void setUrlsJSObj(bool value, JSObjectRef initObj);
+       bool urlsJSObjIsSet() const;
+       JSObjectRef getUrlsJSObj();
+       JSValueRef getUrlsJSValue();
+
+       void setAddressesJSObj(bool value, JSObjectRef initObj);
+       bool addressesJSObjIsSet() const;
+       JSObjectRef getAddressesJSObj();
+       JSValueRef getAddressesJSValue();
+
+       void setOrganizationsJSObj(bool value, JSObjectRef initObj);
+       bool organizationsJSObjIsSet() const;
+       JSObjectRef getOrganizationsJSObj();
+       JSValueRef getOrganizationsJSValue();
+
        void setNotesJSObj(bool value, JSObjectRef initObj);
        bool notesJSObjIsSet() const;
        JSObjectRef getNotesJSObj();
@@ -62,6 +92,30 @@ private:
        contacts_record_h m_platformContactObject;
        contacts_list_h m_platformContactObjectList;
 
+       bool m_numbersJSObjIsSet;
+       JSObjectRef m_numbersObj;
+       JSValueRef m_numbersJSValue;
+
+       bool m_emailsJSObjIsSet;
+       JSObjectRef m_emailsObj;
+       JSValueRef m_emailsJSValue;
+
+       bool m_anniversariesJSObjIsSet;
+       JSObjectRef m_anniversariesObj;
+       JSValueRef m_anniversariesJSValue;
+
+       bool m_urlsJSObjIsSet;
+       JSObjectRef m_urlsObj;
+       JSValueRef m_urlsJSValue;
+
+       bool m_addressesJSObjIsSet;
+       JSObjectRef m_addressesObj;
+       JSValueRef m_addressesJSValue;
+
+       bool m_organizationsJSObjIsSet;
+       JSObjectRef m_organizationsObj;
+       JSValueRef m_organizationsJSValue;
+
        bool m_notesJSObjIsSet;
        JSObjectRef m_notesObj;
        JSValueRef m_notesJSValue;
index 0dc7bf8..c1ed5cc 100755 (executable)
@@ -232,6 +232,9 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue)
        const ScopedJSStringRef notesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NOTES));
        const ScopedJSStringRef phoneNumbersStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_PHONE_NUMBERS));
        const ScopedJSStringRef emailsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_EMAILS));
+       const ScopedJSStringRef anniversariesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ANNIVERSARIES));
+       const ScopedJSStringRef organizationsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ORGANIZATIONS));
+       const ScopedJSStringRef urlsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_URLS));
 
        JSObjectRef jsObject = toJSObjectRef(jsValue);
        JSValueRef nameData = JSObjectGetProperty(m_context, jsObject, nameStr.get(), NULL);
@@ -240,6 +243,9 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue)
        JSValueRef emailsData = JSObjectGetProperty(m_context, jsObject, emailsStr.get(), NULL);
        JSValueRef groupIdsData = JSObjectGetProperty(m_context, jsObject, groupIdsStr.get(), NULL);
        JSValueRef notesData = JSObjectGetProperty(m_context, jsObject, notesStr.get(), NULL);
+       JSValueRef anniversariesData = JSObjectGetProperty(m_context, jsObject, anniversariesStr.get(), NULL);
+       JSValueRef organizationsData = JSObjectGetProperty(m_context, jsObject, organizationsStr.get(), NULL);
+       JSValueRef urlsData = JSObjectGetProperty(m_context, jsObject, urlsStr.get(), NULL);
 
        ContactNamePtr name;
        ContactAddressArrayPtr addresses;
@@ -247,6 +253,9 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue)
        ContactEmailAddressArrayPtr emails;
        StringArrayPtr groupIds;
        StringArrayPtr notes;
+       ContactAnniversaryArrayPtr anniversaries;
+       ContactOrganizationArrayPtr organizations;
+       ContactWebSiteArrayPtr urls;
 
        Validator validator(m_context);
 
@@ -280,6 +289,21 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue)
                tempContact->setNotes(notes);
        }
 
+       if (!validator.isNullOrUndefined(anniversariesData)) {
+               anniversaries = toContactAnniversaryArray(anniversariesData);
+               tempContact->setAnniversaries(anniversaries);
+       }
+
+       if (!validator.isNullOrUndefined(organizationsData)) {
+               organizations = toContactOrganizationArray(organizationsData);
+               tempContact->setOrganizations(organizations);
+       }
+
+       if (!validator.isNullOrUndefined(urlsData)) {
+               urls = toContactWebSiteArray(urlsData);
+               tempContact->setUrls(urls);
+       }
+
        return tempContact;
 
 //     return JSContact::getContact(m_context, jsValue);
@@ -545,9 +569,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactGroupArrayPtr &arg)
 
 ContactGroupArrayPtr ContactConverter::toContactGroupArray(const JSValueRef &jsValue)
 {
-       if(JSContactGroupArray::isObjectOfClass(m_context, jsValue))
-               return JSContactGroupArray::getContactGroupArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactGroupArray is not array.");
 
@@ -926,9 +947,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactAnniversaryArrayPtr &arg)
 
 ContactAnniversaryArrayPtr ContactConverter::toContactAnniversaryArray(const JSValueRef &jsValue)
 {
-       if(JSContactAnniversaryArray::isObjectOfClass(m_context, jsValue))
-               return JSContactAnniversaryArray::getContactAnniversaryArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactAnniversaryArray is not array.");
 
@@ -1138,9 +1156,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberArrayPtr &arg)
 
 ContactPhoneNumberArrayPtr ContactConverter::toContactPhoneNumberArray(const JSValueRef &jsValue)
 {
-       if(JSContactPhoneNumberArray::isObjectOfClass(m_context, jsValue))
-               return JSContactPhoneNumberArray::getContactPhoneNumberArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactPhoneNumberArray is not array.");
 
@@ -1190,9 +1205,7 @@ JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressArrayPtr &arg
 
 ContactEmailAddressArrayPtr ContactConverter::toContactEmailAddressArray(const JSValueRef &jsValue)
 {
-       if(JSContactEmailAddressArray::isObjectOfClass(m_context, jsValue))
-               return JSContactEmailAddressArray::getContactEmailAddressArray(m_context, jsValue);
-
+       LogDebug("1");
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactEmailAddressArray is not array.");
 
@@ -1200,6 +1213,8 @@ ContactEmailAddressArrayPtr ContactConverter::toContactEmailAddressArray(const J
 
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
+
+               LogDebug("count : " << i);
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
         result->push_back(toContactEmailAddress(element));
     }
@@ -1309,9 +1324,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactAddressTypeArrayPtr &arg)
 
 ContactAddressTypeArrayPtr ContactConverter::toContactAddressTypeArray(const JSValueRef &jsValue)
 {
-       if(JSContactAddressTypeArray::isObjectOfClass(m_context, jsValue))
-               return JSContactAddressTypeArray::getContactAddressTypeArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactAddressTypeArray is not array.");
 
@@ -1433,9 +1445,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberTypeArrayPtr &
 
 ContactPhoneNumberTypeArrayPtr ContactConverter::toContactPhoneNumberTypeArray(const JSValueRef &jsValue)
 {
-       if(JSContactPhoneNumberTypeArray::isObjectOfClass(m_context, jsValue))
-               return JSContactPhoneNumberTypeArray::getContactPhoneNumberTypeArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactEmailAddressTypeArray is not array.");
 
@@ -1517,9 +1526,6 @@ JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressTypeArrayPtr
 
 ContactEmailAddressTypeArrayPtr ContactConverter::toContactEmailAddressTypeArray(const JSValueRef &jsValue)
 {
-       if(JSContactEmailAddressTypeArray::isObjectOfClass(m_context, jsValue))
-               return JSContactEmailAddressTypeArray::getContactEmailAddressTypeArray(m_context, jsValue);
-
        if(!JSIsArrayValue(m_context, jsValue))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "ContactEmailAddressTypeArray is not array.");
 
index d0db2bc..d5951a8 100755 (executable)
@@ -662,19 +662,14 @@ void ContactObjectA2PConverter::importCompanyList()
                        }
                }
 
-               LogDebug("organization->getLogoURIIsSet() : " << organization->getLogoURIIsSet());
                // ContactOrganization.logoURI
                if(organization->getLogoURIIsSet())
                {
-                       LogDebug("organization->getLogoURI() : " << organization->getLogoURI());
                        string logoURI = organization->getLogoURI();
                        if(!logoURI.empty())
                        {
-//                             logoURI = ContactUtility::convertUriToPath(logoURI);
-                               LogDebug("logoURI.c_str() : " << logoURI.c_str());
-
+                               logoURI = ContactUtility::convertUriToPath(logoURI);
                                errorCode = contacts_record_set_str(child_record, _contacts_company.logo, logoURI.c_str());
-                               LogDebug("errorCode : " << errorCode);
                                if(errorCode != CONTACTS_ERROR_NONE)
                                {
                                        LogWarning("importing logoURI N (err:" << errorCode << ", str:" << logoURI << ")");
@@ -1054,7 +1049,7 @@ void ContactObjectA2PConverter::importGrouprelList()
 
                child_record = NULL;
 
-               if(ContactUtility::checkStrIsUInt(groupId))
+               if(!ContactUtility::checkStrIsUInt(groupId))
                {
                        LogWarning("groupId (" << groupId << ") is wrong.");
                        continue;
index 92b9c11..806fb58 100755 (executable)
@@ -480,10 +480,24 @@ JSValueRef JSContact::getAddresses(JSContextRef context,
                        ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
                }
                JSContextRef gContext = priv->getContext();
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(gContext);
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getAddresses());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->addressesJSObjIsSet()){
+                       return newContactT->getAddressesJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getAddressesJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getAddresses());
+
+                       JSObjectRef convertedJSObject = newContactT->getAddressesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setAddressesJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -579,10 +593,24 @@ JSValueRef JSContact::getPhoneNumbers(JSContextRef context,
                        ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
                }
                JSContextRef gContext = priv->getContext();
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(gContext);
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getPhoneNumbers());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->numbersJSObjIsSet()){
+                       return newContactT->getNumbersJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getNumbersJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getPhoneNumbers());
+
+                       JSObjectRef convertedJSObject = newContactT->getNumbersJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setNumbersJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -629,10 +657,26 @@ JSValueRef JSContact::getEmails(JSContextRef context,
                }
                JSContextRef gContext = priv->getContext();
 
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(gContext);
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getEmails());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->EmailsJSObjIsSet()){
+                       LogDebug("return init value");
+                       return newContactT->getEmailsJSObj();
+               }else{
+                       LogDebug("new array");
+                       JSValueRef tempJSValue = newContactT->getEmailsJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getEmails());
+
+                       JSObjectRef convertedJSObject = newContactT->getEmailsJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setEmailsJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -723,10 +767,30 @@ JSValueRef JSContact::getAnniversaries(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getAnniversaries());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->anniversariesJSObjIsSet()){
+                       return newContactT->getAnniversariesJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getAnniversariesJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getAnniversaries());
+
+                       JSObjectRef convertedJSObject = newContactT->getAnniversariesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setAnniversariesJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -767,10 +831,30 @@ JSValueRef JSContact::getOrganizations(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getOrganizations());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->organizationsJSObjIsSet()){
+                       return newContactT->getOrganizationsJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getOrganizationsJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getOrganizations());
+
+                       JSObjectRef convertedJSObject = newContactT->getOrganizationsJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setOrganizationsJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -874,10 +958,30 @@ JSValueRef JSContact::getUrls(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getUrls());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->urlsJSObjIsSet()){
+                       return newContactT->getUrlsJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getUrlsJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getUrls());
+
+                       JSObjectRef convertedJSObject = newContactT->getUrlsJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setUrlsJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
index 5fd9374..a1b4b27 100755 (executable)
@@ -35,7 +35,7 @@
 
 #define CONTACT_ATTR_NUMBER "number"
 #define CONTACT_ATTR_TYPES "types"
-#define CONTACT_ATTR_IS_DEFAULT "idDefault"
+#define CONTACT_ATTR_IS_DEFAULT "isDefault"
 
 namespace DeviceAPI {
 namespace Contact {
diff --git a/src/Content/ContentExif.cpp b/src/Content/ContentExif.cpp
new file mode 100755 (executable)
index 0000000..0a77d75
--- /dev/null
@@ -0,0 +1,245 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "ContentExif.h"
+#include <Logger.h>
+
+
+namespace DeviceAPI {
+namespace Content {
+
+ContentExif::ContentExif(std::string path)
+{
+       fp = fopen(path.c_str(), "rb+");
+       m_exifBuf = NULL;
+}
+
+ContentExif::~ContentExif()
+{
+       if(fp)
+       {
+               fclose(fp);
+       }
+       if(!m_exifBuf)
+       {
+               free(m_exifBuf);
+       }
+}
+
+unsigned char ContentExif::nextByte()
+{
+       return getc(fp);
+}
+
+int ContentExif::read_1_byte (void)
+{
+       int c;
+
+       //todo. check EOF
+       c = nextByte();
+
+       return c;
+}
+
+/* Read 2 bytes, convert to unsigned int */
+/* All 2-byte quantities in JPEG markers are MSB first */
+unsigned int ContentExif::read_2_bytes (void)
+{
+       int c1, c2;
+
+       //todo. check EOF
+       c1 = nextByte();
+       c2 = nextByte();
+       return (((unsigned int) c1) << 8) + ((unsigned int) c2);
+}
+
+int ContentExif::LodExif()
+{
+       unsigned char soi[2];
+
+       if(fp == NULL) return 0;
+
+       for (int i = 0; i < sizeof(soi); i++)
+         soi[i] = (unsigned char) read_1_byte();
+
+       //check soi tag for jpeg
+       if (soi[0]!=0xFF || soi[1]!=0xD8)
+       {
+               LogDebug("can not find SOI tag");
+               return -1;
+       }
+
+       //App marker
+       for(;;)
+       {
+               unsigned char app[2];
+               for( int i = 0; i < sizeof(app); i++)
+                       app[i] = (unsigned char) read_1_byte();
+
+               printf("marker:%02x %02x \n",app[0],app[1]);
+               if(app[0] == 0xFF && app[1] == 0xE1)
+                       break;
+               else if(app[0] != 0xFF || !(app[1]==0xEE ||app[1]==0xE0))
+               {
+                       LogDebug("Not supported image type.");
+                       return -1;
+               }
+
+               unsigned int marker_size = read_2_bytes();
+
+               for( int i =0 ; i < marker_size - 2; i++)
+                       read_1_byte();
+       }
+
+       unsigned int len = read_2_bytes() - 8;
+       if (len < 0)
+       {
+               LogDebug("Wrong Image");
+               return -2;
+       }
+
+       //check exif header
+       unsigned char exif[6];
+       for (int i = 0; i < 6; i++)
+         exif[i] = (unsigned char) read_1_byte();
+
+       if (exif[0] != 0x45 || exif[1] != 0x78 || exif[2] != 0x69 ||exif[3] != 0x66)
+       {
+               LogDebug("can not find EXIF tag");
+               return -1;
+       }
+
+       m_exifBuf = (unsigned char*)calloc(len,sizeof(unsigned char));
+
+       fread(m_exifBuf, 1, len,fp);
+
+       /* check endian type */
+       if (m_exifBuf[0] == 0x49 && m_exifBuf[1] == 0x49)
+       {
+               m_endianType = false;
+       }
+       else if (m_exifBuf[0] == 0x4D && m_exifBuf[1] == 0x4D)
+       {
+               m_endianType = true;
+       }
+       else
+       {
+               LogDebug("can not find endian tag");
+               return -1;
+       }
+
+       /* Get first IFD offset (offset to IFD0) */
+       if (m_endianType)
+       {
+               if (m_exifBuf[4] != 0) return 0;
+               if (m_exifBuf[5] != 0) return 0;
+               m_offset = m_exifBuf[6];
+               m_offset <<= 8;
+               m_offset += m_exifBuf[7];
+       }
+       else
+       {
+               if (m_exifBuf[7] != 0) return 0;
+               if (m_exifBuf[6] != 0) return 0;
+               m_offset = m_exifBuf[5];
+               m_offset <<= 8;
+               m_offset += m_exifBuf[4];
+       }
+
+       if (m_offset > len - 2) return 0; /* check end of data segment */
+
+       /* Get the number of directory entries contained in this IFD */
+       if (m_endianType)
+       {
+               m_tagCount = m_exifBuf[m_offset];
+               m_tagCount <<= 8;
+               m_tagCount += m_exifBuf[m_offset+1];
+       }
+       else
+       {
+               m_tagCount = m_exifBuf[m_offset+1];
+               m_tagCount <<= 8;
+               m_tagCount += m_exifBuf[m_offset];
+       }
+       if (m_tagCount == 0) return 0;
+       m_offset += 2;
+
+       return 1;
+}
+
+bool ContentExif::SetExifChar(unsigned int tag, unsigned char value)
+{
+       unsigned int _tag;
+       bool isfound = false;
+       for(unsigned int i = 0; i < m_tagCount; i++)
+       {
+               if(m_endianType)
+               {
+                       _tag = m_exifBuf[m_offset];
+                       _tag <<= 8;
+                       _tag += m_exifBuf[m_offset+1];
+               }
+               else
+               {
+                       _tag = m_exifBuf[m_offset+1];
+                       _tag <<= 8;
+                       _tag += m_exifBuf[m_offset];
+               }
+               if(_tag == tag)
+               {
+                       isfound = true;
+                       break;
+               }
+
+           m_offset += 12;
+       }
+
+       if(isfound)
+       {
+               if (m_endianType) {
+                       m_exifBuf[m_offset+2] = 0; /* Format = unsigned short (2 octets) */
+                       m_exifBuf[m_offset+3] = 3;
+                       m_exifBuf[m_offset+4] = 0; /* Number Of Components = 1 */
+                       m_exifBuf[m_offset+5] = 0;
+                       m_exifBuf[m_offset+6] = 0;
+                       m_exifBuf[m_offset+7] = 1;
+                       m_exifBuf[m_offset+8] = 0;
+                       m_exifBuf[m_offset+9] = value;
+                       m_exifBuf[m_offset+10] = 0;
+                       m_exifBuf[m_offset+11] = 0;
+               } else {
+                       m_exifBuf[m_offset+2] = 3; /* Format = unsigned short (2 octets) */
+                       m_exifBuf[m_offset+3] = 0;
+                       m_exifBuf[m_offset+4] = 1; /* Number Of Components = 1 */
+                       m_exifBuf[m_offset+5] = 0;
+                       m_exifBuf[m_offset+6] = 0;
+                       m_exifBuf[m_offset+7] = 0;
+                       m_exifBuf[m_offset+8] = value;
+                       m_exifBuf[m_offset+9] = 0;
+                       m_exifBuf[m_offset+10] = 0;
+                       m_exifBuf[m_offset+11] = 0;
+               }
+
+               fseek(fp, (4 + 2 + 6 + 2) + m_offset, SEEK_SET);
+               fwrite(m_exifBuf + 2 + m_offset, 1, 10, fp);
+       }
+       return isfound;
+}
+
+
+} // Content
+} // DeviceAPI
diff --git a/src/Content/ContentExif.h b/src/Content/ContentExif.h
new file mode 100755 (executable)
index 0000000..2aabe3e
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef _PLATFORM_CONTENT_EXIF_H_
+#define _PLATFORM_CONTENT_EXIF_H_
+
+#include <string>
+
+namespace DeviceAPI {
+namespace Content {
+
+#define EXIF_TAG_ORIENTATION 0x0112
+
+class ContentExif
+{
+public:
+       ContentExif(std::string path);
+       virtual ~ContentExif();
+
+       int LodExif();
+       bool SetExifChar(unsigned int tag, unsigned char value);
+
+private:
+
+       int read_1_byte();
+       unsigned int read_2_bytes();
+       unsigned char nextByte();
+
+
+       FILE *fp;
+
+       std::string m_path;
+       bool m_endianType;
+       unsigned char *m_exifBuf;
+       unsigned int m_tagCount;
+       unsigned int m_offset;
+};
+
+} // Content
+} // DeviceAPI
+
+#endif // _PLATFORM_CONTENT_UTILITY_H_
\ No newline at end of file
index 4e3d5b2..27ca5b7 100755 (executable)
@@ -948,12 +948,12 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse
                {
                        if ( MEDIA_CONTENT_ERROR_NONE !=  
                                media_info_foreach_media_from_db (filter, mediaItemCallback, eBrowse.Get()))
-                       {       
+                       {
                                LogError("error ( media_folder_foreach_folder_from_db ) : " << ret);
                                eBrowse->setResult(false);
                        }
                        else
-                       {       
+                       {
                                eBrowse->setResult(true);
                        }
                }
@@ -1019,18 +1019,17 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                {
                        MediacontentImagePtr imagePtr = DPL::DynamicPointerCast<MediacontentImage>(mediaPtr);
 
-                       if(imagePtr && (imagePtr->isChangedOrientaion() 
-                               || imagePtr->isChangedLatitude() || imagePtr->isChangedLongitude()))
+                       if(imagePtr)
                        {
                                image_meta_h img=NULL;
                                if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_image(media, &img))
                                {
                                        if(imagePtr->isChangedOrientaion())
                                        {
-                                               if ( MEDIA_CONTENT_ERROR_NONE != 
+                                               if ( MEDIA_CONTENT_ERROR_NONE !=
                                                        image_meta_set_orientation (img, convertToOrientation(imagePtr->getImageOrientation())))
                                                {
-                                                       LogDebug("Error: set orientation"); 
+                                                       LogDebug("Error: set orientation");
                                                        ret = false;
                                                }
                                        }
@@ -1039,7 +1038,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                media_info_set_latitude(media, imagePtr->getImageLatitude())
                                                )
                                        {
-                                               LogDebug("Error: set Latitude"); 
+                                               LogDebug("Error: set Latitude");
                                                ret = false;
                                        }
 
@@ -1059,7 +1058,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
 
                                        if ( MEDIA_CONTENT_ERROR_NONE != image_meta_destroy(img))
                                        {
-                                               LogDebug("Error: destroy media info");  
+                                               LogDebug("Error: destroy media info");
                                                ret = false;
                                        }
 
@@ -1072,14 +1071,13 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                        ret = false;
                                }
                        }
-                       
+
                }
 
                if(type.compare("VIDEO") ==0 )
                {
                        MediacontentVideoPtr videoPtr = DPL::DynamicPointerCast<MediacontentVideo>(mediaPtr);
-                       if (videoPtr && ( videoPtr->isChangedArtists () ||  videoPtr->isChangedAlbum() 
-                               || videoPtr->isChangedLatitude() ||videoPtr->isChangedLongitude()) )
+                       if (videoPtr)
                        {
 
                                video_meta_h video = NULL;
@@ -1094,7 +1092,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                        LogDebug("Error: set play count"); 
                                                        ret = false;
 
-                                               }       
+                                               }
                                        }
 
                                        if (videoPtr->isChangedPlayedTime())
@@ -1144,7 +1142,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
 
                                        if ( MEDIA_CONTENT_ERROR_NONE != video_meta_destroy(video))
                                        {
-                                               LogDebug("Error: destroy video meta");  
+                                               LogDebug("Error: destroy video meta");
                                                ret = false;
                                        }
 
index 24bb722..b7511c0 100755 (executable)
@@ -15,6 +15,7 @@
 // limitations under the License.
 //
 
+#include <libexif/exif-loader.h>
 #include <Commons/StringUtils.h>
 #include <Commons/ThreadPool.h>
 #include "IContentManager.h"
@@ -24,6 +25,9 @@
 #include "ContentVideo.h"
 #include "ContentAudio.h"
 #include "ContentManager.h"
+#include "ContentExif.h"
+#include "ContentUtility.h"
+
 
 namespace DeviceAPI {
 namespace Content {
@@ -329,5 +333,70 @@ bool IMediacontentManager::unsetListener()
        return ret;
 }
 
+bool IMediacontentManager::updateMetadata(MediacontentImagePtr &ptr)
+{
+       LogDebug("ContentManager::updateMetadata called");
+       string orientation = ptr->getImageOrientation();
+       unsigned char orientation_value;
+               LogDebug("ContentManager::updateMetadata called1");
+       if ( orientation.compare("NORMAL")==0)
+       {
+               orientation_value= 1; //MEDIA_CONTENT_ORIENTATION_NORMAL
+       }
+       else if (orientation.compare("FLIP_HORIZONTAL")==0)
+       {
+               orientation_value = 2; //MEDIA_CONTENT_ORIENTATION_HFLIP;
+       }
+       else if (orientation.compare("ROTATE_180")==0)
+       {
+               orientation_value = 3; //MEDIA_CONTENT_ORIENTATION_ROT_180;
+       }
+       else if (orientation.compare("FLIP_VERTICAL")==0)
+       {
+               orientation_value = 4; //MEDIA_CONTENT_ORIENTATION_VFLIP;
+       }
+       else if (orientation.compare("TRANSPOSE")==0)
+       {
+               orientation_value = 5; //MEDIA_CONTENT_ORIENTATION_TRANSPOSE;
+       }
+       else if (orientation.compare("ROTATE_90")==0)
+       {
+               orientation_value = 6; //MEDIA_CONTENT_ORIENTATION_ROT_90;
+       }
+       else if (orientation.compare("TRANSVERSE")==0)
+       {
+               orientation_value = 7; //MEDIA_CONTENT_ORIENTATION_TRANSVERSE;
+       }
+       else if (orientation.compare("ROTATE_270")==0)
+       {
+               orientation_value = 8; //MEDIA_CONTENT_ORIENTATION_ROT_270;
+       }
+       else
+       {
+               LogDebug("wrong value.");
+               return false;
+       }
+       LogDebug("ContentManager::updateMetadata called2");
+       string real_path = ContentUtility::convertUriToPath(ptr->getFilePath());
+       ContentExif exif(real_path.c_str());
+       int res = exif.LodExif();
+       if( res == 0)
+       {
+               ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "Invalid image");
+               return false;
+       }
+       else if(res < 0)
+       {
+               ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Not supported image type");
+               return false;
+
+       }
+       exif.SetExifChar(EXIF_TAG_ORIENTATION,orientation_value);
+
+
+       return true;
+
+}
+
 }
 }
index 42b239f..6467fb9 100755 (executable)
@@ -28,6 +28,9 @@
 #include "IEventUpdate.h"
 #include "IEventUpdateBatch.h"
 #include "IEventFind.h"
+#include "ContentMedia.h"
+#include "ContentImage.h"
+
 
 
 namespace DeviceAPI {
@@ -52,19 +55,20 @@ class IMediacontentManager :
                CONTENT_AUDIO
        } MediacontentType;
 
-       virtual void findFolder(IEventFindFolderPtr &ptr);      
+       virtual void findFolder(IEventFindFolderPtr &ptr);
        virtual void updateMedia(IEventUpdateMediaPtr &ptr);
        virtual void browseFolder(IEventBrowseFolderPtr &ptr);
        virtual void updateMediaItems(IEventUpdateMediaItemsPtr &ptr);
        virtual bool scanFile(scanCompletedCallback callback, std::string path, void* user_data);
        virtual bool setListener(void* user_data);
        virtual bool unsetListener();
+       virtual bool updateMetadata(MediacontentImagePtr &ptr);
 
        virtual void OnRequestReceived(const IEventFindFolderPtr &value) = 0;
        virtual void OnRequestReceived(const IEventUpdateMediaPtr &value) = 0;
-       virtual void OnRequestReceived(const IEventBrowseFolderPtr &value) = 0; 
-       virtual void OnRequestReceived(const IEventUpdateMediaItemsPtr &value) = 0;     
-       
+       virtual void OnRequestReceived(const IEventBrowseFolderPtr &value) = 0;
+       virtual void OnRequestReceived(const IEventUpdateMediaItemsPtr &value) = 0;
+
 };
 
 typedef DPL::SharedPtr<IMediacontentManager> IMediacontentManagerPtr;
index f5841ea..9c6865c 100755 (executable)
@@ -34,6 +34,7 @@
 #include <MultiCallbackUserData.h>
 #include <GlobalContextManager.h>
 #include <FilterConverter.h>
+#include "JSUtil.h"
 
 #include "ContentFactory.h"
 #include "ContentController.h"
@@ -46,6 +47,9 @@
 #include "plugin_config.h"
 #include "ContentAsyncCallbackManager.h"
 #include "ContentListener.h"
+#include "ContentVideo.h"
+#include "ContentImage.h"
+
 
 using namespace DeviceAPI::Common;
 using namespace DeviceAPI::Tizen;
@@ -71,6 +75,7 @@ JSStaticFunction JSMediacontentManager::m_function[] =
        { CONTENT_FUNCTION_API_SCAN_FILE, scanFile, kJSPropertyAttributeNone },
        { CONTENT_FUNCTION_API_SET_CHANGE_LISTENER, setChangeListener, kJSPropertyAttributeNone },
        { CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER, unsetChangeListener,kJSPropertyAttributeNone},
+       { CONTENT_FUNCTION_API_UPDATE_METADATA, updateMetadata,kJSPropertyAttributeNone},
     { 0, 0, 0 }
 };
 
@@ -99,9 +104,9 @@ JSClassDefinition JSMediacontentManager::m_classInfo =
 };
 
 JSValueRef JSMediacontentManager::getFolders(
-                                                       JSContextRef context, 
+                                                       JSContextRef context,
                                                        JSObjectRef object,
-                                                       JSObjectRef thisObject, 
+                                                       JSObjectRef thisObject,
                                                        size_t argumentCount,
                                                        const JSValueRef arguments[],
                                                        JSValueRef* exception )
@@ -170,27 +175,27 @@ JSValueRef JSMediacontentManager::getFolders(
 
                MediaContentAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
     }
-    Catch(UnsupportedException)
+    Catch(WrtDeviceApis::Commons::UnsupportedException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(InvalidArgumentException)
+    Catch(WrtDeviceApis::Commons::InvalidArgumentException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(ConversionException)
+    Catch(WrtDeviceApis::Commons::ConversionException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch (NotFoundException)
+    Catch(WrtDeviceApis::Commons::NotFoundException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(Exception)
+    Catch(WrtDeviceApis::Commons::Exception)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -203,11 +208,11 @@ JSValueRef JSMediacontentManager::getFolders(
 
 
 JSValueRef JSMediacontentManager::findItems(
-                                                       JSContextRef context, 
+                                                       JSContextRef context,
                                                        JSObjectRef object,
-                                                       JSObjectRef thisObject, 
+                                                       JSObjectRef thisObject,
                                                        size_t argumentCount,
-                                                       const JSValueRef arguments[], 
+                                                       const JSValueRef arguments[],
                                                        JSValueRef* exception )
 {
 
@@ -311,8 +316,8 @@ JSValueRef JSMediacontentManager::findItems(
                if(argumentCount >= 5)  //optional SortMode? sortMode
                {
 
-                       if ( JSValueIsObject(context, arguments[4]) && 
-                               !JSValueIsNull(context, arguments[4]) && 
+                       if ( JSValueIsObject(context, arguments[4]) &&
+                               !JSValueIsNull(context, arguments[4]) &&
                                !JSValueIsUndefined(context, arguments[4]) &&
                                !JSIsArrayValue(context, arguments[4]))
                        {
@@ -352,27 +357,27 @@ JSValueRef JSMediacontentManager::findItems(
 
                MediaContentAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
     }
-    Catch(UnsupportedException)
+    Catch(WrtDeviceApis::Commons::UnsupportedException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(InvalidArgumentException)
+    Catch(WrtDeviceApis::Commons::InvalidArgumentException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(ConversionException)
+    Catch(WrtDeviceApis::Commons::ConversionException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch (NotFoundException)
+    Catch(WrtDeviceApis::Commons::NotFoundException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(Exception)
+    Catch(WrtDeviceApis::Commons::Exception)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -421,7 +426,7 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context,
                if((argumentCount >= 1) && (JSIsArrayValue(context, arguments[0])))     //MediaItem[] items
                {
                        events = converter->toVectorOfMediaItem(arguments[0]);
-                       if(!events) 
+                       if(!events)
                        {
                                ThrowMsg(ConversionException, "Items type mismatched.");
                        }
@@ -431,7 +436,7 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context,
                        ThrowMsg(ConversionException, "Items type mismatched.");
                }
 
-               if(argumentCount >= 2)  //Function? successCallback, 
+               if(argumentCount >= 2)  //Function? successCallback,
                {
                        if(validator.isCallback(arguments[1]))
                        {
@@ -443,7 +448,7 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context,
                        }
                }
 
-               if(argumentCount >= 3)  //ErrorCallback? errorCallback, 
+               if(argumentCount >= 3)  //ErrorCallback? errorCallback,
                {
                        if(validator.isCallback(arguments[2]))
                        {
@@ -470,27 +475,27 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context,
 
                MediaContentAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
     }
-    Catch(UnsupportedException)
+    Catch(WrtDeviceApis::Commons::UnsupportedException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(InvalidArgumentException)
+    Catch(WrtDeviceApis::Commons::InvalidArgumentException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(ConversionException)
+    Catch(WrtDeviceApis::Commons::ConversionException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch (NotFoundException)
+    Catch(WrtDeviceApis::Commons::NotFoundException)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
     }
-    Catch(Exception)
+    Catch(WrtDeviceApis::Commons::Exception)
     {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -527,11 +532,11 @@ LogDebug("JSContentManagerManager::updateItem entered");
        Validator validator(context);
 
        Try
-       {               
+       {
                IMediacontentManagerPtr contentMgr = getContentManagerPrivObject(context, thisObject, exception);
-       
+
                //parameter : MediaItem item
-               
+
                JSObjectRef arg;
                if(argumentCount >= 1)
                {
@@ -540,7 +545,7 @@ LogDebug("JSContentManagerManager::updateItem entered");
                                !JSValueIsObjectOfClass(context, arguments[0], JSAudio::getClassRef()) &&                       
                                !JSValueIsObjectOfClass(context, arguments[0], JSVideo::getClassRef())) {
                                    ThrowMsg(ConversionException, "Item type mismatched.");
-                       }                       
+                       }
                        arg = JSValueToObject(context, arguments[0], exception);
                }
                else
@@ -548,38 +553,72 @@ LogDebug("JSContentManagerManager::updateItem entered");
                         ThrowMsg(ConversionException, "Item type mismatched.");
                }
 
-               MediacontentMediaPtr event = JSMedia::getMediaObject(arg);
-
+               MediacontentMediaPtr event;
                IEventUpdateMediaPtr dplEvent(new IEventUpdateMedia());
+
+               if(JSValueIsObjectOfClass(context, arguments[0], JSImage::getClassRef())){
+
+                       JSValueRef geoValRef = JSUtil::getProperty(context ,
+                               JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
+                       JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
+                       double latitude = JSUtil::JSValueToDouble(context,
+                               JSUtil::getProperty(context, geoObjRef, "latitude"));
+
+                       double longitude = JSUtil::JSValueToDouble(context,
+                               JSUtil::getProperty(context, geoObjRef, "longitude"));
+
+                       MediacontentImagePtr imgPtr = JSImage::getImageObject(arg);
+                       imgPtr->setImageLatitude(latitude);
+                       imgPtr->setImageLongitude(longitude);
+
+               }
+               else if(JSValueIsObjectOfClass(context, arguments[0], JSVideo::getClassRef())){
+                       JSValueRef geoValRef = JSUtil::getProperty(context ,
+                               JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
+                       JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
+
+                       double latitude = JSUtil::JSValueToDouble(context,
+                               JSUtil::getProperty(context, geoObjRef, "latitude"));
+
+                       double longitude = JSUtil::JSValueToDouble(context,
+                               JSUtil::getProperty(context, geoObjRef, "longitude"));
+
+                       MediacontentVideoPtr vedioPtr = JSVideo::getVideoObject(arg);
+                       vedioPtr->setVideoLatitude(latitude);
+                       vedioPtr->setVideoLongitude(longitude);
+               }
+
+               event = JSMedia::getMediaObject(arg);
                dplEvent->setMediaItem(event);
+
                dplEvent->setForSynchronousCall();
                contentMgr->updateMedia(dplEvent);
 
         if (!(dplEvent->getResult())) {
-            ThrowMsg(UnknownException, "updating failed by unknown reason.");
+            ThrowMsg(WrtDeviceApis::Commons::Exception, "updating failed by unknown reason.");
         }
        }
-       Catch(UnsupportedException)
+       Catch(WrtDeviceApis::Commons::UnsupportedException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(InvalidArgumentException)
+       Catch(WrtDeviceApis::Commons::InvalidArgumentException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(ConversionException)
+       Catch(WrtDeviceApis::Commons::ConversionException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch (NotFoundException)
+       Catch(WrtDeviceApis::Commons::NotFoundException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(Exception)
+       Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -667,27 +706,27 @@ JSValueRef JSMediacontentManager::scanFile(
                contentMgr->scanFile(_scanCompletedCallback,path,(void*)callback);
 
        }
-       Catch(UnsupportedException)
+       Catch(WrtDeviceApis::Commons::UnsupportedException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(InvalidArgumentException)
+       Catch(WrtDeviceApis::Commons::InvalidArgumentException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(ConversionException)
+       Catch(WrtDeviceApis::Commons::ConversionException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch (NotFoundException)
+       Catch(WrtDeviceApis::Commons::NotFoundException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(Exception)
+       Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -747,27 +786,27 @@ JSValueRef JSMediacontentManager::setChangeListener(
                        ThrowMsg(Exception, "Unknown exception is occured by platfrom");
                }
        }
-       Catch(UnsupportedException)
+       Catch(WrtDeviceApis::Commons::UnsupportedException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(InvalidArgumentException)
+       Catch(WrtDeviceApis::Commons::InvalidArgumentException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(ConversionException)
+       Catch(WrtDeviceApis::Commons::ConversionException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch (NotFoundException)
+       Catch(WrtDeviceApis::Commons::NotFoundException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(Exception)
+       Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -807,27 +846,27 @@ JSValueRef JSMediacontentManager::unsetChangeListener(
                        ThrowMsg(Exception, "Unknown exception is occured by platfrom");
                }
        }
-       Catch(UnsupportedException)
+       Catch(WrtDeviceApis::Commons::UnsupportedException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(InvalidArgumentException)
+       Catch(WrtDeviceApis::Commons::InvalidArgumentException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(ConversionException)
+       Catch(WrtDeviceApis::Commons::ConversionException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch (NotFoundException)
+       Catch(WrtDeviceApis::Commons::NotFoundException)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
        }
-       Catch(Exception)
+       Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
@@ -837,6 +876,78 @@ JSValueRef JSMediacontentManager::unsetChangeListener(
 
 }
 
+JSValueRef JSMediacontentManager::updateMetadata(
+                                               JSContextRef context,
+                                               JSObjectRef object,
+                                               JSObjectRef thisObject,
+                                               size_t argumentCount,
+                                               const JSValueRef arguments[],
+                                               JSValueRef* exception)
+{
+LogDebug("JSContentManagerManager::updateMetadata entered");
+
+
+       MediacontentManagerPrivObject *privateObject;
+       privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
+       if (!privateObject) {
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "private object is null");
+       }
+
+       AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_UPDATE_METADATA);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       Validator validator(context);
+
+       Try
+       {
+               IMediacontentManagerPtr contentMgr = getContentManagerPrivObject(context, thisObject, exception);
+
+               JSObjectRef arg;
+               if(argumentCount >= 1){
+                       if (!JSValueIsObjectOfClass(context, arguments[0],JSImage::getClassRef())){
+                                   ThrowMsg(UnsupportedException, "Not supported type.");
+                       }
+                       arg = JSValueToObject(context, arguments[0], exception);
+               }
+               else{
+                        ThrowMsg(ConversionException, "Invalid content type.");
+               }
+
+               MediacontentImagePtr content = JSImage::getImageObject(arg);
+
+        if (!(contentMgr->updateMetadata(content))) {
+            ThrowMsg(WrtDeviceApis::Commons::Exception, "updating metadata is failed by unknown reason.");
+        }
+       }
+       Catch(WrtDeviceApis::Commons::UnsupportedException)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
+       }
+       Catch(WrtDeviceApis::Commons::InvalidArgumentException)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
+       }
+       Catch(WrtDeviceApis::Commons::ConversionException)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
+       }
+       Catch(WrtDeviceApis::Commons::NotFoundException)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
+       }
+
+       return JSValueMakeUndefined(context);
+
+}
 
 
 const JSClassRef JSMediacontentManager::getClassRef() {
@@ -847,21 +958,21 @@ const JSClassRef JSMediacontentManager::getClassRef() {
 }
 
 
-const JSClassDefinition* JSMediacontentManager::getClassInfo() 
+const JSClassDefinition* JSMediacontentManager::getClassInfo()
 {
        return &m_classInfo;
 }
 
-void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object) 
+void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object)
 {
     LogDebug("JSContentManager  initialize entered");
     MediacontentManagerPrivObject *privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(object));
-    if (NULL == privateObject) 
+    if (NULL == privateObject)
        {
         LogDebug("Create ContenttManagerPrivObject");
         IMediacontentManagerPtr contentManager = MediacontentFactory::getInstance().createMediacontentManagerObject();
         privateObject = new MediacontentManagerPrivObject(context, contentManager);
-        if (!JSObjectSetPrivate(object, static_cast<void*>(privateObject))) 
+        if (!JSObjectSetPrivate(object, static_cast<void*>(privateObject)))
                {
             delete privateObject;
         }
@@ -869,7 +980,7 @@ void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object)
 
 }
 
-void JSMediacontentManager::finalize(JSObjectRef object) 
+void JSMediacontentManager::finalize(JSObjectRef object)
 {
        LogDebug("Entered");
        MediacontentManagerPrivObject* priv = static_cast<MediacontentManagerPrivObject*> (JSObjectGetPrivate(object));
@@ -889,7 +1000,7 @@ IMediacontentManagerPtr JSMediacontentManager::getContentManagerPrivObject(
                                        JSValueRef* exception)
 {
     MediacontentManagerPrivObject *priv = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(object));
-    if (priv) 
+    if (priv)
        {
         return priv->getObject();
     }
@@ -898,6 +1009,6 @@ IMediacontentManagerPtr JSMediacontentManager::getContentManagerPrivObject(
 
 
 }
-} 
+}
 
 
index 6ff4635..7089727 100755 (executable)
@@ -72,27 +72,27 @@ static JSValueRef getMediacontent(
         * The callback invoked when getting a property's value.
         */
        static JSValueRef getProperty(
-                       JSContextRef context, 
-                       JSObjectRef object, 
-                       JSStringRef propertyName, 
+                       JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName,
                        JSValueRef* exception);
 
        /**
         * The callback invoked when an object is used as the target of an 'instanceof' expression.
         */
        static bool hasInstance(
-                       JSContextRef context, 
-                       JSObjectRef constructor, 
-                       JSValueRef possibleInstance, 
+                       JSContextRef context,
+                       JSObjectRef constructor,
+                       JSValueRef possibleInstance,
                        JSValueRef* exception);
 
 
        static JSValueRef getFolders(
-                       JSContextRef context, 
+                       JSContextRef context,
                        JSObjectRef object,
-                       JSObjectRef thisObject, 
+                       JSObjectRef thisObject,
                        size_t argumentCount,
-                       const JSValueRef arguments[], 
+                       const JSValueRef arguments[],
                        JSValueRef* exception);
 
        static JSValueRef updateItem(
@@ -110,12 +110,12 @@ static JSValueRef getMediacontent(
                        size_t argumentCount,
                        const JSValueRef arguments[],
                        JSValueRef* exception);
-                       
+
 
        static JSValueRef findItems(
-                       JSContextRef context, 
+                       JSContextRef context,
                        JSObjectRef object,
-                       JSObjectRef thisObject, 
+                       JSObjectRef thisObject,
                        size_t argumentCount,
                        const JSValueRef arguments[],
                        JSValueRef* exception);
@@ -145,6 +145,15 @@ static JSValueRef getMediacontent(
                        JSValueRef* exception);
 
 
+       static JSValueRef updateMetadata(
+                       JSContextRef context,
+                       JSObjectRef object,
+                       JSObjectRef thisObject,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
+
        /**
         * This structure contains properties and callbacks that define a type of object.
         */
@@ -159,8 +168,8 @@ static JSValueRef getMediacontent(
        static JSClassRef m_jsClassRef;
 };
 
-} 
-} 
+}
+}
 
 #endif //_JS_TIZEN_CONTENTMANAGER_H_
 
index d9fa61c..db6c171 100755 (executable)
@@ -27,6 +27,7 @@
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
 
+#include "JSUtil.h"
 #include "JSImage.h"
 
 
@@ -69,10 +70,10 @@ JSClassDefinition JSImage::m_classInfo =
 JSStaticValue JSImage::m_property[] =
 {
 //    { TIZEN_CONTENT_IMAGE_UID, getPropertyUid, NULL, kJSPropertyAttributeReadOnly},
-    { TIZEN_CONTENT_IMAGE_GEOLOCATION, getPropertyGeoLocation, setPropertyGeolocation, kJSPropertyAttributeNone},
+//    { TIZEN_CONTENT_IMAGE_GEOLOCATION, getPropertyGeoLocation, setPropertyGeolocation, kJSPropertyAttributeNone},
     { TIZEN_CONTENT_IMAGE_WIDTH, getPropertyWidth, NULL, kJSPropertyAttributeReadOnly},
-    { TIZEN_CONTENT_IMAGE_HEIGHT, getPropertyHeight, NULL, kJSPropertyAttributeReadOnly},    
-    { TIZEN_CONTENT_IMAGE_ORIENTATION, getPropertyOrientation, setPropertyOrientation, kJSPropertyAttributeNone},  
+    { TIZEN_CONTENT_IMAGE_HEIGHT, getPropertyHeight, NULL, kJSPropertyAttributeReadOnly},
+    { TIZEN_CONTENT_IMAGE_ORIENTATION, getPropertyOrientation, setPropertyOrientation, kJSPropertyAttributeNone},
     { 0, 0, 0, 0 }
 };
 
@@ -82,8 +83,8 @@ JSClassRef JSImage::m_jsClassRef = JSClassCreate(JSImage::getClassInfo());
 void JSImage::initialize(JSContextRef context, JSObjectRef object)
 {
     LogDebug( "entered" );
-    ImagePrivObject *priv =
-            static_cast<ImagePrivObject*>( JSObjectGetPrivate( object ) );
+    ImagePrivObject *priv = static_cast<ImagePrivObject*>( JSObjectGetPrivate( object ) );
+
     if (!priv) {
         MediacontentImagePtr privateData(new MediacontentImage());
         priv = new ImagePrivObject(context, privateData);
@@ -92,18 +93,23 @@ void JSImage::initialize(JSContextRef context, JSObjectRef object)
     }
     else {
         LogDebug("private object already exists");
+               MediacontentImagePtr image = getImageObject(object);
+               DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
+               JSUtil::setProperty(context, object, TIZEN_CONTENT_IMAGE_GEOLOCATION,
+                                       JSSimpleCoordinates::createJSObject(context,geoPtr),
+                                       kJSPropertyAttributeNone);
     }
 }
 
 void JSImage::finalize(JSObjectRef object)
 {
     LogDebug( "entered" );
-       ImagePrivObject *priv = static_cast<ImagePrivObject*>( JSObjectGetPrivate( object ) ) ;
+       ImagePrivObject *priv = static_cast<ImagePrivObject*>( JSObjectGetPrivate( object ) ) ;
        if (priv != NULL)
        {
                delete (priv);
                priv = NULL;
-               JSObjectSetPrivate(object, NULL);               
+               JSObjectSetPrivate(object, NULL);
        }
 }
 
@@ -135,7 +141,7 @@ MediacontentImagePtr JSImage::getImageObject(JSObjectRef object)
     }
     return result;
 }
-                                       
+
 JSValueRef JSImage::getPropertyGeoLocation(
                JSContextRef context,
         JSObjectRef object,
@@ -150,7 +156,7 @@ JSValueRef JSImage::getPropertyGeoLocation(
         MediacontentImagePtr image = getImageObject(object);
 
                LogDebug("lati :"  << image->getImageLatitude());
-               LogDebug("longi :"  << image->getImageLongitude());             
+               LogDebug("longi :"  << image->getImageLongitude());
                DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
                return JSSimpleCoordinates::createJSObject(context,geoPtr);
 
@@ -165,8 +171,8 @@ JSValueRef JSImage::getPropertyGeoLocation(
 
 JSValueRef JSImage::getPropertyWidth(
                JSContextRef context,
-        JSObjectRef object, 
-        JSStringRef propertyName, 
+        JSObjectRef object,
+        JSStringRef propertyName,
         JSValueRef* exception)
 {
     LogDebug("entered");
index 75898fc..c2c104c 100755 (executable)
@@ -25,6 +25,7 @@
 
 #include "ContentConverter.h"
 #include "JSVideo.h"
+#include "JSUtil.h"
 
 #define TIZEN_CONTENT_VIDEO_ATTRIBUTENAME      "VideoContent"
 #define TIZEN_CONTENT_VIDEO_GEOLOCATION                "geolocation"
@@ -65,12 +66,12 @@ JSClassDefinition JSVideo::m_classInfo =
 
 JSStaticValue JSVideo::m_property[] =
 {
-       { TIZEN_CONTENT_VIDEO_GEOLOCATION, getPropertyGeoLocation, setPropertyGeoLocation, kJSPropertyAttributeNone},
+//     { TIZEN_CONTENT_VIDEO_GEOLOCATION, getPropertyGeoLocation, setPropertyGeoLocation, kJSPropertyAttributeNone},
        { TIZEN_CONTENT_VIDEO_ALBUM, getPropertyAlbum, NULL, kJSPropertyAttributeReadOnly},
        { TIZEN_CONTENT_VIDEO_ARTIST, getPropertyArtist, NULL, kJSPropertyAttributeReadOnly},
-       { TIZEN_CONTENT_VIDEO_DURATION, getPropertyDuration, NULL, kJSPropertyAttributeReadOnly},    
+       { TIZEN_CONTENT_VIDEO_DURATION, getPropertyDuration, NULL, kJSPropertyAttributeReadOnly},
        { TIZEN_CONTENT_VIDEO_WIDTH, getPropertyWidth, NULL, kJSPropertyAttributeReadOnly},
-       { TIZEN_CONTENT_VIDEO_HEIGHT, getPropertyHeight, NULL, kJSPropertyAttributeReadOnly},    
+       { TIZEN_CONTENT_VIDEO_HEIGHT, getPropertyHeight, NULL, kJSPropertyAttributeReadOnly},
        { 0, 0, 0, 0 }
 };
 
@@ -81,27 +82,32 @@ void JSVideo::initialize(JSContextRef context, JSObjectRef object)
 {
     LogDebug( "entered" );
     VideoPrivObject *priv = static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) );
-    if (!priv) 
+    if (!priv)
     {
         MediacontentVideoPtr privateData(new MediacontentVideo());
         priv = new VideoPrivObject(context, privateData);
         JSObjectSetPrivate(object, static_cast<void*>(priv));
-        LogDebug("new event is created" );
+        LogDebug("new pravite object is created" );
     }
     else {
         LogDebug("private object already exists");
+               MediacontentVideoPtr video = getVideoObject(object);
+               DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
+               JSUtil::setProperty(context, object, TIZEN_CONTENT_VIDEO_GEOLOCATION,
+                                       JSSimpleCoordinates::createJSObject(context,geoPtr),
+                                       kJSPropertyAttributeNone);
     }
 }
 
 void JSVideo::finalize(JSObjectRef object)
 {
     LogDebug( "entered" );
-       VideoPrivObject *priv =  static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) ) ;
+       VideoPrivObject *priv =  static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) ) ;
        if (priv != NULL)
        {
                delete (priv);
                priv = NULL;
-               JSObjectSetPrivate(object, NULL);               
+               JSObjectSetPrivate(object, NULL);
        }
 
        priv = NULL;
@@ -112,7 +118,7 @@ const JSClassRef JSVideo::getClassRef()
 {
        LogDebug("JSVideo::getClassRef()");
 
-    if (!m_jsClassRef) 
+    if (!m_jsClassRef)
     {
             m_jsClassRef = JSClassCreate(&m_classInfo);
     }
@@ -128,18 +134,18 @@ MediacontentVideoPtr JSVideo::getVideoObject(JSObjectRef object)
 {
     LogDebug("entered");
     VideoPrivObject *priv = static_cast<VideoPrivObject*>(JSObjectGetPrivate(object));
-    if(!priv) 
+    if(!priv)
     {
         ThrowMsg(NullPointerException, "Private object is null");
     }
     MediacontentVideoPtr result = priv->getObject();
-    if (!result) 
+    if (!result)
     {
         ThrowMsg(NullPointerException, "Private object is null");
     }
     return result;
 }
-                       
+
 JSValueRef JSVideo::getPropertyGeoLocation(
                                                                                JSContextRef context,
                                                                        JSObjectRef object,
@@ -151,7 +157,7 @@ JSValueRef JSVideo::getPropertyGeoLocation(
     {
         Converter converter(context);
         MediacontentVideoPtr video = getVideoObject(object);
-               SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
+               SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
         return JSSimpleCoordinates::createJSObject(context,geoPtr);
     }
     Catch(Exception)
@@ -173,7 +179,7 @@ bool JSVideo::setPropertyGeoLocation(
     {
                Converter converter(context);
                MediacontentVideoPtr video = getVideoObject(object);
-       
+
                DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation =
                DeviceAPI::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
 
@@ -223,7 +229,7 @@ JSValueRef JSVideo::getPropertyArtist(
 {
     LogDebug("entered");
     Try
-    {  
+    {
                Converter converter(context);
                MediacontentVideoPtr video = getVideoObject(object);
                JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
@@ -237,7 +243,7 @@ JSValueRef JSVideo::getPropertyArtist(
                        JSValueRef val = converter.toJSValueRef(artist);
 
                        if(!JSSetArrayElement(context, jsResult, i, val)){
-                          ThrowMsg(UnknownException, "Could not insert value into js array");
+                          ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Could not insert value into js array");
                        }
                }
 
index 5d0a2f9..d78216c 100755 (executable)
 
 #define CONTENT_FEATURE_API_READ  "http://tizen.org/privilege/content.read"
 #define CONTENT_FEATURE_API_WRITE "http://tizen.org/privilege/content.write"
+#define CONTENT_FEATURE_API_MANAGER_WRITE "http://tizen.org/privilege/contentmanager.write"
+
 
 #define CONTENT_DEVICE_CAP_READ "content.read"
 #define CONTENT_DEVICE_CAP_WRITE "content.write"
+#define CONTENT_DEVICE_CAP_MANAGER_WRITE "contentmanager.write"
+
 
 using namespace WrtDeviceApis::Commons;
 
@@ -49,6 +53,7 @@ static FunctionMapping createContentFunctions()
      */
     ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CONTENT_READ, CONTENT_DEVICE_CAP_READ);
     ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CONTENT_WRITE, CONTENT_DEVICE_CAP_WRITE);
+    ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CONTENT_MANAGER_WRITE, CONTENT_DEVICE_CAP_MANAGER_WRITE);
 
     ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST);
     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CONTENT_READ);
@@ -57,11 +62,15 @@ static FunctionMapping createContentFunctions()
     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CONTENT_WRITE);
     ACE_ADD_DEVICE_CAP(DEVICE_LIST_CONTENT_WRITE, DEVICE_CAP_CONTENT_WRITE);
 
+    ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CONTENT_MANAGER_WRITE);
+    ACE_ADD_DEVICE_CAP(DEVICE_LIST_CONTENT_MANAGER_WRITE, DEVICE_CAP_CONTENT_MANAGER_WRITE);
+
     /**
      * Api Features
      */
     ACE_CREATE_FEATURE(FEATURE_CONTENT_READ, CONTENT_FEATURE_API_READ);
     ACE_CREATE_FEATURE(FEATURE_CONTENT_WRITE, CONTENT_FEATURE_API_WRITE);
+    ACE_CREATE_FEATURE(FEATURE_CONTENT_MANAGER_WRITE, CONTENT_FEATURE_API_MANAGER_WRITE);
 
     ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_READ_WRITE);
     ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_READ_WRITE, FEATURE_CONTENT_READ);
@@ -72,11 +81,14 @@ static FunctionMapping createContentFunctions()
 
     ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_WRITE);
     ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_WRITE, FEATURE_CONTENT_WRITE);
+
+    ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_MANAGER_WRITE);
+    ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_MANAGER_WRITE, FEATURE_CONTENT_MANAGER_WRITE);
 #if 0
     ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT);
     ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT,
                         FEATURE_CONTENT);
-       
+
     ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_READ);
     ACE_ADD_API_FEATURE(CONTENT_FEATURES_READ,
                         FEATURE_CONTENT_READ);
@@ -169,6 +181,17 @@ static FunctionMapping createContentFunctions()
                                CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER,
                                unsetListenerFunc));
 
+    //updateMetadata
+    AceFunction updateMetadataFunc = ACE_CREATE_FUNCTION(
+            FUNCTION_UPDATE_METADATA,
+            CONTENT_FUNCTION_API_UPDATE_METADATA,
+            CONTENT_FEATURES_CONTENT_MANAGER_WRITE,
+            DEVICE_LIST_CONTENT_MANAGER_WRITE);
+
+    contentMapping.insert(std::make_pair(
+                               CONTENT_FUNCTION_API_UPDATE_METADATA,
+                               updateMetadataFunc));
+
 
     return contentMapping;
 }
index 6eb9188..3e8aea3 100755 (executable)
@@ -36,6 +36,8 @@ namespace Content {
 #define CONTENT_FUNCTION_API_SCAN_FILE "scanFile"
 #define CONTENT_FUNCTION_API_SET_CHANGE_LISTENER "setChangeListener"
 #define CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER "unsetChangeListener"
+#define CONTENT_FUNCTION_API_UPDATE_METADATA "updateMetadata"
+
 
 
 DECLARE_FUNCTION_GETTER(Content);
index df67c2d..2911152 100755 (executable)
@@ -353,10 +353,12 @@ JSValueRef JSFile::toUri(JSContextRef context,
        }
 
        Converter converter(context);
+
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_TO_URI);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       
+
        try {
-               AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_TO_URI);
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-               
                int widgetId = WrtAccessSingleton::Instance().getWidgetId();
                return converter.toJSValueRef(privateObject->getObject()->getNode()->toUri(widgetId));
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
@@ -467,6 +469,10 @@ JSValueRef JSFile::openStream(JSContextRef context,
        size_t index = 0;
        JSValueRef reserveArguments[4];
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_OPEN_STREAM);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+
        try {
 
                for (index = 0; index < 4; index++) {
@@ -505,7 +511,7 @@ JSValueRef JSFile::openStream(JSContextRef context,
                std::string vpath = Utils::toVirtualPath(globalContext, path);
 
                AccessModeInfo am = AccessModeInfo(mode, vpath);
-               AceSecurityStatus status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_OPEN_STREAM, am);
+               status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_OPEN_STREAM, am);
 
                TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -546,6 +552,7 @@ JSValueRef JSFile::readAsText(JSContextRef context,
 
        JSContextRef globalContext = privateObject->getContext();
        AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ_AS_TEXT);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        size_t index = 0;
        JSValueRef reserveArguments[3];
@@ -560,7 +567,7 @@ JSValueRef JSFile::readAsText(JSContextRef context,
                                reserveArguments[index] = JSValueMakeUndefined(context);                                                        
 
                }
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
                JSValueRef onSuccess = getFunction(globalContext, reserveArguments[0]);
                JSValueRef onError = NULL;
@@ -624,6 +631,10 @@ JSValueRef JSFile::copyTo(JSContextRef context,
        JSValueRef reserveArguments[5];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_COPY_TO);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       
+
        try {
 
                for (index = 0; index < 5; index++)
@@ -658,7 +669,7 @@ JSValueRef JSFile::copyTo(JSContextRef context,
 
                std::string virtualDestPath = Utils::toVirtualPath(globalContext, dest->getFullPath());
                AccessModeInfo amode = AccessModeInfo(AM_WRITE, virtualDestPath);
-               AceSecurityStatus status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(
+               status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(
                        FILESYSTEM_FUNCTION_API_COPY_TO,
                amode);
 
@@ -713,6 +724,9 @@ JSValueRef JSFile::moveTo(JSContextRef context,
        JSValueRef reserveArguments[5];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MOVE_TO);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        try {
 
                for (index = 0; index < 5; index++) {
@@ -791,7 +805,6 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
        }
 
        AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_CREATE_DIR);
-
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
 
@@ -836,7 +849,6 @@ JSValueRef JSFile::createFile(JSContextRef context,
        }
 
        AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_CREATE_FILE);
-
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
 
@@ -884,20 +896,27 @@ JSValueRef JSFile::resolve(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_RESOLVE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        if (privateObject->getObject()->getNode()->getType() != NT_DIRECTORY) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, "IO error");
        }
 
        Converter converter(context);
+
+       
+       
+
        try {
 
+
+               
                if (argc < 1) {
                        ThrowMsg(InvalidArgumentException, "Invalid path name");
                }
 
-               AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_RESOLVE);
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
                
 
                IPathPtr path = converter.toPath(argv[0]);
@@ -938,6 +957,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
+       
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_DIR);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        if (argc < 2) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
@@ -951,6 +973,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
        JSValueRef reserveArguments[4];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);      
 
+       
+
+
        try {
                for (index = 0; index < 4; index++) {
                if (index < argc)
@@ -959,9 +984,6 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                        reserveArguments[index] = JSValueMakeUndefined(context);                                                        
                }
 
-               AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_DIR);
-
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
                JSValueRef onSuccess = NULL;
                JSValueRef onError = NULL;
@@ -1055,6 +1077,10 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
        JSValueRef reserveArguments[3];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);      
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_FILE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+
        try {
                for (index = 0; index < 3; index++) {
                        if (index < argc)
@@ -1063,9 +1089,6 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                                reserveArguments[index] = JSValueMakeUndefined(context);                                                        
                }
 
-               AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_FILE);
-
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
                if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
                        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::PERMISSION_DENIED_ERROR, "Permission denied error");
index 9145bfb..045e8c3 100755 (executable)
@@ -191,14 +191,13 @@ JSValueRef JSFilesystemManager::getStorage(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_GET_STORAGE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        if (argc < 2) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
 
-       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_GET_STORAGE);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-       
-
        JSContextRef globalContext = privateObject->getContext();
        ConverterPtr converter = ConverterFactory::getConverter(globalContext);
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
@@ -248,15 +247,14 @@ JSValueRef JSFilesystemManager::getStorageList(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
-       if (argc < 1) {
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
-       }
-               
-
        AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_LIST_STORAGE);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       
 
-
+       if (argc < 1) {
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
+       }
+       
        JSContextRef globalContext = privateObject->getContext();
        ConverterPtr converter = ConverterFactory::getConverter(globalContext);
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
@@ -307,12 +305,14 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        if (argc < 1) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "TYPE_MISMATCH_ERROR");
        }
 
-       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        JSContextRef globalContext = privateObject->getContext();
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
@@ -363,12 +363,14 @@ JSValueRef JSFilesystemManager::removeStorageStateListener(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        if (argc < 1) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
 
-       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        JSContextRef globalContext = privateObject->getContext();
        ConverterPtr converter = ConverterFactory::getConverter(globalContext);
@@ -413,8 +415,12 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSValueMakeUndefined(context);
+
        }
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       
        if (argc < 2) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
@@ -425,8 +431,10 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
        size_t index = 0;
        JSValueRef reserveArguments[4];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);      
+
        
 
+
        try {
                for (index = 0; index < 4; index++) {
                        if (index < argc)
index 179fc5f..5272832 100755 (executable)
@@ -147,4 +147,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_L
 INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messaging
        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
+)
\ No newline at end of file
index a9870db..1907be2 100644 (file)
@@ -55,9 +55,11 @@ namespace{
                MSG_CLASS_TYPE_T                classType;                                                              /**< Message class type. See enum _MSG_CLASS_TYPE_E */
                msg_storage_id_t                storageId;                                                              /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/
                msg_struct_list_s               *addr_list;
+               GList                                   *addressList;
                char                                    replyAddress[MAX_PHONE_NUMBER_LEN+1];   /**< Indicates the reply address. */
                char                                    subject[MAX_SUBJECT_LEN+1];                                     /**< Indicates the message subject. */
                time_t                                  displayTime;                                                                                                    /**< Indicates the display time related to the specific operation. */
+               time_t                                  scheduledTime;                                                                                          /**< Indicates the time to send scheduled message. */
                msg_network_status_t    networkStatus;                                                  /**< Indicates the network status of the message. */
                msg_encode_type_t               encodeType;                                                     /**< Indicates the string encoding type. */
                bool                                    bRead;                                                                                                                          /**< Indicates whether the message is read or not. */
@@ -73,6 +75,7 @@ namespace{
                size_t                                  dataSize;                                                                                                                       /**< Indicates the data size. The unit is byte. */
                void                                    *pData;                                                                                                                         /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
                void                                    *pMmsData;                                                                                                              /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
+               size_t                                  mmsDataSize;            
        } MSG_MESSAGE_HIDDEN_S;
 
 
@@ -127,6 +130,7 @@ enum _MSG_SUB_TYPE_E
        MSG_STATUS_REPORT_SMS,          /**< SMS-STATUS-REPORT */
        MSG_SYNCML_CP,                          /**< SyncML Message CP */
        MSG_LBS_SMS,                                    /**< LBS Message */
+       MSG_SOS_SMS,                                    /**< SOS Message */
        MSG_REJECT_SMS,                         /**< Reject Message */
        MSG_CONCAT_SIM_SMS,                     /**< Concatenated Message in SIM */
 
@@ -287,7 +291,9 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B
                pTmp->bBackup = dbHandle.getColumnToInt(index++);
                pTmp->priority = dbHandle.getColumnToInt(index++);
                pTmp->direction= dbHandle.getColumnToInt(index++);
-               index++; // This field is reserved.
+               pTmp->addressList = NULL;
+
+               pTmp->scheduledTime = (time_t)dbHandle.getColumnToInt(index++);
 
                dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject);
 
@@ -368,6 +374,28 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B
 
                pTmp->addr_list = addr_list;
 
+               // For GList *addressList
+               msg_struct_s *addrStruct = NULL;
+               MSG_ADDRESS_INFO_S *addrInfo = NULL;
+
+               addrStruct = new msg_struct_s;
+               memset(addrStruct, 0x00, sizeof(msg_struct_s));
+
+               addrStruct->type = MSG_STRUCT_ADDRESS_INFO;
+               addrStruct->data = new MSG_ADDRESS_INFO_S;
+               memset(addrStruct->data, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+               addrInfo = (MSG_ADDRESS_INFO_S *)addrStruct->data;
+
+               addrInfo->addressType = address->addressType;
+               addrInfo->recipientType = address->recipientType;
+               addrInfo->contactId = address->contactId;
+               strncpy(addrInfo->addressVal, address->addressVal, MAX_ADDRESS_VAL_LEN);
+               strncpy(addrInfo->displayName, address->displayName, MAX_DISPLAY_NAME_LEN);
+               addrInfo->displayName[MAX_DISPLAY_NAME_LEN] = '\0';
+
+               pTmp->addressList = g_list_append(pTmp->addressList, addrStruct);
+
                pTmp->attachCount = dbHandle.getColumnToInt(index++);
 
                dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath);
index 37ad489..675071a 100644 (file)
@@ -31,7 +31,6 @@ SET(SRCS_IMPL
        JSAttributeFilter.cpp
        JSAttributeRangeFilter.cpp
        JSCompositeFilter.cpp
-       JSAbstractFilterArray.cpp
        JSSortMode.cpp
        FilterConverter.cpp
        JSSimpleCoordinates.cpp
index fe30795..231d228 100644 (file)
@@ -29,7 +29,6 @@
 #include "JSAttributeFilter.h"
 #include "JSAttributeRangeFilter.h"
 #include "JSCompositeFilter.h"
-#include "JSAbstractFilterArray.h"
 #include "JSSortMode.h"
 #include "FilterConverter.h"
 
@@ -96,7 +95,8 @@ FilterPtr FilterConverter::toFilter(const JSValueRef& arg)
                ThrowMsg(NullPointerException, "JSValueRef is NULL.");
 
        if(!JSValueIsObject(m_context, arg))
-               ThrowMsg(InvalidArgumentException, "Filter is not object.");
+               return FilterPtr(NULL);
+               //ThrowMsg(InvalidArgumentException, "Filter is not object.");
 
        if(JSCompositeFilter::isObjectOfClass(m_context, arg))
                return DPL::StaticPointerCast<IFilter>(JSCompositeFilter::getCompositeFilter(m_context, arg));
@@ -107,7 +107,7 @@ FilterPtr FilterConverter::toFilter(const JSValueRef& arg)
        if(JSAttributeRangeFilter::isObjectOfClass(m_context, arg))
                return DPL::StaticPointerCast<IFilter>(JSAttributeRangeFilter::getAttributeRangeFilter(m_context, arg));
 
-       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
+       //ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        return FilterPtr(NULL);
 }
 
@@ -116,7 +116,23 @@ JSValueRef FilterConverter::toJSValueRef(const FilterArrayPtr& arg)
        if(arg == NULL)
                ThrowMsg(NullPointerException, "FilterArray is NULL.");
 
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSAbstractFilterArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if(jsvalue == NULL)
+                       continue;
+
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not fill Filter array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 FilterArrayPtr FilterConverter::toFilterArray(const JSValueRef& arg)
@@ -124,9 +140,6 @@ FilterArrayPtr FilterConverter::toFilterArray(const JSValueRef& arg)
        if(arg == NULL)
                ThrowMsg(NullPointerException, "JSValueRef is NULL.");
 
-       if(JSAbstractFilterArray::isObjectOfClass(m_context, arg))
-               return JSAbstractFilterArray::getAbstractFilterArray(m_context, arg);
-
        if(!JSIsArrayValue(m_context, arg))
                ThrowMsg(InvalidArgumentException, "JSValueRef is not Array.");
 
@@ -139,16 +152,18 @@ FilterArrayPtr FilterConverter::toFilterArray(const JSValueRef& arg)
        for(unsigned int i=0; i<length; i++)
        {
                JSValueRef value = JSGetArrayElement(m_context, obj, i);
-
-               if(JSValueIsNull(m_context, value) ||  JSValueIsUndefined(m_context, value)) {
-                       ThrowMsg(InvalidArgumentException, "CompositeFilter.filters has null elements.");
+               if(value == NULL)
+               {
+                       LogWarning("value is NULL (" << i << ")");
+                       continue;
                }
 
-               FilterPtr filter;
-               Try {
-                       filter = toFilter(value);
-               } Catch (Exception) {
-                       ThrowMsg(InvalidArgumentException, "Element is not an AbstractFilter (" << i << ")");
+               FilterPtr filter(NULL);
+               filter = toFilter(value);
+               if(filter == NULL)
+               {
+                       LogWarning("Element is not an AbstractFilter (" << i << ")");
+                       continue;
                }
 
                retVal->push_back(filter);
@@ -162,7 +177,14 @@ JSValueRef FilterConverter::toJSValueRef(const CompositeFilterPtr& arg)
        if(arg == NULL)
                ThrowMsg(NullPointerException, "CompositeFilter is NULL.");
 
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSCompositeFilter::getClassRef(), arg);
+       const ScopedJSStringRef jsStrFilters(JSStringCreateWithUTF8CString(TIZEN_FILTER_CONVERTER_ATTRIBUTE_FILTERS));
+       JSValueRef jsValueFilters =     toJSValueRef(arg->getFilters());
+
+       JSObjectRef jsValueResult = WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSCompositeFilter::getClassRef(), arg);
+
+       JSObjectSetProperty(m_context, jsValueResult, jsStrFilters.get(), jsValueFilters, kJSPropertyAttributeNone, NULL);
+
+       return jsValueResult;
 }
 
 CompositeFilterPtr FilterConverter::toCompositeFilter(const JSValueRef& arg)
@@ -173,7 +195,17 @@ CompositeFilterPtr FilterConverter::toCompositeFilter(const JSValueRef& arg)
        if(!JSCompositeFilter::isObjectOfClass(m_context, arg))
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
 
-       return JSCompositeFilter::getCompositeFilter(m_context, arg);
+       CompositeFilterPtr compositeFilter = JSCompositeFilter::getCompositeFilter(m_context, arg);
+
+       FilterArrayPtr filters = FilterArrayPtr(new FilterArray());
+
+       const ScopedJSStringRef jsStrFilters(JSStringCreateWithUTF8CString(TIZEN_FILTER_CONVERTER_ATTRIBUTE_FILTERS));
+       JSObjectRef argObj = JSValueToObject(m_context, arg, NULL);
+       JSValueRef jsValueFilters = JSObjectGetProperty(m_context, argObj, jsStrFilters.get(), NULL);
+       filters = toFilterArray(jsValueFilters);
+       compositeFilter->setFilters(filters);
+
+       return compositeFilter;
 }
 
 JSValueRef FilterConverter::toJSValueRef(const AttributeFilterPtr& arg)
diff --git a/src/Tizen/JSAbstractFilterArray.cpp b/src/Tizen/JSAbstractFilterArray.cpp
deleted file mode 100644 (file)
index 9b7f802..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file        JSAbstractFilterArray.cpp
- * @author      Kisub Song (kisubs.song@samsung.com)
- * @version     0.1
- * @brief
- */
-
-#include <algorithm>
-#include <dpl/log/log.h>
-#include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
-#include "FilterConverter.h"
-#include "JSAbstractFilterArray.h"
-
-#define FUNCTION_CONCAT "concat"
-#define FUNCTION_JOIN "join"
-#define FUNCTION_POP "pop"
-#define FUNCTION_PUSH "push"
-#define FUNCTION_REVERSE "reverse"
-#define FUNCTION_SHIFT "shift"
-#define FUNCTION_SLICE "slice"
-#define FUNCTION_SORT "sort"
-#define FUNCTION_SPLICE "splice"
-#define FUNCTION_TOSTRING "toString"
-#define FUNCTION_UNSHIFT "unshift"
-#define FUNCTION_VALUEOF "valueOf"
-#define ARRAY "Array"
-#define ATTRIBUTE_LENGTH "length"
-#define FUNCTION_CONSTRUCTOR "constructor"
-
-namespace DeviceAPI {\rnamespace Tizen {
-
-using namespace DeviceAPI::Common;
-using namespace DeviceAPI::Tizen;
-using namespace WrtDeviceApis::CommonsJavaScript;
-
-JSClassDefinition JSAbstractFilterArray::m_classInfo = {
-       0,
-       kJSClassAttributeNone,
-       ARRAY,
-       0,
-       m_property,
-       m_function,
-       initialize,
-       finalize,
-       hasProperty,
-       getProperty,
-       setProperty,
-       NULL, //deleteProperty,
-       getPropertyNames,
-       NULL, //callAsFunction,
-       NULL, //callAsConstructor,
-       NULL, //hasInstance,
-       NULL, //convertToType,
-};
-
-JSStaticValue JSAbstractFilterArray::m_property[] = {
-       { ATTRIBUTE_LENGTH, getLength, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSAbstractFilterArray::m_function[] = {
-       { FUNCTION_CONCAT, concat, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_JOIN, join, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_POP, pop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_PUSH, push, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_REVERSE, reverse, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SHIFT, shift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SLICE, slice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SORT, sort, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SPLICE, splice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_TOSTRING, toString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_UNSHIFT, unshift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_VALUEOF, valueOf, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_CONSTRUCTOR, constructor, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0 }
-};
-
-JSClassRef JSAbstractFilterArray::m_jsClassRef = JSClassCreate(
-               JSAbstractFilterArray::getClassInfo());
-
-JSValueRef JSAbstractFilterArray::getLength(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       //LogDebug("enter");
-       Try
-       {
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               FilterArrayPtr filters = priv->getObject();
-               if (filters) {
-                       FilterConverterFactory::ConverterType converter =
-                                       FilterConverterFactory::getConverter(context);
-                       return converter->toJSValueRef(filters->size());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid conversion");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-bool JSAbstractFilterArray::isObjectOfClass(JSContextRef context, JSValueRef value)
-{
-       return JSValueIsObjectOfClass(context, value, getClassRef());
-}
-
-FilterArrayPtr JSAbstractFilterArray::getAbstractFilterArray(JSContextRef context, JSValueRef value)
-{
-       if (!isObjectOfClass(context, value)) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSObjectRef object = JSValueToObject(context, value, NULL);
-       if (!object) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSAbstractFilterArrayPriv *priv = static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               Throw(WrtDeviceApis::Commons::NullPointerException);
-       }
-       return priv->getObject();
-}
-
-JSObjectRef JSAbstractFilterArray::createArray(JSContextRef context,
-               const FilterArrayPtr &filters)
-{
-       JSAbstractFilterArrayPriv *priv = new JSAbstractFilterArrayPriv(context, filters);
-       return JSObjectMake(context, getClassRef(), priv);
-}
-
-const JSClassDefinition* JSAbstractFilterArray::getClassInfo()
-{
-       return &(m_classInfo);
-}
-
-JSClassRef JSAbstractFilterArray::getClassRef()
-{
-       if (!m_jsClassRef) {
-               m_jsClassRef = JSClassCreate(&m_classInfo);
-       }
-       return m_jsClassRef;
-}
-
-void JSAbstractFilterArray::initialize(JSContextRef context,
-               JSObjectRef object)
-{
-       //LogDebug("enter");
-}
-
-void JSAbstractFilterArray::finalize(JSObjectRef object)
-{
-       //LogDebug("enter");
-       JSAbstractFilterArrayPriv* priv =
-               static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-       delete priv;
-       JSObjectSetPrivate(object, NULL);
-}
-
-bool JSAbstractFilterArray::hasProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName)
-{
-       //LogDebug("enter");
-       FilterConverterFactory::ConverterType converter =
-                       FilterConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               FilterArrayPtr filters = priv->getObject();
-               if (index < filters->size()) {
-                       return true;
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               //not reporting error is intended
-       }
-       return false;
-}
-
-JSValueRef JSAbstractFilterArray::getProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       //LogDebug("enter");
-       FilterConverterFactory::ConverterType converter =
-                       FilterConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               FilterArrayPtr filters = priv->getObject();
-               if (index < filters->size()) {
-                       FilterPtr result = filters->at(index);
-                       if (result) {
-                               return converter->toJSValueRef(result);
-                       }
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-bool JSAbstractFilterArray::setProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef value,
-               JSValueRef* exception)
-{
-       //LogDebug("enter");
-       FilterConverterFactory::ConverterType converter =
-                       FilterConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               FilterPtr filter;
-               if (!JSValueIsUndefined(context, value)) {
-                       filter = converter->toFilter(value);
-               }
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               FilterArrayPtr filters = priv->getObject();
-               if (!filters) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               if (filters->size() <= index) {
-                       filters->resize(index + 1);
-               }
-               (*filters)[index] = filter;
-               return true;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-               JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-       }
-       return false;
-}
-
-void JSAbstractFilterArray::getPropertyNames(JSContextRef context,
-               JSObjectRef object,
-               JSPropertyNameAccumulatorRef propertyNames)
-{
-       FilterConverterFactory::ConverterType converter =
-                       FilterConverterFactory::getConverter(context);
-       Try
-       {
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               FilterArrayPtr filters = priv->getObject();
-
-               int count = filters->size();
-
-               for(int i=0; i < count; i++)
-               {
-                       ScopedJSStringRef name(converter->toJSStringRef(converter->toString(i)));
-                       JSPropertyNameAccumulatorAddName(propertyNames, name.get());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-}
-
-JSValueRef JSAbstractFilterArray::concat(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("enter");
-       Try
-       {
-               FilterArrayPtr filters = FilterArrayPtr(new FilterArray());
-               JSAbstractFilterArrayPriv *newPrivateObject = new JSAbstractFilterArrayPriv(context, filters);
-               JSValueRef result = JSObjectMake(context, getClassRef(), newPrivateObject);
-
-               //copy current filters
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               for (size_t i = 0; i < currentWebSites->size(); ++i) {
-                       filters->push_back(currentWebSites->at(i));
-               }
-
-               //copy submitted arrays
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       if (!JSIsArrayValue(context, arguments[i])) {
-                               Throw(WrtDeviceApis::Commons::ConversionException);
-                       }
-                       // process array of strings
-                       JSObjectRef arrayObj = converter->toJSObjectRef(arguments[i]);
-                       unsigned int len = JSGetArrayLength(context, arrayObj);
-                       for (unsigned int e = 0; e < len; ++e) {
-                               JSValueRef att = JSGetArrayElement(context, arrayObj, e);
-                               filters->push_back(converter->toFilter(att));
-                       }
-               }
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSAbstractFilterArray::join(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               std::string result;
-               std::string separator(",");
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               if (argumentCount > 0 && JSValueIsString(context, arguments[0])) {
-                       separator = converter->toString(arguments[0]);
-               }
-               for (size_t i = 0; i < currentWebSites->size(); ++i) {
-                       if (i != 0) {
-                               result += separator;
-                       }
-                       //FIXME : to be changed to support join
-                       //result += currentWebSites->at(i);
-               }
-               return converter->toJSValueRef(result);
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSAbstractFilterArray::pop(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               if (currentWebSites->size() > 0) {
-                       FilterPtr result = currentWebSites->at(
-                                       currentWebSites->size() - 1);
-                       currentWebSites->pop_back();
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::push(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       currentWebSites->push_back(converter->toFilter(arguments[i]));
-               }
-               return converter->toJSValueRef(currentWebSites->size());
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSAbstractFilterArray::reverse(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               std::reverse(currentWebSites->begin(), currentWebSites->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::shift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               if (currentWebSites->size() > 0) {
-                       FilterPtr result = currentWebSites->at(0);
-                       currentWebSites->erase(currentWebSites->begin());
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::slice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("enter");
-       Try
-       {
-               if (argumentCount < 1) {
-                       return JSValueMakeUndefined(context);
-               }
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               FilterArrayPtr filters = FilterArrayPtr(new FilterArray());
-               JSAbstractFilterArrayPriv *newPrivateObject = new JSAbstractFilterArrayPriv(
-                               context,
-                               filters);
-               JSValueRef result = JSObjectMake(context,
-                                                                                getClassRef(), newPrivateObject);
-
-               //copy current filters
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               std::size_t first = converter->toSizeT(arguments[0]);
-               std::size_t last = currentWebSites->size() - 1;
-               if (argumentCount > 1) {
-                       last = converter->toSizeT(arguments[1]);
-                       if (last >= currentWebSites->size()) {
-                               last = currentWebSites->size() - 1;
-                       }
-               }
-               for (size_t i = first; i <= last; ++i) {
-                       filters->push_back(currentWebSites->at(i));
-               }
-
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSAbstractFilterArray::sort(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       Try
-       {
-               FilterConverterFactory::ConverterType converter =
-                               FilterConverterFactory::getConverter(context);
-               JSAbstractFilterArrayPriv* priv =
-                       static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
-               FilterArrayPtr currentWebSites = priv->getObject();
-               std::sort(currentWebSites->begin(), currentWebSites->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::splice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::toString(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       return join(context, function, thisObject, 0, arguments, exception);
-}
-
-JSValueRef JSAbstractFilterArray::unshift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::valueOf(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       //LogDebug("entered");
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSAbstractFilterArray::constructor(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       // To determine this object as array
-       WrtDeviceApis::CommonsJavaScript::ScopedJSStringRef json(JSStringCreateWithUTF8CString("[]"));
-       JSValueRef array = JSValueMakeFromJSONString(context, json.get());
-       WrtDeviceApis::CommonsJavaScript::ScopedJSStringRef constructorStr(JSStringCreateWithUTF8CString("constructor"));
-       JSObjectRef arrayObject = JSValueToObject(context, array, NULL);
-       JSValueRef constructorValue = JSObjectGetProperty(context, arrayObject, constructorStr.get(), NULL);
-       return constructorValue;
-}
-
-} // Tizen
-} // DeviceAPI
-
diff --git a/src/Tizen/JSAbstractFilterArray.h b/src/Tizen/JSAbstractFilterArray.h
deleted file mode 100644 (file)
index 5d4e041..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file        JSAbstractFilterArray.h
- * @author      Kisub Song (kisubs.song@samsung.com)
- * @version     0.1
- * @brief
- */
-
-#ifndef _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_
-#define _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_
-
-#include <JavaScriptCore/JavaScript.h>
-#include <CommonsJavaScript/PrivateObject.h>
-#include "IFilter.h"
-
-namespace DeviceAPI {\rnamespace Tizen {
-
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< DeviceAPI::Tizen::FilterArrayPtr >::Type JSAbstractFilterArrayPriv;
-
-class JSAbstractFilterArray
-{
-public:
-
-       static const JSClassDefinition* getClassInfo();
-
-       static JSClassRef getClassRef();
-
-       static JSObjectRef createArray(JSContextRef context,
-                       const DeviceAPI::Tizen::FilterArrayPtr &filterArray);
-
-       static bool isObjectOfClass(JSContextRef context, JSValueRef value);
-
-       static DeviceAPI::Tizen::FilterArrayPtr getAbstractFilterArray(JSContextRef context, JSValueRef value);
-
-private:
-
-       /**
-        * The callback invoked when an object is first created.
-        */
-       static void initialize(JSContextRef context,
-                       JSObjectRef object);
-
-       /**
-        * The callback invoked when an object is finalized.
-        */
-       static void finalize(JSObjectRef object);
-
-       static JSValueRef getLength(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool hasProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName);
-
-       static JSValueRef getProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool setProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef value,
-                       JSValueRef* exception);
-
-       static void getPropertyNames(JSContextRef context,
-                       JSObjectRef object,
-                       JSPropertyNameAccumulatorRef propertyNames);
-
-       static JSValueRef concat(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef join(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef pop(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef push(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef reverse(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef shift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef slice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef sort(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef splice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef toString(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef unshift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef valueOf(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef constructor(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static bool checkValue(const std::string &value);
-
-       static JSClassRef m_jsClassRef;
-       /**
-        * This structure describes a statically declared function property.
-        */
-       static JSStaticFunction m_function[];
-
-       /**
-        * This structure contains properties and callbacks that define a type of object.
-        */
-       static JSClassDefinition m_classInfo;
-
-       /**
-        * This member variable contains the initialization values for the static properties of this class.
-        * The values are given according to the data structure JSPropertySpec
-        */
-       static JSStaticValue m_property[];
-};
-
-} // Tizen
-} // DeviceAPI
-
-
-#endif // _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_
index 4732349..14d562c 100644 (file)
@@ -64,7 +64,7 @@ JSClassDefinition JSAttributeFilter::m_classInfo =
        NULL, //DeleteProperty,
        NULL, //getPropertyNames,
        NULL, //CallAsFunction,
-       constructor, //CallAsConstructor,
+       NULL, //CallAsConstructor,
        NULL, //HasInstance,
        NULL, //ConvertToType,
 };
@@ -120,44 +120,6 @@ JSObjectRef JSAttributeFilter::createJSObject(JSContextRef context, AttributeFil
        return jsObjectRef;
 }
 
-void JSAttributeFilter::Initialize(JSContextRef context, JSObjectRef object)
-{
-       if (!JSObjectGetPrivate(object))
-       {
-               AttributeFilterPtr filter(new AttributeFilter("", MATCH_NONE, AnyPtr(NULL)));
-               JSAttributeFilterPriv *priv = new JSAttributeFilterPriv(context, AttributeFilterPtr(filter));
-               if (!JSObjectSetPrivate(object, priv)) {
-                       delete priv;
-               }
-       }
-}
-
-void JSAttributeFilter::Finalize(JSObjectRef object)
-{
-       JSAttributeFilterPriv *priv = static_cast<JSAttributeFilterPriv*>(JSObjectGetPrivate(object));
-
-       if (priv != NULL)
-       {
-               delete (priv);
-       }
-
-       priv = NULL;
-}
-
-AttributeFilterPtr JSAttributeFilter::getPrivData(JSObjectRef object)
-{
-       LogDebug("entered");
-       JSAttributeFilterPriv *priv = static_cast<JSAttributeFilterPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       AttributeFilterPtr result = priv->getObject();
-       if (!result) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       return result;
-}
-
 JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
                JSObjectRef constructor,
                size_t argumentCount,
@@ -169,39 +131,28 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
        bool js2ndParamIsString = false;
        bool js3rdParamIsValue = false;
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
-//     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       JSAttributeFilterPriv *priv = static_cast<JSAttributeFilterPriv*>(JSObjectGetPrivate(constructor));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       JSContextRef gContext = priv->getContext();
-
-//     JSContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
        BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
                if (argumentCount < 1)
                        ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
 
-               if (!JSValueIsString(gContext, arguments[0]))
+               if (!JSValueIsString(context, arguments[0]))
                        ThrowMsg(InvalidArgumentException, "1st argument is not string.");
 
                if (argumentCount >= 2)
                {
-                       if (JSValueIsString(gContext, arguments[1]))
+                       if (JSValueIsString(context, arguments[1]))
                                js2ndParamIsString = true;
 
                        if (!js2ndParamIsString &&
-                                       !JSValueIsNull(gContext, arguments[1]) &&
-                                       !JSValueIsUndefined(gContext, arguments[1]))
+                                       !JSValueIsNull(context, arguments[1]) &&
+                                       !JSValueIsUndefined(context, arguments[1]))
                                ThrowMsg(InvalidArgumentException, "2nd argument is not array.");
                }
 
                if (argumentCount >= 3)
                {
-                       if (!JSValueIsNull(gContext, arguments[2]) && !JSValueIsUndefined(gContext, arguments[2]))
+                       if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2]))
                                js3rdParamIsValue = true;
                }
 
@@ -212,7 +163,7 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
                return NULL;
        }
 
-       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
        std::string attributeName;
        MatchFlag matchFlag;
@@ -255,7 +206,7 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
        JSObjectRef jsobject;
 
        Try {
-               jsobject = createJSObject(gContext, attributeFilter);
+               jsobject = createJSObject(context, attributeFilter);
        } Catch(Exception) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
                *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
@@ -265,6 +216,44 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
        return jsobject;
 }
 
+void JSAttributeFilter::Initialize(JSContextRef context, JSObjectRef object)
+{
+       if (!JSObjectGetPrivate(object))
+       {
+               AttributeFilterPtr filter(new AttributeFilter("", MATCH_NONE, AnyPtr(NULL)));
+               JSAttributeFilterPriv *priv = new JSAttributeFilterPriv(context, AttributeFilterPtr(filter));
+               if (!JSObjectSetPrivate(object, priv)) {
+                       delete priv;
+               }
+       }
+}
+
+void JSAttributeFilter::Finalize(JSObjectRef object)
+{
+       JSAttributeFilterPriv *priv = static_cast<JSAttributeFilterPriv*>(JSObjectGetPrivate(object));
+
+       if (priv != NULL)
+       {
+               delete (priv);
+       }
+
+       priv = NULL;
+}
+
+AttributeFilterPtr JSAttributeFilter::getPrivData(JSObjectRef object)
+{
+       LogDebug("entered");
+       JSAttributeFilterPriv *priv = static_cast<JSAttributeFilterPriv*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       AttributeFilterPtr result = priv->getObject();
+       if (!result) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       return result;
+}
+
 JSValueRef JSAttributeFilter::getAttributeName(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
index 5e966cc..c699566 100644 (file)
@@ -48,6 +48,12 @@ public:
 
        static JSObjectRef createJSObject(JSContextRef context, DeviceAPI::Tizen::AttributeFilterPtr privateData);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
        /**
         * The callback invoked when an object is first created.
@@ -79,12 +85,6 @@ private:
 
        static DeviceAPI::Tizen::AttributeFilterPtr getPrivData(JSObjectRef object);
 
-       static JSObjectRef constructor(JSContextRef context,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
        static JSValueRef getAttributeName(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
index 0b5cda8..19a7814 100644 (file)
@@ -63,7 +63,7 @@ JSClassDefinition JSAttributeRangeFilter::m_classInfo =
        NULL, //DeleteProperty,
        NULL, //getPropertyNames,
        NULL, //CallAsFunction,
-       constructor, //CallAsConstructor,
+       NULL, //CallAsConstructor,
        NULL, //HasInstance,
        NULL, //ConvertToType,
 };
@@ -119,44 +119,6 @@ JSObjectRef JSAttributeRangeFilter::createJSObject(JSContextRef context, Attribu
        return jsObjectRef;
 }
 
-void JSAttributeRangeFilter::Initialize(JSContextRef context, JSObjectRef object)
-{
-       if (!JSObjectGetPrivate(object))
-       {
-               AttributeRangeFilterPtr filter(new AttributeRangeFilter("", AnyPtr(NULL), AnyPtr(NULL)));
-               JSAttributeRangeFilterPriv *priv = new JSAttributeRangeFilterPriv(context, AttributeRangeFilterPtr(filter));
-               if (!JSObjectSetPrivate(object, priv)) {
-                       delete priv;
-               }
-       }
-}
-
-void JSAttributeRangeFilter::Finalize(JSObjectRef object)
-{
-       JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(object));
-
-       if (priv != NULL)
-       {
-               delete (priv);
-       }
-
-       priv = NULL;
-}
-
-AttributeRangeFilterPtr JSAttributeRangeFilter::getPrivData(JSObjectRef object)
-{
-       LogDebug("entered");
-       JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       AttributeRangeFilterPtr result = priv->getObject();
-       if (!result) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       return result;
-}
-
 JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
                JSObjectRef constructor,
                size_t argumentCount,
@@ -168,35 +130,24 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
        bool js2ndParamIsValue = false;
        bool js3rdParamIsValue = false;
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
-//     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(constructor));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       JSContextRef gContext = priv->getContext();
-
-//     JSContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
-       BasicValidator validator = BasicValidatorFactory::getValidator(gContext, exception);
+       BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
                if (argumentCount < 1)
                        ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
 
-               if (!JSValueIsString(gContext, arguments[0]))
+               if (!JSValueIsString(context, arguments[0]))
                        ThrowMsg(InvalidArgumentException, "1st argument is not string.");
 
                // 2nd and 3rd argument can be any type.
                if (argumentCount >= 2)
                {
-                       if(!JSValueIsUndefined(gContext, arguments[1]) && !JSValueIsNull(gContext, arguments[1]))
+                       if(!JSValueIsUndefined(context, arguments[1]) && !JSValueIsNull(context, arguments[1]))
                                js2ndParamIsValue = true;
                }
 
                if (argumentCount >= 3)
                {
-                       if(!JSValueIsUndefined(gContext, arguments[2]) && !JSValueIsNull(gContext, arguments[2]))
+                       if(!JSValueIsUndefined(context, arguments[2]) && !JSValueIsNull(context, arguments[2]))
                                js3rdParamIsValue = true;
                }
 
@@ -206,7 +157,7 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
                return NULL;
        }
 
-       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
        std::string attributeName;
        AnyPtr initialValue(NULL);
@@ -249,7 +200,7 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
        JSObjectRef jsobject;
 
        Try {
-               jsobject = createJSObject(gContext, attributeRangeFilter);
+               jsobject = createJSObject(context, attributeRangeFilter);
        } Catch(Exception) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
                *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
@@ -259,6 +210,44 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
        return jsobject;
 }
 
+void JSAttributeRangeFilter::Initialize(JSContextRef context, JSObjectRef object)
+{
+       if (!JSObjectGetPrivate(object))
+       {
+               AttributeRangeFilterPtr filter(new AttributeRangeFilter("", AnyPtr(NULL), AnyPtr(NULL)));
+               JSAttributeRangeFilterPriv *priv = new JSAttributeRangeFilterPriv(context, AttributeRangeFilterPtr(filter));
+               if (!JSObjectSetPrivate(object, priv)) {
+                       delete priv;
+               }
+       }
+}
+
+void JSAttributeRangeFilter::Finalize(JSObjectRef object)
+{
+       JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(object));
+
+       if (priv != NULL)
+       {
+               delete (priv);
+       }
+
+       priv = NULL;
+}
+
+AttributeRangeFilterPtr JSAttributeRangeFilter::getPrivData(JSObjectRef object)
+{
+       LogDebug("entered");
+       JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       AttributeRangeFilterPtr result = priv->getObject();
+       if (!result) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       return result;
+}
+
 JSValueRef JSAttributeRangeFilter::getAttributeName(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
index 17b7334..6621170 100644 (file)
@@ -49,6 +49,12 @@ public:
        static JSObjectRef createJSObject(JSContextRef context,
                        DeviceAPI::Tizen::AttributeRangeFilterPtr privateData);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
    /**
        * The callback invoked when an object is first created.
@@ -80,12 +86,6 @@ private:
 
        static DeviceAPI::Tizen::AttributeRangeFilterPtr getPrivData(JSObjectRef object);
 
-       static JSObjectRef constructor(JSContextRef context,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
        static JSValueRef getAttributeName(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
index e6bd4db..5645760 100644 (file)
 #include <dpl/shared_ptr.h>
 #include <CommonsJavaScript/Converter.h>
 #include <CommonsJavaScript/Validator.h>
+#include <CommonsJavaScript/ScopedJSStringRef.h>
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include "CompositeFilter.h"
 #include "FilterConverter.h"
-#include "JSAbstractFilterArray.h"
 #include "JSCompositeFilter.h"
 
 #define ATTRIBUTE_FILTER_CLASS_NAME "CompositeFilter"
@@ -58,20 +58,20 @@ JSClassDefinition JSCompositeFilter::m_classInfo =
        m_functions,
        Initialize,
        Finalize,
-       NULL, //hasProperty,
-       NULL, //GetProperty,
-       NULL, //SetProperty,
-       NULL, //DeleteProperty,
-       NULL, //getPropertyNames,
+       NULL,//hasProperty,
+       NULL,//getProperty,
+       setProperty,
+       NULL,//deleteProperty,
+       NULL,//getPropertyNames,
        NULL, //CallAsFunction,
-       constructor, //CallAsConstructor,
+       NULL, //CallAsConstructor,
        NULL, //HasInstance,
        NULL, //ConvertToType,
 };
 
 JSStaticValue JSCompositeFilter::m_property[] = {
        { ATTRIBUTE_FILTER_ATTR_TYPE, getType, setType, kJSPropertyAttributeNone },
-       { ATTRIBUTE_FILTER_ATTR_FILTERS, getFilters, setFilters, kJSPropertyAttributeNone },
+       //{ ATTRIBUTE_FILTER_ATTR_FILTERS, getFilters, setFilters, kJSPropertyAttributeNone },
        { 0, 0, 0, 0 }
 };
 
@@ -116,45 +116,15 @@ JSObjectRef JSCompositeFilter::createJSObject(JSContextRef context, CompositeFil
                LogError("object creation error");
                return NULL;
        }
-       return jsObjectRef;
-}
 
-void JSCompositeFilter::Initialize(JSContextRef context, JSObjectRef object)
-{
-       if (!JSObjectGetPrivate(object))
-       {
-               CompositeFilterPtr filter(new CompositeFilter(UNION_FILTER, FilterArrayPtr(NULL)));
-               JSCompositeFilterPriv *priv = new JSCompositeFilterPriv(context, CompositeFilterPtr(filter));
-               if (!JSObjectSetPrivate(object, priv)) {
-                       delete priv;
-               }
-       }
-}
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
-void JSCompositeFilter::Finalize(JSObjectRef object)
-{
-       JSCompositeFilterPriv *priv = static_cast<JSCompositeFilterPriv*>(JSObjectGetPrivate(object));
+       const ScopedJSStringRef jsStrFilters(JSStringCreateWithUTF8CString(ATTRIBUTE_FILTER_ATTR_FILTERS));
+       JSValueRef jsValueFilters =     converter->toJSValueRef(privateData->getFilters());
 
-       if (priv != NULL)
-       {
-               delete (priv);
-       }
+       JSObjectSetProperty(context, jsObjectRef, jsStrFilters.get(), jsValueFilters, kJSPropertyAttributeNone, NULL);
 
-       priv = NULL;
-}
-
-CompositeFilterPtr JSCompositeFilter::getPrivData(JSObjectRef object)
-{
-       LogDebug("entered");
-       JSCompositeFilterPriv *priv = static_cast<JSCompositeFilterPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       CompositeFilterPtr result = priv->getObject();
-       if (!result) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       return result;
+       return jsObjectRef;
 }
 
 JSObjectRef JSCompositeFilter::constructor(JSContextRef context,
@@ -167,33 +137,22 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context,
 
        bool js2ndParamIsObject = false;
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
-//     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       JSCompositeFilterPriv *priv = static_cast<JSCompositeFilterPriv*>(JSObjectGetPrivate(constructor));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       JSContextRef gContext = priv->getContext();
-
-//     JSContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
-       BasicValidator validator = BasicValidatorFactory::getValidator(gContext, exception);
+       BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
                if (argumentCount < 1)
                        ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
 
-               if (!JSValueIsString(gContext, arguments[0]))
+               if (!JSValueIsString(context, arguments[0]))
                        ThrowMsg(InvalidArgumentException, "1st argument is not string.");
 
                if (argumentCount >= 2)
                {
-                       if (JSValueIsObject(gContext, arguments[1]))
+                       if (JSValueIsObject(context, arguments[1]))
                                js2ndParamIsObject = true;
 
                        if (!js2ndParamIsObject &&
-                                       !JSValueIsNull(gContext, arguments[1]) &&
-                                       !JSValueIsUndefined(gContext, arguments[1]))
+                                       !JSValueIsNull(context, arguments[1]) &&
+                                       !JSValueIsUndefined(context, arguments[1]))
                                ThrowMsg(InvalidArgumentException, "2nd argument is not array.");
                }
 
@@ -203,7 +162,7 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context,
                return NULL;
        }
 
-       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
        FilterType type;
        FilterArrayPtr filters(NULL);
@@ -233,7 +192,7 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context,
        JSObjectRef jsobject;
 
        Try {
-               jsobject = createJSObject(gContext, compositeFilter);
+               jsobject = createJSObject(context, compositeFilter);
        } Catch(Exception) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
                *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
@@ -243,7 +202,71 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context,
        return jsobject;
 }
 
-JSValueRef JSCompositeFilter::getType(JSContextRef context,
+void JSCompositeFilter::Initialize(JSContextRef context, JSObjectRef object)
+{
+       if (!JSObjectGetPrivate(object))
+       {
+               CompositeFilterPtr filter(new CompositeFilter(UNION_FILTER, FilterArrayPtr(NULL)));
+               JSCompositeFilterPriv *priv = new JSCompositeFilterPriv(context, CompositeFilterPtr(filter));
+               if (!JSObjectSetPrivate(object, priv)) {
+                       delete priv;
+               }
+       }
+}
+
+void JSCompositeFilter::Finalize(JSObjectRef object)
+{
+       JSCompositeFilterPriv *priv = static_cast<JSCompositeFilterPriv*>(JSObjectGetPrivate(object));
+
+       if (priv != NULL)
+       {
+               delete (priv);
+       }
+
+       priv = NULL;
+}
+
+CompositeFilterPtr JSCompositeFilter::getPrivData(JSObjectRef object)
+{
+       LogDebug("entered");
+       JSCompositeFilterPriv *priv = static_cast<JSCompositeFilterPriv*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       CompositeFilterPtr result = priv->getObject();
+       if (!result) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       return result;
+}
+
+bool JSCompositeFilter::hasProperty(JSContextRef context,
+               JSObjectRef object,
+               JSStringRef propertyName)
+{
+       LogDebug("entered");
+       Try
+       {
+               CompositeFilterPtr compositeFilter = getPrivData(object);
+
+               FilterConverterFactory::ConverterType converter =
+                               FilterConverterFactory::getConverter(context);
+               std::string name = converter->toString(propertyName);
+
+               if(name == ATTRIBUTE_FILTER_ATTR_FILTERS ||
+                               name == ATTRIBUTE_FILTER_ATTR_TYPE )
+                       return true;
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("trying to get incorrect value");
+               return false;
+       }
+
+       return false;
+}
+
+JSValueRef JSCompositeFilter::getProperty(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
                JSValueRef* exception)
@@ -251,42 +274,92 @@ JSValueRef JSCompositeFilter::getType(JSContextRef context,
        LogDebug("entered");
        Try
        {
+               CompositeFilterPtr compositeFilter = getPrivData(object);
+
                FilterConverterFactory::ConverterType converter =
                                FilterConverterFactory::getConverter(context);
-               CompositeFilterPtr compositeFilter = getPrivData(object);
-               return converter->toJSValueRef(compositeFilter->getFilterType());
+               std::string name = converter->toString(propertyName);
+               if(name == ATTRIBUTE_FILTER_ATTR_FILTERS)
+                       return NULL;
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("trying to get incorrect value");
        }
+
        return JSValueMakeUndefined(context);
 }
 
-bool JSCompositeFilter::setType(JSContextRef context,
+bool JSCompositeFilter::setProperty(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
                JSValueRef value,
                JSValueRef* exception)
 {
+       LogDebug("entered");
        Try
        {
                CompositeFilterPtr compositeFilter = getPrivData(object);
                FilterConverterFactory::ConverterType converter =
                                FilterConverterFactory::getConverter(context);
-               compositeFilter->setFilterType(converter->toCompositeFilterType(value));
-               return true;
+               std::string name = converter->toString(propertyName);
+               if(name == ATTRIBUTE_FILTER_ATTR_FILTERS)
+               {
+                       if(!JSIsArrayValue(context, value))
+                               return true;
+
+                       return false;
+//                     const ScopedJSStringRef jsStrFilters(
+//                                     JSStringCreateWithUTF8CString(ATTRIBUTE_FILTER_ATTR_FILTERS));
+//
+//                     JSObjectSetProperty(context, object, jsStrFilters.get(),
+//                                     value, kJSPropertyAttributeNone, NULL);
+//
+//                     return true;
+               }
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("trying to set incorrect value");
+       }
+
+       return false;
+}
+
+bool JSCompositeFilter::deleteProperty(JSContextRef context,
+               JSObjectRef object,
+               JSStringRef propertyName,
+               JSValueRef* exception)
+{
+       LogDebug("entered");
+       Try
+       {
+               CompositeFilterPtr compositeFilter = getPrivData(object);
+               FilterConverterFactory::ConverterType converter =
+                               FilterConverterFactory::getConverter(context);
+               std::string name = converter->toString(propertyName);
+               if(name == ATTRIBUTE_FILTER_ATTR_FILTERS)
+                       return true;
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LogWarning("trying to set incorrect value");
        }
 
-       JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
        return false;
 }
 
-JSValueRef JSCompositeFilter::getFilters(JSContextRef context,
+void JSCompositeFilter::getPropertyNames(JSContextRef context,
+               JSObjectRef object,
+               JSPropertyNameAccumulatorRef propertyNames)
+{
+       LogDebug("entered");
+
+       const ScopedJSStringRef jsStrFilters(JSStringCreateWithUTF8CString(ATTRIBUTE_FILTER_ATTR_FILTERS));
+       JSPropertyNameAccumulatorAddName(propertyNames, jsStrFilters.get());
+}
+
+JSValueRef JSCompositeFilter::getType(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
                JSValueRef* exception)
@@ -297,7 +370,7 @@ JSValueRef JSCompositeFilter::getFilters(JSContextRef context,
                FilterConverterFactory::ConverterType converter =
                                FilterConverterFactory::getConverter(context);
                CompositeFilterPtr compositeFilter = getPrivData(object);
-               return converter->toJSValueRef(compositeFilter->getFilters());
+               return converter->toJSValueRef(compositeFilter->getFilterType());
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -306,7 +379,7 @@ JSValueRef JSCompositeFilter::getFilters(JSContextRef context,
        return JSValueMakeUndefined(context);
 }
 
-bool JSCompositeFilter::setFilters(JSContextRef context,
+bool JSCompositeFilter::setType(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
                JSValueRef value,
@@ -317,7 +390,7 @@ bool JSCompositeFilter::setFilters(JSContextRef context,
                CompositeFilterPtr compositeFilter = getPrivData(object);
                FilterConverterFactory::ConverterType converter =
                                FilterConverterFactory::getConverter(context);
-               compositeFilter->setFilters(converter->toFilterArray(value));
+               compositeFilter->setFilterType(converter->toCompositeFilterType(value));
                return true;
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -329,6 +402,49 @@ bool JSCompositeFilter::setFilters(JSContextRef context,
        return false;
 }
 
+//JSValueRef JSCompositeFilter::getFilters(JSContextRef context,
+//             JSObjectRef object,
+//             JSStringRef propertyName,
+//             JSValueRef* exception)
+//{
+//     LogDebug("entered");
+//     Try
+//     {
+//             FilterConverterFactory::ConverterType converter =
+//                             FilterConverterFactory::getConverter(context);
+//             CompositeFilterPtr compositeFilter = getPrivData(object);
+//             return converter->toJSValueRef(compositeFilter->getFilters());
+//     }
+//     Catch(WrtDeviceApis::Commons::Exception)
+//     {
+//             LogWarning("trying to get incorrect value");
+//     }
+//     return JSValueMakeUndefined(context);
+//}
+
+//bool JSCompositeFilter::setFilters(JSContextRef context,
+//             JSObjectRef object,
+//             JSStringRef propertyName,
+//             JSValueRef value,
+//             JSValueRef* exception)
+//{
+//     Try
+//     {
+//             CompositeFilterPtr compositeFilter = getPrivData(object);
+//             FilterConverterFactory::ConverterType converter =
+//                             FilterConverterFactory::getConverter(context);
+//             compositeFilter->setFilters(converter->toFilterArray(value));
+//             return true;
+//     }
+//     Catch(WrtDeviceApis::Commons::Exception)
+//     {
+//             LogWarning("trying to set incorrect value");
+//     }
+//
+//     JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
+//     return false;
+//}
+//
 } // Tizen
 } // DeviceAPI
 
index a730bcc..9bb43fd 100644 (file)
@@ -48,6 +48,12 @@ public:
 
        static JSObjectRef createJSObject(JSContextRef context, DeviceAPI::Tizen::CompositeFilterPtr privateData);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
        /**
         * The callback invoked when an object is first created.
@@ -79,33 +85,51 @@ private:
 
        static DeviceAPI::Tizen::CompositeFilterPtr getPrivData(JSObjectRef object);
 
-       static JSObjectRef constructor(JSContextRef context,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
+       static bool hasProperty(JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName);
 
-       static JSValueRef getType(JSContextRef context,
+       static JSValueRef getProperty(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
                        JSValueRef* exception);
 
-       static bool setType(JSContextRef context,
+       static bool setProperty(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
                        JSValueRef value,
                        JSValueRef* exception);
 
-       static JSValueRef getFilters(JSContextRef context,
+       static bool deleteProperty(JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName,
+                       JSValueRef* exception);
+
+       static void getPropertyNames(JSContextRef context,
+                       JSObjectRef object,
+                       JSPropertyNameAccumulatorRef propertyNames);
+
+       static JSValueRef getType(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
                        JSValueRef* exception);
 
-       static bool setFilters(JSContextRef context,
+       static bool setType(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
                        JSValueRef value,
                        JSValueRef* exception);
+
+//     static JSValueRef getFilters(JSContextRef context,
+//                     JSObjectRef object,
+//                     JSStringRef propertyName,
+//                     JSValueRef* exception);
+
+//     static bool setFilters(JSContextRef context,
+//                     JSObjectRef object,
+//                     JSStringRef propertyName,
+//                     JSValueRef value,
+//                     JSValueRef* exception);
 };
 
 } // Tizen
index 3034553..a503725 100644 (file)
@@ -63,7 +63,7 @@ JSClassDefinition JSSimpleCoordinates::m_classInfo =
        NULL, //DeleteProperty,
        NULL, //getPropertyNames,
        NULL, //CallAsFunction,
-       constructor, //CallAsConstructor,
+       NULL, //CallAsConstructor,
        NULL, //HasInstance,
        NULL, //ConvertToType,
 };
@@ -118,44 +118,6 @@ JSObjectRef JSSimpleCoordinates::createJSObject(JSContextRef context, SimpleCoor
        return jsObjectRef;
 }
 
-void JSSimpleCoordinates::Initialize(JSContextRef context, JSObjectRef object)
-{
-       if (!JSObjectGetPrivate(object))
-       {
-               SimpleCoordinatesPtr coord(new SimpleCoordinates(0.0, 0.0));
-               JSSimpleCoordinatesPriv *priv = new JSSimpleCoordinatesPriv(context, SimpleCoordinatesPtr(coord));
-               if (!JSObjectSetPrivate(object, priv)) {
-                       delete priv;
-               }
-       }
-}
-
-void JSSimpleCoordinates::Finalize(JSObjectRef object)
-{
-       JSSimpleCoordinatesPriv *priv = static_cast<JSSimpleCoordinatesPriv*>(JSObjectGetPrivate(object));
-
-       if (priv != NULL)
-       {
-               delete (priv);
-       }
-
-       priv = NULL;
-}
-
-SimpleCoordinatesPtr JSSimpleCoordinates::getPrivData(JSObjectRef object)
-{
-       LogDebug("entered");
-       JSSimpleCoordinatesPriv *priv = static_cast<JSSimpleCoordinatesPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       SimpleCoordinatesPtr result = priv->getObject();
-       if (!result) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       return result;
-}
-
 JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context,
                JSObjectRef constructor,
                size_t argumentCount,
@@ -164,26 +126,15 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context,
 {
        LogDebug("entered");
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
-//     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       JSSimpleCoordinatesPriv *priv = static_cast<JSSimpleCoordinatesPriv*>(JSObjectGetPrivate(constructor));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       JSContextRef gContext = priv->getContext();
-
-//     JSGlobalContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
-       BasicValidator validator = BasicValidatorFactory::getValidator(gContext, exception);
+       BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
                if (argumentCount < 2)
                        ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
 
-               if (!JSValueIsNumber(gContext, arguments[0]))
+               if (!JSValueIsNumber(context, arguments[0]))
                        ThrowMsg(InvalidArgumentException, "1st argument is not string.");
 
-               if (!JSValueIsNumber(gContext, arguments[1]))
+               if (!JSValueIsNumber(context, arguments[1]))
                        ThrowMsg(InvalidArgumentException, "2nd argument is not string.");
 
        } Catch(Exception ) {
@@ -192,7 +143,7 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context,
                return NULL;
        }
 
-       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
        double latitude;
        double longitude;
@@ -218,7 +169,7 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context,
        JSObjectRef jsobject;
 
        Try {
-               jsobject = createJSObject(gContext, simpleCoordinates);
+               jsobject = createJSObject(context, simpleCoordinates);
        } Catch(Exception) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
                *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
@@ -228,6 +179,44 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context,
        return jsobject;
 }
 
+void JSSimpleCoordinates::Initialize(JSContextRef context, JSObjectRef object)
+{
+       if (!JSObjectGetPrivate(object))
+       {
+               SimpleCoordinatesPtr coord(new SimpleCoordinates(0.0, 0.0));
+               JSSimpleCoordinatesPriv *priv = new JSSimpleCoordinatesPriv(context, SimpleCoordinatesPtr(coord));
+               if (!JSObjectSetPrivate(object, priv)) {
+                       delete priv;
+               }
+       }
+}
+
+void JSSimpleCoordinates::Finalize(JSObjectRef object)
+{
+       JSSimpleCoordinatesPriv *priv = static_cast<JSSimpleCoordinatesPriv*>(JSObjectGetPrivate(object));
+
+       if (priv != NULL)
+       {
+               delete (priv);
+       }
+
+       priv = NULL;
+}
+
+SimpleCoordinatesPtr JSSimpleCoordinates::getPrivData(JSObjectRef object)
+{
+       LogDebug("entered");
+       JSSimpleCoordinatesPriv *priv = static_cast<JSSimpleCoordinatesPriv*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       SimpleCoordinatesPtr result = priv->getObject();
+       if (!result) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       return result;
+}
+
 JSValueRef JSSimpleCoordinates::getLatitude(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
index 1213857..4b9f8de 100644 (file)
@@ -48,6 +48,12 @@ public:
 
        static JSObjectRef createJSObject(JSContextRef context, DeviceAPI::Tizen::SimpleCoordinatesPtr privateData);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
        /**
         * The callback invoked when an object is first created.
@@ -79,12 +85,6 @@ private:
 
        static DeviceAPI::Tizen::SimpleCoordinatesPtr getPrivData(JSObjectRef object);
 
-       static JSObjectRef constructor(JSContextRef context,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
        static JSValueRef getLatitude(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
index 5b568df..75c2277 100644 (file)
@@ -63,7 +63,7 @@ JSClassDefinition JSSortMode::m_classInfo =
        NULL, //DeleteProperty,
        NULL, //getPropertyNames,
        NULL, //CallAsFunction,
-       constructor, //CallAsConstructor,
+       NULL, //CallAsConstructor,
        NULL, //HasInstance,
        NULL, //ConvertToType,
 };
@@ -118,44 +118,6 @@ JSObjectRef JSSortMode::createJSObject(JSContextRef context, SortModePtr private
        return jsObjectRef;
 }
 
-void JSSortMode::Initialize(JSContextRef context, JSObjectRef object)
-{
-       if (!JSObjectGetPrivate(object))
-       {
-               SortModePtr sortMode(new SortMode(""));
-               JSSortModePriv *priv = new JSSortModePriv(context, SortModePtr(sortMode));
-               if (!JSObjectSetPrivate(object, priv)) {
-                       delete priv;
-               }
-       }
-}
-
-void JSSortMode::Finalize(JSObjectRef object)
-{
-       JSSortModePriv *priv = static_cast<JSSortModePriv*>(JSObjectGetPrivate(object));
-
-       if (priv != NULL)
-       {
-               delete (priv);
-       }
-
-       priv = NULL;
-}
-
-SortModePtr JSSortMode::getPrivData(JSObjectRef object)
-{
-       LogDebug("entered");
-       JSSortModePriv *priv = static_cast<JSSortModePriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       SortModePtr result = priv->getObject();
-       if (!result) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       return result;
-}
-
 JSObjectRef JSSortMode::constructor(JSContextRef context,
                JSObjectRef constructor,
                size_t argumentCount,
@@ -166,33 +128,22 @@ JSObjectRef JSSortMode::constructor(JSContextRef context,
 
        bool js2ndParamIsString = false;
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
-//     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       JSSortModePriv *priv = static_cast<JSSortModePriv*>(JSObjectGetPrivate(constructor));
-       if (!priv) {
-               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-       }
-       JSContextRef gContext = priv->getContext();
-
-//     JSContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
-       BasicValidator validator = BasicValidatorFactory::getValidator(gContext, exception);
+       BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
                if (argumentCount < 1)
                        ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
 
-               if (!JSValueIsString(gContext, arguments[0]))
+               if (!JSValueIsString(context, arguments[0]))
                        ThrowMsg(InvalidArgumentException, "1st argument is not string.");
 
                if (argumentCount >= 2)
                {
-                       if (JSValueIsString(gContext, arguments[1]))
+                       if (JSValueIsString(context, arguments[1]))
                                js2ndParamIsString = true;
 
                        if (!js2ndParamIsString &&
-                                       !JSValueIsNull(gContext, arguments[1]) &&
-                                       !JSValueIsUndefined(gContext, arguments[1]))
+                                       !JSValueIsNull(context, arguments[1]) &&
+                                       !JSValueIsUndefined(context, arguments[1]))
                                ThrowMsg(InvalidArgumentException, "2nd argument is not string.");
                }
 
@@ -202,7 +153,7 @@ JSObjectRef JSSortMode::constructor(JSContextRef context,
                return NULL;
        }
 
-       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
+       FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(context);
 
        std::string attributeName;
        SortOrder sortOrder;
@@ -232,7 +183,7 @@ JSObjectRef JSSortMode::constructor(JSContextRef context,
        JSObjectRef jsobject;
 
        Try {
-               jsobject = createJSObject(gContext, sortMode);
+               jsobject = createJSObject(context, sortMode);
        } Catch(Exception) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
                *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
@@ -242,6 +193,44 @@ JSObjectRef JSSortMode::constructor(JSContextRef context,
        return jsobject;
 }
 
+void JSSortMode::Initialize(JSContextRef context, JSObjectRef object)
+{
+       if (!JSObjectGetPrivate(object))
+       {
+               SortModePtr sortMode(new SortMode(""));
+               JSSortModePriv *priv = new JSSortModePriv(context, SortModePtr(sortMode));
+               if (!JSObjectSetPrivate(object, priv)) {
+                       delete priv;
+               }
+       }
+}
+
+void JSSortMode::Finalize(JSObjectRef object)
+{
+       JSSortModePriv *priv = static_cast<JSSortModePriv*>(JSObjectGetPrivate(object));
+
+       if (priv != NULL)
+       {
+               delete (priv);
+       }
+
+       priv = NULL;
+}
+
+SortModePtr JSSortMode::getPrivData(JSObjectRef object)
+{
+       LogDebug("entered");
+       JSSortModePriv *priv = static_cast<JSSortModePriv*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       SortModePtr result = priv->getObject();
+       if (!result) {
+               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+       }
+       return result;
+}
+
 JSValueRef JSSortMode::getAttributeName(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
index 37e4126..22d7b91 100644 (file)
@@ -48,6 +48,12 @@ public:
 
        static JSObjectRef createJSObject(JSContextRef context, DeviceAPI::Tizen::SortModePtr privateData);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
        /**
         * The callback invoked when an object is first created.
@@ -79,12 +85,6 @@ private:
 
        static DeviceAPI::Tizen::SortModePtr getPrivData(JSObjectRef object);
 
-       static JSObjectRef constructor(JSContextRef context,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
        static JSValueRef getAttributeName(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
index 9bc32d8..edb7a4b 100644 (file)
@@ -33,8 +33,6 @@
 #include "JSSortMode.h"
 #include "JSSimpleCoordinates.h"
 
-#define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
-
 #define OBJECT_TIZEN "tizen"
 
 namespace Options{
@@ -49,6 +47,16 @@ class_definition_options_t TizenOptions =
     NULL
 };
 
+class_definition_options_t TizenInterfaceOptions = {
+    JS_INTERFACE,
+    CREATE_INSTANCE,
+    NONE_NOTICE,
+    USE_OVERLAYED, //ignored
+    NULL, // JSWidget::acquireGlobalContext,
+    NULL,
+    NULL
+};
+
 }
 
 using namespace WrtDeviceApis;
@@ -88,26 +96,31 @@ PLUGIN_CLASS_MAP_BEGIN
                                OBJECT_TIZEN,
                                (js_class_template_getter)DeviceAPI::Tizen::JSTizen::getClassRef,
                                &Options::TizenOptions)
-    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(OBJECT_TIZEN,
                                "AttributeFilter",
                                (js_class_template_getter)DeviceAPI::Tizen::JSAttributeFilter::getClassRef,
-                               &Options::TizenOptions)
-    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               (js_class_constructor_cb_t)DeviceAPI::Tizen::JSAttributeFilter::constructor,
+                               &Options::TizenInterfaceOptions)
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(OBJECT_TIZEN,
                                "AttributeRangeFilter",
                                (js_class_template_getter)DeviceAPI::Tizen::JSAttributeRangeFilter::getClassRef,
-                               &Options::TizenOptions)
-    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               (js_class_constructor_cb_t)DeviceAPI::Tizen::JSAttributeRangeFilter::constructor,
+                               &Options::TizenInterfaceOptions)
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(OBJECT_TIZEN,
                                "CompositeFilter",
                                (js_class_template_getter)DeviceAPI::Tizen::JSCompositeFilter::getClassRef,
-                               &Options::TizenOptions)
-    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               (js_class_constructor_cb_t)DeviceAPI::Tizen::JSCompositeFilter::constructor,
+                               &Options::TizenInterfaceOptions)
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(OBJECT_TIZEN,
                                "SortMode",
                                (js_class_template_getter)DeviceAPI::Tizen::JSSortMode::getClassRef,
-                               &Options::TizenOptions)
-    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               (js_class_constructor_cb_t)DeviceAPI::Tizen::JSSortMode::constructor,
+                               &Options::TizenInterfaceOptions)
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(OBJECT_TIZEN,
                                "SimpleCoordinates",
                                (js_class_template_getter)DeviceAPI::Tizen::JSSimpleCoordinates::getClassRef,
-                               &Options::TizenOptions)
+                               (js_class_constructor_cb_t)DeviceAPI::Tizen::JSSimpleCoordinates::constructor,
+                               &Options::TizenInterfaceOptions)
 PLUGIN_CLASS_MAP_END
 
 #undef OBJECT_TIZEN