1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include "connectivity/sdbcx/VGroup.hxx"
29cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
30cdf0e10cSrcweir #include <com/sun/star/sdbcx/Privilege.hpp>
31cdf0e10cSrcweir #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
32cdf0e10cSrcweir #include <comphelper/sequence.hxx>
33cdf0e10cSrcweir #include <connectivity/dbexception.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // -------------------------------------------------------------------------
36cdf0e10cSrcweir using namespace ::connectivity::sdbcx;
37cdf0e10cSrcweir using namespace ::connectivity;
38cdf0e10cSrcweir using namespace ::dbtools;
39cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
40cdf0e10cSrcweir using namespace ::com::sun::star::uno;
41cdf0e10cSrcweir using namespace ::com::sun::star::container;
42cdf0e10cSrcweir using namespace ::com::sun::star::lang;
43cdf0e10cSrcweir using namespace ::com::sun::star::beans;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
46cdf0e10cSrcweir // -------------------------------------------------------------------------
OGroup(sal_Bool _bCase)47cdf0e10cSrcweir OGroup::OGroup(sal_Bool _bCase) :	OGroup_BASE(m_aMutex)
48cdf0e10cSrcweir 				,	ODescriptor(OGroup_BASE::rBHelper,_bCase)
49cdf0e10cSrcweir 				,	m_pUsers(NULL)
50cdf0e10cSrcweir {
51cdf0e10cSrcweir }
52cdf0e10cSrcweir // -------------------------------------------------------------------------
OGroup(const::rtl::OUString & _Name,sal_Bool _bCase)53cdf0e10cSrcweir OGroup::OGroup(const ::rtl::OUString& _Name,sal_Bool _bCase) :	OGroup_BASE(m_aMutex)
54cdf0e10cSrcweir 						,ODescriptor(OGroup_BASE::rBHelper,_bCase)
55cdf0e10cSrcweir 						,m_pUsers(NULL)
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	m_Name = _Name;
58cdf0e10cSrcweir }
59cdf0e10cSrcweir // -------------------------------------------------------------------------
~OGroup()60cdf0e10cSrcweir OGroup::~OGroup()
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	delete m_pUsers;
63cdf0e10cSrcweir }
64cdf0e10cSrcweir // -------------------------------------------------------------------------
queryInterface(const Type & rType)65cdf0e10cSrcweir Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir     Any aRet = ODescriptor::queryInterface( rType);
68cdf0e10cSrcweir 	return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
69cdf0e10cSrcweir }
70cdf0e10cSrcweir // -------------------------------------------------------------------------
getTypes()71cdf0e10cSrcweir Sequence< Type > SAL_CALL OGroup::getTypes(  ) throw(RuntimeException)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
74cdf0e10cSrcweir }
75cdf0e10cSrcweir // -------------------------------------------------------------------------
disposing(void)76cdf0e10cSrcweir void OGroup::disposing(void)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	OPropertySetHelper::disposing();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	if(m_pUsers)
83cdf0e10cSrcweir 		m_pUsers->disposing();
84cdf0e10cSrcweir }
85cdf0e10cSrcweir // -------------------------------------------------------------------------
createArrayHelper() const86cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	Sequence< Property > aProps;
89cdf0e10cSrcweir 	describeProperties(aProps);
90cdf0e10cSrcweir 	return new ::cppu::OPropertyArrayHelper(aProps);
91cdf0e10cSrcweir }
92cdf0e10cSrcweir // -------------------------------------------------------------------------
getInfoHelper()93cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	return *const_cast<OGroup*>(this)->getArrayHelper();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir // -------------------------------------------------------------------------
getUsers()98cdf0e10cSrcweir Reference< XNameAccess > SAL_CALL OGroup::getUsers(  ) throw(RuntimeException)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
101cdf0e10cSrcweir 	checkDisposed(OGroup_BASE::rBHelper.bDisposed);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	try
104cdf0e10cSrcweir 	{
105cdf0e10cSrcweir 		if ( !m_pUsers )
106cdf0e10cSrcweir 			refreshUsers();
107cdf0e10cSrcweir 	}
108cdf0e10cSrcweir 	catch( const RuntimeException& )
109cdf0e10cSrcweir 	{
110cdf0e10cSrcweir 		// allowed to leave this method
111cdf0e10cSrcweir 		throw;
112cdf0e10cSrcweir 	}
113cdf0e10cSrcweir 	catch( const Exception& )
114cdf0e10cSrcweir 	{
115cdf0e10cSrcweir 		// allowed
116cdf0e10cSrcweir 	}
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	return const_cast<OGroup*>(this)->m_pUsers;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir // -------------------------------------------------------------------------
121cdf0e10cSrcweir 
getPrivileges(const::rtl::OUString &,sal_Int32)122cdf0e10cSrcweir sal_Int32 SAL_CALL OGroup::getPrivileges( const ::rtl::OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
125cdf0e10cSrcweir 	checkDisposed(OGroup_BASE::rBHelper.bDisposed);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	return 0;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir // -------------------------------------------------------------------------
getGrantablePrivileges(const::rtl::OUString &,sal_Int32)130cdf0e10cSrcweir sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const ::rtl::OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
133cdf0e10cSrcweir 	checkDisposed(OGroup_BASE::rBHelper.bDisposed);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	return 0;
136cdf0e10cSrcweir }
137cdf0e10cSrcweir // -------------------------------------------------------------------------
grantPrivileges(const::rtl::OUString &,sal_Int32,sal_Int32)138cdf0e10cSrcweir void SAL_CALL OGroup::grantPrivileges( const ::rtl::OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
141cdf0e10cSrcweir 	checkDisposed(OGroup_BASE::rBHelper.bDisposed);
142cdf0e10cSrcweir     throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
143cdf0e10cSrcweir }
144cdf0e10cSrcweir // -------------------------------------------------------------------------
revokePrivileges(const::rtl::OUString &,sal_Int32,sal_Int32)145cdf0e10cSrcweir void SAL_CALL OGroup::revokePrivileges( const ::rtl::OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
146cdf0e10cSrcweir {
147cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
148cdf0e10cSrcweir 	checkDisposed(OGroup_BASE::rBHelper.bDisposed);
149cdf0e10cSrcweir     throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
150cdf0e10cSrcweir }
151cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertySetInfo()152cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
155cdf0e10cSrcweir }
156cdf0e10cSrcweir // -----------------------------------------------------------------------------
getName()157cdf0e10cSrcweir ::rtl::OUString SAL_CALL OGroup::getName(  ) throw(::com::sun::star::uno::RuntimeException)
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	return m_Name;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir // -----------------------------------------------------------------------------
setName(const::rtl::OUString &)162cdf0e10cSrcweir void SAL_CALL OGroup::setName( const ::rtl::OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     throwFeatureNotImplementedException( "XNamed::setName", *this );
165cdf0e10cSrcweir }
166cdf0e10cSrcweir // -----------------------------------------------------------------------------
167cdf0e10cSrcweir // XInterface
acquire()168cdf0e10cSrcweir void SAL_CALL OGroup::acquire() throw()
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	OGroup_BASE::acquire();
171cdf0e10cSrcweir }
172cdf0e10cSrcweir // -----------------------------------------------------------------------------
release()173cdf0e10cSrcweir void SAL_CALL OGroup::release() throw()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir 	OGroup_BASE::release();
176cdf0e10cSrcweir }
177cdf0e10cSrcweir // -----------------------------------------------------------------------------
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 
180