@@ -233,16 +233,40 @@ public IbeQueryParam makeQueryParam(Map<String, String> queryInfo) {
233
233
234
234
String refSourceId = queryInfo .get ("refSourceId" );
235
235
String sourceId = queryInfo .get ("sourceId" );
236
- String dataproductlevel = queryInfo .get ("dataproductlevel" );
237
- String sourceidTable = getSchemaFromSourceId (sourceId );
238
-
236
+
237
+ if (sourceId != null ) {
238
+ String sourceProductLevel = getProductLevelFromSourceId (sourceId );
239
+ if (sourceProductLevel == null ) {
240
+ throw new IllegalArgumentException ("Invalid Source ID: " + sourceId );
241
+ }
242
+ if ( sourceProductLevel == "1b" ) {
243
+ String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + sourceId + "\" )" ;
244
+ queryParam .setPos (sourceSpec );
245
+ }
246
+ else if (sourceProductLevel == "3a" ) {
247
+ String sourceSchema = getSchemaFromSourceId (sourceId );
248
+ String ss = sourceSchema .toUpperCase ();
249
+ String tt = sourceProductLevel .toUpperCase ();
250
+ DataProduct sourcedt = DataProduct .valueOf (ss + "_" + tt );
251
+ String sourceTable = sourcedt .getSourceTable ();
252
+ String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + sourceId + "\" )" ;
253
+ queryParam .setPos (sourceSpec );
254
+ }
255
+ }
239
256
if (refSourceId != null ) {
240
- String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + refSourceId + "\" )" ;
241
- queryParam .setRefBy (sourceSpec );
242
- } else if (sourceId != null ) {
243
- String sourceTable = wds .getSourceTable ();
244
- String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + sourceId + "\" )" ;
245
- queryParam .setPos (sourceSpec );
257
+ String sourceProductLevel = getProductLevelFromSourceId (refSourceId );
258
+ if (sourceProductLevel == null ) {
259
+ throw new IllegalArgumentException ("Invalid Source ID: " + refSourceId );
260
+ }
261
+ if (sourceProductLevel == "1b" ) {
262
+ String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + refSourceId + "\" )" ;
263
+ queryParam .setRefBy (sourceSpec );
264
+ } else if (sourceProductLevel == "3a" ) {
265
+ DataProduct sourcedt = DataProduct .ALLSKY_4BAND_3A ;
266
+ String sourceTable = sourcedt .getSourceTable ();
267
+ String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + refSourceId + "\" )" ;
268
+ queryParam .setPos (sourceSpec );
269
+ }
246
270
}
247
271
248
272
// process constraints
@@ -343,6 +367,7 @@ private void setupDS(String ibeHost, String baseFsPath, DataProduct ds) {
343
367
setDataset (wds .getDataset ());
344
368
setTableName (wds .getImageTable ());
345
369
370
+ // following code was commented out to force url file retrieval
346
371
// File dir= (baseFsPath!=null) ? new File(baseFsPath) : null;
347
372
//
348
373
// if (baseFsPath != null && dir.canRead()) {
@@ -407,11 +432,13 @@ private String processConstraints(Map<String, String> queryInfo) {
407
432
// process DATE RANGE
408
433
String timeStart = queryInfo .get ("timeStart" );
409
434
if (!StringUtils .isEmpty (timeStart )) {
410
- constraints .add ("mjd_obs>='" + IBE .convertUnixToMJD (timeStart ) + "'" );
435
+ //constraints.add("mjd_obs>='" + IBE.convertUnixToMJD(timeStart) + "'");
436
+ constraints .add ("date_obs>='" + timeStart + "'" );
411
437
}
412
438
String timeEnd = queryInfo .get ("timeEnd" );
413
439
if (!StringUtils .isEmpty (timeEnd )) {
414
- constraints .add ("mjd_obs<='" + IBE .convertUnixToMJD (timeEnd ) + "'" );
440
+ //constraints.add("mjd_obs<='" + IBE.convertUnixToMJD(timeEnd) + "'");
441
+ constraints .add ("date_obs<='" + timeEnd + "'" );
415
442
}
416
443
417
444
// process Scan IDs (support multiple IDs)
@@ -589,17 +616,17 @@ public enum DataProduct {
589
616
PRELIM_POSTCRYO_1B ("prelim_postcryo" ,"p1bm_frm" , "prelim_2band_p1bs_psd" , "links-postcryo-prelim/l1b-2band/" ),
590
617
ALLWISE_MULTIBAND_3A ("allwise" ,"p3am_cdd" , "allsky_4band_p1bs_psd" , "links-allwise/l3a/" ), // TODO: change for production, changed XW
591
618
ALLSKY_4BAND_1B ("allsky" , "4band_p1bm_frm" , "allsky_4band_p1bs_psd" , "links-allsky/l1b-4band/" ),
592
- ALLSKY_4BAND_3A ("allsky" , "4band_p3am_cdd" , "allsky_4band_p1bs_psd " , "links-allsky/l3a-4band/" ),
593
- CRYO_3BAND_1B ("cryo_3band" , "3band_p1bm_frm" , "allsky_4band_p1bs_psd " , "links-3band/l1b-3band/" ),
594
- CRYO_3BAND_3A ("cryo_3band" , "3band_p3am_cdd" , "allsky_4band_p1bs_psd " , "links-3band/l3a-3band/" ), // currently they are different: p1bm_frm and p3am_cdd
595
- POSTCRYO_1B ("postcryo" , "2band_p1bm_frm" , "allsky_4band_p1bs_psd " , "links-postcryo/l1b-2band/" ),
619
+ ALLSKY_4BAND_3A ("allsky" , "4band_p3am_cdd" , "allsky_4band_p3as_psd " , "links-allsky/l3a-4band/" ),
620
+ CRYO_3BAND_1B ("cryo_3band" , "3band_p1bm_frm" , "allsky_3band_p1bs_psd " , "links-3band/l1b-3band/" ),
621
+ CRYO_3BAND_3A ("cryo_3band" , "3band_p3am_cdd" , "allsky_3band_p3as_psd " , "links-3band/l3a-3band/" ), // currently they are different: p1bm_frm and p3am_cdd
622
+ POSTCRYO_1B ("postcryo" , "2band_p1bm_frm" , "allsky_2band_p1bs_psd " , "links-postcryo/l1b-2band/" ),
596
623
MERGE_1B ("merge" , "merge_p1bm_frm" , "allsky_4band_p1bs_psd" , "links-allsky/l1b-merge/" ), // exists under links-allsky
597
624
MERGE_INT_1B ("merge_int" , "merge_i1bm_frm" , "merge_i1bs_psd" , "links-merge/l1b/" ),
598
625
MERGE_3A ("merge" , "merge_p3am_cdd" , "allsky_4band_p1bs_psd" , "links-allwise/l3a-merge/" ), // exists under links-allwise
599
626
MERGE_INT_3A ("merge_int" , "merge_p3am_cdd" , "allsky_4band_p3as_psd" , "links-merge/l3a/" ),
600
627
NEOWISER_PROV_1B ("neowiser_prov" , "i1bm_frm" , "i1bs_psd" , "links-nprov/l1b/" ),
601
628
NEOWISER_YR1_1B ("neowiser_yr1" , "yr1_p1bm_frm" , "yr1_p1bs_psd" , "links-neowiser/l1b-yr1/" ),
602
- NEOWISER_1B ("neowiser" , "p1bm_frm" , "allsky_4band_p1bs_psd " , "links-neowiser/l1b/" ),
629
+ NEOWISER_1B ("neowiser" , "p1bm_frm" , "neowiser_p1bs_psd " , "links-neowiser/l1b/" ),
603
630
604
631
PASS1_1B ("pass1" , "i1bm_frm" , "i1bs_psd" , "links-pass1/l1b/" ),
605
632
PASS1_3A ("pass1" , "i3am_cdd" , "i3as_psd" , "links-pass1/l3a/" ),
0 commit comments