public class HistorySql extends AbstractSql
stella.jview.JStella. In the
default setup, the table of this database is called 'done' and has the
following structure:
CREATE TABLE "done" (
"objid" varchar(255),
"object" varchar(255) UNIQUE,
"start" timestamp without time zone NOT NULL,
"duration" integer,
"success" boolean,
"merrit" real,
Constraint "done_pkey" Primary Key ("start")
);
GRANT ALL on "done" to "postgres";
GRANT ALL on "done" to "stella";
GRANT SELECT on "done" to "guest";
In this setup, the columns have the following meanings:
| Modifier and Type | Class and Description |
|---|---|
static class |
HistorySql.GridFix
Fixes wrong enries entered between 2008-10-17 15:28:30 and 2008-12-18
08:55:47, when the done table was writtn to early due to GRID timeline
visibilities.
|
static class |
HistorySql.PilarPointing
We add total pointing model offsets from Pilar save files to the history
db.
|
static class |
HistorySql.Show |
static class |
HistorySql.Sum |
AbstractSql.Columns, AbstractSql.ExtractPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFDATEFIELD
The default target name field in the database
|
private static String |
DEFDURATIONFIELD
The default target name field in the database
|
private static String |
DEFFIRSTALTFIELD
The key to the first azimuth offset in the database.
|
private static String |
DEFFIRSTAZFIELD
The key to the first azimuth offset in the database.
|
private static String |
DEFMERITFIELD
The default target name field in the database
|
private static String |
DEFSUCCESSFIELD
The default target name field in the database
|
static String |
DEFTABLE
The default table name.
|
private static String |
DEFTARGETNAMEFIELD
The default target name field in the database
|
private static String |
DEFTELESCOPEFIELD
The default target name field in the database
|
private static String |
DEFTOTALAZFIELD
The key to the first azimuth offset in the database.
|
private static String |
DEFTOTALZFIELD
The key to the first azimuth offset in the database.
|
private static String |
DEFUNIQUEFIELD
The default target name field in the database
|
static String |
KEY_DATEFIELD
The key to the target name in the database.
|
static String |
KEY_DURATIONFIELD
The key to the target name in the database.
|
static String |
KEY_FIRSTALTFIELD
The key to the first azimuth offset in the database.
|
static String |
KEY_FIRSTAZFIELD
The key to the first azimuth offset in the database.
|
static String |
KEY_MERITFIELD
The key to the target name in the database.
|
static String |
KEY_SUCCESSFIELD
The key to the target name in the database.
|
static String |
KEY_TARGETNAMEFIELD
The key to the target name in the database.
|
static String |
KEY_TELESCOPEFIELD
The key to the target name in the database.
|
static String |
KEY_TOTALAZFIELD
The key to the first azimuth offset in the database.
|
static String |
KEY_TOTALZFIELD
The key to the first azimuth offset in the database.
|
static String |
KEY_UNIQUEFIELD
The key to the target name in the database.
|
KEY_TABLE, SQLBATCHDIR, SQLFAILDIRKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
HistorySql(Map<String,String> prop)
Constructs a new history database.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addFirstOffsets(String unique,
Vector2D degoff)
After a successful acquire, the first offset encountered is writtn to the
database.
|
boolean |
addHistoryPickToDatabase(String targetname,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
Adds a history entry to the database.
|
boolean |
addHistoryPickToDatabase(TargetDefinition target,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
Adds a history entry to the database.
|
boolean |
addTotalOffsets(String unique,
Vector2D degoff)
After a successful acquire, the total offset encountered is writtn to the
database.
|
HistoryAware.Pick |
getFirstFailure(String tel,
String name)
Returns the first succesful pick.
|
HistoryAware.Pick |
getFirstSuccess(String tel,
String name)
Returns the first succesful pick.
|
private List<HistoryAware.Pick> |
getFormerHistoryFromDatabase(String telescope,
String name,
int maxlen)
Scans a database for the history.
|
List<HistoryAware.Pick> |
getHistoryFromDatabase(String telescope,
String name,
int maxlen)
Scans a database for the history.
|
Map<String,List<HistoryAware.Pick>> |
getHistoryPicks(String idtel,
Date from,
Date to)
Returns a list of
HistoryAware.Picks of all targets that have
been picked between the given dates. |
HistoryAware.Pick |
getLastFailure(String tel,
String name)
Returns the first succesful pick.
|
HistoryAware.Pick |
getLastSuccess(String tel,
String name)
Returns the first succesful pick.
|
HistoryAware.Pick |
getPickFromUnique(String uniq)
Returns a single history pick from the db by specifying the unique TARGET
id of the pick.
|
HistoryAware.Pick |
getPickFromUnique(String uniq,
String datekey,
String durkey,
String merkey,
String suckey,
String uniqkey,
String targetkey)
Returns a single history pick from the db by specifying the unique target
id of the pick plus all field names.
|
private HistoryAware.Pick |
getSinglePick(String tel,
String name,
boolean succ,
char order) |
long |
getSumDuration(String idtel,
Date from,
Date to) |
long |
getSumSuccess(String idtel,
Date from,
Date to) |
(package private) String |
historyWhere(String idtel,
Date from,
Date to) |
boolean |
removeHistoryPickFromDatabase(String unique)
Removes a entry from the history db if the unique specifier is given.
|
private static HistoryAware.Pick |
retrievePick(ResultSet history,
String datekey,
String durationkey,
String meritkey,
String successkey,
String uniquekey,
String targetkey)
Converts the current row in the result set into a history pick.
|
private long |
sumDuration(String where)
We cannot simple sum as we would count daughter-targets twice.
|
boolean |
updateHistoryPick(String unique,
boolean to)
Updates the success flag of the pick with the given unique identifier.
|
delete, distinct, distinct, exit, getAccess, getDefaultArchive, getDefaultFormat, getTable, init, insert, isEntry, release, release, replace, retrieve, retrieve, retrieve, single, singleclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String KEY_TARGETNAMEFIELD
public static final String KEY_UNIQUEFIELD
public static final String KEY_DATEFIELD
public static final String KEY_DURATIONFIELD
public static final String KEY_SUCCESSFIELD
public static final String KEY_MERITFIELD
public static final String KEY_TELESCOPEFIELD
public static final String KEY_FIRSTAZFIELD
public static final String KEY_FIRSTALTFIELD
public static final String KEY_TOTALAZFIELD
public static final String KEY_TOTALZFIELD
public static final String DEFTABLE
private static final String DEFTARGETNAMEFIELD
private static final String DEFUNIQUEFIELD
private static final String DEFDATEFIELD
private static final String DEFDURATIONFIELD
private static final String DEFSUCCESSFIELD
private static final String DEFMERITFIELD
private static final String DEFTELESCOPEFIELD
private static final String DEFFIRSTAZFIELD
private static final String DEFFIRSTALTFIELD
private static final String DEFTOTALAZFIELD
private static final String DEFTOTALZFIELD
public HistoryAware.Pick getPickFromUnique(String uniq) throws SQLException
uniq - The unique target id, i.e. without exposure ID.SQLExceptionpublic HistoryAware.Pick getPickFromUnique(String uniq, String datekey, String durkey, String merkey, String suckey, String uniqkey, String targetkey) throws SQLException
uniq - The unique target id, i.e. without exposure ID.datekey - The name of the date column.durkey - The name of the duration column.merkey - The name of the merit column.suckey - The name of the successful column.uniqkey - The name of the column holding the unique target ID.SQLExceptionpublic final boolean removeHistoryPickFromDatabase(String unique)
public final boolean addHistoryPickToDatabase(TargetDefinition target, boolean success, Date start, long duration, String unique, double merit, String idtelescope)
public final boolean addHistoryPickToDatabase(String targetname, boolean success, Date start, long duration, String unique, double merit, String idtelescope)
public final boolean updateHistoryPick(String unique, boolean to)
public long getSumDuration(String idtel, Date from, Date to) throws SQLException
SQLExceptionpublic long getSumSuccess(String idtel, Date from, Date to) throws SQLException
SQLExceptionprivate long sumDuration(String where) throws SQLException
where - SQLExceptionpublic Map<String,List<HistoryAware.Pick>> getHistoryPicks(String idtel, Date from, Date to)
HistoryAware.Picks of all targets that have
been picked between the given dates.public final HistoryAware.Pick getFirstSuccess(String tel, String name)
public final HistoryAware.Pick getFirstFailure(String tel, String name)
public final HistoryAware.Pick getLastSuccess(String tel, String name)
public final HistoryAware.Pick getLastFailure(String tel, String name)
private final HistoryAware.Pick getSinglePick(String tel, String name, boolean succ, char order)
private final List<HistoryAware.Pick> getFormerHistoryFromDatabase(String telescope, String name, int maxlen)
public final List<HistoryAware.Pick> getHistoryFromDatabase(String telescope, String name, int maxlen)
public boolean addFirstOffsets(String unique, Vector2D degoff)
public boolean addTotalOffsets(String unique, Vector2D degoff)
private static HistoryAware.Pick retrievePick(ResultSet history, String datekey, String durationkey, String meritkey, String successkey, String uniquekey, String targetkey) throws SQLException
SQLException