1309 |
08 Sep 05 |
enell |
1 |
/* |
1309 |
08 Sep 05 |
enell |
$Id$ |
1309 |
08 Sep 05 |
enell |
3 |
|
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Johan Enell, Nicklas Nordborg |
4889 |
06 Apr 09 |
nicklas |
Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1309 |
08 Sep 05 |
enell |
7 |
|
2304 |
22 May 06 |
jari |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
Available at http://base.thep.lu.se/ |
1309 |
08 Sep 05 |
enell |
10 |
|
1309 |
08 Sep 05 |
enell |
BASE is free software; you can redistribute it and/or |
1309 |
08 Sep 05 |
enell |
modify it under the terms of the GNU General Public License |
4480 |
05 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 |
1309 |
08 Sep 05 |
enell |
of the License, or (at your option) any later version. |
1309 |
08 Sep 05 |
enell |
15 |
|
1309 |
08 Sep 05 |
enell |
BASE is distributed in the hope that it will be useful, |
1309 |
08 Sep 05 |
enell |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1309 |
08 Sep 05 |
enell |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1309 |
08 Sep 05 |
enell |
GNU General Public License for more details. |
1309 |
08 Sep 05 |
enell |
20 |
|
1309 |
08 Sep 05 |
enell |
You should have received a copy of the GNU General Public License |
4514 |
11 Sep 08 |
jari |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1309 |
08 Sep 05 |
enell |
23 |
*/ |
1376 |
22 Sep 05 |
nicklas |
24 |
import net.sf.basedb.core.ArrayDesign; |
1376 |
22 Sep 05 |
nicklas |
25 |
import net.sf.basedb.core.BaseException; |
1376 |
22 Sep 05 |
nicklas |
26 |
import net.sf.basedb.core.DbControl; |
1376 |
22 Sep 05 |
nicklas |
27 |
import net.sf.basedb.core.File; |
1376 |
22 Sep 05 |
nicklas |
28 |
import net.sf.basedb.core.Item; |
1376 |
22 Sep 05 |
nicklas |
29 |
import net.sf.basedb.core.Job; |
1376 |
22 Sep 05 |
nicklas |
30 |
import net.sf.basedb.core.ParameterType; |
1376 |
22 Sep 05 |
nicklas |
31 |
import net.sf.basedb.core.Permission; |
3820 |
12 Oct 07 |
nicklas |
32 |
import net.sf.basedb.core.Platform; |
1376 |
22 Sep 05 |
nicklas |
33 |
import net.sf.basedb.core.PluginConfiguration; |
1376 |
22 Sep 05 |
nicklas |
34 |
import net.sf.basedb.core.PluginDefinition; |
1376 |
22 Sep 05 |
nicklas |
35 |
import net.sf.basedb.core.PluginParameter; |
1376 |
22 Sep 05 |
nicklas |
36 |
import net.sf.basedb.core.PluginConfigurationRequest; |
1376 |
22 Sep 05 |
nicklas |
37 |
import net.sf.basedb.core.PluginResponse; |
1376 |
22 Sep 05 |
nicklas |
38 |
import net.sf.basedb.core.ReporterType; |
1376 |
22 Sep 05 |
nicklas |
39 |
import net.sf.basedb.core.RequestInformation; |
1376 |
22 Sep 05 |
nicklas |
40 |
import net.sf.basedb.core.plugin.Response; |
1309 |
08 Sep 05 |
enell |
41 |
|
1376 |
22 Sep 05 |
nicklas |
42 |
|
1309 |
08 Sep 05 |
enell |
43 |
public class TestReporterMapFlatFileImporter |
1309 |
08 Sep 05 |
enell |
44 |
{ |
1309 |
08 Sep 05 |
enell |
45 |
static boolean ok = true; |
1309 |
08 Sep 05 |
enell |
46 |
|
1309 |
08 Sep 05 |
enell |
47 |
public static void main(String[] args) |
1309 |
08 Sep 05 |
enell |
48 |
{ |
1309 |
08 Sep 05 |
enell |
49 |
TestUtil.checkArgs(args); |
1309 |
08 Sep 05 |
enell |
50 |
TestUtil.begin(); |
1309 |
08 Sep 05 |
enell |
51 |
test_all(); |
1309 |
08 Sep 05 |
enell |
52 |
TestUtil.stop(); |
1309 |
08 Sep 05 |
enell |
53 |
} |
1309 |
08 Sep 05 |
enell |
54 |
|
1309 |
08 Sep 05 |
enell |
55 |
static boolean test_all() |
1309 |
08 Sep 05 |
enell |
56 |
{ |
1309 |
08 Sep 05 |
enell |
57 |
write("++Testing reporter map import using plugin"); |
1309 |
08 Sep 05 |
enell |
58 |
|
1309 |
08 Sep 05 |
enell |
// Import reporters needed for reportermap import |
1309 |
08 Sep 05 |
enell |
// Create reporter type and upload file |
1309 |
08 Sep 05 |
enell |
61 |
int reporterTypeId = TestReporterType.test_create(); |
3820 |
12 Oct 07 |
nicklas |
62 |
int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false); |
3719 |
12 Sep 07 |
nicklas |
63 |
int fileId = TestFile.test_create("data/test.reportermap.import.txt", false, false); |
1309 |
08 Sep 05 |
enell |
64 |
|
1309 |
08 Sep 05 |
enell |
// Create reporter plugin configuration and job |
1309 |
08 Sep 05 |
enell |
66 |
int reporterPluginDefinitionId = TestPluginDefinition.test_get("net.sf.basedb.plugins.ReporterFlatFileImporter"); |
1309 |
08 Sep 05 |
enell |
67 |
int reporterPluginConfigurationId = test_create_configuration_reporter(reporterPluginDefinitionId, reporterTypeId); |
3596 |
24 Jul 07 |
nicklas |
68 |
int jobId = TestReporterFlatFileImporter.test_create_job(reporterPluginConfigurationId, fileId, "create"); |
1400 |
03 Oct 05 |
enell |
69 |
|
1400 |
03 Oct 05 |
enell |
// Execute job |
5319 |
20 Apr 10 |
nicklas |
71 |
ok &= TestJob.test_execute(jobId, false); |
1400 |
03 Oct 05 |
enell |
72 |
|
1309 |
08 Sep 05 |
enell |
73 |
TestJob.test_delete(jobId); |
1309 |
08 Sep 05 |
enell |
74 |
TestPluginConfiguration.test_delete(reporterPluginConfigurationId); |
1309 |
08 Sep 05 |
enell |
75 |
|
1309 |
08 Sep 05 |
enell |
// ReporterMap import |
1309 |
08 Sep 05 |
enell |
77 |
int reporterMapPluginDefinitionId = TestPluginDefinition.test_get("net.sf.basedb.plugins.ReporterMapFlatFileImporter"); |
1309 |
08 Sep 05 |
enell |
78 |
int reporterMapPluginConfigurationId = test_create_configuration_reporter_map(reporterMapPluginDefinitionId); |
1309 |
08 Sep 05 |
enell |
79 |
jobId = test_create_map_job(reporterMapPluginConfigurationId, fileId, arrayDesignId); |
1309 |
08 Sep 05 |
enell |
80 |
|
1309 |
08 Sep 05 |
enell |
// Execute job |
5319 |
20 Apr 10 |
nicklas |
82 |
ok &= TestJob.test_execute(jobId, false); |
1400 |
03 Oct 05 |
enell |
83 |
|
1400 |
03 Oct 05 |
enell |
// Print result |
1400 |
03 Oct 05 |
enell |
85 |
TestArrayDesign.write_feature_header(); |
1594 |
14 Nov 05 |
nicklas |
86 |
TestArrayDesign.test_list_features(arrayDesignId, -1); |
1309 |
08 Sep 05 |
enell |
87 |
|
1529 |
27 Oct 05 |
nicklas |
88 |
if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); |
4257 |
29 Apr 08 |
nicklas |
89 |
|
4257 |
29 Apr 08 |
nicklas |
90 |
TestArrayDesign.test_delete(arrayDesignId); |
1309 |
08 Sep 05 |
enell |
91 |
TestJob.test_delete(jobId); |
1309 |
08 Sep 05 |
enell |
92 |
TestPluginConfiguration.test_delete(reporterMapPluginConfigurationId); |
1309 |
08 Sep 05 |
enell |
93 |
TestReporter.test_delete(); |
1309 |
08 Sep 05 |
enell |
94 |
TestFile.test_delete(fileId); |
1309 |
08 Sep 05 |
enell |
95 |
TestReporterType.test_delete(reporterTypeId); |
1309 |
08 Sep 05 |
enell |
96 |
|
1309 |
08 Sep 05 |
enell |
97 |
write("++Testing reporter map import using plugin "+(ok ? "OK" : "Failed")+"\n"); |
1309 |
08 Sep 05 |
enell |
98 |
return ok; |
1309 |
08 Sep 05 |
enell |
99 |
} |
1309 |
08 Sep 05 |
enell |
100 |
|
1309 |
08 Sep 05 |
enell |
101 |
static int test_create_configuration_reporter(int pluginDefinitionId, int reporterTypeId) |
1309 |
08 Sep 05 |
enell |
102 |
{ |
1309 |
08 Sep 05 |
enell |
103 |
if (pluginDefinitionId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.PLUGINCONFIGURATION)) return 0; |
1309 |
08 Sep 05 |
enell |
104 |
int id = 0; |
1309 |
08 Sep 05 |
enell |
105 |
DbControl dc = null; |
1309 |
08 Sep 05 |
enell |
106 |
try |
1309 |
08 Sep 05 |
enell |
107 |
{ |
1309 |
08 Sep 05 |
enell |
108 |
dc = TestUtil.getDbControl(); |
1309 |
08 Sep 05 |
enell |
109 |
|
1309 |
08 Sep 05 |
enell |
110 |
PluginDefinition pd = PluginDefinition.getById(dc, pluginDefinitionId); |
1309 |
08 Sep 05 |
enell |
111 |
PluginConfiguration pc = pd.newPluginConfiguration(); |
1309 |
08 Sep 05 |
enell |
112 |
pc.setName(pd.getName()); |
1309 |
08 Sep 05 |
enell |
113 |
|
1376 |
22 Sep 05 |
nicklas |
114 |
PluginConfigurationRequest request = pc.configure(); |
1309 |
08 Sep 05 |
enell |
115 |
|
1309 |
08 Sep 05 |
enell |
116 |
write_request_information(request.getRequestInformation()); |
1309 |
08 Sep 05 |
enell |
117 |
|
2203 |
28 Apr 06 |
nicklas |
118 |
request.setParameterValue("dataSplitterRegexp", "\\t"); |
1309 |
08 Sep 05 |
enell |
119 |
request.setParameterValue("dataHeaderRegexp", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\"\\t\"Symbol\""); |
2203 |
28 Apr 06 |
nicklas |
120 |
request.setParameterValue("reporterIdColumnMapping", "\\ID\\"); |
2203 |
28 Apr 06 |
nicklas |
121 |
request.setParameterValue("nameColumnMapping", "\\Name\\"); |
2203 |
28 Apr 06 |
nicklas |
122 |
request.setParameterValue("symbolColumnMapping", "\\Symbol\\"); |
1309 |
08 Sep 05 |
enell |
123 |
if (reporterTypeId != 0) |
1309 |
08 Sep 05 |
enell |
124 |
{ |
1309 |
08 Sep 05 |
enell |
125 |
request.setParameterValue("reporterType", ReporterType.getById(dc, reporterTypeId)); |
1309 |
08 Sep 05 |
enell |
126 |
} |
1309 |
08 Sep 05 |
enell |
127 |
|
1309 |
08 Sep 05 |
enell |
128 |
PluginResponse response = request.invoke(); |
1309 |
08 Sep 05 |
enell |
129 |
if (response.getStatus() == Response.Status.DONE) |
1309 |
08 Sep 05 |
enell |
130 |
{ |
1779 |
17 Jan 06 |
nicklas |
131 |
response.saveParameters(dc); |
1309 |
08 Sep 05 |
enell |
132 |
dc.saveItem(pc); |
1309 |
08 Sep 05 |
enell |
133 |
dc.commit(); |
1309 |
08 Sep 05 |
enell |
134 |
} |
1309 |
08 Sep 05 |
enell |
135 |
else |
1309 |
08 Sep 05 |
enell |
136 |
{ |
1622 |
16 Nov 05 |
nicklas |
137 |
throw new BaseException(response.getMessage(), response.getErrorList().get(0)); |
1309 |
08 Sep 05 |
enell |
138 |
} |
1309 |
08 Sep 05 |
enell |
139 |
id = pc.getId(); |
1309 |
08 Sep 05 |
enell |
140 |
write("--Create configuration for reporter import OK"); |
1309 |
08 Sep 05 |
enell |
141 |
} |
1309 |
08 Sep 05 |
enell |
142 |
catch (Throwable ex) |
1309 |
08 Sep 05 |
enell |
143 |
{ |
1309 |
08 Sep 05 |
enell |
144 |
write("--Create configuration for reporter import FAILED"); |
1309 |
08 Sep 05 |
enell |
145 |
ex.printStackTrace(); |
1309 |
08 Sep 05 |
enell |
146 |
ok = false; |
1309 |
08 Sep 05 |
enell |
147 |
} |
1309 |
08 Sep 05 |
enell |
148 |
finally |
1309 |
08 Sep 05 |
enell |
149 |
{ |
1309 |
08 Sep 05 |
enell |
150 |
if (dc != null) dc.close(); |
1309 |
08 Sep 05 |
enell |
151 |
} |
1309 |
08 Sep 05 |
enell |
152 |
return id; |
1309 |
08 Sep 05 |
enell |
153 |
} |
1309 |
08 Sep 05 |
enell |
154 |
|
1309 |
08 Sep 05 |
enell |
155 |
static int test_create_configuration_reporter_map(int pluginDefinitionId) |
1309 |
08 Sep 05 |
enell |
156 |
{ |
1309 |
08 Sep 05 |
enell |
157 |
if (pluginDefinitionId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.PLUGINCONFIGURATION)) return 0; |
1309 |
08 Sep 05 |
enell |
158 |
int id = 0; |
1309 |
08 Sep 05 |
enell |
159 |
DbControl dc = null; |
1309 |
08 Sep 05 |
enell |
160 |
try |
1309 |
08 Sep 05 |
enell |
161 |
{ |
1309 |
08 Sep 05 |
enell |
162 |
dc = TestUtil.getDbControl(); |
1309 |
08 Sep 05 |
enell |
163 |
|
1309 |
08 Sep 05 |
enell |
164 |
PluginDefinition pd = PluginDefinition.getById(dc, pluginDefinitionId); |
1309 |
08 Sep 05 |
enell |
165 |
PluginConfiguration pc = pd.newPluginConfiguration(); |
1309 |
08 Sep 05 |
enell |
166 |
pc.setName(pd.getName()); |
1309 |
08 Sep 05 |
enell |
167 |
|
1376 |
22 Sep 05 |
nicklas |
168 |
PluginConfigurationRequest request = pc.configure(); |
1309 |
08 Sep 05 |
enell |
169 |
|
1309 |
08 Sep 05 |
enell |
170 |
write_request_information(request.getRequestInformation()); |
1309 |
08 Sep 05 |
enell |
171 |
|
1309 |
08 Sep 05 |
enell |
172 |
request.setParameterValue("dataSplitterRegexp", "\"?\\t\"?"); |
1309 |
08 Sep 05 |
enell |
173 |
request.setParameterValue("dataHeaderRegexp", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\"\\t\"Symbol\""); |
1309 |
08 Sep 05 |
enell |
174 |
request.setParameterValue("reporterIdColumnMapping", "\\3\\"); |
1309 |
08 Sep 05 |
enell |
175 |
request.setParameterValue("blockColumnMapping", "\\0\\"); |
1309 |
08 Sep 05 |
enell |
176 |
request.setParameterValue("columnColumnMapping", "\\1\\"); |
1309 |
08 Sep 05 |
enell |
177 |
request.setParameterValue("rowColumnMapping", "\\2\\"); |
1309 |
08 Sep 05 |
enell |
178 |
|
1309 |
08 Sep 05 |
enell |
179 |
PluginResponse response = request.invoke(); |
1309 |
08 Sep 05 |
enell |
180 |
if (response.getStatus() == Response.Status.DONE) |
1309 |
08 Sep 05 |
enell |
181 |
{ |
1779 |
17 Jan 06 |
nicklas |
182 |
response.saveParameters(dc); |
1309 |
08 Sep 05 |
enell |
183 |
dc.saveItem(pc); |
1309 |
08 Sep 05 |
enell |
184 |
dc.commit(); |
1309 |
08 Sep 05 |
enell |
185 |
} |
1309 |
08 Sep 05 |
enell |
186 |
else if (response.getStatus() == Response.Status.ERROR) |
1309 |
08 Sep 05 |
enell |
187 |
{ |
1622 |
16 Nov 05 |
nicklas |
188 |
throw new BaseException(response.getMessage(), response.getErrorList().get(0)); |
1309 |
08 Sep 05 |
enell |
189 |
} |
1309 |
08 Sep 05 |
enell |
190 |
else |
1309 |
08 Sep 05 |
enell |
191 |
{ |
1309 |
08 Sep 05 |
enell |
192 |
throw new BaseException("Unknown status on response: "+response.getStatus()); |
1309 |
08 Sep 05 |
enell |
193 |
} |
1309 |
08 Sep 05 |
enell |
194 |
id = pc.getId(); |
1309 |
08 Sep 05 |
enell |
195 |
write("--Create configuration for reporter map import OK"); |
1309 |
08 Sep 05 |
enell |
196 |
} |
1309 |
08 Sep 05 |
enell |
197 |
catch (Throwable ex) |
1309 |
08 Sep 05 |
enell |
198 |
{ |
1309 |
08 Sep 05 |
enell |
199 |
write("--Create configuration for reporter map import FAILED"); |
1309 |
08 Sep 05 |
enell |
200 |
ex.printStackTrace(); |
1309 |
08 Sep 05 |
enell |
201 |
ok = false; |
1309 |
08 Sep 05 |
enell |
202 |
} |
1309 |
08 Sep 05 |
enell |
203 |
finally |
1309 |
08 Sep 05 |
enell |
204 |
{ |
1309 |
08 Sep 05 |
enell |
205 |
if (dc != null) dc.close(); |
1309 |
08 Sep 05 |
enell |
206 |
} |
1309 |
08 Sep 05 |
enell |
207 |
return id; |
1309 |
08 Sep 05 |
enell |
208 |
} |
1309 |
08 Sep 05 |
enell |
209 |
|
1309 |
08 Sep 05 |
enell |
210 |
static int test_create_job(int pluginConfigurationId, int fileId) |
1309 |
08 Sep 05 |
enell |
211 |
{ |
1309 |
08 Sep 05 |
enell |
212 |
if (pluginConfigurationId == 0 || fileId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.JOB)) return 0; |
1309 |
08 Sep 05 |
enell |
213 |
int id = 0; |
1309 |
08 Sep 05 |
enell |
214 |
DbControl dc = null; |
1309 |
08 Sep 05 |
enell |
215 |
try |
1309 |
08 Sep 05 |
enell |
216 |
{ |
1309 |
08 Sep 05 |
enell |
217 |
dc = TestUtil.getDbControl(); |
1309 |
08 Sep 05 |
enell |
218 |
|
1309 |
08 Sep 05 |
enell |
219 |
PluginConfiguration pc = PluginConfiguration.getById(dc, pluginConfigurationId); |
4254 |
28 Apr 08 |
nicklas |
220 |
Job j = pc.newJob(null); |
1309 |
08 Sep 05 |
enell |
221 |
j.setName(pc.getName()); |
1309 |
08 Sep 05 |
enell |
222 |
|
1789 |
18 Jan 06 |
nicklas |
223 |
PluginConfigurationRequest request = j.configure(null); |
1309 |
08 Sep 05 |
enell |
224 |
write_request_information(request.getRequestInformation()); |
1309 |
08 Sep 05 |
enell |
225 |
request.setParameterValue("file", File.getById(dc, fileId)); |
1309 |
08 Sep 05 |
enell |
226 |
request.setParameterValue("updateExisting", false); |
1309 |
08 Sep 05 |
enell |
227 |
|
1309 |
08 Sep 05 |
enell |
228 |
PluginResponse response = request.invoke(); |
1309 |
08 Sep 05 |
enell |
229 |
if (response.getStatus() == Response.Status.DONE) |
1309 |
08 Sep 05 |
enell |
230 |
{ |
1779 |
17 Jan 06 |
nicklas |
231 |
response.saveParameters(dc); |
1309 |
08 Sep 05 |
enell |
232 |
dc.saveItem(j); |
1309 |
08 Sep 05 |
enell |
233 |
dc.commit(); |
1309 |
08 Sep 05 |
enell |
234 |
} |
1309 |
08 Sep 05 |
enell |
235 |
else |
1309 |
08 Sep 05 |
enell |
236 |
{ |
1622 |
16 Nov 05 |
nicklas |
237 |
throw new BaseException(response.getMessage(), response.getErrorList().get(0)); |
1309 |
08 Sep 05 |
enell |
238 |
} |
1309 |
08 Sep 05 |
enell |
239 |
id = j.getId(); |
1309 |
08 Sep 05 |
enell |
240 |
write("--Create job for import OK"); |
1309 |
08 Sep 05 |
enell |
241 |
} |
1309 |
08 Sep 05 |
enell |
242 |
catch (Throwable ex) |
1309 |
08 Sep 05 |
enell |
243 |
{ |
1309 |
08 Sep 05 |
enell |
244 |
write("--Create job for import FAILED"); |
1309 |
08 Sep 05 |
enell |
245 |
ex.printStackTrace(); |
1309 |
08 Sep 05 |
enell |
246 |
ok = false; |
1309 |
08 Sep 05 |
enell |
247 |
} |
1309 |
08 Sep 05 |
enell |
248 |
finally |
1309 |
08 Sep 05 |
enell |
249 |
{ |
1309 |
08 Sep 05 |
enell |
250 |
if (dc != null) dc.close(); |
1309 |
08 Sep 05 |
enell |
251 |
} |
1309 |
08 Sep 05 |
enell |
252 |
return id; |
1309 |
08 Sep 05 |
enell |
253 |
} |
1309 |
08 Sep 05 |
enell |
254 |
|
1309 |
08 Sep 05 |
enell |
255 |
static int test_create_map_job(int pluginConfigurationId, int fileId, int arrayDesignId) |
1309 |
08 Sep 05 |
enell |
256 |
{ |
1309 |
08 Sep 05 |
enell |
257 |
if (pluginConfigurationId == 0 || fileId == 0 || arrayDesignId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.JOB)) return 0; |
1309 |
08 Sep 05 |
enell |
258 |
int id = 0; |
1309 |
08 Sep 05 |
enell |
259 |
DbControl dc = null; |
1309 |
08 Sep 05 |
enell |
260 |
try |
1309 |
08 Sep 05 |
enell |
261 |
{ |
1309 |
08 Sep 05 |
enell |
262 |
dc = TestUtil.getDbControl(); |
1309 |
08 Sep 05 |
enell |
263 |
|
1309 |
08 Sep 05 |
enell |
264 |
PluginConfiguration pc = PluginConfiguration.getById(dc, pluginConfigurationId); |
4254 |
28 Apr 08 |
nicklas |
265 |
Job j = pc.newJob(null); |
1309 |
08 Sep 05 |
enell |
266 |
j.setName(pc.getName()); |
1309 |
08 Sep 05 |
enell |
267 |
|
1789 |
18 Jan 06 |
nicklas |
268 |
PluginConfigurationRequest request = j.configure(null); |
1309 |
08 Sep 05 |
enell |
269 |
write_request_information(request.getRequestInformation()); |
1309 |
08 Sep 05 |
enell |
270 |
request.setParameterValue("file", File.getById(dc, fileId)); |
1309 |
08 Sep 05 |
enell |
271 |
request.setParameterValue("arrayDesign", ArrayDesign.getById(dc, arrayDesignId)); |
1309 |
08 Sep 05 |
enell |
272 |
|
1309 |
08 Sep 05 |
enell |
273 |
PluginResponse response = request.invoke(); |
1309 |
08 Sep 05 |
enell |
274 |
if (response.getStatus() == Response.Status.DONE) |
1309 |
08 Sep 05 |
enell |
275 |
{ |
1779 |
17 Jan 06 |
nicklas |
276 |
response.saveParameters(dc); |
1309 |
08 Sep 05 |
enell |
277 |
dc.saveItem(j); |
1309 |
08 Sep 05 |
enell |
278 |
dc.commit(); |
1309 |
08 Sep 05 |
enell |
279 |
} |
1309 |
08 Sep 05 |
enell |
280 |
else |
1309 |
08 Sep 05 |
enell |
281 |
{ |
1622 |
16 Nov 05 |
nicklas |
282 |
throw new BaseException(response.getMessage(), response.getErrorList().get(0)); |
1309 |
08 Sep 05 |
enell |
283 |
} |
1309 |
08 Sep 05 |
enell |
284 |
id = j.getId(); |
1309 |
08 Sep 05 |
enell |
285 |
write("--Create job for map import OK"); |
1309 |
08 Sep 05 |
enell |
286 |
} |
1309 |
08 Sep 05 |
enell |
287 |
catch (Throwable ex) |
1309 |
08 Sep 05 |
enell |
288 |
{ |
1309 |
08 Sep 05 |
enell |
289 |
write("--Create job for map import FAILED"); |
1309 |
08 Sep 05 |
enell |
290 |
ex.printStackTrace(); |
1309 |
08 Sep 05 |
enell |
291 |
ok = false; |
1309 |
08 Sep 05 |
enell |
292 |
} |
1309 |
08 Sep 05 |
enell |
293 |
finally |
1309 |
08 Sep 05 |
enell |
294 |
{ |
1309 |
08 Sep 05 |
enell |
295 |
if (dc != null) dc.close(); |
1309 |
08 Sep 05 |
enell |
296 |
} |
1309 |
08 Sep 05 |
enell |
297 |
return id; |
1309 |
08 Sep 05 |
enell |
298 |
} |
1309 |
08 Sep 05 |
enell |
299 |
|
1309 |
08 Sep 05 |
enell |
300 |
|
1309 |
08 Sep 05 |
enell |
301 |
static void write(String message) |
1309 |
08 Sep 05 |
enell |
302 |
{ |
1309 |
08 Sep 05 |
enell |
303 |
System.out.println(message); |
1309 |
08 Sep 05 |
enell |
304 |
} |
1309 |
08 Sep 05 |
enell |
305 |
|
1309 |
08 Sep 05 |
enell |
306 |
|
1309 |
08 Sep 05 |
enell |
307 |
static void write_request_information(RequestInformation ri) |
1309 |
08 Sep 05 |
enell |
308 |
{ |
1309 |
08 Sep 05 |
enell |
309 |
if (TestUtil.getSilent()) return; |
1309 |
08 Sep 05 |
enell |
310 |
|
1309 |
08 Sep 05 |
enell |
311 |
write("Request information for command: "+ri.getCommand()); |
1309 |
08 Sep 05 |
enell |
312 |
write("\tTitle:\t"+ri.getTitle()); |
1309 |
08 Sep 05 |
enell |
313 |
write("\tDescription:\t"+ri.getDescription()); |
1396 |
03 Oct 05 |
enell |
314 |
for (PluginParameter<?> pp : ri.getParameters()) |
1309 |
08 Sep 05 |
enell |
315 |
{ |
6875 |
20 Apr 15 |
nicklas |
316 |
ParameterType<?> pt = pp.getParameterType(); |
1309 |
08 Sep 05 |
enell |
317 |
write("\tParameter:\t"+pp.getName() + "\t" + pp.getLabel() + "\t" + pt ); |
1309 |
08 Sep 05 |
enell |
318 |
} |
1309 |
08 Sep 05 |
enell |
319 |
} |
1309 |
08 Sep 05 |
enell |
320 |
} |
1309 |
08 Sep 05 |
enell |
321 |
|