2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _CALENDAR_FILTER_H_
19 #define _CALENDAR_FILTER_H_
22 #include <dpl/shared_ptr.h>
23 #include <API/Filter/IFilterVisitor.h>
24 #include <API/Filter/SortMode.h>
25 #include "API/Calendar/CalendarEvent.h"
26 #include "CalendarQuery.h"
27 #include <calendar-svc-provider.h>
29 using namespace TizenApis::Api::Calendar;
35 // List of attributes that can be used as the filter argument.
36 #define CALENDAR_FILTER_ATTRIBUTE_ID_UID "id.uid"
37 #define CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE "lastModificationDate"
38 #define CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION "description"
39 #define CALENDAR_FILTER_ATTRIBUTE_SUMMARY "summary"
40 #define CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY "isAllDay"
41 #define CALENDAR_FILTER_ATTRIBUTE_START_DATE "startDate"
42 //#define CALENDAR_FILTER_ATTRIBUTE_DURATION "duration"
43 #define CALENDAR_FILTER_ATTRIBUTE_LOCATION "location"
44 #define CALENDAR_FILTER_ATTRIBUTE_LATITUDE "geolocation.latitude"
45 #define CALENDAR_FILTER_ATTRIBUTE_LONGITUDE "geolocation.longitude"
46 #define CALENDAR_FILTER_ATTRIBUTE_ORGANIZER "organizer"
47 #define CALENDAR_FILTER_ATTRIBUTE_VISIBILITY "visibility"
48 #define CALENDAR_FILTER_ATTRIBUTE_STATUS "status"
49 #define CALENDAR_FILTER_ATTRIBUTE_PRIORITY "priority"
50 //#define CALENDAR_FILTER_ATTRIBUTE_ALARMS "alarms"
51 #define CALENDAR_FILTER_ATTRIBUTE_CATEGORIES "categories"
52 //#define CALENDAR_FILTER_ATTRIBUTE_ATTENDEES "attendees"
53 #define CALENDAR_FILTER_ATTRIBUTE_DUE_DATE "dueDate"
54 //#define CALENDAR_FILTER_ATTRIBUTE_COMPLETED_DATE "completedDate"
55 #define CALENDAR_FILTER_ATTRIBUTE_PROGRESS "progress"
56 //#define CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED "isDetached"
57 #define CALENDAR_FILTER_ATTRIBUTE_END_DATE "endDate"
58 #define CALENDAR_FILTER_ATTRIBUTE_AVAILABILITY "availability"
59 //#define CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE "recurrenceRule"
61 class CalendarFilter: public TizenApis::Api::Tizen::IFilterVisitor
65 static std::map<std::string, std::string> m_attributeMap;
69 virtual ~CalendarFilter();
71 virtual void visitPreComposite(TizenApis::Api::Tizen::FilterType& type, int depth);
73 virtual void visitInComposite(TizenApis::Api::Tizen::FilterType& type, int depth);
75 virtual void visitPostComposite(TizenApis::Api::Tizen::FilterType& type, int depth);
77 virtual void visitAttribute(std::string& attrName,
78 TizenApis::Api::Tizen::MatchFlag& matchFlag,
79 TizenApis::Api::Tizen::AnyPtr& matchValue,
82 virtual void visitAttributeRange(std::string& attrName,
83 TizenApis::Api::Tizen::AnyPtr& initialValue,
84 TizenApis::Api::Tizen::AnyPtr& endValue,
87 std::string getResult() const;
89 bool executeQuery(std::string &query, CalendarEventListPtr calendarListPtr);
91 std::string makeQuerySortMode(TizenApis::Api::Tizen::SortModeArrayPtr attr);
94 bool convertToCalendar(calendar_query_s *query_log, CalendarEventListPtr calendarListPtr);
95 std::string convertStringToValue(const std::string attrName, const std::string valueString);
96 std::string concatenateFilterAttributes();
99 typedef DPL::SharedPtr<CalendarFilter> CalendarFilterPtr;
105 #endif /* _CALENDAR_FILTER_H_ */