Fixed Filter related issues.
authorPraveen Gattu <gattu.p@samsung.com>
Fri, 24 Jun 2016 09:16:40 +0000 (14:46 +0530)
committerPraveen Gattu <gattu.p@samsung.com>
Fri, 24 Jun 2016 09:16:40 +0000 (14:46 +0530)
Change-Id: Iba194a0e503ea8241598e8f4204e7fc5c48b556c
Signed-off-by: Praveen Gattu <gattu.p@samsung.com>
Tizen.Content/Tizen.Content.MediaContent/ContentDatabase.cs
Tizen.Content/Tizen.Content.MediaContent/ContentFilter.cs

index ec232f9..f25dc13 100644 (file)
@@ -245,7 +245,7 @@ namespace Tizen.Content.MediaContent
                     throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection");
                 }
                 if (_handle != IntPtr.Zero)
-                    contentCollection = new MediaFolder(_handle);
+                    contentCollection = new PlayList(_handle);
             }
             else if (typeof(T) == typeof(Album))
             {
@@ -256,7 +256,7 @@ namespace Tizen.Content.MediaContent
                     throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection");
                 }
                 if (_handle != IntPtr.Zero)
-                    contentCollection = new Storage(_handle);
+                    contentCollection = new Album(_handle);
             }
             else if (typeof(T) == typeof(Tag))
             {
@@ -267,7 +267,7 @@ namespace Tizen.Content.MediaContent
                     throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection");
                 }
                 if (_handle != IntPtr.Zero)
-                    contentCollection = new Storage(_handle);
+                    contentCollection = new Tag(_handle);
             }
             return (T)contentCollection;
         }
index 367244e..9fb8633 100644 (file)
@@ -60,6 +60,9 @@ namespace Tizen.Content.MediaContent
     {
         private IntPtr _filterHandle;
         private bool _disposedValue = false;
+        private ContentOrder _order = ContentOrder.Asc;
+        private string _orderKey = "MEDIA_ID";
+        private ContentCollation _collationType = ContentCollation.Default;
         internal IntPtr Handle
         {
             get
@@ -81,7 +84,7 @@ namespace Tizen.Content.MediaContent
                 res = (MediaContentError)Interop.Filter.GetOffset(_filterHandle, out offset, out count);
                 if (res != MediaContentError.None)
                 {
-                    Log.Warn(MediaContentErrorFactory.LogTag, "Failed to Setoffset");
+                    Log.Warn(MediaContentErrorFactory.LogTag, "Failed to Get offset");
                 }
                 return offset;
             }
@@ -104,6 +107,7 @@ namespace Tizen.Content.MediaContent
             {
                 throw MediaContentErrorFactory.CreateException(res, "Failed to Create Filter handle.");
             }
+            res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle,(int) _order, _orderKey, (int) _collationType);
         }
         /// <summary>
         /// The number of items to be searched with respect to the offset
@@ -126,7 +130,7 @@ namespace Tizen.Content.MediaContent
             {
                 //TOD: check if we can convert this as method to club offset and count.
                 MediaContentError res;
-                res = (MediaContentError)Interop.Filter.SetOffset(_filterHandle, value, this.Count);
+                res = (MediaContentError)Interop.Filter.SetOffset(_filterHandle, this.Offset, value);
                 if (res != MediaContentError.None)
                 {
                     throw MediaContentErrorFactory.CreateException(res, "Failed to Setoffset/Count");
@@ -151,6 +155,10 @@ namespace Tizen.Content.MediaContent
                 {
                     Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder");
                 }
+                if ( orderKey.Length == 0)
+                {
+                    orderKey = _orderKey;
+                }
                 return (ContentOrder)orderType;
             }
             set
@@ -182,10 +190,11 @@ namespace Tizen.Content.MediaContent
                 {
                     Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder");
                 }
-                return (ContentCollation)collatetType;
+                 return (ContentCollation)collatetType;
             }
             set
             {
+                _collationType = value;
                 //TOD: check if we can convert this as method to club offset and count.
                 MediaContentError res;
                 res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle, (int)this.Order, this.OrderKey, (int)value);
@@ -208,6 +217,7 @@ namespace Tizen.Content.MediaContent
                 MediaContentError res;
                 int collatetType;
                 res = (MediaContentError)Interop.Filter.GetCondition(_filterHandle, out conditionVal, out collatetType);
+                _collationType = (ContentCollation)collatetType;
                 if (res != MediaContentError.None)
                 {
                     Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetCondition");
@@ -218,7 +228,7 @@ namespace Tizen.Content.MediaContent
             {
                 //TOD: check if we can convert this as method to club offset and count.
                 MediaContentError res;
-                res = (MediaContentError)Interop.Filter.SetCondition(_filterHandle, value, (int)this.CollationType);
+                res = (MediaContentError)Interop.Filter.SetCondition(_filterHandle, value, (int) _collationType);
                 if (res != MediaContentError.None)
                 {
                     throw MediaContentErrorFactory.CreateException(res, "Failed to SetCondition");
@@ -273,10 +283,15 @@ namespace Tizen.Content.MediaContent
                 {
                     Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder");
                 }
+                if (orderKey.Length == 0)
+                {
+                    orderKey = _orderKey;
+                }
                 return orderKey;
             }
             set
             {
+                _orderKey = value;
                 //TOD: check if we can convert this as method to club offset and count.
                 MediaContentError res;
                 res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle, (int)this.Order, value, (int)this.CollationType);