LibreOffice Module connectivity (master) 1
VGroup.cxx
Go to the documentation of this file.
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 <sdbcx/VGroup.hxx>
24
25
26using namespace ::connectivity::sdbcx;
27using namespace ::connectivity;
28using namespace ::dbtools;
29using namespace ::com::sun::star::sdbc;
30using namespace ::com::sun::star::uno;
31using namespace ::com::sun::star::container;
32using namespace ::com::sun::star::lang;
33using namespace ::com::sun::star::beans;
34
35IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
36
37OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
38 , ODescriptor(OGroup_BASE::rBHelper,_bCase)
39{
40}
41
42OGroup::OGroup(const OUString& Name, bool _bCase) : OGroup_BASE(m_aMutex)
43 ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
44{
45 m_Name = Name;
46}
47
49{
50}
51
52Any SAL_CALL OGroup::queryInterface( const Type & rType )
53{
54 Any aRet = ODescriptor::queryInterface( rType);
55 return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
56}
57
58Sequence< Type > SAL_CALL OGroup::getTypes( )
59{
60 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
61}
62
64{
66
67 ::osl::MutexGuard aGuard(m_aMutex);
68
69 if(m_pUsers)
70 m_pUsers->disposing();
71}
72
74{
75 Sequence< Property > aProps;
76 describeProperties(aProps);
77 return new ::cppu::OPropertyArrayHelper(aProps);
78}
79
81{
82 return *getArrayHelper();
83}
84
85Reference< XNameAccess > SAL_CALL OGroup::getUsers( )
86{
87 ::osl::MutexGuard aGuard(m_aMutex);
88 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
89
90 try
91 {
92 if ( !m_pUsers )
94 }
95 catch( const RuntimeException& )
96 {
97 // allowed to leave this method
98 throw;
99 }
100 catch( const Exception& )
101 {
102 // allowed
103 }
104
105 return m_pUsers.get();
106}
107
108
109sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
110{
111 ::osl::MutexGuard aGuard(m_aMutex);
112 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
113
114 return 0;
115}
116
117sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
118{
119 ::osl::MutexGuard aGuard(m_aMutex);
120 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
121
122 return 0;
123}
124
125void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
126{
127 ::osl::MutexGuard aGuard(m_aMutex);
128 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
129 throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
130}
131
132void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
133{
134 ::osl::MutexGuard aGuard(m_aMutex);
135 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
136 throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
137}
138
139css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( )
140{
141 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
142}
143
144OUString SAL_CALL OGroup::getName( )
145{
146 return m_Name;
147}
148
149void SAL_CALL OGroup::setName( const OUString& /*aName*/ )
150{
151 throwFeatureNotImplementedRuntimeException( "XNamed::setName", *this );
152}
153
154// XInterface
155void SAL_CALL OGroup::acquire() noexcept
156{
157 OGroup_BASE::acquire();
158}
159
160void SAL_CALL OGroup::release() noexcept
161{
162 OGroup_BASE::release();
163}
164
165
166/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group")
::cppu::IPropertyArrayHelper * getArrayHelper()
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void disposing(std::unique_lock< std::mutex > &rGuard)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
Definition: VDescriptor.cxx:94
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: VGroup.cxx:52
virtual void SAL_CALL release() noexcept override
Definition: VGroup.cxx:160
virtual void SAL_CALL acquire() noexcept override
Definition: VGroup.cxx:155
virtual sal_Int32 SAL_CALL getGrantablePrivileges(const OUString &objName, sal_Int32 objType) override
Definition: VGroup.cxx:117
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: VGroup.cxx:73
virtual void SAL_CALL revokePrivileges(const OUString &objName, sal_Int32 objType, sal_Int32 objPrivileges) override
Definition: VGroup.cxx:132
virtual ~OGroup() override
virtual OUString SAL_CALL getName() override
Definition: VGroup.cxx:144
std::unique_ptr< OUsers > m_pUsers
Definition: VGroup.hxx:52
virtual void SAL_CALL disposing() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: VGroup.cxx:58
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: VGroup.cxx:80
virtual sal_Int32 SAL_CALL getPrivileges(const OUString &objName, sal_Int32 objType) override
Definition: VGroup.cxx:109
virtual void SAL_CALL grantPrivileges(const OUString &objName, sal_Int32 objType, sal_Int32 objPrivileges) override
Definition: VGroup.cxx:125
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers() override
Definition: VGroup.cxx:85
virtual void SAL_CALL setName(const OUString &aName) override
Definition: VGroup.cxx:149
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
mutable::osl::Mutex m_aMutex
std::mutex m_aMutex
@ Exception
Type
::cppu::WeakComponentImplHelper< css::sdbcx::XUsersSupplier, css::sdbcx::XAuthorizable, css::container::XNamed, css::lang::XServiceInfo > OGroup_BASE
Definition: VGroup.hxx:41
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
void throwFeatureNotImplementedRuntimeException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext)
void throwFeatureNotImplementedSQLException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext, const Any &_rNextException)
OUString Name