3932 |
13 May 16 |
nicklas |
1 |
package net.sf.basedb.reggie.plugins.release; |
3932 |
13 May 16 |
nicklas |
2 |
|
3932 |
13 May 16 |
nicklas |
3 |
import java.util.ArrayList; |
3932 |
13 May 16 |
nicklas |
4 |
import java.util.Arrays; |
3932 |
13 May 16 |
nicklas |
5 |
import java.util.Collections; |
3932 |
13 May 16 |
nicklas |
6 |
import java.util.List; |
3932 |
13 May 16 |
nicklas |
7 |
import java.util.Set; |
3932 |
13 May 16 |
nicklas |
8 |
|
3932 |
13 May 16 |
nicklas |
9 |
import net.sf.basedb.core.BaseException; |
3932 |
13 May 16 |
nicklas |
10 |
import net.sf.basedb.core.BooleanParameterType; |
3932 |
13 May 16 |
nicklas |
11 |
import net.sf.basedb.core.DbControl; |
3932 |
13 May 16 |
nicklas |
12 |
import net.sf.basedb.core.Directory; |
4345 |
09 Feb 17 |
nicklas |
13 |
import net.sf.basedb.core.FileServer; |
3932 |
13 May 16 |
nicklas |
14 |
import net.sf.basedb.core.Item; |
3932 |
13 May 16 |
nicklas |
15 |
import net.sf.basedb.core.ItemList; |
3932 |
13 May 16 |
nicklas |
16 |
import net.sf.basedb.core.ItemParameterType; |
4345 |
09 Feb 17 |
nicklas |
17 |
import net.sf.basedb.core.ItemQuery; |
3932 |
13 May 16 |
nicklas |
18 |
import net.sf.basedb.core.Path; |
3932 |
13 May 16 |
nicklas |
19 |
import net.sf.basedb.core.PathParameterType; |
3932 |
13 May 16 |
nicklas |
20 |
import net.sf.basedb.core.PluginParameter; |
3932 |
13 May 16 |
nicklas |
21 |
import net.sf.basedb.core.ProgressReporter; |
3932 |
13 May 16 |
nicklas |
22 |
import net.sf.basedb.core.RequestInformation; |
4345 |
09 Feb 17 |
nicklas |
23 |
import net.sf.basedb.core.StringParameterType; |
3932 |
13 May 16 |
nicklas |
24 |
import net.sf.basedb.core.Job.ExecutionTime; |
4992 |
01 Oct 18 |
nicklas |
25 |
import net.sf.basedb.core.Listable; |
3932 |
13 May 16 |
nicklas |
26 |
import net.sf.basedb.core.plugin.AbstractPlugin; |
3932 |
13 May 16 |
nicklas |
27 |
import net.sf.basedb.core.plugin.GuiContext; |
3932 |
13 May 16 |
nicklas |
28 |
import net.sf.basedb.core.plugin.InteractivePlugin; |
3932 |
13 May 16 |
nicklas |
29 |
import net.sf.basedb.core.plugin.Request; |
3932 |
13 May 16 |
nicklas |
30 |
import net.sf.basedb.core.plugin.Response; |
4992 |
01 Oct 18 |
nicklas |
31 |
import net.sf.basedb.core.query.Annotations; |
4345 |
09 Feb 17 |
nicklas |
32 |
import net.sf.basedb.core.query.Expressions; |
4345 |
09 Feb 17 |
nicklas |
33 |
import net.sf.basedb.core.query.Hql; |
4345 |
09 Feb 17 |
nicklas |
34 |
import net.sf.basedb.core.query.Restrictions; |
3932 |
13 May 16 |
nicklas |
35 |
import net.sf.basedb.core.signal.SignalHandler; |
3932 |
13 May 16 |
nicklas |
36 |
import net.sf.basedb.core.signal.SignalTarget; |
3932 |
13 May 16 |
nicklas |
37 |
import net.sf.basedb.core.signal.ThreadSignalHandler; |
4420 |
23 Mar 17 |
nicklas |
38 |
import net.sf.basedb.opengrid.CmdResult; |
4420 |
23 Mar 17 |
nicklas |
39 |
import net.sf.basedb.opengrid.OpenGrid; |
4420 |
23 Mar 17 |
nicklas |
40 |
import net.sf.basedb.opengrid.RemoteHost; |
4420 |
23 Mar 17 |
nicklas |
41 |
import net.sf.basedb.opengrid.RemoteSession; |
4420 |
23 Mar 17 |
nicklas |
42 |
import net.sf.basedb.opengrid.ScriptBuilder; |
4420 |
23 Mar 17 |
nicklas |
43 |
import net.sf.basedb.opengrid.config.ConnectionInfo; |
4345 |
09 Feb 17 |
nicklas |
44 |
import net.sf.basedb.reggie.Reggie; |
4992 |
01 Oct 18 |
nicklas |
45 |
import net.sf.basedb.reggie.dao.Annotationtype; |
4431 |
29 Mar 17 |
nicklas |
46 |
import net.sf.basedb.reggie.dao.Fileserver; |
4339 |
07 Feb 17 |
nicklas |
47 |
import net.sf.basedb.util.FileUtil; |
4431 |
29 Mar 17 |
nicklas |
48 |
import net.sf.basedb.util.NameableComparator; |
5555 |
13 Aug 19 |
nicklas |
49 |
import net.sf.basedb.util.Values; |
3932 |
13 May 16 |
nicklas |
50 |
|
3932 |
13 May 16 |
nicklas |
51 |
/** |
3932 |
13 May 16 |
nicklas |
Plug-in for generating the release files. This class implements |
3932 |
13 May 16 |
nicklas |
the plug-in parts for interacting with the user. Actual export |
3932 |
13 May 16 |
nicklas |
functionality is implemented by {@link ReleaseExporter}. |
3932 |
13 May 16 |
nicklas |
55 |
|
3932 |
13 May 16 |
nicklas |
@author nicklas |
3932 |
13 May 16 |
nicklas |
@since 4.5 |
3932 |
13 May 16 |
nicklas |
58 |
*/ |
3932 |
13 May 16 |
nicklas |
59 |
public class ReleaseExporterPlugin |
3932 |
13 May 16 |
nicklas |
60 |
extends AbstractPlugin |
3932 |
13 May 16 |
nicklas |
61 |
implements InteractivePlugin, SignalTarget |
3932 |
13 May 16 |
nicklas |
62 |
{ |
3932 |
13 May 16 |
nicklas |
63 |
|
4345 |
09 Feb 17 |
nicklas |
64 |
private RequestInformation configureExport; |
4345 |
09 Feb 17 |
nicklas |
65 |
private RequestInformation configureExportLocal; |
4345 |
09 Feb 17 |
nicklas |
66 |
private RequestInformation configureExportRemote; |
4345 |
09 Feb 17 |
nicklas |
67 |
|
3932 |
13 May 16 |
nicklas |
68 |
private ThreadSignalHandler signalHandler; |
3932 |
13 May 16 |
nicklas |
69 |
|
3932 |
13 May 16 |
nicklas |
70 |
public ReleaseExporterPlugin() |
3932 |
13 May 16 |
nicklas |
71 |
{} |
3932 |
13 May 16 |
nicklas |
72 |
|
3932 |
13 May 16 |
nicklas |
73 |
/* |
3932 |
13 May 16 |
nicklas |
From the Plugin interface |
3932 |
13 May 16 |
nicklas |
75 |
-------------------------------- |
3932 |
13 May 16 |
nicklas |
76 |
*/ |
3932 |
13 May 16 |
nicklas |
77 |
@Override |
3932 |
13 May 16 |
nicklas |
78 |
public boolean supportsConfigurations() |
3932 |
13 May 16 |
nicklas |
79 |
{ |
3932 |
13 May 16 |
nicklas |
80 |
return false; |
3932 |
13 May 16 |
nicklas |
81 |
} |
3932 |
13 May 16 |
nicklas |
82 |
@Override |
3932 |
13 May 16 |
nicklas |
83 |
public boolean requiresConfiguration() |
3932 |
13 May 16 |
nicklas |
84 |
{ |
3932 |
13 May 16 |
nicklas |
85 |
return false; |
3932 |
13 May 16 |
nicklas |
86 |
} |
3932 |
13 May 16 |
nicklas |
87 |
|
3932 |
13 May 16 |
nicklas |
88 |
@Override |
3932 |
13 May 16 |
nicklas |
89 |
public MainType getMainType() |
3932 |
13 May 16 |
nicklas |
90 |
{ |
3932 |
13 May 16 |
nicklas |
91 |
return MainType.EXPORT; |
3932 |
13 May 16 |
nicklas |
92 |
} |
3932 |
13 May 16 |
nicklas |
93 |
|
3932 |
13 May 16 |
nicklas |
94 |
@Override |
3932 |
13 May 16 |
nicklas |
95 |
public void run(Request request, Response response, ProgressReporter progress) |
3932 |
13 May 16 |
nicklas |
96 |
{ |
3932 |
13 May 16 |
nicklas |
97 |
if (signalHandler != null) signalHandler.setWorkerThread(null); |
3932 |
13 May 16 |
nicklas |
98 |
|
3932 |
13 May 16 |
nicklas |
99 |
DbControl dc = null; |
4339 |
07 Feb 17 |
nicklas |
100 |
OutputLocation outputLocation = null; |
3932 |
13 May 16 |
nicklas |
101 |
try |
3932 |
13 May 16 |
nicklas |
102 |
{ |
3932 |
13 May 16 |
nicklas |
103 |
dc = sc.newDbControl(); |
3932 |
13 May 16 |
nicklas |
104 |
|
3932 |
13 May 16 |
nicklas |
105 |
ItemList list = (ItemList)job.getValue("itemList"); |
3932 |
13 May 16 |
nicklas |
106 |
list = ItemList.getById(dc, list.getId()); |
3932 |
13 May 16 |
nicklas |
107 |
|
4345 |
09 Feb 17 |
nicklas |
108 |
String releaseType = (String)job.getValue("releaseType"); |
4485 |
09 May 17 |
nicklas |
109 |
String releaseVersion = (String)job.getValue("releaseVersion"); |
3932 |
13 May 16 |
nicklas |
110 |
|
4420 |
23 Mar 17 |
nicklas |
111 |
ReleaseWriterOptions options = new ReleaseWriterOptions(list); |
5140 |
22 Nov 18 |
nicklas |
112 |
options.setSkipHistologyImages(Boolean.TRUE.equals(job.getValue("skipHistologyImages"))); |
5555 |
13 Aug 19 |
nicklas |
113 |
options.setDebugMode(Boolean.TRUE.equals(job.getValue("debugMode"))); |
4345 |
09 Feb 17 |
nicklas |
114 |
|
4345 |
09 Feb 17 |
nicklas |
115 |
if ("Remote".equals(releaseType)) |
4345 |
09 Feb 17 |
nicklas |
116 |
{ |
4420 |
23 Mar 17 |
nicklas |
117 |
options.setVersion(releaseVersion); |
4420 |
23 Mar 17 |
nicklas |
118 |
options.setExportFileSyncScripts(true); |
4481 |
05 May 17 |
nicklas |
119 |
|
4481 |
05 May 17 |
nicklas |
120 |
FileServer fileServer = (FileServer)job.getValue("fileServer"); |
4481 |
05 May 17 |
nicklas |
121 |
fileServer = FileServer.getById(dc, fileServer.getId()); |
6962 |
19 Dec 22 |
nicklas |
122 |
outputLocation = new FileServerOutputLocation(fileServer, releaseVersion, 600); |
4481 |
05 May 17 |
nicklas |
123 |
outputLocation.setOverwrite(Boolean.TRUE.equals(job.getValue("overwrite"))); |
4345 |
09 Feb 17 |
nicklas |
124 |
} |
4345 |
09 Feb 17 |
nicklas |
125 |
else // Local |
4345 |
09 Feb 17 |
nicklas |
126 |
{ |
5106 |
19 Nov 18 |
nicklas |
127 |
options.setVersion("Local"); |
5106 |
19 Nov 18 |
nicklas |
128 |
options.setExportFileSyncScripts(true); |
5106 |
19 Nov 18 |
nicklas |
129 |
|
4345 |
09 Feb 17 |
nicklas |
130 |
String saveToPath = (String)job.getValue("saveTo"); |
4345 |
09 Feb 17 |
nicklas |
131 |
Directory saveTo = Directory.getNew(dc, new Path(saveToPath, Path.Type.DIRECTORY)); |
4345 |
09 Feb 17 |
nicklas |
132 |
outputLocation = new BaseFileOutputLocation(dc, saveTo); |
4481 |
05 May 17 |
nicklas |
133 |
outputLocation.setOverwrite(Boolean.TRUE.equals(job.getValue("overwrite"))); |
4345 |
09 Feb 17 |
nicklas |
134 |
} |
4345 |
09 Feb 17 |
nicklas |
135 |
|
4079 |
06 Sep 16 |
nicklas |
136 |
ReleaseExporter exporter = new ReleaseExporter(options); |
3932 |
13 May 16 |
nicklas |
137 |
exporter.setItemList(list); |
4339 |
07 Feb 17 |
nicklas |
138 |
exporter.setOutputLocation(outputLocation); |
3932 |
13 May 16 |
nicklas |
139 |
exporter.createAllReleaseFiles(dc, progress); |
3971 |
24 May 16 |
nicklas |
140 |
|
3932 |
13 May 16 |
nicklas |
141 |
dc.commit(); |
4552 |
04 Jul 17 |
nicklas |
142 |
String msg = releaseType + " release of '" + list.getName() + "'" + (releaseVersion != null ? " (version " + releaseVersion + ")" : "") + " has been created"; |
5555 |
13 Aug 19 |
nicklas |
143 |
if (options.debugMode()) |
5555 |
13 Aug 19 |
nicklas |
144 |
{ |
5555 |
13 Aug 19 |
nicklas |
// DEBUG!! will make it easier to re-run a job with same settings |
5555 |
13 Aug 19 |
nicklas |
146 |
response.setError("[DEBUG] "+msg, null); |
5555 |
13 Aug 19 |
nicklas |
147 |
} |
5555 |
13 Aug 19 |
nicklas |
148 |
else |
5555 |
13 Aug 19 |
nicklas |
149 |
{ |
5555 |
13 Aug 19 |
nicklas |
150 |
response.setDone(msg); |
5555 |
13 Aug 19 |
nicklas |
151 |
} |
3932 |
13 May 16 |
nicklas |
152 |
} |
3932 |
13 May 16 |
nicklas |
153 |
catch (Throwable t) |
3932 |
13 May 16 |
nicklas |
154 |
{ |
3932 |
13 May 16 |
nicklas |
155 |
response.setError(t.getMessage(), Arrays.asList(t)); |
3932 |
13 May 16 |
nicklas |
156 |
} |
3932 |
13 May 16 |
nicklas |
157 |
finally |
3932 |
13 May 16 |
nicklas |
158 |
{ |
4339 |
07 Feb 17 |
nicklas |
159 |
FileUtil.close(outputLocation); |
3932 |
13 May 16 |
nicklas |
160 |
if (dc != null) dc.close(); |
3932 |
13 May 16 |
nicklas |
161 |
} |
3932 |
13 May 16 |
nicklas |
162 |
|
3932 |
13 May 16 |
nicklas |
163 |
} |
3932 |
13 May 16 |
nicklas |
164 |
// ------------------------------------- |
3932 |
13 May 16 |
nicklas |
165 |
/* |
3932 |
13 May 16 |
nicklas |
From the InteractivePlugin interface |
3932 |
13 May 16 |
nicklas |
167 |
------------------------------------------- |
3932 |
13 May 16 |
nicklas |
168 |
*/ |
3932 |
13 May 16 |
nicklas |
169 |
/** |
3932 |
13 May 16 |
nicklas |
The plug-in will appear on the single-item view |
3932 |
13 May 16 |
nicklas |
for item lists. |
3932 |
13 May 16 |
nicklas |
172 |
*/ |
3932 |
13 May 16 |
nicklas |
173 |
@Override |
3932 |
13 May 16 |
nicklas |
174 |
public Set<GuiContext> getGuiContexts() |
3932 |
13 May 16 |
nicklas |
175 |
{ |
3932 |
13 May 16 |
nicklas |
176 |
return Collections.singleton(GuiContext.item(Item.ITEMLIST)); |
3932 |
13 May 16 |
nicklas |
177 |
} |
3932 |
13 May 16 |
nicklas |
178 |
/** |
3932 |
13 May 16 |
nicklas |
We accept all itemlists with raw bioassays. |
3932 |
13 May 16 |
nicklas |
180 |
*/ |
3932 |
13 May 16 |
nicklas |
181 |
@Override |
3932 |
13 May 16 |
nicklas |
182 |
public String isInContext(GuiContext context, Object item) |
3932 |
13 May 16 |
nicklas |
183 |
{ |
3932 |
13 May 16 |
nicklas |
184 |
String message = null; |
3932 |
13 May 16 |
nicklas |
185 |
if (item == null) |
3932 |
13 May 16 |
nicklas |
186 |
{ |
3932 |
13 May 16 |
nicklas |
187 |
message = "The object is null"; |
3932 |
13 May 16 |
nicklas |
188 |
} |
3932 |
13 May 16 |
nicklas |
189 |
else if (!(item instanceof ItemList)) |
3932 |
13 May 16 |
nicklas |
190 |
{ |
3932 |
13 May 16 |
nicklas |
191 |
message = "The object is not an item list: " + item; |
3932 |
13 May 16 |
nicklas |
192 |
} |
3932 |
13 May 16 |
nicklas |
193 |
ItemList list = (ItemList)item; |
5089 |
14 Nov 18 |
nicklas |
194 |
if (list.getMemberType() != Item.BIOSOURCE) |
3932 |
13 May 16 |
nicklas |
195 |
{ |
5089 |
14 Nov 18 |
nicklas |
196 |
message = "This plug-in need an item list with biosources"; |
3932 |
13 May 16 |
nicklas |
197 |
} |
3932 |
13 May 16 |
nicklas |
198 |
return message; |
3932 |
13 May 16 |
nicklas |
199 |
} |
3932 |
13 May 16 |
nicklas |
200 |
@Override |
3932 |
13 May 16 |
nicklas |
201 |
public RequestInformation getRequestInformation(GuiContext context, String command) |
3932 |
13 May 16 |
nicklas |
202 |
throws BaseException |
3932 |
13 May 16 |
nicklas |
203 |
{ |
3932 |
13 May 16 |
nicklas |
204 |
RequestInformation requestInformation = null; |
3932 |
13 May 16 |
nicklas |
205 |
if (Request.COMMAND_CONFIGURE_JOB.equals(command)) |
3932 |
13 May 16 |
nicklas |
206 |
{ |
4345 |
09 Feb 17 |
nicklas |
207 |
requestInformation = getConfigureExportParameters(); |
3932 |
13 May 16 |
nicklas |
208 |
} |
4345 |
09 Feb 17 |
nicklas |
209 |
else if ("ExportLocal".equals(command)) |
4345 |
09 Feb 17 |
nicklas |
210 |
{ |
4345 |
09 Feb 17 |
nicklas |
211 |
requestInformation = getConfigureExportLocalParameters(); |
4345 |
09 Feb 17 |
nicklas |
212 |
} |
4345 |
09 Feb 17 |
nicklas |
213 |
else if ("ExportRemote".equals(command)) |
4345 |
09 Feb 17 |
nicklas |
214 |
{ |
4345 |
09 Feb 17 |
nicklas |
215 |
requestInformation = getConfigureExportRemoteParameters(); |
4345 |
09 Feb 17 |
nicklas |
216 |
} |
3932 |
13 May 16 |
nicklas |
217 |
return requestInformation; |
3932 |
13 May 16 |
nicklas |
218 |
} |
3932 |
13 May 16 |
nicklas |
219 |
|
3932 |
13 May 16 |
nicklas |
220 |
@Override |
3932 |
13 May 16 |
nicklas |
221 |
public void configure(GuiContext context, Request request, Response response) |
3932 |
13 May 16 |
nicklas |
222 |
{ |
3932 |
13 May 16 |
nicklas |
223 |
String command = request.getCommand(); |
3932 |
13 May 16 |
nicklas |
224 |
try |
3932 |
13 May 16 |
nicklas |
225 |
{ |
3932 |
13 May 16 |
nicklas |
226 |
if (command.equals(Request.COMMAND_CONFIGURE_JOB)) |
3932 |
13 May 16 |
nicklas |
227 |
{ |
4345 |
09 Feb 17 |
nicklas |
228 |
RequestInformation ri = getConfigureExportParameters(); |
3932 |
13 May 16 |
nicklas |
229 |
List<Throwable> errors = validateRequestParameters(ri.getParameters(), request); |
3932 |
13 May 16 |
nicklas |
230 |
if (errors != null) |
3932 |
13 May 16 |
nicklas |
231 |
{ |
3932 |
13 May 16 |
nicklas |
232 |
response.setError(errors.size() + " invalid parameters were found in the request",errors); |
3932 |
13 May 16 |
nicklas |
233 |
return; |
4345 |
09 Feb 17 |
nicklas |
234 |
} |
3932 |
13 May 16 |
nicklas |
235 |
|
4992 |
01 Oct 18 |
nicklas |
236 |
if (ri.getParameter("acceptDoNotUse") != null && !Boolean.TRUE.equals(request.getParameterValue("acceptDoNotUse"))) |
4992 |
01 Oct 18 |
nicklas |
237 |
{ |
4992 |
01 Oct 18 |
nicklas |
238 |
response.setError("The DoNotUse parameter must be set TRUE", null); |
4992 |
01 Oct 18 |
nicklas |
239 |
return; |
4992 |
01 Oct 18 |
nicklas |
240 |
} |
4992 |
01 Oct 18 |
nicklas |
241 |
|
3979 |
27 May 16 |
nicklas |
242 |
DbControl dc = null; |
3979 |
27 May 16 |
nicklas |
243 |
ItemList list = (ItemList)request.getParameterValue("itemList"); |
3979 |
27 May 16 |
nicklas |
244 |
try |
3979 |
27 May 16 |
nicklas |
245 |
{ |
3979 |
27 May 16 |
nicklas |
// Make some pre-checks before accepting the job |
3979 |
27 May 16 |
nicklas |
247 |
dc = sc.newDbControl(); |
3979 |
27 May 16 |
nicklas |
248 |
list = ItemList.getById(dc, list.getId()); |
4420 |
23 Mar 17 |
nicklas |
249 |
ReleaseExporter exporter = new ReleaseExporter(new ReleaseWriterOptions(list)); |
3979 |
27 May 16 |
nicklas |
250 |
exporter.setItemList(list); |
3979 |
27 May 16 |
nicklas |
251 |
} |
3979 |
27 May 16 |
nicklas |
252 |
catch (RuntimeException ex) |
3979 |
27 May 16 |
nicklas |
253 |
{ |
3979 |
27 May 16 |
nicklas |
254 |
response.setError("The '" + list.getName() + "' list can't be used", |
3979 |
27 May 16 |
nicklas |
255 |
Collections.singletonList(ex)); |
3979 |
27 May 16 |
nicklas |
256 |
return; |
3979 |
27 May 16 |
nicklas |
257 |
} |
3979 |
27 May 16 |
nicklas |
258 |
finally |
3979 |
27 May 16 |
nicklas |
259 |
{ |
3979 |
27 May 16 |
nicklas |
260 |
if (dc != null) dc.close(); |
3979 |
27 May 16 |
nicklas |
261 |
} |
3979 |
27 May 16 |
nicklas |
262 |
|
4345 |
09 Feb 17 |
nicklas |
263 |
String releaseType = (String)request.getParameterValue("releaseType"); |
4345 |
09 Feb 17 |
nicklas |
264 |
|
3932 |
13 May 16 |
nicklas |
265 |
storeValue(job, request, ri.getParameter("itemList")); |
4345 |
09 Feb 17 |
nicklas |
266 |
storeValue(job, request, ri.getParameter("releaseType")); |
4992 |
01 Oct 18 |
nicklas |
267 |
storeValue(job, request, ri.getParameter("acceptDoNotUse")); |
4345 |
09 Feb 17 |
nicklas |
268 |
|
4345 |
09 Feb 17 |
nicklas |
269 |
if ("Remote".equals(releaseType)) |
4345 |
09 Feb 17 |
nicklas |
270 |
{ |
4345 |
09 Feb 17 |
nicklas |
271 |
response.setContinue("ExportRemote"); |
4345 |
09 Feb 17 |
nicklas |
272 |
} |
4345 |
09 Feb 17 |
nicklas |
273 |
else |
4345 |
09 Feb 17 |
nicklas |
274 |
{ |
4345 |
09 Feb 17 |
nicklas |
275 |
response.setContinue("ExportLocal"); |
4345 |
09 Feb 17 |
nicklas |
276 |
} |
4345 |
09 Feb 17 |
nicklas |
277 |
} |
4345 |
09 Feb 17 |
nicklas |
278 |
else if (command.equals("ExportLocal")) |
4345 |
09 Feb 17 |
nicklas |
279 |
{ |
4345 |
09 Feb 17 |
nicklas |
280 |
RequestInformation ri = getConfigureExportLocalParameters(); |
4345 |
09 Feb 17 |
nicklas |
281 |
List<Throwable> errors = validateRequestParameters(ri.getParameters(), request); |
4345 |
09 Feb 17 |
nicklas |
282 |
if (errors != null) |
4345 |
09 Feb 17 |
nicklas |
283 |
{ |
4345 |
09 Feb 17 |
nicklas |
284 |
response.setError(errors.size() + " invalid parameters were found in the request",errors); |
4345 |
09 Feb 17 |
nicklas |
285 |
return; |
4345 |
09 Feb 17 |
nicklas |
286 |
} |
4345 |
09 Feb 17 |
nicklas |
287 |
|
4345 |
09 Feb 17 |
nicklas |
288 |
ItemList list = (ItemList)job.getValue("itemList"); |
4345 |
09 Feb 17 |
nicklas |
289 |
|
3932 |
13 May 16 |
nicklas |
290 |
storeValue(job, request, ri.getParameter("saveTo")); |
3932 |
13 May 16 |
nicklas |
291 |
storeValue(job, request, ri.getParameter("overwrite")); |
5140 |
22 Nov 18 |
nicklas |
292 |
|
5140 |
22 Nov 18 |
nicklas |
// Export options |
5140 |
22 Nov 18 |
nicklas |
294 |
storeValue(job, request, ri.getParameter("skipHistologyImages")); |
5555 |
13 Aug 19 |
nicklas |
295 |
storeValue(job, request, ri.getParameter("debugMode")); |
4345 |
09 Feb 17 |
nicklas |
296 |
|
4345 |
09 Feb 17 |
nicklas |
297 |
response.setSuggestedJobName("Local release export for '" + list.getName() + "'"); |
3932 |
13 May 16 |
nicklas |
298 |
response.setDone("The job configuration is complete", ExecutionTime.MEDIUM); |
3932 |
13 May 16 |
nicklas |
299 |
} |
4345 |
09 Feb 17 |
nicklas |
300 |
else if (command.equals("ExportRemote")) |
4345 |
09 Feb 17 |
nicklas |
301 |
{ |
4345 |
09 Feb 17 |
nicklas |
302 |
RequestInformation ri = getConfigureExportRemoteParameters(); |
4345 |
09 Feb 17 |
nicklas |
303 |
List<Throwable> errors = validateRequestParameters(ri.getParameters(), request); |
4345 |
09 Feb 17 |
nicklas |
304 |
if (errors != null) |
4345 |
09 Feb 17 |
nicklas |
305 |
{ |
4345 |
09 Feb 17 |
nicklas |
306 |
response.setError(errors.size() + " invalid parameters were found in the request",errors); |
4345 |
09 Feb 17 |
nicklas |
307 |
return; |
4345 |
09 Feb 17 |
nicklas |
308 |
} |
4345 |
09 Feb 17 |
nicklas |
309 |
|
4420 |
23 Mar 17 |
nicklas |
310 |
FileServer server = (FileServer)request.getParameterValue("fileServer"); |
4420 |
23 Mar 17 |
nicklas |
311 |
String releaseVersion = (String)request.getParameterValue("releaseVersion"); |
4420 |
23 Mar 17 |
nicklas |
312 |
if (!releaseVersion.matches("\\d+\\.\\d+")) |
4420 |
23 Mar 17 |
nicklas |
313 |
{ |
4420 |
23 Mar 17 |
nicklas |
314 |
response.setError("Release version must match <<i>major.minor</i>> where " + |
4420 |
23 Mar 17 |
nicklas |
315 |
"<i>major</i> and <i>minor</i> are numeric values: " + releaseVersion, null); |
4420 |
23 Mar 17 |
nicklas |
316 |
return; |
4420 |
23 Mar 17 |
nicklas |
317 |
} |
4420 |
23 Mar 17 |
nicklas |
318 |
|
4430 |
28 Mar 17 |
nicklas |
319 |
if (!Boolean.TRUE.equals(request.getParameterValue("overwrite"))) |
4420 |
23 Mar 17 |
nicklas |
320 |
{ |
4430 |
28 Mar 17 |
nicklas |
// Check that the release directory doesn't already exists on the file server |
4430 |
28 Mar 17 |
nicklas |
322 |
DbControl dc = null; |
4430 |
28 Mar 17 |
nicklas |
323 |
RemoteSession session = null; |
4430 |
28 Mar 17 |
nicklas |
324 |
try |
4420 |
23 Mar 17 |
nicklas |
325 |
{ |
4430 |
28 Mar 17 |
nicklas |
// Make some pre-checks before accepting the job |
4430 |
28 Mar 17 |
nicklas |
327 |
dc = sc.newDbControl(); |
4430 |
28 Mar 17 |
nicklas |
328 |
server = FileServer.getById(dc, server.getId()); |
4430 |
28 Mar 17 |
nicklas |
329 |
String path = server.getRootPath() + "/" + releaseVersion; |
4430 |
28 Mar 17 |
nicklas |
330 |
|
4430 |
28 Mar 17 |
nicklas |
331 |
ConnectionInfo ci = new ConnectionInfo(server); |
4430 |
28 Mar 17 |
nicklas |
332 |
RemoteHost host = new RemoteHost(ci); |
4430 |
28 Mar 17 |
nicklas |
333 |
session = host.connect(5); |
4430 |
28 Mar 17 |
nicklas |
334 |
|
4430 |
28 Mar 17 |
nicklas |
335 |
ScriptBuilder script = new ScriptBuilder(); |
4430 |
28 Mar 17 |
nicklas |
336 |
script.cmd("if [ -d " + path + " ]; then"); |
4430 |
28 Mar 17 |
nicklas |
337 |
script.cmd(" exit 99"); |
4430 |
28 Mar 17 |
nicklas |
338 |
script.cmd("fi"); |
4430 |
28 Mar 17 |
nicklas |
339 |
|
4430 |
28 Mar 17 |
nicklas |
340 |
CmdResult<String> checkDir = session.executeCmd(script.toString(), 5); |
4430 |
28 Mar 17 |
nicklas |
341 |
if (checkDir.getExitStatus() == 99) |
4430 |
28 Mar 17 |
nicklas |
342 |
{ |
4430 |
28 Mar 17 |
nicklas |
343 |
response.setError("Directory already exists on host '" + server.getHost() + "': " + path, null); |
4430 |
28 Mar 17 |
nicklas |
344 |
return; |
4430 |
28 Mar 17 |
nicklas |
345 |
} |
4430 |
28 Mar 17 |
nicklas |
346 |
checkDir.throwExceptionIfNonZeroExitStatus(); |
4430 |
28 Mar 17 |
nicklas |
347 |
} |
4430 |
28 Mar 17 |
nicklas |
348 |
catch (RuntimeException ex) |
4430 |
28 Mar 17 |
nicklas |
349 |
{ |
4430 |
28 Mar 17 |
nicklas |
350 |
response.setError(ex.getMessage(), Collections.singletonList(ex)); |
4420 |
23 Mar 17 |
nicklas |
351 |
return; |
4420 |
23 Mar 17 |
nicklas |
352 |
} |
4430 |
28 Mar 17 |
nicklas |
353 |
finally |
4430 |
28 Mar 17 |
nicklas |
354 |
{ |
4430 |
28 Mar 17 |
nicklas |
355 |
if (dc != null) dc.close(); |
4430 |
28 Mar 17 |
nicklas |
356 |
OpenGrid.close(session); |
4430 |
28 Mar 17 |
nicklas |
357 |
} |
4420 |
23 Mar 17 |
nicklas |
358 |
} |
4420 |
23 Mar 17 |
nicklas |
359 |
|
4345 |
09 Feb 17 |
nicklas |
360 |
ItemList list = (ItemList)job.getValue("itemList"); |
4420 |
23 Mar 17 |
nicklas |
361 |
|
4345 |
09 Feb 17 |
nicklas |
362 |
storeValue(job, request, ri.getParameter("fileServer")); |
4420 |
23 Mar 17 |
nicklas |
363 |
storeValue(job, request, ri.getParameter("releaseVersion")); |
4430 |
28 Mar 17 |
nicklas |
364 |
storeValue(job, request, ri.getParameter("overwrite")); |
5140 |
22 Nov 18 |
nicklas |
365 |
|
5140 |
22 Nov 18 |
nicklas |
// Export options |
5140 |
22 Nov 18 |
nicklas |
367 |
storeValue(job, request, ri.getParameter("skipHistologyImages")); |
5555 |
13 Aug 19 |
nicklas |
368 |
storeValue(job, request, ri.getParameter("debugMode")); |
4485 |
09 May 17 |
nicklas |
369 |
job.getJob().setDescription("Specify release version '" + releaseVersion + "' when importing on the remote server."); |
4345 |
09 Feb 17 |
nicklas |
370 |
|
4485 |
09 May 17 |
nicklas |
371 |
response.setSuggestedJobName("Remote release export for '" + list.getName() + "' (version " + releaseVersion + ")"); |
4345 |
09 Feb 17 |
nicklas |
372 |
response.setDone("The job configuration is complete", ExecutionTime.MEDIUM); |
4345 |
09 Feb 17 |
nicklas |
373 |
} |
3932 |
13 May 16 |
nicklas |
374 |
} |
4420 |
23 Mar 17 |
nicklas |
375 |
catch (Throwable ex) |
3932 |
13 May 16 |
nicklas |
376 |
{ |
3932 |
13 May 16 |
nicklas |
377 |
response.setError(ex.getMessage(), Arrays.asList(ex)); |
3932 |
13 May 16 |
nicklas |
378 |
} |
3932 |
13 May 16 |
nicklas |
379 |
} |
3932 |
13 May 16 |
nicklas |
380 |
|
3932 |
13 May 16 |
nicklas |
381 |
/* |
3932 |
13 May 16 |
nicklas |
From the SignalTarget interface |
3932 |
13 May 16 |
nicklas |
383 |
------------------------------------------- |
3932 |
13 May 16 |
nicklas |
384 |
*/ |
3932 |
13 May 16 |
nicklas |
385 |
@Override |
3932 |
13 May 16 |
nicklas |
386 |
public SignalHandler getSignalHandler() |
3932 |
13 May 16 |
nicklas |
387 |
{ |
3932 |
13 May 16 |
nicklas |
388 |
signalHandler = new ThreadSignalHandler(); |
3932 |
13 May 16 |
nicklas |
389 |
return signalHandler; |
3932 |
13 May 16 |
nicklas |
390 |
} |
3932 |
13 May 16 |
nicklas |
391 |
// ------------------------------------------- |
3932 |
13 May 16 |
nicklas |
392 |
|
3932 |
13 May 16 |
nicklas |
393 |
|
4345 |
09 Feb 17 |
nicklas |
394 |
private RequestInformation getConfigureExportParameters() |
3932 |
13 May 16 |
nicklas |
395 |
{ |
4345 |
09 Feb 17 |
nicklas |
396 |
if (configureExport == null) |
3932 |
13 May 16 |
nicklas |
397 |
{ |
3932 |
13 May 16 |
nicklas |
// Load the current item list |
3932 |
13 May 16 |
nicklas |
399 |
ItemList currentList = null; |
3932 |
13 May 16 |
nicklas |
400 |
int currentListId = sc.getCurrentContext(Item.ITEMLIST).getId(); |
4992 |
01 Oct 18 |
nicklas |
401 |
long numDoNotUse = 0; |
3932 |
13 May 16 |
nicklas |
402 |
if (currentListId != 0) |
3932 |
13 May 16 |
nicklas |
403 |
{ |
3932 |
13 May 16 |
nicklas |
404 |
DbControl dc = sc.newDbControl(); |
3932 |
13 May 16 |
nicklas |
405 |
try |
3932 |
13 May 16 |
nicklas |
406 |
{ |
3932 |
13 May 16 |
nicklas |
407 |
currentList = ItemList.getById(dc, currentListId); |
4992 |
01 Oct 18 |
nicklas |
408 |
ItemQuery<? extends Listable> query = currentList.getMembers(); |
4992 |
01 Oct 18 |
nicklas |
409 |
query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); |
4992 |
01 Oct 18 |
nicklas |
410 |
query.join(Annotations.innerJoin(Annotationtype.DO_NOT_USE.load(dc), "dnu"));; |
4992 |
01 Oct 18 |
nicklas |
411 |
numDoNotUse = query.count(dc); |
3932 |
13 May 16 |
nicklas |
412 |
} |
3932 |
13 May 16 |
nicklas |
413 |
finally |
3932 |
13 May 16 |
nicklas |
414 |
{ |
3932 |
13 May 16 |
nicklas |
415 |
if (dc != null) dc.close(); |
3932 |
13 May 16 |
nicklas |
416 |
} |
3932 |
13 May 16 |
nicklas |
417 |
} |
3932 |
13 May 16 |
nicklas |
418 |
|
3932 |
13 May 16 |
nicklas |
419 |
List<PluginParameter<?>> parameters = new ArrayList<PluginParameter<?>>(); |
3932 |
13 May 16 |
nicklas |
420 |
|
3932 |
13 May 16 |
nicklas |
421 |
parameters.add(new PluginParameter<ItemList>( |
5089 |
14 Nov 18 |
nicklas |
422 |
"itemList", "Biosource list", "Select the list with biosources (patients and other types) to export", |
3932 |
13 May 16 |
nicklas |
423 |
new ItemParameterType<ItemList>(ItemList.class, currentList, true, 1, null) |
3932 |
13 May 16 |
nicklas |
424 |
)); |
3932 |
13 May 16 |
nicklas |
425 |
|
4345 |
09 Feb 17 |
nicklas |
426 |
parameters.add(new PluginParameter<String>( |
4345 |
09 Feb 17 |
nicklas |
427 |
"releaseType", "Release type", |
4345 |
09 Feb 17 |
nicklas |
428 |
"Select the type of release to create. \n" + |
4345 |
09 Feb 17 |
nicklas |
429 |
"Local = Release files are saved on the local BASE server\n" + |
4345 |
09 Feb 17 |
nicklas |
430 |
"Remote = Release files are saved on a remote file server", |
4345 |
09 Feb 17 |
nicklas |
431 |
new StringParameterType(255, null, true, 1, 0, 0, |
4345 |
09 Feb 17 |
nicklas |
432 |
Arrays.asList("Local", "Remote")) |
4078 |
06 Sep 16 |
nicklas |
433 |
)); |
4420 |
23 Mar 17 |
nicklas |
434 |
|
4992 |
01 Oct 18 |
nicklas |
435 |
if (numDoNotUse > 0) |
4992 |
01 Oct 18 |
nicklas |
436 |
{ |
4992 |
01 Oct 18 |
nicklas |
437 |
parameters.add(new PluginParameter<Boolean>( |
4992 |
01 Oct 18 |
nicklas |
438 |
"acceptDoNotUse", "[Warning] DoNotUse", |
4992 |
01 Oct 18 |
nicklas |
439 |
"The selected list contains " + numDoNotUse + " items marked with <b>DoNotUse</b>.\n"+ |
4992 |
01 Oct 18 |
nicklas |
440 |
"To continue with the release this parameter must be set to <b>true</b>.", |
4992 |
01 Oct 18 |
nicklas |
441 |
new BooleanParameterType(null, true) |
4992 |
01 Oct 18 |
nicklas |
442 |
)); |
4992 |
01 Oct 18 |
nicklas |
443 |
} |
4992 |
01 Oct 18 |
nicklas |
444 |
|
4345 |
09 Feb 17 |
nicklas |
445 |
configureExport = new RequestInformation |
4345 |
09 Feb 17 |
nicklas |
446 |
( |
4345 |
09 Feb 17 |
nicklas |
447 |
Request.COMMAND_CONFIGURE_JOB, |
4345 |
09 Feb 17 |
nicklas |
448 |
"Release type", |
4345 |
09 Feb 17 |
nicklas |
449 |
"Select the type of release to create.", |
4345 |
09 Feb 17 |
nicklas |
450 |
parameters |
4345 |
09 Feb 17 |
nicklas |
451 |
); |
4345 |
09 Feb 17 |
nicklas |
452 |
} |
4345 |
09 Feb 17 |
nicklas |
453 |
return configureExport; |
4345 |
09 Feb 17 |
nicklas |
454 |
} |
4345 |
09 Feb 17 |
nicklas |
455 |
|
4345 |
09 Feb 17 |
nicklas |
456 |
private RequestInformation getConfigureExportLocalParameters() |
4345 |
09 Feb 17 |
nicklas |
457 |
{ |
4345 |
09 Feb 17 |
nicklas |
458 |
if (configureExportLocal == null) |
4345 |
09 Feb 17 |
nicklas |
459 |
{ |
4345 |
09 Feb 17 |
nicklas |
460 |
List<PluginParameter<?>> parameters = new ArrayList<PluginParameter<?>>(); |
4345 |
09 Feb 17 |
nicklas |
461 |
|
3932 |
13 May 16 |
nicklas |
462 |
parameters.add(new PluginParameter<String>( |
5140 |
22 Nov 18 |
nicklas |
463 |
"saveToSection", "Save to", "Options affecting where the export is saved.", null |
5140 |
22 Nov 18 |
nicklas |
464 |
)); |
5140 |
22 Nov 18 |
nicklas |
465 |
|
5140 |
22 Nov 18 |
nicklas |
466 |
parameters.add(new PluginParameter<String>( |
3932 |
13 May 16 |
nicklas |
467 |
"saveTo", "Save to", "Select the location where files should be saved", |
3932 |
13 May 16 |
nicklas |
468 |
new PathParameterType(Path.Type.DIRECTORY, null, true) |
3932 |
13 May 16 |
nicklas |
469 |
)); |
3932 |
13 May 16 |
nicklas |
470 |
|
3932 |
13 May 16 |
nicklas |
471 |
parameters.add(new PluginParameter<Boolean>( |
3932 |
13 May 16 |
nicklas |
472 |
"overwrite", "Overwrite", "Is it allowed to overwrite existing files or not?", |
3932 |
13 May 16 |
nicklas |
473 |
new BooleanParameterType(null, false) |
3932 |
13 May 16 |
nicklas |
474 |
)); |
5140 |
22 Nov 18 |
nicklas |
475 |
|
5140 |
22 Nov 18 |
nicklas |
476 |
addExportOptionsParameters(parameters, false); |
4345 |
09 Feb 17 |
nicklas |
477 |
|
4345 |
09 Feb 17 |
nicklas |
478 |
configureExportLocal = new RequestInformation |
3932 |
13 May 16 |
nicklas |
479 |
( |
3932 |
13 May 16 |
nicklas |
480 |
Request.COMMAND_CONFIGURE_JOB, |
4345 |
09 Feb 17 |
nicklas |
481 |
"Local release export options", |
4345 |
09 Feb 17 |
nicklas |
482 |
"Select a location where the files should be saved.", |
3932 |
13 May 16 |
nicklas |
483 |
parameters |
3932 |
13 May 16 |
nicklas |
484 |
); |
3932 |
13 May 16 |
nicklas |
485 |
} |
4345 |
09 Feb 17 |
nicklas |
486 |
return configureExportLocal; |
3932 |
13 May 16 |
nicklas |
487 |
} |
3932 |
13 May 16 |
nicklas |
488 |
|
4345 |
09 Feb 17 |
nicklas |
489 |
private RequestInformation getConfigureExportRemoteParameters() |
4345 |
09 Feb 17 |
nicklas |
490 |
{ |
4345 |
09 Feb 17 |
nicklas |
491 |
if (configureExportRemote == null) |
4345 |
09 Feb 17 |
nicklas |
492 |
{ |
4345 |
09 Feb 17 |
nicklas |
493 |
List<PluginParameter<?>> parameters = new ArrayList<PluginParameter<?>>(); |
4345 |
09 Feb 17 |
nicklas |
494 |
|
4345 |
09 Feb 17 |
nicklas |
495 |
DbControl dc = null; |
4345 |
09 Feb 17 |
nicklas |
496 |
try |
4345 |
09 Feb 17 |
nicklas |
497 |
{ |
4345 |
09 Feb 17 |
nicklas |
498 |
dc = sc.newDbControl(); |
4345 |
09 Feb 17 |
nicklas |
499 |
|
5140 |
22 Nov 18 |
nicklas |
500 |
parameters.add(new PluginParameter<String>( |
5140 |
22 Nov 18 |
nicklas |
501 |
"saveToSection", "Save to", "Options affecting where the export is saved.", null |
5140 |
22 Nov 18 |
nicklas |
502 |
)); |
5140 |
22 Nov 18 |
nicklas |
503 |
|
4345 |
09 Feb 17 |
nicklas |
504 |
ItemQuery<FileServer> query = FileServer.getQuery(); |
4345 |
09 Feb 17 |
nicklas |
505 |
query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); |
4345 |
09 Feb 17 |
nicklas |
506 |
query.restrict(Restrictions.eq(Hql.property("connectionManagerFactory"), Expressions.string("net.sf.basedb.xfiles.sftp-connection-manager"))); |
4431 |
29 Mar 17 |
nicklas |
507 |
List<FileServer> fileServers = new ArrayList<FileServer>(query.list(dc)); |
4431 |
29 Mar 17 |
nicklas |
508 |
FileServer releaseArchive = Fileserver.RELEASE_ARCHIVE.load(dc); |
4431 |
29 Mar 17 |
nicklas |
509 |
if (!fileServers.contains(releaseArchive)) fileServers.add(releaseArchive); |
4431 |
29 Mar 17 |
nicklas |
510 |
fileServers.sort(new NameableComparator<>(false)); |
4430 |
28 Mar 17 |
nicklas |
511 |
|
4431 |
29 Mar 17 |
nicklas |
512 |
parameters.add(new PluginParameter<FileServer>( |
4431 |
29 Mar 17 |
nicklas |
513 |
"fileServer", "File server", |
4431 |
29 Mar 17 |
nicklas |
514 |
"Select the file server where the exported files should be saved.", |
4431 |
29 Mar 17 |
nicklas |
515 |
new ItemParameterType<>(FileServer.class, releaseArchive, true, 1, fileServers) |
4431 |
29 Mar 17 |
nicklas |
516 |
)); |
4431 |
29 Mar 17 |
nicklas |
517 |
|
4430 |
28 Mar 17 |
nicklas |
518 |
parameters.add(new PluginParameter<String>( |
4430 |
28 Mar 17 |
nicklas |
519 |
"releaseVersion", "Release version", |
4430 |
28 Mar 17 |
nicklas |
520 |
"The version number of this release. It should consist of a major and minor " + |
4430 |
28 Mar 17 |
nicklas |
521 |
"number separated with a dot. For example: 1.0, 1.2, 2.1. When creating " + |
4434 |
29 Mar 17 |
nicklas |
522 |
"a remote release the version must not already exist, unless the overwrite " + |
4434 |
29 Mar 17 |
nicklas |
523 |
"parameter is set.", |
4430 |
28 Mar 17 |
nicklas |
524 |
new StringParameterType(255, null, true) |
4430 |
28 Mar 17 |
nicklas |
525 |
)); |
4345 |
09 Feb 17 |
nicklas |
526 |
|
4430 |
28 Mar 17 |
nicklas |
527 |
parameters.add(new PluginParameter<Boolean>( |
4430 |
28 Mar 17 |
nicklas |
528 |
"overwrite", "Overwrite", "Is it allowed to overwrite existing files or not?", |
4430 |
28 Mar 17 |
nicklas |
529 |
new BooleanParameterType(null, false) |
4420 |
23 Mar 17 |
nicklas |
530 |
)); |
5140 |
22 Nov 18 |
nicklas |
531 |
|
5140 |
22 Nov 18 |
nicklas |
532 |
addExportOptionsParameters(parameters, true); |
5089 |
14 Nov 18 |
nicklas |
533 |
|
4345 |
09 Feb 17 |
nicklas |
534 |
} |
4345 |
09 Feb 17 |
nicklas |
535 |
finally |
4345 |
09 Feb 17 |
nicklas |
536 |
{ |
4345 |
09 Feb 17 |
nicklas |
537 |
if (dc != null) dc.close(); |
4345 |
09 Feb 17 |
nicklas |
538 |
} |
3932 |
13 May 16 |
nicklas |
539 |
|
4345 |
09 Feb 17 |
nicklas |
540 |
configureExportRemote = new RequestInformation |
4345 |
09 Feb 17 |
nicklas |
541 |
( |
4345 |
09 Feb 17 |
nicklas |
542 |
Request.COMMAND_CONFIGURE_JOB, |
4345 |
09 Feb 17 |
nicklas |
543 |
"External release export options", |
4345 |
09 Feb 17 |
nicklas |
544 |
"Select a file server where the files should be saved.", |
4345 |
09 Feb 17 |
nicklas |
545 |
parameters |
4345 |
09 Feb 17 |
nicklas |
546 |
); |
4345 |
09 Feb 17 |
nicklas |
547 |
} |
4345 |
09 Feb 17 |
nicklas |
548 |
return configureExportRemote; |
4345 |
09 Feb 17 |
nicklas |
549 |
} |
5140 |
22 Nov 18 |
nicklas |
550 |
|
5140 |
22 Nov 18 |
nicklas |
551 |
private void addExportOptionsParameters(List<PluginParameter<?>> parameters, boolean remote) |
5140 |
22 Nov 18 |
nicklas |
552 |
{ |
5140 |
22 Nov 18 |
nicklas |
553 |
parameters.add(new PluginParameter<String>( |
5140 |
22 Nov 18 |
nicklas |
554 |
"optionsSection", "Export options", "Options affecting what to export.", null |
5140 |
22 Nov 18 |
nicklas |
555 |
)); |
5140 |
22 Nov 18 |
nicklas |
556 |
|
5140 |
22 Nov 18 |
nicklas |
557 |
parameters.add(new PluginParameter<Boolean>( |
5140 |
22 Nov 18 |
nicklas |
558 |
"skipHistologyImages", "Skip histology images", "If this option is enabled histology images are not exported. " |
5140 |
22 Nov 18 |
nicklas |
559 |
+ "This will save time during testing.", |
5140 |
22 Nov 18 |
nicklas |
560 |
new BooleanParameterType(remote ? null : true, false) |
5140 |
22 Nov 18 |
nicklas |
561 |
)); |
5140 |
22 Nov 18 |
nicklas |
562 |
|
5555 |
13 Aug 19 |
nicklas |
// If <developer-mode>1</developer-mode> is in reggie-config.xml we allow debug via parameter |
5555 |
13 Aug 19 |
nicklas |
564 |
if (Values.getBoolean(Reggie.getConfig().getConfig("developer-mode"))) |
5555 |
13 Aug 19 |
nicklas |
565 |
{ |
5555 |
13 Aug 19 |
nicklas |
566 |
parameters.add(new PluginParameter<Boolean>( |
5555 |
13 Aug 19 |
nicklas |
567 |
"debugMode", "Debug mode", "Runs the plug-in in debug mode. Major difference is " |
5555 |
13 Aug 19 |
nicklas |
568 |
+ "that it will always report an error making it easier to re-start the " |
5555 |
13 Aug 19 |
nicklas |
569 |
+ "plug-in with the same parameters. It is recommended that <b>Overwrite</b> " |
5555 |
13 Aug 19 |
nicklas |
570 |
+ "is also enabled.", |
5555 |
13 Aug 19 |
nicklas |
571 |
new BooleanParameterType(null, false) |
5555 |
13 Aug 19 |
nicklas |
572 |
)); |
5555 |
13 Aug 19 |
nicklas |
573 |
} |
5555 |
13 Aug 19 |
nicklas |
574 |
|
5140 |
22 Nov 18 |
nicklas |
575 |
} |
3932 |
13 May 16 |
nicklas |
576 |
|
3932 |
13 May 16 |
nicklas |
577 |
} |