27d3f09d690912fde190fe0198018ea9acd06e3d
[framework/web/wrt-plugins-common.git] / src / modules / API / Task / ITask.h
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  * @file        ITask.h
18  * @author      Shi Hezhang (hezhang.shi@samsung.com)
19  * @author      Pan Rui (r.pan@samsung.com)
20  * @version     0.1
21  */
22
23 #ifndef WRTDEVICEAPIS_TASK_ITASK_H_
24 #define WRTDEVICEAPIS_TASK_ITASK_H_
25
26 #include <string>
27 #include <dpl/log/log.h>
28 #include <dpl/shared_ptr.h>
29 #include <Task/CalendarTask.h>
30 #include <Task/TaskFilter.h>
31 #include <Task/IEventAddTask.h>
32 #include <Task/IEventCreateTask.h>
33 #include <Task/IEventDeleteTask.h>
34 #include <Task/IEventFindTasks.h>
35 #include <Task/IEventUpdateTask.h>
36
37 namespace WrtDeviceApis {
38 namespace Task {
39 namespace Api {
40
41 class ITask : public Commons::EventRequestReceiver< IEventAddTask >,
42     public Commons::EventRequestReceiver< IEventDeleteTask>,
43     public Commons::EventRequestReceiver< IEventUpdateTask>,
44     public Commons::EventRequestReceiver< IEventFindTasks>,
45     public Commons::EventRequestReceiver< IEventCreateTask>
46 {
47   public:
48
49     typedef enum
50     {
51         SIM_TASK,
52         DEVICE_TASK
53     } TaskType;
54
55     ITask();
56     virtual ~ITask();
57     virtual void                createTask(IEventCreateTaskPtr &event);
58     virtual void                addTask(IEventAddTaskPtr &event);
59     virtual void                updateTask(IEventUpdateTaskPtr &event);
60     virtual void                deleteTask(IEventDeleteTaskPtr &event);
61     virtual void                findTasks(IEventFindTasksPtr &event);
62
63     virtual std::string         getName() const
64     {
65         return m_name;
66     }
67     virtual void                setName(const std::string &value)
68     {
69         m_name = value;
70     }
71     virtual TaskType                getType() const
72     {
73         return m_type;
74     }
75     virtual void                setType(const TaskType value)
76     {
77         m_type = value;
78     }
79     virtual int                 getId() const
80     {
81         return m_id;
82     }
83     virtual void                setId(const int value)
84     {
85         m_id = value;
86     }
87     virtual int                 getAccountId() const
88     {
89         return m_accountId;
90     }
91     virtual void                setAccountId(const int value)
92     {
93         m_accountId = value;
94     }
95   protected:
96     int m_id;
97     int m_accountId;
98     std::string m_name;
99     TaskType m_type;
100
101     virtual void OnRequestReceived(const IEventAddTaskPtr &event) = 0;
102     virtual void OnRequestReceived(const IEventDeleteTaskPtr &event) = 0;
103     virtual void OnRequestReceived(const IEventUpdateTaskPtr &event) = 0;
104     virtual void OnRequestReceived(const IEventFindTasksPtr &event) = 0;
105     virtual void OnRequestReceived(const IEventCreateTaskPtr &event) = 0;
106 };
107
108 typedef DPL::SharedPtr<ITask> ITaskPtr;
109
110 }
111 }
112 }
113
114 #endif //WRTDEVICEAPIS_TASK_ITASK_H_