Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Messaging / StorageChangesMessageGenerator.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  * StorageChangesMessageGenerator.cpp
18  *
19  *  Created on: 2011. 10. 28.
20  *      Author: sangtai
21  */
22
23 #include "StorageChangesMessageGenerator.h"
24 #include "StorageChangesMessageFilterValidatorFactory.h"
25 #include "API/Messaging/ConversationFilterValidatorFactory.h"
26
27 #include "IMessagingTypes.h"
28
29 #include <emf-types.h>
30
31 #include <dpl/log/log.h>
32
33 using namespace std;
34 using namespace TizenApis::Api::Tizen;
35
36 namespace TizenApis {
37         namespace Platform {
38                 namespace Messaging {
39
40                 const int StorageChangesMessageGenerator::MESSAGE_TYPE_NOT_INITIALIZED = -1;
41
42                 StorageChangesMessageGenerator::StorageChangesMessageGenerator(Api::Messaging::IMessagePtr msg):m_messageType(MESSAGE_TYPE_NOT_INITIALIZED) {
43
44                         m_type = msg->getMessageType();
45                         m_folder = msg->getCurrentFolder();
46                         m_dateTime = msg->getDateTime();
47                         m_from = msg->getFrom();
48
49                         Recipents = msg->getToRecipientsPtr();
50
51                         if(m_type == Api::Messaging::SMS)
52                         {
53                                 LogDebug("size :" << Recipents->getRecipientSize());
54                         
55                                 if(Recipents->getRecipientSize()>0)
56                                 {
57                                 m_to = Recipents->getRecipientsRef();
58                                         LogDebug("m_to :" << m_to[0]);                                          
59                                 }
60                         }
61                         else if(m_type == Api::Messaging::MMS)
62                         {
63                                 LogDebug("to size :" << Recipents->getRecipientSize());
64                         
65                                 Api::Messaging::IMmsPtr mms = DPL::DynamicPointerCast<Api::Messaging::IMms >(msg);
66                                 if(Recipents->getRecipientSize() > 0)
67                                 {
68                                         m_to = Recipents->getRecipientsRef();
69                                         LogDebug("m_to :" << m_to[0]);          
70                                 }
71
72                                 Recipents = mms->getCcRecipientsPtr();
73                                 LogDebug("cc size :" << Recipents->getRecipientSize());
74                                 
75                                 if(Recipents->getRecipientSize() > 0)
76                                 {
77                                         m_cc = Recipents->getRecipientsRef();
78                                 }
79
80                                 Recipents = mms->getBccRecipientsPtr();
81                                 LogDebug("bcc size :" << Recipents->getRecipientSize());
82                                 
83                                 if(Recipents->getRecipientSize() > 0)
84                                 {
85                                         m_bcc = Recipents->getRecipientsRef();
86                                 }
87                         }
88                         else if(m_type == Api::Messaging::EMAIL)
89                         {
90                                 LogDebug("to size :" << Recipents->getRecipientSize());
91                         
92                                 Api::Messaging::IEmailPtr email = DPL::DynamicPointerCast<Api::Messaging::IEmail >(msg);                        
93                                 if(Recipents->getRecipientSize() > 0)
94                                 {
95                                         m_to = Recipents->getRecipientsRef();
96                                         LogDebug("m_to :" << m_to[0]);          
97                                 }
98
99                                 Recipents = email->getCcRecipientsPtr();
100                                 LogDebug("cc size :" << Recipents->getRecipientSize());
101                                 
102                                 if(Recipents->getRecipientSize() > 0)
103                                 {
104                                         m_cc = Recipents->getRecipientsRef();
105                                 }
106
107                                 Recipents = email->getBccRecipientsPtr();
108                                 LogDebug("bcc size :" << Recipents->getRecipientSize());
109                                 
110                                 if(Recipents->getRecipientSize() > 0)
111                                 {
112                                         m_bcc = Recipents->getRecipientsRef();
113                                 }
114                                 
115                         }
116
117
118                         
119                         m_body = msg->getBody();
120                         m_isRead = msg->isRead();
121                         m_priority = msg->getPriority();
122                         m_subject = msg->getSubject();
123                         
124                         LogDebug("m_type:" << m_type );
125                         LogDebug("m_folder:" << m_folder );
126                         LogDebug("m_dateTime year:" << m_dateTime.tm_year + 1900 );
127                         LogDebug("m_dateTime mon:" << m_dateTime.tm_mon );
128                         LogDebug("m_dateTime day:" << m_dateTime.tm_mday );
129                         LogDebug("m_dateTime hour:" << m_dateTime.tm_hour );
130                         LogDebug("m_dateTime min:" << m_dateTime.tm_min );
131                         LogDebug("m_dateTime sec:" << m_dateTime.tm_sec );                      
132                         LogDebug("m_from:" << m_from );
133                         LogDebug("m_body:" << m_body );
134                         LogDebug("m_isRead:" << m_isRead );
135                         LogDebug("m_priority:" << m_priority );
136                         LogDebug("m_subject:" << m_subject );
137                         
138                 }
139
140                 StorageChangesMessageGenerator::~StorageChangesMessageGenerator() {
141                 }
142
143                 void StorageChangesMessageGenerator::visitPreComposite(Api::Tizen::FilterType& type, int depth){
144                         LogDebug("<<<");
145                         m_operand.push_back(leftblank);                                         
146                         LogDebug("Left_blank");                 
147                         LogDebug(">>>");
148                 }
149
150                 void StorageChangesMessageGenerator::visitInComposite(Api::Tizen::FilterType& type, int depth){
151                         LogDebug("<<<");
152                         if(type ==  UNION_FILTER ){
153                                 LogDebug("UNION_FILTER");
154                                 m_operand.push_back(operandUnion);                              
155                         }else if(type == INTERSECTION_FILTER){
156                                 LogDebug("INTERSECTION_FILTER");
157                                 m_operand.push_back(operandIntersection);                               
158                         }else{
159                                 LogError("[ERROR] invalid Filter type:" << type);
160                         }
161
162                         LogDebug(">>>");
163                 }
164
165                 void StorageChangesMessageGenerator::visitPostComposite(Api::Tizen::FilterType& type, int depth){
166                         LogDebug("<<<");
167                         bool data1, data2;
168                         do
169                         {
170                                 LogDebug("m_result size =" << m_result.size());
171                                 data1 = m_result.back();
172                                 m_result.pop_back();
173                                 data2 = m_result.back();
174                                 m_result.pop_back();
175                                 LogDebug("m_result size =" << m_result.size());                         
176                                 LogDebug("m_operand.back() =" << m_operand.back());     
177                                 LogDebug("m_operand size =" << m_operand.size());                                                               
178                                 if(m_operand.back() == operandUnion)
179                                 {
180                                         LogDebug("Union");                              
181                                         LogDebug("data1 = " << data1);
182                                         LogDebug("data2 = " << data2);
183                                         LogDebug("data1 || data2 = " << (data1 || data2));                                      
184                                         m_operand.pop_back();
185                                         m_result.push_back(data1 || data2);
186                                         LogDebug("result" << m_result.back());
187                                         LogDebug("m_result size =" << m_result.size());
188                                 }
189                                 else if(m_operand.back() == operandIntersection)
190                                 {
191                                         LogDebug("Intersection");                               
192                                         LogDebug("data1 = " << data1);
193                                         LogDebug("data2 = " << data2);
194                                         LogDebug("data1 && data2 = " << (data1 && data2));                                      
195                                         m_operand.pop_back();                           
196                                         m_result.push_back(data1 && data2);
197                                         LogDebug("result" << m_result.back());
198                                         LogDebug("m_result size =" << m_result.size());                                 
199                         
200                         }
201                         }while(m_operand.back() != leftblank);
202                         m_operand.pop_back();
203                         LogDebug("elase leftblank from m_operand");                     
204                         LogDebug("m_operand size =" << m_operand.size());                                                                                       
205                         LogDebug(">>>");
206                 }
207
208                 struct tm StorageChangesMessageGenerator::convertToTimeFormat(const std::string& timeString){
209                         LogDebug("<<< timeString:[" << timeString << "]");
210
211                         struct tm tm_Time;
212
213                         int nextStart = 0;
214
215                         int yearLength = 4;
216                         tm_Time.tm_year = atoi(timeString.substr(0, yearLength).c_str())-1900;
217                         nextStart = nextStart + yearLength;
218                         LogDebug("<<< tm_Time.tm_year:[" << tm_Time.tm_year << "]");
219
220                         int monthLength = 2;
221                         tm_Time.tm_mon = atoi(timeString.substr(nextStart, monthLength).c_str());
222                         nextStart = nextStart + monthLength;
223                         LogDebug("<<< initTime.tm_mon:[" << tm_Time.tm_mon << "]");
224
225                         int dateLength = 2;
226                         tm_Time.tm_mday = atoi(timeString.substr(nextStart, dateLength).c_str());
227                         nextStart = nextStart + dateLength;
228                         LogDebug("<<< initTime.tm_mday:[" << tm_Time.tm_mday << "]");
229
230                         int hourLength = 2;
231                         tm_Time.tm_hour = atoi(timeString.substr(nextStart, hourLength).c_str());
232                         nextStart = nextStart + hourLength;
233                         LogDebug("<<< initTime.tm_hour:[" << tm_Time.tm_hour << "]");
234
235                         int minuteLength = 2;
236                         tm_Time.tm_min = atoi(timeString.substr(nextStart, minuteLength).c_str());
237                         nextStart = nextStart + minuteLength;
238                         LogDebug("<<< initTime.tm_min:[" << tm_Time.tm_min << "]");
239
240                         int secondLength = 2;
241                         tm_Time.tm_sec = atoi(timeString.substr(nextStart, secondLength).c_str());
242                         LogDebug("<<< initTime.tm_sec:[" << tm_Time.tm_sec << "]");
243
244                         return tm_Time;
245                 }
246
247                 bool StorageChangesMessageGenerator::getMatchExactlyClause(std::string& attrName, Api::Tizen::AnyPtr& value)
248                 {
249                         std::string valueString = value->toString();
250                         LogDebug("<<< attrName : " << attrName);
251                         LogDebug("<<< valueString : " << valueString);
252                         LogDebug("<<< attrName.compare(valueString) : " << attrName.compare(valueString));
253                         
254                         if(attrName.compare(valueString) == 0)
255                         {
256                                 LogDebug("<<< getMatchExactlyClause SAME >>>");
257                                 return TRUE;                            
258                         }
259                         else{
260                                 LogDebug("<<< getMatchExactlyClause DIFF >>>");
261                                 return FALSE;                                                           
262                         }
263                         }
264
265                 bool StorageChangesMessageGenerator::getMatchContainsClause(std::string& attrName, Api::Tizen::AnyPtr& value)
266                 {
267                         std::string valueString = value->toString();
268                         LogDebug("<<< attrName : " << attrName);
269                         LogDebug("<<< valueString : " << valueString);
270                         LogDebug("<<< attrName.find(valueString) : " << attrName.find(valueString));
271                         
272                         if(attrName.find(valueString) != std::string::npos)
273                         {
274                                 LogDebug("<<< getMatchContainsClause CONTAINS >>>");
275                                 return TRUE;                            
276                         }else{
277                                 LogDebug("<<< getMatchContainsClause NOT CONTAINS >>>");
278                                 return FALSE;                                                           
279                         }
280                 }
281
282                 bool StorageChangesMessageGenerator::getMatchStartwithClause(std::string& attrName, Api::Tizen::AnyPtr& value)
283                 {
284                         std::string valueString = value->toString();
285                         LogDebug("<<< attrName : " << attrName);
286                         LogDebug("<<< valueString : " << valueString);
287                         LogDebug("<<< attrName.compare(0,valueString.size(), valueString) : " << attrName.compare(0,valueString.size(), valueString));
288
289                         
290                         if(attrName.size()-valueString.size() < 0)
291                                 return FALSE;
292                                 
293                         if(attrName.compare(0,valueString.size(), valueString) == 0)
294                         {
295                                 LogDebug("<<< getMatchStartwithClause START WITH >>>");
296                         return TRUE;
297                 }
298                         else{
299                                 LogDebug("<<< getMatchStartwithClause NOT START WITH >>>");
300                                 return FALSE;                                                           
301                         }
302                 }
303
304                 bool StorageChangesMessageGenerator::getMatchEndwithClause(std::string& attrName, Api::Tizen::AnyPtr& value)
305                 {
306                         std::string valueString = value->toString();
307
308                         LogDebug("<<< attrName : " << attrName);
309                         LogDebug("<<< valueString : " << valueString);
310                         LogDebug("<<< attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) : " << attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString));
311
312
313                         if(attrName.size()-valueString.size() < 0)
314                                 return FALSE;
315                         
316                         if(attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) == 0 )
317                         {
318                                 LogDebug("<<< getMatchEndwithClause END WITH >>>");
319                                 return TRUE;                            
320                         }
321                         else{
322                                 LogDebug("<<< getMatchEndwithClause NOT END WITH >>>");
323                                 return FALSE;                                                           
324                         }
325                 }
326                 
327                 bool StorageChangesMessageGenerator::getBetweenRangeClause(struct tm initialValue, struct tm endValue)
328                 {
329                         time_t init_time, mid_time, end_time;
330                         init_time = mktime(&initialValue);
331                         mid_time = mktime(&m_dateTime);
332                         end_time = mktime(&endValue);
333                         LogDebug("<<< mktime(initialValue):[" << init_time << "]");
334                         LogDebug("<<< mktime(m_dateTime):[" << mid_time << "]");
335                         LogDebug("<<< mktime(endValue):[" << end_time << "]");
336                         LogDebug("<<< mid_time - init_time:[" << mid_time - init_time << "]");
337                         LogDebug("<<< end_time - mid_time:[" << end_time - mid_time << "]");
338                         
339                         if(((mid_time - init_time) >= 0 ) && ((end_time - mid_time) >= 0 ))
340                                 return TRUE;
341                         else
342                                 return FALSE;
343                                 
344                 }
345
346                 void StorageChangesMessageGenerator::visitAttribute(std::string& attrName,
347                                 MatchFlag& matchFlag, Api::Tizen::AnyArrayPtr& values, int depth){
348                         LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]");
349                         LogDebug("values->size():" << values->size());
350
351                         Api::Tizen::FilterType filterType = UNION_FILTER;
352
353                         if(matchFlag == Api::Tizen::MATCH_EXISTS){
354                                 //TODO implement for EXIST
355                         }else if(values->size() == 1){
356                                 AnyPtr matchValue = values->at(0);
357                                 visitAttributeEach(attrName, matchFlag, matchValue, depth);
358                         }else{
359                                 visitPreComposite(filterType, depth);
360                         
361                                 AnyArray::iterator iter;
362                                 for(iter=values->begin(); iter!= values->end(); iter++){
363                         
364                                         if(iter != values->begin()){
365                         
366                                                 visitInComposite(filterType, depth);
367                                         }
368                         
369                                         AnyPtr matchValue = *iter;
370                                         visitAttributeEach(attrName, matchFlag, matchValue, depth);
371                                 }
372                         
373                                 visitPostComposite(filterType, depth);
374                         }
375                         LogDebug(">>>");
376                 }
377                 
378                 void StorageChangesMessageGenerator::visitAttributeEach(std::string& attrName, MatchFlag& matchFlag, Api::Tizen::AnyPtr& value, int depth){
379                         LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]");
380                         std::string valueString;
381
382 //  Check msg_type and filter_type
383                         if(attrName.compare("type")==0){
384                                 LogDebug("<<< value:[" << value << "]");
385                                 m_currentType = value->toString();
386                                 m_messageType = convertMessageType(m_currentType);
387                                 if((int)m_type == m_messageType)
388                                 {
389                                         m_result.push_back(TRUE);
390                                         LogDebug("<<< Type is same");
391                                 }
392                                 else
393                                 {
394                                         m_result.push_back(FALSE);
395                                         LogDebug("<<< Type is different");
396                                 }
397                                 return;
398                                 }
399                         if(attrName.compare("folder")==0){
400                                 LogDebug("<<< value:[" << value << "]");
401                                 std::string convertType = value->toString();
402                                 int nType = convertFolderType(convertType);
403                                 if((int)m_folder == nType)
404                                 {
405                                         m_result.push_back(TRUE);
406                                         LogDebug("<<< folder is same");
407                                 }
408                                 else
409                                 {
410                                         m_result.push_back(FALSE);
411                                         LogDebug("<<< folder is different");
412                                 }
413                                 return;
414                         }
415                         if(attrName.compare("isRead")==0){
416                                 LogDebug("<<< value:[" << value << "]");
417                                 int nType = value->toString().compare("true");
418                                 if((int)m_isRead == nType)
419                                 {
420                                         m_result.push_back(TRUE);
421                                         LogDebug("<<< isRead is same");
422                                 }
423                                 else
424                                 {
425                                         m_result.push_back(FALSE);
426                                         LogDebug("<<< isRead is different");
427                                 }
428                                 return;
429                         }
430                         if(attrName.compare("priority")==0){
431                                 LogDebug("<<< value:[" << value->toString() << "]");
432                                 if(value->toString().compare("true") == 0)
433                                 {
434                                         if((int)m_priority == Api::Messaging::MessagePriority::Priority::HIGH)
435                                         {
436                                                 m_result.push_back(TRUE);
437                                                 LogDebug("<<< priority is HIGH");
438                                         }
439                                         else
440                                         {
441                                                 m_result.push_back(FALSE);
442                                                 LogDebug("<<< priority is LOW OR NORMAL");
443                                         }
444                                 }
445                                 else
446                                 {
447                                         if((int)m_priority == Api::Messaging::MessagePriority::Priority::HIGH)
448                                         {
449                                                 m_result.push_back(FALSE);
450                                                 LogDebug("<<< priority is HIGH");
451                                         }
452                                         else
453                                         {
454                                                 m_result.push_back(TRUE);
455                                                 LogDebug("<<< priority is LOW OR NORMAL");
456                                         }
457                                 }
458                                 return;
459                         }
460                         if(attrName.compare("body")==0){
461                                 LogDebug("<<< value:[" << value << "]");
462                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
463                                 LogDebug("<<< m_body:[" << m_body << "]");
464
465                                 valueString = m_body;
466                                 if(getMatchFlagResult(value, valueString, matchFlag))
467                                 {
468                                         m_result.push_back(TRUE);
469                                         LogDebug("<<< body is same");
470                                 }
471                                 else
472                                 {
473                                         m_result.push_back(FALSE);
474                                         LogDebug("<<< body is different");
475                                 }
476                                 return;
477                         }
478
479                         if(attrName.compare("subject")==0){
480                                 LogDebug("<<< value:[" << value << "]");
481                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
482                                 LogDebug("<<< m_subject:[" << m_subject << "]");
483
484                                 valueString = m_subject;
485                                 if(getMatchFlagResult(value, valueString, matchFlag))
486                                 {
487                                         m_result.push_back(TRUE);
488                                         LogDebug("<<< subject is same");
489                                 }
490                                 else
491                                 {
492                                         m_result.push_back(FALSE);
493                                         LogDebug("<<< subject is different");
494                                 }
495                                 return;
496                         }
497
498                         if(attrName.compare("from")==0){
499                                 LogDebug("<<< value:[" << value << "]");
500                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
501                                 LogDebug("<<< m_from:[" << m_from << "]");
502
503                                 valueString = m_from;
504                                 if(getMatchFlagResult(value, valueString, matchFlag))
505                                 {
506                                         m_result.push_back(TRUE);
507                                         LogDebug("<<< from is same");
508                                 }
509                                 else
510                                 {
511                                         m_result.push_back(FALSE);
512                                         LogDebug("<<< from is different");
513                                 }
514                                 return;
515                         }
516
517                         if(attrName.compare("to")==0){
518                                 LogDebug("<<< value:[" << value << "]");
519                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
520                                 LogDebug("<<< m_to.size :[" << m_to.size() << "]");
521
522                                 bool result = FALSE;
523                                 for(unsigned int i=0; i < m_to.size(); i++)
524                                 {
525                                         valueString = m_to[i];
526                                         result = result || getMatchFlagResult(value, valueString, matchFlag);
527                                 }
528                                 LogDebug("<<< to compare result is :" << result);
529                                 m_result.push_back(result);
530                                 return;
531                         }
532
533                         if(attrName.compare("cc")==0){
534                                 LogDebug("<<< value:[" << value << "]");
535                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
536                                 LogDebug("<<< m_cc.size :[" << m_cc.size() << "]");
537
538                                 bool result = FALSE;
539                                 for(unsigned int i=0; i < m_cc.size(); i++)
540                                 {
541                                         valueString = m_cc[i];
542                                         result = result || getMatchFlagResult(value, valueString, matchFlag);
543                                 }
544                                 LogDebug("<<< cc compare result is : " << result);
545                                 m_result.push_back(result);
546                                 return;
547                         }
548
549                         if(attrName.compare("bcc")==0){
550                                 LogDebug("<<< value:[" << value << "]");
551                                 LogDebug("<<< value->toString():[" << value->toString() << "]");
552                                 LogDebug("<<< m_cc.size :[" << m_bcc.size() << "]");
553
554                                 bool result = FALSE;
555                                 for(unsigned int i=0; i < m_bcc.size(); i++)
556                                 {
557                                         valueString = m_bcc[i];
558                                         result = result || getMatchFlagResult(value, valueString, matchFlag);
559                                 }
560                                 LogDebug("<<< bcc compare result is : " << result);
561                                 m_result.push_back(result);
562                                 return;
563                         }
564
565                         LogDebug(">>>");
566                 }
567
568                 int StorageChangesMessageGenerator::convertMessageType(std::string& stringType){
569                         LogDebug("<<< stringType:[" << stringType << "]");
570
571                         int retMessageType = -1;
572
573                         if(stringType.compare("messaging.sms") ==0){
574                                 retMessageType = Api::Messaging::SMS;
575                         }else if(stringType.compare("messaging.mms") ==0){
576                                 retMessageType = Api::Messaging::MMS;
577                         }else if(stringType.compare("messaging.email") ==0){
578                                 retMessageType = Api::Messaging::EMAIL;
579                         }else{
580                                 LogError("invalid type:[" << stringType << "]");
581                                 return -1;
582                         }
583
584                         LogDebug(">>> retMessageType:" << retMessageType);
585                         return retMessageType;
586                 }
587
588                 int StorageChangesMessageGenerator::convertFolderType(std::string& stringType){
589                         LogDebug("<<< stringType:[" << stringType << "]");
590
591                         int retMessageType = -1;
592
593                         if(stringType.compare("INBOX") ==0){
594                                 retMessageType = Api::Messaging::INBOX;
595                         }else if(stringType.compare("OUTBOX") ==0){
596                                 retMessageType = Api::Messaging::OUTBOX;
597                         }else if(stringType.compare("DRAFTBOX") ==0){
598                                 retMessageType = Api::Messaging::DRAFTBOX;
599                         }else if(stringType.compare("SENTBOX") ==0){
600                                 retMessageType = Api::Messaging::SENTBOX;
601                         }else{
602                                 LogError("invalid type:[" << stringType << "]");
603                                 return -1;
604                         }
605
606                         LogDebug(">>> retMessageType:" << retMessageType);
607                         return retMessageType;
608                 }
609
610                 void StorageChangesMessageGenerator::visitAttributeRange(std::string& attrName, Api::Tizen::AnyPtr& initialValue, Api::Tizen::AnyPtr& endValue, int depth) {
611                         struct tm startTime;
612                         struct tm endTime;
613                         bool result = FALSE;
614
615                         if(attrName.compare("timestamp")==0){
616                                 startTime = convertToTimeFormat(initialValue->toString());
617                                 endTime = convertToTimeFormat(endValue->toString());
618                                 result = getBetweenRangeClause(startTime, endTime);
619                                 if(result == TRUE)
620                                 {
621                                         LogDebug("<<< timestamp is in range");
622                                         m_result.push_back(TRUE);
623                                 }else{
624                                         LogDebug("<<< timestamp is out of range");
625                                         m_result.push_back(FALSE);
626                                 }
627                         }
628                 }
629
630                 bool StorageChangesMessageGenerator::getMatchFlagResult(Api::Tizen::AnyPtr& value, std::string& valueString, MatchFlag& matchFlag)
631                 {
632                                 std::vector<std::string>::iterator iter;
633                         bool result = FALSE;
634                         if(matchFlag == Api::Tizen::MATCH_EXACTLY){
635                                 LogDebug("STRING_MATCH_EXCACTLY");
636                                 result = result || getMatchExactlyClause(valueString, value);
637                         }else if(matchFlag == Api::Tizen::MATCH_CONTAINS){
638                                 LogDebug("STRING_MATCH_CONTAINS");
639                                 result = result || getMatchContainsClause(valueString, value);                                          
640                         }else if(matchFlag == Api::Tizen::MATCH_STARTSWITH){
641                                 LogDebug("STRING_MATCH_STARTSWITH");
642                                 result = result || getMatchStartwithClause(valueString, value);
643                         }else if(matchFlag == Api::Tizen::MATCH_ENDSWITH){
644                                 LogDebug("STRING_MATCH_ENDSWITH");
645                                 result = result || getMatchEndwithClause(valueString, value);                           
646                         }else{
647                                 LogDebug("[ERROR]invalid match flag : iter:" << *iter);
648                         }
649                         return result;
650                 }
651
652                 bool StorageChangesMessageGenerator::getCompareResult()
653                 {
654                         bool result;
655                         LogDebug("m_result.size() " << m_result.size());                                
656                         result = m_result.back();
657                         m_result.pop_back();
658                         LogDebug("result = " << result);        
659                         return result;
660                 }
661         }
662         }               //namespace Platform
663 }               //namespace WrtPlugins