1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBACCESS_MIGRATIONERROR_HXX
25 #define DBACCESS_MIGRATIONERROR_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/uno/Any.hxx>
29 /** === end UNO includes === **/
30 
31 #include <vector>
32 
33 //........................................................................
34 namespace dbmm
35 {
36 //........................................................................
37 
38     enum MigrationErrorType
39     {
40         ERR_OPENING_SUB_DOCUMENT_FAILED = 1,
41         ERR_CLOSING_SUB_DOCUMENT_FAILED,
42         ERR_STORAGE_COMMIT_FAILED,
43         ERR_STORING_DATABASEDOC_FAILED,
44         ERR_COLLECTING_DOCUMENTS_FAILED,
45         ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
46         ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
47         ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
48         ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
49         ERR_GENERAL_MACRO_MIGRATION_FAILURE,
50         ERR_UNKNOWN_SCRIPT_TYPE,
51         ERR_UNKNOWN_SCRIPT_LANGUAGE,
52         ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
53         ERR_SCRIPT_TRANSLATION_FAILURE,
54         ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
55         ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
56         ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
57         ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
58         ERR_BIND_SCRIPT_STORAGE_FAILED,
59         ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
60         ERR_DOCUMENT_BACKUP_FAILED,
61         ERR_UNKNOWN_SCRIPT_FOLDER,
62         ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
63         ERR_PASSWORD_VERIFICATION_FAILED,
64         ERR_NEW_STYLE_REPORT
65     };
66 
67 	//====================================================================
68 	//= MigrationError
69 	//====================================================================
70     /** encapsulates information about an error which happened during the migration
71     */
72 	struct MigrationError
73 	{
74         const MigrationErrorType            eType;
75         ::std::vector< ::rtl::OUString >    aErrorDetails;
76         const ::com::sun::star::uno::Any    aCaughtException;
77 
MigrationErrordbmm::MigrationError78         MigrationError(
79                 const MigrationErrorType _eType )
80             :eType( _eType )
81         {
82         }
83 
MigrationErrordbmm::MigrationError84         MigrationError(
85                 const MigrationErrorType _eType,
86                 const ::com::sun::star::uno::Any& _rCaughtException )
87             :eType( _eType )
88             ,aCaughtException( _rCaughtException )
89         {
90         }
91 
MigrationErrordbmm::MigrationError92         MigrationError(
93                 const MigrationErrorType _eType,
94                 const ::rtl::OUString& _rDetail )
95             :eType( _eType )
96         {
97             impl_constructDetails( _rDetail );
98         }
99 
MigrationErrordbmm::MigrationError100         MigrationError(
101                 const MigrationErrorType _eType,
102                 const ::rtl::OUString& _rDetail,
103                 const ::com::sun::star::uno::Any& _rCaughtException )
104             :eType( _eType )
105             ,aCaughtException( _rCaughtException )
106         {
107             impl_constructDetails( _rDetail );
108         }
109 
MigrationErrordbmm::MigrationError110         MigrationError(
111                 const MigrationErrorType _eType,
112                 const ::rtl::OUString& _rDetail1,
113                 const ::rtl::OUString& _rDetail2 )
114             :eType( _eType )
115         {
116             impl_constructDetails( _rDetail1, _rDetail2 );
117         }
118 
MigrationErrordbmm::MigrationError119         MigrationError(
120                 const MigrationErrorType _eType,
121                 const ::rtl::OUString& _rDetail1,
122                 const ::rtl::OUString& _rDetail2,
123                 const ::com::sun::star::uno::Any& _rCaughtException )
124             :eType( _eType )
125             ,aCaughtException( _rCaughtException )
126         {
127             impl_constructDetails( _rDetail1, _rDetail2 );
128         }
129 
MigrationErrordbmm::MigrationError130         MigrationError(
131                 const MigrationErrorType _eType,
132                 const ::rtl::OUString& _rDetail1,
133                 const ::rtl::OUString& _rDetail2,
134                 const ::rtl::OUString& _rDetail3,
135                 const ::com::sun::star::uno::Any& _rCaughtException )
136             :eType( _eType )
137             ,aCaughtException( _rCaughtException )
138         {
139             impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
140         }
141 
MigrationErrordbmm::MigrationError142         MigrationError(
143                 const MigrationErrorType _eType,
144                 const ::rtl::OUString& _rDetail1,
145                 const ::rtl::OUString& _rDetail2,
146                 const ::rtl::OUString& _rDetail3 )
147             :eType( _eType )
148         {
149             impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
150         }
151 
152     private:
impl_constructDetailsdbmm::MigrationError153         void    impl_constructDetails(
154                     const ::rtl::OUString& _rDetail1,
155                     const ::rtl::OUString& _rDetail2 = ::rtl::OUString(),
156                     const ::rtl::OUString& _rDetail3 = ::rtl::OUString()
157                 )
158         {
159             if ( _rDetail1.getLength() ) aErrorDetails.push_back( _rDetail1 );
160             if ( _rDetail2.getLength() ) aErrorDetails.push_back( _rDetail2 );
161             if ( _rDetail3.getLength() ) aErrorDetails.push_back( _rDetail3 );
162         }
163 	};
164 
165 //........................................................................
166 } // namespace dbmm
167 //........................................................................
168 
169 #endif // DBACCESS_MIGRATIONERROR_HXX
170 
171