Skip to content

Commit efa8641

Browse files
authored
DM-9565 merge Support Hidden Filters pr #316
DM-9565 - support for hidden filters
2 parents 06ff1a7 + b8b403f commit efa8641

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

src/firefly/java/edu/caltech/ipac/firefly/server/query/SearchRequestUtils.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,31 @@ public class SearchRequestUtils {
2929
* @throws IOException
3030
* @throws DataAccessException
3131
*/
32-
static DataGroup dataGroupFromSearchRequest(String searchRequestJson) throws IOException, DataAccessException {
32+
public static DataGroup dataGroupFromSearchRequest(String searchRequestJson) throws IOException, DataAccessException {
33+
FileInfo fi = fileInfoFromSearchRequest(searchRequestJson);
34+
return DataGroupReader.readAnyFormat(new File(fi.getInternalFilename()));
35+
}
36+
37+
/**
38+
* Get file created by the search request
39+
* @param searchRequestJson search request in JSON format
40+
* @return File file with the result table
41+
* @throws IOException
42+
* @throws DataAccessException
43+
**/
44+
public static File fileFromSearchRequest(String searchRequestJson) throws IOException, DataAccessException {
45+
FileInfo fi = fileInfoFromSearchRequest(searchRequestJson);
46+
return new File(fi.getInternalFilename());
47+
}
48+
49+
/**
50+
* Get file info for the results created by the search request
51+
* @param searchRequestJson search request in JSON format
52+
* @return File file with the result table
53+
* @throws IOException
54+
* @throws DataAccessException
55+
**/
56+
static FileInfo fileInfoFromSearchRequest(String searchRequestJson) throws IOException, DataAccessException {
3357
if (searchRequestJson == null) {
3458
throw new DataAccessException("Missing search request");
3559
}
@@ -51,6 +75,6 @@ static DataGroup dataGroupFromSearchRequest(String searchRequestJson) throws IOE
5175
throw new SecurityException("Access is not permitted.");
5276
}
5377

54-
return DataGroupReader.readAnyFormat(new File(fi.getInternalFilename()));
78+
return fi;
5579
}
5680
}

src/firefly/java/edu/caltech/ipac/firefly/server/query/tables/IpacTableFromSource.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@
2828
public class IpacTableFromSource extends IpacTablePartProcessor {
2929
public static final String TBL_TYPE = "tblType";
3030
public static final String TYPE_CATALOG = "catalog";
31-
public static final String TBL_INDEX = TableServerRequest.TBL_INDEX; // the table to show if it's a multi-table file.
31+
//public static final String TBL_INDEX = TableServerRequest.TBL_INDEX; // the table to show if it's a multi-table file.
32+
private static final String SEARCH_REQUEST = "searchRequest";
33+
3234

3335
protected File loadDataFile(TableServerRequest request) throws IOException, DataAccessException {
3436

3537
String source = request.getParam(ServerParams.SOURCE);
3638
String altSource = request.getParam(ServerParams.ALT_SOURCE);
3739
String processor = request.getParam("processor");
40+
String searchRequestJson = request.getParam(SEARCH_REQUEST);
3841

3942
if (StringUtils.isEmpty(source) && processor != null) {
4043
return getByProcessor(processor, request);
44+
} else if (searchRequestJson != null) {
45+
// wrapping search request is useful to hide filters of the wrapped search request
46+
return SearchRequestUtils.fileFromSearchRequest(searchRequestJson);
4147
} else {
4248
// get source by source key
4349
File inf = getSourceFile(source, request);
@@ -58,7 +64,7 @@ protected File loadDataFile(TableServerRequest request) throws IOException, Data
5864

5965
private File getByProcessor(String processor, TableServerRequest request) throws DataAccessException {
6066
if (StringUtils.isEmpty(processor)) {
61-
throw new DataAccessException("Required parameter 'source' is not given.");
67+
throw new DataAccessException("Required parameter 'processor' is not given.");
6268
}
6369
TableServerRequest sReq = new TableServerRequest(processor, request);
6470
FileInfo fi = new SearchManager().getFileInfo(sReq);
@@ -82,9 +88,9 @@ public boolean doCache() {
8288
/**
8389
* resolve the file given a 'source' string. it could be a local path, or a url.
8490
* if it's a url, download it into the application's workarea
85-
* @param source
86-
* @param request
87-
* @return
91+
* @param source source file
92+
* @param request table request
93+
* @return file
8894
*/
8995
private File getSourceFile(String source, TableServerRequest request) {
9096
if (source == null) return null;

src/firefly/js/templates/lightcurve/lsst_sdss/LsstSdssMissionOptions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {ValidationField} from '../../../ui/ValidationField.jsx';
88
import {SuggestBoxInputField} from '../../../ui/SuggestBoxInputField.jsx';
99
import {RadioGroupInputField} from '../../../ui/RadioGroupInputField.jsx';
1010
import {FieldGroup} from '../../../ui/FieldGroup.jsx';
11-
import {makeFileRequest} from '../../../tables/TableUtil.js';
11+
import {makeFileRequest, makeTblRequest} from '../../../tables/TableUtil.js';
1212
import {dispatchTableSearch} from '../../../tables/TablesCntlr.js';
1313
import {sortInfoString} from '../../../tables/SortInfo.js';
1414
import {FilterInfo} from '../../../tables/FilterInfo.js';
@@ -202,16 +202,16 @@ export function lsstSdssRawTableRequest(converter, source) {
202202
}
203203

204204
function makeRawTableRequest(missionEntries) {
205+
const band = missionEntries['band'];
205206
const filterInfo = new FilterInfo;
206-
filterInfo.addFilter('filterName', `LIKE ${missionEntries['band']}`);
207+
filterInfo.addFilter('filterName', `LIKE ${band}`);
208+
const searchRequest = JSON.stringify(makeFileRequest('Raw Table', missionEntries['rawTableSource'], null, {filters: filterInfo.serialize()}));
207209
const options = {
208210
tbl_id: LC.RAW_TABLE,
209211
tblType: 'notACatalog',
210212
sortInfo: sortInfoString(missionEntries[LC.META_TIME_CNAME]),
211-
filters: filterInfo.serialize(),
212213
META_INFO: missionEntries,
213214
pageSize: LC.TABLE_PAGESIZE
214215
};
215-
return makeFileRequest('Raw Table', missionEntries['rawTableSource'], null, options);
216-
216+
return makeTblRequest('IpacTableFromSource', `Raw Table ${band}`, {searchRequest}, options);
217217
}

0 commit comments

Comments
 (0)