1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: VGroup.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
35 #include "connectivity/sdbcx/VGroup.hxx"
36 #include <com/sun/star/lang/DisposedException.hpp>
37 #include <com/sun/star/sdbcx/Privilege.hpp>
38 #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
39 #include <comphelper/sequence.hxx>
40 #include <connectivity/dbexception.hxx>
42 // -------------------------------------------------------------------------
43 using namespace ::connectivity::sdbcx
;
44 using namespace ::connectivity
;
45 using namespace ::dbtools
;
46 using namespace ::com::sun::star::sdbc
;
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::container
;
49 using namespace ::com::sun::star::lang
;
50 using namespace ::com::sun::star::beans
;
52 IMPLEMENT_SERVICE_INFO(OGroup
,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
53 // -------------------------------------------------------------------------
54 OGroup::OGroup(sal_Bool _bCase
) : OGroup_BASE(m_aMutex
)
55 , ODescriptor(OGroup_BASE::rBHelper
,_bCase
)
59 // -------------------------------------------------------------------------
60 OGroup::OGroup(const ::rtl::OUString
& _Name
,sal_Bool _bCase
) : OGroup_BASE(m_aMutex
)
61 ,ODescriptor(OGroup_BASE::rBHelper
,_bCase
)
66 // -------------------------------------------------------------------------
71 // -------------------------------------------------------------------------
72 Any SAL_CALL
OGroup::queryInterface( const Type
& rType
) throw(RuntimeException
)
74 Any aRet
= ODescriptor::queryInterface( rType
);
75 return aRet
.hasValue() ? aRet
: OGroup_BASE::queryInterface( rType
);
77 // -------------------------------------------------------------------------
78 Sequence
< Type
> SAL_CALL
OGroup::getTypes( ) throw(RuntimeException
)
80 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
82 // -------------------------------------------------------------------------
83 void OGroup::disposing(void)
85 OPropertySetHelper::disposing();
87 ::osl::MutexGuard
aGuard(m_aMutex
);
90 m_pUsers
->disposing();
92 // -------------------------------------------------------------------------
93 ::cppu::IPropertyArrayHelper
* OGroup::createArrayHelper( ) const
95 Sequence
< Property
> aProps
;
96 describeProperties(aProps
);
97 return new ::cppu::OPropertyArrayHelper(aProps
);
99 // -------------------------------------------------------------------------
100 ::cppu::IPropertyArrayHelper
& OGroup::getInfoHelper()
102 return *const_cast<OGroup
*>(this)->getArrayHelper();
104 // -------------------------------------------------------------------------
105 Reference
< XNameAccess
> SAL_CALL
OGroup::getUsers( ) throw(RuntimeException
)
107 ::osl::MutexGuard
aGuard(m_aMutex
);
108 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
115 catch( const RuntimeException
& )
117 // allowed to leave this method
120 catch( const Exception
& )
125 return const_cast<OGroup
*>(this)->m_pUsers
;
127 // -------------------------------------------------------------------------
129 sal_Int32 SAL_CALL
OGroup::getPrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
131 ::osl::MutexGuard
aGuard(m_aMutex
);
132 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
136 // -------------------------------------------------------------------------
137 sal_Int32 SAL_CALL
OGroup::getGrantablePrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
139 ::osl::MutexGuard
aGuard(m_aMutex
);
140 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
144 // -------------------------------------------------------------------------
145 void SAL_CALL
OGroup::grantPrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
147 ::osl::MutexGuard
aGuard(m_aMutex
);
148 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
149 throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
151 // -------------------------------------------------------------------------
152 void SAL_CALL
OGroup::revokePrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
154 ::osl::MutexGuard
aGuard(m_aMutex
);
155 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
156 throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
158 // -----------------------------------------------------------------------------
159 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
)
161 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
163 // -----------------------------------------------------------------------------
164 ::rtl::OUString SAL_CALL
OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException
)
168 // -----------------------------------------------------------------------------
169 void SAL_CALL
OGroup::setName( const ::rtl::OUString
& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException
)
171 throwFeatureNotImplementedException( "XNamed::setName", *this );
173 // -----------------------------------------------------------------------------
175 void SAL_CALL
OGroup::acquire() throw()
177 OGroup_BASE::acquire();
179 // -----------------------------------------------------------------------------
180 void SAL_CALL
OGroup::release() throw()
182 OGroup_BASE::release();
184 // -----------------------------------------------------------------------------