Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / sdbcx / VGroup.cxx
blobb1eeac8eb52f5894f3f48cdc49336b37a38fcfa9
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>
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");
41 OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
42 , ODescriptor(OGroup_BASE::rBHelper,_bCase)
43 , m_pUsers(NULL)
47 OGroup::OGroup(const OUString& _Name, bool _bCase) : OGroup_BASE(m_aMutex)
48 ,ODescriptor(OGroup_BASE::rBHelper,_bCase)
49 ,m_pUsers(NULL)
51 m_Name = _Name;
54 OGroup::~OGroup()
56 delete m_pUsers;
59 Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
61 Any aRet = ODescriptor::queryInterface( rType);
62 return aRet.hasValue() ? aRet : OGroup_BASE::queryInterface( rType);
65 Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException, std::exception)
67 return ::comphelper::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes());
70 void OGroup::disposing(void)
72 OPropertySetHelper::disposing();
74 ::osl::MutexGuard aGuard(m_aMutex);
76 if(m_pUsers)
77 m_pUsers->disposing();
80 ::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const
82 Sequence< Property > aProps;
83 describeProperties(aProps);
84 return new ::cppu::OPropertyArrayHelper(aProps);
87 ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper()
89 return *const_cast<OGroup*>(this)->getArrayHelper();
92 Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, std::exception)
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;
116 sal_Int32 SAL_CALL OGroup::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
118 ::osl::MutexGuard aGuard(m_aMutex);
119 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
121 return 0;
124 sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
126 ::osl::MutexGuard aGuard(m_aMutex);
127 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
129 return 0;
132 void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
134 ::osl::MutexGuard aGuard(m_aMutex);
135 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
136 throwFeatureNotImplementedException( "XAuthorizable::grantPrivileges", *this );
139 void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
141 ::osl::MutexGuard aGuard(m_aMutex);
142 checkDisposed(OGroup_BASE::rBHelper.bDisposed);
143 throwFeatureNotImplementedException( "XAuthorizable::revokePrivileges", *this );
146 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
148 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
151 OUString SAL_CALL OGroup::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
153 return m_Name;
156 void SAL_CALL OGroup::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
158 throwFeatureNotImplementedException( "XNamed::setName", *this );
161 // XInterface
162 void SAL_CALL OGroup::acquire() throw()
164 OGroup_BASE::acquire();
167 void SAL_CALL OGroup::release() throw()
169 OGroup_BASE::release();
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */