Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <connectivity/sdbcx/VGroup.hxx>
22 : #include <com/sun/star/lang/DisposedException.hpp>
23 : #include <com/sun/star/sdbcx/Privilege.hpp>
24 : #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
25 : #include <comphelper/sequence.hxx>
26 : #include <connectivity/dbexception.hxx>
27 :
28 :
29 : using namespace ::connectivity::sdbcx;
30 : using namespace ::connectivity;
31 : using namespace ::dbtools;
32 : using namespace ::com::sun::star::sdbc;
33 : using namespace ::com::sun::star::uno;
34 : using namespace ::com::sun::star::container;
35 : using namespace ::com::sun::star::lang;
36 : using namespace ::com::sun::star::beans;
37 :
38 0 : IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
39 :
40 0 : OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
41 : , ODescriptor(OGroup_BASE::rBHelper,_bCase)
42 0 : , m_pUsers(NULL)
43 : {
44 0 : }
45 :
46 0 : OGroup::OGroup(const OUString& _Name, bool _bCase) : OGroup_BASE(m_aMutex)
47 : ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
48 0 : ,m_pUsers(NULL)
49 : {
50 0 : m_Name = _Name;
51 0 : }
52 :
53 0 : OGroup::~OGroup()
54 : {
55 0 : delete m_pUsers;
56 0 : }
57 :
58 0 : Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
59 : {
60 0 : Any aRet = ODescriptor::queryInterface( rType);
61 0 : return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
62 : }
63 :
64 0 : Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException, std::exception)
65 : {
66 0 : return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
67 : }
68 :
69 0 : void OGroup::disposing()
70 : {
71 0 : OPropertySetHelper::disposing();
72 :
73 0 : ::osl::MutexGuard aGuard(m_aMutex);
74 :
75 0 : if(m_pUsers)
76 0 : m_pUsers->disposing();
77 0 : }
78 :
79 0 : ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
80 : {
81 0 : Sequence< Property > aProps;
82 0 : describeProperties(aProps);
83 0 : return new ::cppu::OPropertyArrayHelper(aProps);
84 : }
85 :
86 0 : ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
87 : {
88 0 : return *getArrayHelper();
89 : }
90 :
91 0 : Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, std::exception)
92 : {
93 0 : ::osl::MutexGuard aGuard(m_aMutex);
94 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
95 :
96 : try
97 : {
98 0 : if ( !m_pUsers )
99 0 : refreshUsers();
100 : }
101 0 : catch( const RuntimeException& )
102 : {
103 : // allowed to leave this method
104 0 : throw;
105 : }
106 0 : catch( const Exception& )
107 : {
108 : // allowed
109 : }
110 :
111 0 : return m_pUsers;
112 : }
113 :
114 :
115 0 : sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
116 : {
117 0 : ::osl::MutexGuard aGuard(m_aMutex);
118 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
119 :
120 0 : return 0;
121 : }
122 :
123 0 : sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
124 : {
125 0 : ::osl::MutexGuard aGuard(m_aMutex);
126 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
127 :
128 0 : return 0;
129 : }
130 :
131 0 : void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
132 : {
133 0 : ::osl::MutexGuard aGuard(m_aMutex);
134 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
135 0 : throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
136 0 : }
137 :
138 0 : void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
139 : {
140 0 : ::osl::MutexGuard aGuard(m_aMutex);
141 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
142 0 : throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
143 0 : }
144 :
145 0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
146 : {
147 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
148 : }
149 :
150 0 : OUString SAL_CALL OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
151 : {
152 0 : return m_Name;
153 : }
154 :
155 0 : void SAL_CALL OGroup::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
156 : {
157 0 : throwFeatureNotImplementedRuntimeException( "XNamed::setName", *this );
158 0 : }
159 :
160 : // XInterface
161 0 : void SAL_CALL OGroup::acquire() throw()
162 : {
163 0 : OGroup_BASE::acquire();
164 0 : }
165 :
166 0 : void SAL_CALL OGroup::release() throw()
167 : {
168 0 : OGroup_BASE::release();
169 0 : }
170 :
171 :
172 :
173 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|