1 package fr.ifremer.quadrige3.synchro.service.client;
2
3 /*-
4 * #%L
5 * Quadrige3 Core :: Quadrige3 Client Core
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2017 Ifremer
10 * %%
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * #L%
24 */
25
26 import fr.ifremer.quadrige3.core.ProgressionCoreModel;
27 import fr.ifremer.quadrige3.synchro.service.client.vo.SynchroClientImportResult;
28 import fr.ifremer.quadrige3.synchro.vo.SynchroChangesVO;
29 import fr.ifremer.quadrige3.synchro.vo.SynchroImportContextVO;
30 import org.springframework.transaction.annotation.Propagation;
31 import org.springframework.transaction.annotation.Transactional;
32
33 import java.io.File;
34
35 /**
36 * Synchro Client Internal Service Interface
37 * Only Transactional methods
38 *
39 * Created by Ludovic on 06/04/2016.
40 */
41 @Transactional(propagation = Propagation.REQUIRED)
42 public interface SynchroClientInternalService extends SynchroClientService {
43
44 /**
45 * Run the importation inside a transaction, from a temporary DB to the local DB.
46 * Note: This method is not expected to be executed directly, use importFromTempDb instead
47 *
48 * @param userId
49 * the connected user
50 * @param dbDirToImport
51 * the temporary DB directory
52 * @param importContext
53 * import context
54 * @param dataRejectResolver
55 * resolver that gives the strategy to resolve rejected rows
56 * @param progressionModel
57 * a not null progression model
58 * @param progressionModelMaxCount
59 * the maximum increment that should be used from the importation
60 * @return a {@link fr.ifremer.quadrige3.synchro.service.client.vo.SynchroClientImportResult} object.
61 */
62 SynchroClientImportResult importFromTempDbTransactional(
63 int userId,
64 File dbDirToImport,
65 SynchroImportContextVO importContext,
66 SynchroRejectedRowResolver dataRejectResolver,
67 ProgressionCoreModel progressionModel,
68 int progressionModelMaxCount);
69
70 /**
71 * Imports referential/data from server to local database.
72 * <p/>
73 * WARNING : Direct connection to Quadrige database (synchronization server will not be used). Note: This method is
74 * not expected to be executed directly, use importFromServerDatabase instead
75 *
76 * @param userId
77 * the user to synchronize
78 * @param importContext
79 * import context
80 * @param dataRejectResolver
81 * resolver that gives the strategy to resolve rejected rows
82 * @param progressionModel
83 * a not null progression model
84 * @param progressionModelMaxCount
85 * the maximum increment that should be used from the importation
86 * @return the result of the importation
87 */
88 SynchroClientImportResult importFromServerDatabaseTransactional(
89 int userId,
90 SynchroImportContextVO importContext,
91 SynchroRejectedRowResolver dataRejectResolver,
92 ProgressionCoreModel progressionModel,
93 int progressionModelMaxCount);
94
95 /**
96 * <p>
97 * getImportFileInsertAndUpdateChangesTransactional.
98 * </p>
99 *
100 * @param userId
101 * a int.
102 * @param dbZipFile
103 * a {@link File} object.
104 * @param importContext
105 * a {@link SynchroImportContextVO} object.
106 * @param progressionModel
107 * a {@link ProgressionCoreModel} object.
108 * @param progressionModelMaxCount
109 * a int.
110 * @param keepTempDirectory
111 * a boolean.
112 * @return a {@link fr.ifremer.quadrige3.synchro.vo.SynchroChangesVO} object.
113 */
114 SynchroChangesVO getImportFileInsertAndUpdateChangesTransactional(
115 int userId,
116 File dbZipFile,
117 SynchroImportContextVO importContext,
118 ProgressionCoreModel progressionModel,
119 int progressionModelMaxCount,
120 boolean keepTempDirectory);
121
122 /**
123 * <p>
124 * getImportFileReferentialDeleteChangesTransactional.
125 * </p>
126 *
127 * @param userId
128 * a int.
129 * @param dbZipFile
130 * a {@link File} object.
131 * @param importContext
132 * a {@link SynchroImportContextVO} object.
133 * @param progressionModel
134 * a {@link ProgressionCoreModel} object.
135 * @param progressionModelMaxCount
136 * a int.
137 * @param keepTempDirectory
138 * a boolean.
139 * @return a {@link fr.ifremer.quadrige3.synchro.vo.SynchroChangesVO} object.
140 */
141 SynchroChangesVO getImportFileReferentialDeleteChangesTransactional(
142 int userId,
143 File dbZipFile,
144 SynchroImportContextVO importContext,
145 ProgressionCoreModel progressionModel,
146 int progressionModelMaxCount,
147 boolean keepTempDirectory);
148 }