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 <stdio.h>
22 : #include "connectivity/sdbcx/VGroup.hxx"
23 : #include <com/sun/star/lang/DisposedException.hpp>
24 : #include <com/sun/star/sdbcx/Privilege.hpp>
25 : #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
26 : #include <comphelper/sequence.hxx>
27 : #include <connectivity/dbexception.hxx>
28 :
29 :
30 : using namespace ::connectivity::sdbcx;
31 : using namespace ::connectivity;
32 : using namespace ::dbtools;
33 : using namespace ::com::sun::star::sdbc;
34 : using namespace ::com::sun::star::uno;
35 : using namespace ::com::sun::star::container;
36 : using namespace ::com::sun::star::lang;
37 : using namespace ::com::sun::star::beans;
38 :
39 0 : IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
40 :
41 0 : OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
42 : , ODescriptor(OGroup_BASE::rBHelper,_bCase)
43 0 : , m_pUsers(NULL)
44 : {
45 0 : }
46 :
47 0 : OGroup::OGroup(const OUString& _Name, bool _bCase) : OGroup_BASE(m_aMutex)
48 : ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
49 0 : ,m_pUsers(NULL)
50 : {
51 0 : m_Name = _Name;
52 0 : }
53 :
54 0 : OGroup::~OGroup()
55 : {
56 0 : delete m_pUsers;
57 0 : }
58 :
59 0 : Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
60 : {
61 0 : Any aRet = ODescriptor::queryInterface( rType);
62 0 : return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
63 : }
64 :
65 0 : Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException, std::exception)
66 : {
67 0 : return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
68 : }
69 :
70 0 : void OGroup::disposing(void)
71 : {
72 0 : OPropertySetHelper::disposing();
73 :
74 0 : ::osl::MutexGuard aGuard(m_aMutex);
75 :
76 0 : if(m_pUsers)
77 0 : m_pUsers->disposing();
78 0 : }
79 :
80 0 : ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
81 : {
82 0 : Sequence< Property > aProps;
83 0 : describeProperties(aProps);
84 0 : return new ::cppu::OPropertyArrayHelper(aProps);
85 : }
86 :
87 0 : ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
88 : {
89 0 : return *const_cast<OGroup*>(this)->getArrayHelper();
90 : }
91 :
92 0 : Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, std::exception)
93 : {
94 0 : ::osl::MutexGuard aGuard(m_aMutex);
95 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
96 :
97 : try
98 : {
99 0 : if ( !m_pUsers )
100 0 : refreshUsers();
101 : }
102 0 : catch( const RuntimeException& )
103 : {
104 : // allowed to leave this method
105 0 : throw;
106 : }
107 0 : catch( const Exception& )
108 : {
109 : // allowed
110 : }
111 :
112 0 : return const_cast<OGroup*>(this)->m_pUsers;
113 : }
114 :
115 :
116 0 : sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
117 : {
118 0 : ::osl::MutexGuard aGuard(m_aMutex);
119 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
120 :
121 0 : return 0;
122 : }
123 :
124 0 : sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
125 : {
126 0 : ::osl::MutexGuard aGuard(m_aMutex);
127 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
128 :
129 0 : return 0;
130 : }
131 :
132 0 : void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
133 : {
134 0 : ::osl::MutexGuard aGuard(m_aMutex);
135 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
136 0 : throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
137 0 : }
138 :
139 0 : void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
140 : {
141 0 : ::osl::MutexGuard aGuard(m_aMutex);
142 0 : checkDisposed(OGroup_BASE::rBHelper.bDisposed);
143 0 : throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
144 0 : }
145 :
146 0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
147 : {
148 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
149 : }
150 :
151 0 : OUString SAL_CALL OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
152 : {
153 0 : return m_Name;
154 : }
155 :
156 0 : void SAL_CALL OGroup::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
157 : {
158 0 : throwFeatureNotImplementedException( "XNamed::setName", *this );
159 0 : }
160 :
161 : // XInterface
162 0 : void SAL_CALL OGroup::acquire() throw()
163 : {
164 0 : OGroup_BASE::acquire();
165 0 : }
166 :
167 0 : void SAL_CALL OGroup::release() throw()
168 : {
169 0 : OGroup_BASE::release();
170 0 : }
171 :
172 :
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|