{ 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 }
};
}
-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() {
if (!m_jsClassRef) {
m_jsClassRef = JSClassCreate(&m_classInfo);