Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-siav2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaLactea
vlkb-siav2
Commits
a8098492
Commit
a8098492
authored
7 months ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
makes database-access tolerate missing columns (sets VOTable.col NULL rather then stop with error)
parent
ca5a9270
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-discovery/src/main/java/search/DbPSearch.java
+104
-45
104 additions, 45 deletions
data-discovery/src/main/java/search/DbPSearch.java
data-discovery/src/main/java/webapi/formatfilter/ObscoreExt.java
+25
-21
25 additions, 21 deletions
...scovery/src/main/java/webapi/formatfilter/ObscoreExt.java
with
129 additions
and
66 deletions
data-discovery/src/main/java/search/DbPSearch.java
+
104
−
45
View file @
a8098492
...
...
@@ -182,55 +182,55 @@ public class DbPSearch
{
FormatResponseFilter
.
ObsCore
obsCore
=
new
FormatResponseFilter
.
ObsCore
();
obsCore
.
dataproduct_type
=
re
s
.
getString
(
"dataproduct_type"
);
obsCore
.
calib_level
=
re
s
.
getInt
(
"calib_level"
);
obsCore
.
obs_collection
=
re
s
.
getString
(
"obs_collection"
);
obsCore
.
obs_title
=
re
s
.
getString
(
"obs_title"
);
obsCore
.
obs_id
=
re
s
.
getString
(
"obs_id"
);
obsCore
.
obs_publisher_did
=
re
s
.
getString
(
"obs_publisher_did"
);
obsCore
.
bib_reference
=
re
s
.
getString
(
"bib_reference"
);
obsCore
.
data_rights
=
re
s
.
getString
(
"data_rights"
);
obsCore
.
access_url
=
re
s
.
getString
(
"access_url"
);
obsCore
.
access_format
=
re
s
.
getString
(
"access_format"
);
obsCore
.
access_estsize
=
re
s
.
getLong
(
"access_estsize"
);
obsCore
.
target_name
=
re
s
.
getString
(
"target_name"
);
obsCore
.
s_ra
=
re
s
.
getDouble
(
"s_ra"
);
obsCore
.
s_dec
=
re
s
.
getDouble
(
"s_dec"
);
obsCore
.
s_fov
=
re
s
.
getDouble
(
"s_fov"
);
obsCore
.
s_region
=
re
s
.
getString
(
"s_region"
);
obsCore
.
s_region_galactic
=
re
s
.
getString
(
"s_region_galactic"
);
obsCore
.
s_xel1
=
re
s
.
getLong
(
"s_xel1"
);
obsCore
.
s_xel2
=
re
s
.
getLong
(
"s_xel2"
);
obsCore
.
s_resolution
=
re
s
.
getDouble
(
"s_resolution"
);
obsCore
.
t_min
=
re
s
.
getDouble
(
"t_min"
);
obsCore
.
t_max
=
re
s
.
getDouble
(
"t_max"
);
obsCore
.
t_exptime
=
re
s
.
getDouble
(
"t_exptime"
);
obsCore
.
t_resolution
=
re
s
.
getDouble
(
"t_resolution"
);
obsCore
.
t_xel
=
re
s
.
getLong
(
"t_xel"
);
obsCore
.
vel_min
=
re
s
.
getDouble
(
"vel_min"
);
//boolean em_min_valid = !res.wasNull();
obsCore
.
vel_max
=
re
s
.
getDouble
(
"vel_max"
);
//boolean em_max_valid = !res.wasNull();
obsCore
.
em_min
=
re
s
.
getDouble
(
"em_min"
);
boolean
em_min_valid
=
!
res
.
wasNull
();
obsCore
.
em_max
=
re
s
.
getDouble
(
"em_max"
);
boolean
em_max_valid
=
!
res
.
wasNull
();
obsCore
.
dataproduct_type
=
thi
s
.
getString
(
res
,
"dataproduct_type"
);
obsCore
.
calib_level
=
thi
s
.
getInt
(
res
,
"calib_level"
);
obsCore
.
obs_collection
=
thi
s
.
getString
(
res
,
"obs_collection"
);
obsCore
.
obs_title
=
thi
s
.
getString
(
res
,
"obs_title"
);
obsCore
.
obs_id
=
thi
s
.
getString
(
res
,
"obs_id"
);
obsCore
.
obs_publisher_did
=
thi
s
.
getString
(
res
,
"obs_publisher_did"
);
obsCore
.
bib_reference
=
thi
s
.
getString
(
res
,
"bib_reference"
);
obsCore
.
data_rights
=
thi
s
.
getString
(
res
,
"data_rights"
);
obsCore
.
access_url
=
thi
s
.
getString
(
res
,
"access_url"
);
obsCore
.
access_format
=
thi
s
.
getString
(
res
,
"access_format"
);
obsCore
.
access_estsize
=
thi
s
.
getLong
(
res
,
"access_estsize"
);
obsCore
.
target_name
=
thi
s
.
getString
(
res
,
"target_name"
);
obsCore
.
s_ra
=
thi
s
.
getDouble
(
res
,
"s_ra"
);
obsCore
.
s_dec
=
thi
s
.
getDouble
(
res
,
"s_dec"
);
obsCore
.
s_fov
=
thi
s
.
getDouble
(
res
,
"s_fov"
);
obsCore
.
s_region
=
thi
s
.
getString
(
res
,
"s_region"
);
obsCore
.
s_region_galactic
=
thi
s
.
getString
(
res
,
"s_region_galactic"
);
obsCore
.
s_xel1
=
thi
s
.
getLong
(
res
,
"s_xel1"
);
obsCore
.
s_xel2
=
thi
s
.
getLong
(
res
,
"s_xel2"
);
obsCore
.
s_resolution
=
thi
s
.
getDouble
(
res
,
"s_resolution"
);
obsCore
.
t_min
=
thi
s
.
getDouble
(
res
,
"t_min"
);
obsCore
.
t_max
=
thi
s
.
getDouble
(
res
,
"t_max"
);
obsCore
.
t_exptime
=
thi
s
.
getDouble
(
res
,
"t_exptime"
);
obsCore
.
t_resolution
=
thi
s
.
getDouble
(
res
,
"t_resolution"
);
obsCore
.
t_xel
=
thi
s
.
getLong
(
res
,
"t_xel"
);
obsCore
.
vel_min
=
thi
s
.
getDouble
(
res
,
"vel_min"
);
//boolean em_min_valid = !res.wasNull();
obsCore
.
vel_max
=
thi
s
.
getDouble
(
res
,
"vel_max"
);
//boolean em_max_valid = !res.wasNull();
obsCore
.
em_min
=
thi
s
.
getDouble
(
res
,
"em_min"
);
boolean
em_min_valid
=
!
res
.
wasNull
();
obsCore
.
em_max
=
thi
s
.
getDouble
(
res
,
"em_max"
);
boolean
em_max_valid
=
!
res
.
wasNull
();
obsCore
.
em_valid
=
em_min_valid
&&
em_max_valid
;;
obsCore
.
em_res_power
=
re
s
.
getDouble
(
"em_res_power"
);
obsCore
.
em_xel
=
re
s
.
getLong
(
"em_xel"
);
obsCore
.
em_res_power
=
thi
s
.
getDouble
(
res
,
"em_res_power"
);
obsCore
.
em_xel
=
thi
s
.
getLong
(
res
,
"em_xel"
);
obsCore
.
o_ucd
=
re
s
.
getString
(
"o_ucd"
);
obsCore
.
o_ucd
=
thi
s
.
getString
(
res
,
"o_ucd"
);
obsCore
.
pol_states
=
re
s
.
getString
(
"pol_states"
);
obsCore
.
pol_xel
=
re
s
.
getLong
(
"pol_xel"
);
obsCore
.
pol_states
=
thi
s
.
getString
(
res
,
"pol_states"
);
obsCore
.
pol_xel
=
thi
s
.
getLong
(
res
,
"pol_xel"
);
obsCore
.
facility_name
=
re
s
.
getString
(
"facility_name"
);
obsCore
.
instrument_name
=
re
s
.
getString
(
"instrument_name"
);
obsCore
.
facility_name
=
thi
s
.
getString
(
res
,
"facility_name"
);
obsCore
.
instrument_name
=
thi
s
.
getString
(
res
,
"instrument_name"
);
obsCore
.
vertices_str
=
re
s
.
getString
(
"polygon_region_galactic"
);
obsCore
.
vertices_str
=
thi
s
.
getString
(
res
,
"polygon_region_galactic"
);
obsCore
.
inputInsideDb
=
res
.
getBoolean
(
"inputInsideDb"
);
obsCore
.
dbInsideInput
=
res
.
getBoolean
(
"dbInsideInput"
);
...
...
@@ -250,6 +250,65 @@ public class DbPSearch
return
cubes
;
}
/* conversions tolerate missing columns */
private
Integer
getInt
(
ResultSet
res
,
String
colLabel
)
{
try
{
Integer
value
=
res
.
getInt
(
colLabel
);
return
(
res
.
wasNull
()
?
null
:
value
);
}
catch
(
SQLException
se
)
{
logSqlExInfo
(
se
);
return
null
;
}
}
private
Long
getLong
(
ResultSet
res
,
String
colLabel
)
{
try
{
Long
value
=
res
.
getLong
(
colLabel
);
return
(
res
.
wasNull
()
?
null
:
value
);
}
catch
(
SQLException
se
)
{
logSqlExInfo
(
se
);
return
null
;
}
}
private
Double
getDouble
(
ResultSet
res
,
String
colLabel
)
{
try
{
Double
value
=
res
.
getDouble
(
colLabel
);
return
(
res
.
wasNull
()
?
null
:
value
);
}
catch
(
SQLException
se
)
{
logSqlExInfo
(
se
);
return
null
;
}
}
private
String
getString
(
ResultSet
res
,
String
colLabel
)
{
try
{
String
value
=
res
.
getString
(
colLabel
);
return
(
res
.
wasNull
()
?
null
:
value
);
}
catch
(
SQLException
se
)
{
logSqlExInfo
(
se
);
return
null
;
}
}
private
String
toPgSphereSqlTypeString
(
Pos
pos
)
{
...
...
@@ -338,7 +397,7 @@ public class DbPSearch
{
LOGGER
.
fine
(
"SQLState : "
+
se
.
getSQLState
());
LOGGER
.
fine
(
"ErrorCode: "
+
se
.
getErrorCode
());
LOGGER
.
f
in
e
(
"Message : "
+
se
.
getMessage
());
LOGGER
.
warn
in
g
(
"Message : "
+
se
.
getMessage
());
Throwable
t
=
se
.
getCause
();
while
(
t
!=
null
)
{
LOGGER
.
fine
(
"Cause: "
+
t
);
...
...
This diff is collapsed.
Click to expand it.
data-discovery/src/main/java/webapi/formatfilter/ObscoreExt.java
+
25
−
21
View file @
a8098492
...
...
@@ -63,8 +63,8 @@ class ObscoreExt
{
return
new
Object
[]
{
dataset
.
obsCore
.
dataproduct_type
,
//dataset.dataType,
Integer
.
valueOf
(
dataset
.
obsCore
.
calib_level
)
,
dataset
.
obsCore
.
dataproduct_type
,
dataset
.
obsCore
.
calib_level
,
dataset
.
obsCore
.
obs_collection
,
dataset
.
obsCore
.
obs_title
,
dataset
.
obsCore
.
obs_id
,
...
...
@@ -72,31 +72,36 @@ class ObscoreExt
dataset
.
obsCore
.
bib_reference
,
dataset
.
obsCore
.
data_rights
,
dataset
.
obsCore
.
access_url
,
//dataset.access.accessCutoutUrl,
dataset
.
obsCore
.
access_url
,
dataset
.
obsCore
.
access_format
,
Long
.
valueOf
(
dataset
.
obsCore
.
access_estsize
)
,
dataset
.
obsCore
.
access_estsize
,
dataset
.
obsCore
.
target_name
,
Double
.
valueOf
(
dataset
.
obsCore
.
s_ra
),
Double
.
valueOf
(
dataset
.
obsCore
.
s_dec
),
Double
.
valueOf
(
dataset
.
obsCore
.
s_fov
),
dataset
.
obsCore
.
s_ra
,
dataset
.
obsCore
.
s_dec
,
dataset
.
obsCore
.
s_fov
,
dataset
.
obsCore
.
s_region
,
Long
.
valueOf
(
dataset
.
obsCore
.
s_xel1
),
Long
.
valueOf
(
dataset
.
obsCore
.
s_xel2
),
Double
.
valueOf
(
dataset
.
obsCore
.
s_resolution
),
dataset
.
obsCore
.
s_xel1
,
dataset
.
obsCore
.
s_xel2
,
dataset
.
obsCore
.
s_resolution
,
Double
.
valueOf
(
dataset
.
obsCore
.
t_min
),
Double
.
valueOf
(
dataset
.
obsCore
.
t_max
),
Double
.
valueOf
(
dataset
.
obsCore
.
t_exptime
),
Double
.
valueOf
(
dataset
.
obsCore
.
t_resolution
),
Long
.
valueOf
(
dataset
.
obsCore
.
t_xel
),
dataset
.
obsCore
.
t_min
,
dataset
.
obsCore
.
t_max
,
dataset
.
obsCore
.
t_exptime
,
dataset
.
obsCore
.
t_resolution
,
dataset
.
obsCore
.
t_xel
,
Double
.
valueOf
(
dataset
.
obsCore
.
em_min
),
Double
.
valueOf
(
dataset
.
obsCore
.
em_max
),
Double
.
valueOf
(
dataset
.
obsCore
.
em_res_power
),
Long
.
valueOf
(
dataset
.
obsCore
.
em_xel
),
dataset
.
obsCore
.
em_min
,
dataset
.
obsCore
.
em_max
,
dataset
.
obsCore
.
em_res_power
,
dataset
.
obsCore
.
em_xel
,
dataset
.
obsCore
.
o_ucd
,
dataset
.
obsCore
.
pol_states
,
Long
.
valueOf
(
dataset
.
obsCore
.
pol_xel
)
,
dataset
.
obsCore
.
pol_xel
,
dataset
.
obsCore
.
facility_name
,
dataset
.
obsCore
.
instrument_name
,
...
...
@@ -121,15 +126,14 @@ class ObscoreExt
{
return
new
Object
[]
{
Integer
.
valueOf
(
dataset
.
overlapCode
)
,
Integer
.
valueOf
(
dataset
.
overlapCodeSky
)
,
Integer
.
valueOf
(
dataset
.
overlapCodeVel
)
,
dataset
.
overlapCode
,
dataset
.
overlapCodeSky
,
dataset
.
overlapCodeVel
,
dataset
.
obsCore
.
s_region_galactic
,
dataset
.
obsCore
.
vel_min
==
null
?
null
:
Double
.
valueOf
(
dataset
.
obsCore
.
vel_min
),
dataset
.
obsCore
.
vel_min
==
null
?
null
:
Double
.
valueOf
(
dataset
.
obsCore
.
vel_max
),
dataset
.
obsCore
.
vel_min
,
dataset
.
obsCore
.
vel_max
,
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment