1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_sdb_application_CopyTableWizard_idl__
29*cdf0e10cSrcweir#define __com_sun_star_sdb_application_CopyTableWizard_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_sdb_application_XCopyTableWizard_idl__
32*cdf0e10cSrcweir#include <com/sun/star/sdb/application/XCopyTableWizard.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__
35*cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
38*cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
39*cdf0e10cSrcweir#endif
40*cdf0e10cSrcweir#ifndef __com_sun_star_lang_WrappedTargetException_idl__
41*cdf0e10cSrcweir#include <com/sun/star/lang/WrappedTargetException.idl>
42*cdf0e10cSrcweir#endif
43*cdf0e10cSrcweir#ifndef __com_sun_star_task_XInteractionHandler_idl__
44*cdf0e10cSrcweir#include <com/sun/star/task/XInteractionHandler.idl>
45*cdf0e10cSrcweir#endif
46*cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_SQLException_idl__
47*cdf0e10cSrcweir#include <com/sun/star/sdbc/SQLException.idl>
48*cdf0e10cSrcweir#endif
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir//=============================================================================
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirmodule com { module sun { module star { module sdb { module application {
53*cdf0e10cSrcweir
54*cdf0e10cSrcweir//=============================================================================
55*cdf0e10cSrcweir
56*cdf0e10cSrcweir/** describes a wizard which can be used to copy table like data from one
57*cdf0e10cSrcweir    database to another.
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir    <dt><b><a name="interaction"></a>Interactions</b></dt>
60*cdf0e10cSrcweir    <dd>
61*cdf0e10cSrcweir        <p>There are various cases where the wizard needs to interact with the user (except of
62*cdf0e10cSrcweir        course the obvious case to display and operate the wizard dialog itself). For those cases,
63*cdf0e10cSrcweir        an interaction handler is needed, which is used for
64*cdf0e10cSrcweir        <ul>
65*cdf0e10cSrcweir            <li>fulfilling parameter requests. This might become necessary if the copy source
66*cdf0e10cSrcweir            describes a parametrized query.</li>
67*cdf0e10cSrcweir            <li>user interaction in case copying a row fails. If no copy table listener is
68*cdf0e10cSrcweir            registered at the wizard, or none of the registered listener handles an error during
69*cdf0e10cSrcweir            copying a row, or a registered listeners explicitly tells the wizard to ask the user
70*cdf0e10cSrcweir            how to handle the error, then the interaction handler is used together with the
71*cdf0e10cSrcweir            error (an <code>SQLException</code>, usually) that happened.</li>
72*cdf0e10cSrcweir            <li>displaying other errors which happen during copying, in particular errors in
73*cdf0e10cSrcweir            creating the target table or view.</li>
74*cdf0e10cSrcweir        </ul></p>
75*cdf0e10cSrcweir
76*cdf0e10cSrcweir        <p>When you do not specify an interaction handler by using the
77*cdf0e10cSrcweir        <member>createWithInteractionHandler</member> constructor, the wizard will use the interaction
78*cdf0e10cSrcweir        handler associated with the copy target, i.e. the interaction handler specified when loading
79*cdf0e10cSrcweir        the document which the copy target refers to. If the copy target cannot be associated with
80*cdf0e10cSrcweir        a database document (e.g. because it is a mere <code>ConnectionResource</code>, or a connection
81*cdf0e10cSrcweir        not obtained from a data source), or if the copy target's database document cannot provide
82*cdf0e10cSrcweir        an interaction handler, a newly-created instance of an interaction handler is used.</p>
83*cdf0e10cSrcweir
84*cdf0e10cSrcweir        <p>There's one exception to the above, however: Upon creating the copy table wizard,
85*cdf0e10cSrcweir        the copy source and the copy target descriptors are used to create a Connection. For any
86*cdf0e10cSrcweir        interaction during this phase - including, for instance, necessary authentication -, the
87*cdf0e10cSrcweir        interaction handler of the respective data source is used, no matter what you specified
88*cdf0e10cSrcweir        in <member>createWithInteractionHandler</member>. Only if there is no such interaction
89*cdf0e10cSrcweir        handler, the processing described above, to find another handler, is applied.</p>
90*cdf0e10cSrcweir    </dd>
91*cdf0e10cSrcweir
92*cdf0e10cSrcweir    @see ::com::sun::star::sdb::ParametersRequest
93*cdf0e10cSrcweir    @see XCopyTableWizard::addCopyTableListener
94*cdf0e10cSrcweir    @see CopyTableContinuation
95*cdf0e10cSrcweir    @see ::com::sun::star::document::MediaDescriptor::InteractionHandler
96*cdf0e10cSrcweir    @see ::com::sun::star::sdb::DatabaseDocument
97*cdf0e10cSrcweir    @see ::com::sun::star::sdb::DataSource
98*cdf0e10cSrcweir    @see ::com::sun::star::sdb::DataAccessDescriptor::ConnectionResource
99*cdf0e10cSrcweir    @see ::com::sun::star::sdb::InteractionHandler
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir    @since OOo 2.4
102*cdf0e10cSrcweir */
103*cdf0e10cSrcweirservice CopyTableWizard : XCopyTableWizard
104*cdf0e10cSrcweir{
105*cdf0e10cSrcweir    /** creates an executable wizard dialog, which is to guide the user through copying
106*cdf0e10cSrcweir        a table from one database to another.
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir        <p>At creation time, an attempt will be made to obtain the connections described
109*cdf0e10cSrcweir        by <arg>Source</arg> resp. <arg>Dest</arg>. Failing to do so will result in an
110*cdf0e10cSrcweir        exception.</p>
111*cdf0e10cSrcweir
112*cdf0e10cSrcweir        <p>If the connection has been newly created by the wizard (e.g. because the
113*cdf0e10cSrcweir        data access descriptor specified a <code>DataSource</code> instead of an <code>ActiveConnection</code>),
114*cdf0e10cSrcweir        then this connection will be disposed upon disposal of the wizard.</p>
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir        @param Source
117*cdf0e10cSrcweir            the <type scope="com::sun::star::sdb">DataAccessDescriptor</type> describing the
118*cdf0e10cSrcweir            data to copy.
119*cdf0e10cSrcweir
120*cdf0e10cSrcweir            <p>The following members of the <code>DataAccessDescriptor</code> are supported, and evaluated
121*cdf0e10cSrcweir            in the given order:
122*cdf0e10cSrcweir            <ol><li><code>ActiveConnection</code></li>
123*cdf0e10cSrcweir                <li><code>DataSourceName</code></li>
124*cdf0e10cSrcweir                <li><code>DatabaseLocation</code></li>
125*cdf0e10cSrcweir                <li><code>ConnectionResource</code></li>
126*cdf0e10cSrcweir                <li><code>ConnectionInfo</code></li>
127*cdf0e10cSrcweir                <li><code>Command</code></li>
128*cdf0e10cSrcweir                <li><code>CommandType</code></li>
129*cdf0e10cSrcweir            </ol>
130*cdf0e10cSrcweir            The first 5 items are used to obtain the connection, the last two to determine which
131*cdf0e10cSrcweir            of the connection's objects is to be copied. Note that <code>Command</code> and <code>CommandType</code>
132*cdf0e10cSrcweir            are required.</p>
133*cdf0e10cSrcweir
134*cdf0e10cSrcweir            <p>Additionally to the obvious restrictions (such as that creating a view is not possible
135*cdf0e10cSrcweir            if the copy source and the copy destination denote different databases), the following restrictions
136*cdf0e10cSrcweir            apply to the settings, and possible combinations:
137*cdf0e10cSrcweir            <ul><li>Only <member scope="com::sun::star::sdb">CommandType::TABLE</member> and
138*cdf0e10cSrcweir                <member scope="com::sun::star::sdb">CommandType::QUERY</member> are supported.</li>
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir                <li>If you specify a <code>ConnectionResource</code>, or an
141*cdf0e10cSrcweir                <code>ActiveConnection</code> which implements an <type scope="com::sun::star::sdbc">Connection</type> only
142*cdf0e10cSrcweir                (as opposed to a <type scope="com::sun::star::sdb">Connection</type>), then the resulting connection is
143*cdf0e10cSrcweir                not able to provide queries, thus a command type <code>QUERY</code> will be rejected.</li>
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir                <li><code>Filter</code>, <code>Order</code>, <code>HavingClause</code> and <code>GroupBy</code>
146*cdf0e10cSrcweir                are unsupported at the moment.</li>
147*cdf0e10cSrcweir            </ul>
148*cdf0e10cSrcweir            Violating any of the above restrictions will result in an error at creation time.</p>
149*cdf0e10cSrcweir
150*cdf0e10cSrcweir        @param Destination
151*cdf0e10cSrcweir            the <type scope="com::sun::star::sdb">DataAccessDescriptor</type> describing the
152*cdf0e10cSrcweir            target for the copy operation.
153*cdf0e10cSrcweir
154*cdf0e10cSrcweir            <p>Only <code>DataSourceName</code>, <code>DatabaseLocation</code>, <code>ActiveConnection</code>
155*cdf0e10cSrcweir            are supported, effectively describing the target connection to copy the data to. They're evaluated
156*cdf0e10cSrcweir            in the order mentioned here, so if multiple of the are present, only the first one is evaluated.</p>
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir            <p>Also, at the moment the connection which is implied by either of the settings above
159*cdf0e10cSrcweir            must support the <type scope="com::sun::star::sdb">Connection</type> service. In particular,
160*cdf0e10cSrcweir            it is not sufficient to pass an SDBC-level connection.</p>
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir            <p>Note that creating a view (see <member>CopyTableOperation::CreateAsView</member>) is
163*cdf0e10cSrcweir            not supported if the target connection is an SDBC-level connection only.</p>
164*cdf0e10cSrcweir
165*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
166*cdf0e10cSrcweir            if
167*cdf0e10cSrcweir            <ul><li>either <code>Source</code> or <code>Destination</code> is <NULL/></li>
168*cdf0e10cSrcweir                <li>either <code>Source</code> or <code>Destination</code> are not sufficient
169*cdf0e10cSrcweir                    to describe a database connection.</li>
170*cdf0e10cSrcweir                <li><code>Source</code> is not sufficient to describe the to-be-copied data</li>
171*cdf0e10cSrcweir                <li>either <code>Source</code> or <code>Destination</code> contain unsupported settings.</li>
172*cdf0e10cSrcweir            </ul>
173*cdf0e10cSrcweir
174*cdf0e10cSrcweir        @throws ::com::sun::star::sdbc::SQLException
175*cdf0e10cSrcweir            if an error occurs during obtaining the source or destination connection. Those errors
176*cdf0e10cSrcweir            are passed unchanged to the creator of the wizard.
177*cdf0e10cSrcweir
178*cdf0e10cSrcweir        @throws ::com::sun::star::lang::WrappedTargetException
179*cdf0e10cSrcweir            if an error other than the ones mentioned above occurs while extracting the necessary
180*cdf0e10cSrcweir            information from any of the data access descriptors. For instance, this might
181*cdf0e10cSrcweir            be an <type scope="com::sun::star::sdbc">SQLException</type> thrown upon connecting
182*cdf0e10cSrcweir            to a data source described by the descriptor's <code>DataSourceName</code> member.
183*cdf0e10cSrcweir
184*cdf0e10cSrcweir        @see ::com::sun::star::sdb::DataAccessDescriptor
185*cdf0e10cSrcweir    */
186*cdf0e10cSrcweir    create(
187*cdf0e10cSrcweir        [in] ::com::sun::star::beans::XPropertySet Source,
188*cdf0e10cSrcweir        [in] ::com::sun::star::beans::XPropertySet Destination
189*cdf0e10cSrcweir    )
190*cdf0e10cSrcweir        raises  (   ::com::sun::star::lang::IllegalArgumentException
191*cdf0e10cSrcweir                ,   ::com::sun::star::sdbc::SQLException
192*cdf0e10cSrcweir                ,   ::com::sun::star::lang::WrappedTargetException
193*cdf0e10cSrcweir                );
194*cdf0e10cSrcweir
195*cdf0e10cSrcweir    /** creates an executable wizard dialog, which is to guide the user through copying
196*cdf0e10cSrcweir        a table from one database to another.
197*cdf0e10cSrcweir
198*cdf0e10cSrcweir        <p>The only difference to the <member>create</member> constructor is that
199*cdf0e10cSrcweir        <code>createWithInteractionHandler</code> takes an additional argument, which
200*cdf0e10cSrcweir        can be used to intercept interactions (such as error messages) during the wizard
201*cdf0e10cSrcweir        run.</p>
202*cdf0e10cSrcweir
203*cdf0e10cSrcweir        @param InteractionHandler
204*cdf0e10cSrcweir            specifies an interaction handler to use when user input is required.
205*cdf0e10cSrcweir
206*cdf0e10cSrcweir            <p>When specifying this parameter, you should use an implementation
207*cdf0e10cSrcweir            supporting the <type scope="com::sun::star::sdb">InteractionHandler</type>, since
208*cdf0e10cSrcweir            the general-purpose <type scope="com::sun::star::task">InteractionHandler</type> cannot
209*cdf0e10cSrcweir            handle all requests described <a href="#interaction">above</a>.</p>
210*cdf0e10cSrcweir
211*cdf0e10cSrcweir        @see ::com::sun::star::sdb::InteractionHandler
212*cdf0e10cSrcweir    */
213*cdf0e10cSrcweir    createWithInteractionHandler(
214*cdf0e10cSrcweir        [in] ::com::sun::star::beans::XPropertySet Source,
215*cdf0e10cSrcweir        [in] ::com::sun::star::beans::XPropertySet Destination,
216*cdf0e10cSrcweir        [in] ::com::sun::star::task::XInteractionHandler InteractionHandler
217*cdf0e10cSrcweir    )
218*cdf0e10cSrcweir        raises  (   ::com::sun::star::lang::IllegalArgumentException
219*cdf0e10cSrcweir                ,   ::com::sun::star::sdbc::SQLException
220*cdf0e10cSrcweir                ,   ::com::sun::star::lang::WrappedTargetException
221*cdf0e10cSrcweir                );
222*cdf0e10cSrcweir
223*cdf0e10cSrcweir};
224*cdf0e10cSrcweir
225*cdf0e10cSrcweir//=============================================================================
226*cdf0e10cSrcweir
227*cdf0e10cSrcweir}; }; }; }; };
228*cdf0e10cSrcweir
229*cdf0e10cSrcweir//=============================================================================
230*cdf0e10cSrcweir
231*cdf0e10cSrcweir#endif
232