1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
31 #include "connectivity/sdbcx/VGroup.hxx"
32 #include <com/sun/star/lang/DisposedException.hpp>
33 #include <com/sun/star/sdbcx/Privilege.hpp>
34 #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
35 #include <comphelper/sequence.hxx>
36 #include <connectivity/dbexception.hxx>
38 // -------------------------------------------------------------------------
39 using namespace ::connectivity::sdbcx
;
40 using namespace ::connectivity
;
41 using namespace ::dbtools
;
42 using namespace ::com::sun::star::sdbc
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::container
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::beans
;
48 IMPLEMENT_SERVICE_INFO(OGroup
,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
49 // -------------------------------------------------------------------------
50 OGroup::OGroup(sal_Bool _bCase
) : OGroup_BASE(m_aMutex
)
51 , ODescriptor(OGroup_BASE::rBHelper
,_bCase
)
55 // -------------------------------------------------------------------------
56 OGroup::OGroup(const ::rtl::OUString
& _Name
,sal_Bool _bCase
) : OGroup_BASE(m_aMutex
)
57 ,ODescriptor(OGroup_BASE::rBHelper
,_bCase
)
62 // -------------------------------------------------------------------------
67 // -------------------------------------------------------------------------
68 Any SAL_CALL
OGroup::queryInterface( const Type
& rType
) throw(RuntimeException
)
70 Any aRet
= ODescriptor::queryInterface( rType
);
71 return aRet
.hasValue() ? aRet
: OGroup_BASE::queryInterface( rType
);
73 // -------------------------------------------------------------------------
74 Sequence
< Type
> SAL_CALL
OGroup::getTypes( ) throw(RuntimeException
)
76 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
78 // -------------------------------------------------------------------------
79 void OGroup::disposing(void)
81 OPropertySetHelper::disposing();
83 ::osl::MutexGuard
aGuard(m_aMutex
);
86 m_pUsers
->disposing();
88 // -------------------------------------------------------------------------
89 ::cppu::IPropertyArrayHelper
* OGroup::createArrayHelper( ) const
91 Sequence
< Property
> aProps
;
92 describeProperties(aProps
);
93 return new ::cppu::OPropertyArrayHelper(aProps
);
95 // -------------------------------------------------------------------------
96 ::cppu::IPropertyArrayHelper
& OGroup::getInfoHelper()
98 return *const_cast<OGroup
*>(this)->getArrayHelper();
100 // -------------------------------------------------------------------------
101 Reference
< XNameAccess
> SAL_CALL
OGroup::getUsers( ) throw(RuntimeException
)
103 ::osl::MutexGuard
aGuard(m_aMutex
);
104 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
111 catch( const RuntimeException
& )
113 // allowed to leave this method
116 catch( const Exception
& )
121 return const_cast<OGroup
*>(this)->m_pUsers
;
123 // -------------------------------------------------------------------------
125 sal_Int32 SAL_CALL
OGroup::getPrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
127 ::osl::MutexGuard
aGuard(m_aMutex
);
128 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
132 // -------------------------------------------------------------------------
133 sal_Int32 SAL_CALL
OGroup::getGrantablePrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
135 ::osl::MutexGuard
aGuard(m_aMutex
);
136 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
140 // -------------------------------------------------------------------------
141 void SAL_CALL
OGroup::grantPrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
143 ::osl::MutexGuard
aGuard(m_aMutex
);
144 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
145 throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
147 // -------------------------------------------------------------------------
148 void SAL_CALL
OGroup::revokePrivileges( const ::rtl::OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException
, RuntimeException
)
150 ::osl::MutexGuard
aGuard(m_aMutex
);
151 checkDisposed(OGroup_BASE::rBHelper
.bDisposed
);
152 throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
154 // -----------------------------------------------------------------------------
155 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
)
157 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
159 // -----------------------------------------------------------------------------
160 ::rtl::OUString SAL_CALL
OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException
)
164 // -----------------------------------------------------------------------------
165 void SAL_CALL
OGroup::setName( const ::rtl::OUString
& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException
)
167 throwFeatureNotImplementedException( "XNamed::setName", *this );
169 // -----------------------------------------------------------------------------
171 void SAL_CALL
OGroup::acquire() throw()
173 OGroup_BASE::acquire();
175 // -----------------------------------------------------------------------------
176 void SAL_CALL
OGroup::release() throw()
178 OGroup_BASE::release();
180 // -----------------------------------------------------------------------------
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */