bump product version to 4.1.6.2
[LibreOffice.git] / connectivity / source / sdbcx / VGroup.cxx
blob72a2be7ddb192bf116de62c2120c02d874d6389c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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;
39 IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
40 // -------------------------------------------------------------------------
41 OGroup::OGroup(sal_Bool _bCase) : OGroup_BASE(m_aMutex)
42 , ODescriptor(OGroup_BASE::rBHelper,_bCase)
43 , m_pUsers(NULL)
46 // -------------------------------------------------------------------------
47 OGroup::OGroup(const OUString& _Name,sal_Bool _bCase) : OGroup_BASE(m_aMutex)
48 ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
49 ,m_pUsers(NULL)
51 m_Name = _Name;
53 // -------------------------------------------------------------------------
54 OGroup::~OGroup()
56 delete m_pUsers;
58 // -------------------------------------------------------------------------
59 Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException)
61 Any aRet = ODescriptor::queryInterface( rType);
62 return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
64 // -------------------------------------------------------------------------
65 Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException)
67 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
69 // -------------------------------------------------------------------------
70 void OGroup::disposing(void)
72 OPropertySetHelper::disposing();
74 ::osl::MutexGuard aGuard(m_aMutex);
76 if(m_pUsers)
77 m_pUsers->disposing();
79 // -------------------------------------------------------------------------
80 ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
82 Sequence< Property > aProps;
83 describeProperties(aProps);
84 return new ::cppu::OPropertyArrayHelper(aProps);
86 // -------------------------------------------------------------------------
87 ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
89 return *const_cast<OGroup*>(this)->getArrayHelper();
91 // -------------------------------------------------------------------------
92 Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException)
94 ::osl::MutexGuard aGuard(m_aMutex);
95 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
97 try
99 if ( !m_pUsers )
100 refreshUsers();
102 catch( const RuntimeException& )
104 // allowed to leave this method
105 throw;
107 catch( const Exception& )
109 // allowed
112 return const_cast<OGroup*>(this)->m_pUsers;
114 // -------------------------------------------------------------------------
116 sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
118 ::osl::MutexGuard aGuard(m_aMutex);
119 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
121 return 0;
123 // -------------------------------------------------------------------------
124 sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
126 ::osl::MutexGuard aGuard(m_aMutex);
127 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
129 return 0;
131 // -------------------------------------------------------------------------
132 void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
134 ::osl::MutexGuard aGuard(m_aMutex);
135 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
136 throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
138 // -------------------------------------------------------------------------
139 void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
141 ::osl::MutexGuard aGuard(m_aMutex);
142 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
143 throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
145 // -----------------------------------------------------------------------------
146 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
148 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
150 // -----------------------------------------------------------------------------
151 OUString SAL_CALL OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException)
153 return m_Name;
155 // -----------------------------------------------------------------------------
156 void SAL_CALL OGroup::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException)
158 throwFeatureNotImplementedException( "XNamed::setName", *this );
160 // -----------------------------------------------------------------------------
161 // XInterface
162 void SAL_CALL OGroup::acquire() throw()
164 OGroup_BASE::acquire();
166 // -----------------------------------------------------------------------------
167 void SAL_CALL OGroup::release() throw()
169 OGroup_BASE::release();
171 // -----------------------------------------------------------------------------
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */