Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef DBACCESS_MIGRATIONERROR_HXX
21 : : #define DBACCESS_MIGRATIONERROR_HXX
22 : :
23 : : #include <com/sun/star/uno/Any.hxx>
24 : :
25 : : #include <vector>
26 : :
27 : : //........................................................................
28 : : namespace dbmm
29 : : {
30 : : //........................................................................
31 : :
32 : : enum MigrationErrorType
33 : : {
34 : : ERR_OPENING_SUB_DOCUMENT_FAILED = 1,
35 : : ERR_CLOSING_SUB_DOCUMENT_FAILED,
36 : : ERR_STORAGE_COMMIT_FAILED,
37 : : ERR_STORING_DATABASEDOC_FAILED,
38 : : ERR_COLLECTING_DOCUMENTS_FAILED,
39 : : ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
40 : : ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
41 : : ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
42 : : ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
43 : : ERR_GENERAL_MACRO_MIGRATION_FAILURE,
44 : : ERR_UNKNOWN_SCRIPT_TYPE,
45 : : ERR_UNKNOWN_SCRIPT_LANGUAGE,
46 : : ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
47 : : ERR_SCRIPT_TRANSLATION_FAILURE,
48 : : ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
49 : : ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
50 : : ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
51 : : ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
52 : : ERR_BIND_SCRIPT_STORAGE_FAILED,
53 : : ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
54 : : ERR_DOCUMENT_BACKUP_FAILED,
55 : : ERR_UNKNOWN_SCRIPT_FOLDER,
56 : : ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
57 : : ERR_PASSWORD_VERIFICATION_FAILED,
58 : : ERR_NEW_STYLE_REPORT
59 : : };
60 : :
61 : : //====================================================================
62 : : //= MigrationError
63 : : //====================================================================
64 : : /** encapsulates information about an error which happened during the migration
65 : : */
66 : 0 : struct MigrationError
67 : : {
68 : : const MigrationErrorType eType;
69 : : ::std::vector< ::rtl::OUString > aErrorDetails;
70 : : const ::com::sun::star::uno::Any aCaughtException;
71 : :
72 : : MigrationError(
73 : : const MigrationErrorType _eType )
74 : : :eType( _eType )
75 : : {
76 : : }
77 : :
78 : 0 : MigrationError(
79 : : const MigrationErrorType _eType,
80 : : const ::com::sun::star::uno::Any& _rCaughtException )
81 : : :eType( _eType )
82 : 0 : ,aCaughtException( _rCaughtException )
83 : : {
84 : 0 : }
85 : :
86 : 0 : MigrationError(
87 : : const MigrationErrorType _eType,
88 : : const ::rtl::OUString& _rDetail )
89 : 0 : :eType( _eType )
90 : : {
91 : 0 : impl_constructDetails( _rDetail );
92 : 0 : }
93 : :
94 : 0 : MigrationError(
95 : : const MigrationErrorType _eType,
96 : : const ::rtl::OUString& _rDetail,
97 : : const ::com::sun::star::uno::Any& _rCaughtException )
98 : : :eType( _eType )
99 : 0 : ,aCaughtException( _rCaughtException )
100 : : {
101 : 0 : impl_constructDetails( _rDetail );
102 : 0 : }
103 : :
104 : 0 : MigrationError(
105 : : const MigrationErrorType _eType,
106 : : const ::rtl::OUString& _rDetail1,
107 : : const ::rtl::OUString& _rDetail2 )
108 : 0 : :eType( _eType )
109 : : {
110 : 0 : impl_constructDetails( _rDetail1, _rDetail2 );
111 : 0 : }
112 : :
113 : 0 : MigrationError(
114 : : const MigrationErrorType _eType,
115 : : const ::rtl::OUString& _rDetail1,
116 : : const ::rtl::OUString& _rDetail2,
117 : : const ::com::sun::star::uno::Any& _rCaughtException )
118 : : :eType( _eType )
119 : 0 : ,aCaughtException( _rCaughtException )
120 : : {
121 : 0 : impl_constructDetails( _rDetail1, _rDetail2 );
122 : 0 : }
123 : :
124 : 0 : MigrationError(
125 : : const MigrationErrorType _eType,
126 : : const ::rtl::OUString& _rDetail1,
127 : : const ::rtl::OUString& _rDetail2,
128 : : const ::rtl::OUString& _rDetail3,
129 : : const ::com::sun::star::uno::Any& _rCaughtException )
130 : : :eType( _eType )
131 : 0 : ,aCaughtException( _rCaughtException )
132 : : {
133 : 0 : impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
134 : 0 : }
135 : :
136 : 0 : MigrationError(
137 : : const MigrationErrorType _eType,
138 : : const ::rtl::OUString& _rDetail1,
139 : : const ::rtl::OUString& _rDetail2,
140 : : const ::rtl::OUString& _rDetail3 )
141 : 0 : :eType( _eType )
142 : : {
143 : 0 : impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
144 : 0 : }
145 : :
146 : : private:
147 : 0 : void impl_constructDetails(
148 : : const ::rtl::OUString& _rDetail1,
149 : : const ::rtl::OUString& _rDetail2 = ::rtl::OUString(),
150 : : const ::rtl::OUString& _rDetail3 = ::rtl::OUString()
151 : : )
152 : : {
153 : 0 : if ( !_rDetail1.isEmpty() ) aErrorDetails.push_back( _rDetail1 );
154 : 0 : if ( !_rDetail2.isEmpty() ) aErrorDetails.push_back( _rDetail2 );
155 : 0 : if ( !_rDetail3.isEmpty() ) aErrorDetails.push_back( _rDetail3 );
156 : 0 : }
157 : : };
158 : :
159 : : //........................................................................
160 : : } // namespace dbmm
161 : : //........................................................................
162 : :
163 : : #endif // DBACCESS_MIGRATIONERROR_HXX
164 : :
165 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|