Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Mediacontent / MediaFilterValidator.cpp
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. 
15 */
16
17
18 #include "MediaFilterValidator.h"
19 #include <dpl/log/log.h>
20
21 namespace TizenApis {
22 namespace Platform {
23 namespace Mediacontent{
24
25 static PropertyStructArray folderProperties =
26 {
27         {"id",                                  PrimitiveType_String},
28         {"folderURL",                   PrimitiveType_String},
29         {"storageType",                 PrimitiveType_String},
30         {"title",                               PrimitiveType_String},
31         {"modifiedDate",                PrimitiveType_Time},
32         {0,     PrimitiveType_NoType}
33 };
34
35 static PropertyStructArray mediaProperties =
36 {
37         {"folder.id",                   PrimitiveType_String},
38         {"folder.title",                PrimitiveType_String},
39         {"folder.folderURL",    PrimitiveType_String},
40         {"folder.storageType",  PrimitiveType_String},
41         {"id",                                  PrimitiveType_String},
42         {"type",                                PrimitiveType_String},
43         {"mimeType",                    PrimitiveType_String},
44         {"title",                               PrimitiveType_String},
45         {"fileURL",                             PrimitiveType_String},
46         {"thumbnailURL",                PrimitiveType_String},
47         {"description",                 PrimitiveType_String},  
48         {"rating",                              PrimitiveType_Int},     
49         {"fileURL",                             PrimitiveType_String},
50         {"createdDate",                 PrimitiveType_Time},
51         {"releasedDate",                PrimitiveType_Time},
52         {"modifiedDate",                PrimitiveType_Time},
53         {"geolocation.latitude",        PrimitiveType_Double},
54         {"geolocation.longitude",       PrimitiveType_Double},  
55         {"album",                               PrimitiveType_String},  
56         {"artist",                              PrimitiveType_String},  
57         {"width",                               PrimitiveType_String},  
58         {"height",                              PrimitiveType_String},          
59         {"playedTime",                  PrimitiveType_Long},            
60         {"playCount",                   PrimitiveType_Long},            
61         {"genre",                               PrimitiveType_String},                  
62         {"artist",                              PrimitiveType_String},                          
63         {0,     PrimitiveType_NoType}
64 };
65
66 FilterValidatorPtr MediaFilterValidatorFactory::getMediaFilterValidator(QueryType value)
67 {
68         static FilterValidatorPtr theFolderInstance;
69         static FilterValidatorPtr theMediaInstance;
70
71     if(value == QUERY_FOLDER)
72     {
73             theFolderInstance = FilterValidatorPtr(new FilterValidator(folderProperties));
74             return theFolderInstance;
75         }
76         else if(value == QUERY_MEDIA)
77         {
78                 theMediaInstance = FilterValidatorPtr(new FilterValidator(mediaProperties));
79                 return theMediaInstance;
80         }
81            
82    
83 }
84
85 } // Media
86 } // Platform
87 } // TizenApis