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