forked from BimberLab/DiscvrLabKeyModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSequenceOutputFile.java
More file actions
275 lines (227 loc) · 5.69 KB
/
SequenceOutputFile.java
File metadata and controls
275 lines (227 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/*
* Copyright (c) 2015 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.labkey.api.sequenceanalysis;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.TableSelector;
import org.labkey.api.exp.api.ExpData;
import org.labkey.api.exp.api.ExperimentService;
import org.labkey.api.pipeline.PipelineJobService;
import java.io.File;
import java.io.Serializable;
import java.util.Date;
/**
* Created by bimber on 1/7/2015.
*/
public class SequenceOutputFile implements Serializable
{
private Integer _rowid;
private String _name;
private String _description;
private Long _dataId;
private Integer _library_id;
private Long _readset;
private Long _analysis_id;
private Long _runid;
private String _category;
private Boolean _intermediate;
private String _container;
private Integer _createdby;
private Date _created;
private Integer _modifiedby;
private Date _modified;
private File _file;
public SequenceOutputFile()
{
}
public Integer getRowid()
{
return _rowid;
}
public void setRowid(Integer rowid)
{
_rowid = rowid;
}
public String getName()
{
return _name;
}
public void setName(String name)
{
_name = name;
}
public String getDescription()
{
return _description;
}
public void setDescription(String description)
{
_description = description;
}
public Long getDataId()
{
return _dataId;
}
public void setDataId(Long dataId)
{
_dataId = dataId;
}
public Integer getLibrary_id()
{
return _library_id;
}
public void setLibrary_id(Integer library_id)
{
_library_id = library_id;
}
public Long getReadset()
{
return _readset;
}
public void setReadset(Long readset)
{
_readset = readset;
}
public Long getAnalysis_id()
{
return _analysis_id;
}
public void setAnalysis_id(Long analysis_id)
{
_analysis_id = analysis_id;
}
public Long getRunId()
{
return _runid;
}
public void setRunId(Long runid)
{
_runid = runid;
}
public String getCategory()
{
return _category;
}
public void setCategory(String category)
{
_category = category;
}
public Boolean isIntermediate()
{
return _intermediate;
}
public void setIntermediate(Boolean intermediate)
{
_intermediate = intermediate;
}
public String getContainer()
{
return _container;
}
public Container getContainerObj()
{
return ContainerManager.getForId(_container);
}
public void setContainer(String container)
{
_container = container;
}
public Integer getCreatedby()
{
return _createdby;
}
public void setCreatedby(Integer createdby)
{
_createdby = createdby;
}
public Date getCreated()
{
return _created;
}
public void setCreated(Date created)
{
_created = created;
}
public Integer getModifiedby()
{
return _modifiedby;
}
public void setModifiedby(Integer modifiedby)
{
_modifiedby = modifiedby;
}
public Date getModified()
{
return _modified;
}
public void setModified(Date modified)
{
_modified = modified;
}
public static SequenceOutputFile getForId(Integer rowId)
{
if (PipelineJobService.get().getLocationType() != PipelineJobService.LocationType.WebServer)
{
throw new IllegalAccessError("This method should only be called from the webserver");
}
return new TableSelector(DbSchema.get("sequenceanalysis").getTable("outputfiles")).getObject(rowId, SequenceOutputFile.class);
}
@JsonIgnore
public ExpData getExpData()
{
if (PipelineJobService.get().getLocationType() != PipelineJobService.LocationType.WebServer)
{
throw new IllegalAccessError("This method should only be called from the webserver");
}
return _dataId != null && _dataId > 0 ? ExperimentService.get().getExpData(_dataId) : null;
}
public File getFile()
{
if (_file != null)
{
return _file;
}
ExpData data = getExpData();
_file = data == null ? null : data.getFile();
return _file;
}
public void setFile(File file)
{
_file = file;
}
public void cacheForRemoteServer()
{
getFile();
}
public JSONObject toJSON()
{
JSONObject ret = new JSONObject();
ret.put("name", _name);
ret.put("category", _category);
ret.put("description", _description);
ret.put("genomeId", _library_id);
ret.put("dataId", _dataId);
ExpData d = getExpData();
if (d != null)
{
ret.put("fileName", d.getFile().getName());
}
return ret;
}
}