Implement security origin dao for setting menu
[framework/web/wrt-commons.git] / modules / security_origin_dao / include / wrt-commons / security-origin-dao / security_origin_dao.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    securoty_origin_dao.h
18  * @author  Jihoon Chung (jihoon.chung@samsung.com)
19  * @version 1.0
20  * @brief   This file contains the declaration of security origin dao
21  */
22 #ifndef _SECURITY_ORIGIN_DAO_H_
23 #define _SECURITY_ORIGIN_DAO_H_
24
25 #include <dpl/db/thread_database_support.h>
26 #include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
27
28 namespace SecurityOriginDB {
29
30 class SecurityOriginDAO
31 {
32   public:
33     class Exception
34     {
35       public:
36         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
37         DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
38         DECLARE_EXCEPTION_TYPE(Base, DataNotExist)
39     };
40
41     explicit SecurityOriginDAO(int handle);
42     virtual ~SecurityOriginDAO();
43     SecurityOriginDataList getSecurityOriginDataList();
44     Result getResult(const SecurityOriginData &securityOriginData);
45     void setSecurityOriginData(const SecurityOriginData &securityOriginData,
46                                const Result result);
47     void removeSecurityOriginData(const SecurityOriginData &securityOriginData);
48   private:
49     std::string m_securityOriginDBPath;
50     DPL::DB::ThreadDatabaseSupport m_securityOriginDBInterface;
51     bool hasResult(const SecurityOriginData &securityOriginData);
52 };
53
54 typedef std::shared_ptr<SecurityOriginDAO> SecurityOriginDAOPtr;
55
56 } // namespace SecurityOriginDB
57
58 #endif // _SECURITY_ORIGIN_DAO_H_