1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3*cdf0e10cSrcweir  *
4*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
5*cdf0e10cSrcweir  *
6*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
7*cdf0e10cSrcweir  *
8*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
9*cdf0e10cSrcweir  *
10*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
11*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
12*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
13*cdf0e10cSrcweir  *
14*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
15*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
18*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
19*cdf0e10cSrcweir  *
20*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
21*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
22*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
23*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
24*cdf0e10cSrcweir  *
25*cdf0e10cSrcweir ************************************************************************/
26*cdf0e10cSrcweir 
27*cdf0e10cSrcweir #ifndef DBACCESS_MIGRATIONERROR_HXX
28*cdf0e10cSrcweir #define DBACCESS_MIGRATIONERROR_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir /** === begin UNO includes === **/
31*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
32*cdf0e10cSrcweir /** === end UNO includes === **/
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <vector>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //........................................................................
37*cdf0e10cSrcweir namespace dbmm
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir //........................................................................
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir     enum MigrationErrorType
42*cdf0e10cSrcweir     {
43*cdf0e10cSrcweir         ERR_OPENING_SUB_DOCUMENT_FAILED = 1,
44*cdf0e10cSrcweir         ERR_CLOSING_SUB_DOCUMENT_FAILED,
45*cdf0e10cSrcweir         ERR_STORAGE_COMMIT_FAILED,
46*cdf0e10cSrcweir         ERR_STORING_DATABASEDOC_FAILED,
47*cdf0e10cSrcweir         ERR_COLLECTING_DOCUMENTS_FAILED,
48*cdf0e10cSrcweir         ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
49*cdf0e10cSrcweir         ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
50*cdf0e10cSrcweir         ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
51*cdf0e10cSrcweir         ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
52*cdf0e10cSrcweir         ERR_GENERAL_MACRO_MIGRATION_FAILURE,
53*cdf0e10cSrcweir         ERR_UNKNOWN_SCRIPT_TYPE,
54*cdf0e10cSrcweir         ERR_UNKNOWN_SCRIPT_LANGUAGE,
55*cdf0e10cSrcweir         ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
56*cdf0e10cSrcweir         ERR_SCRIPT_TRANSLATION_FAILURE,
57*cdf0e10cSrcweir         ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
58*cdf0e10cSrcweir         ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
59*cdf0e10cSrcweir         ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
60*cdf0e10cSrcweir         ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
61*cdf0e10cSrcweir         ERR_BIND_SCRIPT_STORAGE_FAILED,
62*cdf0e10cSrcweir         ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
63*cdf0e10cSrcweir         ERR_DOCUMENT_BACKUP_FAILED,
64*cdf0e10cSrcweir         ERR_UNKNOWN_SCRIPT_FOLDER,
65*cdf0e10cSrcweir         ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
66*cdf0e10cSrcweir         ERR_PASSWORD_VERIFICATION_FAILED,
67*cdf0e10cSrcweir         ERR_NEW_STYLE_REPORT
68*cdf0e10cSrcweir     };
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	//====================================================================
71*cdf0e10cSrcweir 	//= MigrationError
72*cdf0e10cSrcweir 	//====================================================================
73*cdf0e10cSrcweir     /** encapsulates information about an error which happened during the migration
74*cdf0e10cSrcweir     */
75*cdf0e10cSrcweir 	struct MigrationError
76*cdf0e10cSrcweir 	{
77*cdf0e10cSrcweir         const MigrationErrorType            eType;
78*cdf0e10cSrcweir         ::std::vector< ::rtl::OUString >    aErrorDetails;
79*cdf0e10cSrcweir         const ::com::sun::star::uno::Any    aCaughtException;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir         MigrationError(
82*cdf0e10cSrcweir                 const MigrationErrorType _eType )
83*cdf0e10cSrcweir             :eType( _eType )
84*cdf0e10cSrcweir         {
85*cdf0e10cSrcweir         }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir         MigrationError(
88*cdf0e10cSrcweir                 const MigrationErrorType _eType,
89*cdf0e10cSrcweir                 const ::com::sun::star::uno::Any& _rCaughtException )
90*cdf0e10cSrcweir             :eType( _eType )
91*cdf0e10cSrcweir             ,aCaughtException( _rCaughtException )
92*cdf0e10cSrcweir         {
93*cdf0e10cSrcweir         }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir         MigrationError(
96*cdf0e10cSrcweir                 const MigrationErrorType _eType,
97*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail )
98*cdf0e10cSrcweir             :eType( _eType )
99*cdf0e10cSrcweir         {
100*cdf0e10cSrcweir             impl_constructDetails( _rDetail );
101*cdf0e10cSrcweir         }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir         MigrationError(
104*cdf0e10cSrcweir                 const MigrationErrorType _eType,
105*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail,
106*cdf0e10cSrcweir                 const ::com::sun::star::uno::Any& _rCaughtException )
107*cdf0e10cSrcweir             :eType( _eType )
108*cdf0e10cSrcweir             ,aCaughtException( _rCaughtException )
109*cdf0e10cSrcweir         {
110*cdf0e10cSrcweir             impl_constructDetails( _rDetail );
111*cdf0e10cSrcweir         }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir         MigrationError(
114*cdf0e10cSrcweir                 const MigrationErrorType _eType,
115*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail1,
116*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail2 )
117*cdf0e10cSrcweir             :eType( _eType )
118*cdf0e10cSrcweir         {
119*cdf0e10cSrcweir             impl_constructDetails( _rDetail1, _rDetail2 );
120*cdf0e10cSrcweir         }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         MigrationError(
123*cdf0e10cSrcweir                 const MigrationErrorType _eType,
124*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail1,
125*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail2,
126*cdf0e10cSrcweir                 const ::com::sun::star::uno::Any& _rCaughtException )
127*cdf0e10cSrcweir             :eType( _eType )
128*cdf0e10cSrcweir             ,aCaughtException( _rCaughtException )
129*cdf0e10cSrcweir         {
130*cdf0e10cSrcweir             impl_constructDetails( _rDetail1, _rDetail2 );
131*cdf0e10cSrcweir         }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         MigrationError(
134*cdf0e10cSrcweir                 const MigrationErrorType _eType,
135*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail1,
136*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail2,
137*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail3,
138*cdf0e10cSrcweir                 const ::com::sun::star::uno::Any& _rCaughtException )
139*cdf0e10cSrcweir             :eType( _eType )
140*cdf0e10cSrcweir             ,aCaughtException( _rCaughtException )
141*cdf0e10cSrcweir         {
142*cdf0e10cSrcweir             impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
143*cdf0e10cSrcweir         }
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         MigrationError(
146*cdf0e10cSrcweir                 const MigrationErrorType _eType,
147*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail1,
148*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail2,
149*cdf0e10cSrcweir                 const ::rtl::OUString& _rDetail3 )
150*cdf0e10cSrcweir             :eType( _eType )
151*cdf0e10cSrcweir         {
152*cdf0e10cSrcweir             impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
153*cdf0e10cSrcweir         }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     private:
156*cdf0e10cSrcweir         void    impl_constructDetails(
157*cdf0e10cSrcweir                     const ::rtl::OUString& _rDetail1,
158*cdf0e10cSrcweir                     const ::rtl::OUString& _rDetail2 = ::rtl::OUString(),
159*cdf0e10cSrcweir                     const ::rtl::OUString& _rDetail3 = ::rtl::OUString()
160*cdf0e10cSrcweir                 )
161*cdf0e10cSrcweir         {
162*cdf0e10cSrcweir             if ( _rDetail1.getLength() ) aErrorDetails.push_back( _rDetail1 );
163*cdf0e10cSrcweir             if ( _rDetail2.getLength() ) aErrorDetails.push_back( _rDetail2 );
164*cdf0e10cSrcweir             if ( _rDetail3.getLength() ) aErrorDetails.push_back( _rDetail3 );
165*cdf0e10cSrcweir         }
166*cdf0e10cSrcweir 	};
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir //........................................................................
169*cdf0e10cSrcweir } // namespace dbmm
170*cdf0e10cSrcweir //........................................................................
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir #endif // DBACCESS_MIGRATIONERROR_HXX
173*cdf0e10cSrcweir 
174