bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / sdbcx / VGroup.cxx
blobc5e27d85583f9d5b4c500da034c5ccd8bdec25c1
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 <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>
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;
38 IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
40 OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
41 , ODescriptor(OGroup_BASE::rBHelper,_bCase)
42 , m_pUsers(NULL)
46 OGroup::OGroup(const OUString& _Name, bool _bCase) : OGroup_BASE(m_aMutex)
47 ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
48 ,m_pUsers(NULL)
50 m_Name = _Name;
53 OGroup::~OGroup()
55 delete m_pUsers;
58 Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
60 Any aRet = ODescriptor::queryInterface( rType);
61 return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
64 Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException, std::exception)
66 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
69 void OGroup::disposing()
71 OPropertySetHelper::disposing();
73 ::osl::MutexGuard aGuard(m_aMutex);
75 if(m_pUsers)
76 m_pUsers->disposing();
79 ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
81 Sequence< Property > aProps;
82 describeProperties(aProps);
83 return new ::cppu::OPropertyArrayHelper(aProps);
86 ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
88 return *getArrayHelper();
91 Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, std::exception)
93 ::osl::MutexGuard aGuard(m_aMutex);
94 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
96 try
98 if ( !m_pUsers )
99 refreshUsers();
101 catch( const RuntimeException& )
103 // allowed to leave this method
104 throw;
106 catch( const Exception& )
108 // allowed
111 return const_cast<OGroup*>(this)->m_pUsers;
115 sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
117 ::osl::MutexGuard aGuard(m_aMutex);
118 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
120 return 0;
123 sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
125 ::osl::MutexGuard aGuard(m_aMutex);
126 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
128 return 0;
131 void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
133 ::osl::MutexGuard aGuard(m_aMutex);
134 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
135 throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
138 void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
140 ::osl::MutexGuard aGuard(m_aMutex);
141 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
142 throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
145 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
147 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
150 OUString SAL_CALL OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
152 return m_Name;
155 void SAL_CALL OGroup::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
157 throwFeatureNotImplementedRuntimeException( "XNamed::setName", *this );
160 // XInterface
161 void SAL_CALL OGroup::acquire() throw()
163 OGroup_BASE::acquire();
166 void SAL_CALL OGroup::release() throw()
168 OGroup_BASE::release();
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */