public class TargetReport extends Mailer implements Initializable, ExitCleaning
select * from obs,done,target where obs.objid=done.object and
obs.objname=target.objname and obs.objid='20090501-0063';
Mailer.GooglePropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEFDEBUG
The default debuggin mode.
|
private static String |
DEFDEPARAMETER
Default name of the time parameter.
|
private static boolean |
DEFEXPLANATION
Default include field explanation.
|
private static String |
DEFFROM
The default from address.
|
private static double |
DEFGENERALCYCLE
Default report cycle.
|
private static String |
DEFGENERALTO
The default from address.
|
private static String |
DEFRAPARAMETER
Default name of the time parameter.
|
private static double |
DEFREPORTCYCLE
Default report cycle.
|
private static boolean |
DEFREPORTFAILURE
Default report only successes.
|
private static String |
DEFREPORTFIELD
Default reported per user fields.
|
private static String |
DEFREPORTGENERAL
Default reported fields for the general report.
|
private static String |
DEFTELESCOPE
Default telescope name.
|
private static String |
DEFTIMEPARAMETER
Default name of the time parameter.
|
private static Map<String,String> |
EXPLAIN
All possible fields with explanations.
|
private javax.mail.Address |
from
The from-address.
|
private Date |
general
The date of the last general report.
|
static String |
KEY_BCC
Address list of the recipients, bcc-type.
|
static String |
KEY_CC
Address list of the recipients, cc-type.
|
static String |
KEY_DEBUG
If true, mail-delivery is blocked for debugging mode.
|
static String |
KEY_DEPARAMETER
The parameter that holds the object's right ascension.
|
static String |
KEY_EXPLANATION
If true, the field explanation is added.
|
static String |
KEY_FROM
Address of the sender, with or without domain.
|
static String |
KEY_GENERALCYCLE
The report cycle of the general report in days, zero = no report.
|
static String |
KEY_GENERALTO
Address list of the recipients of the general report.
|
static String |
KEY_PARAMETERS
The properties of the parameter cluster we use.
|
static String |
KEY_RAPARAMETER
The parameter that holds the object's right ascension.
|
static String |
KEY_REPORTCYCLE
The report cycle in days, zero = no report.
|
static String |
KEY_REPORTFAILURE
If true, only successful observations are reported.
|
static String |
KEY_REPORTFIELD
The fields to be included in the report, plus order.
|
static String |
KEY_REPORTGENERAL
The fields to be included in the general report, plus order.
|
static String |
KEY_TELESCOPE
The issuing telescope.
|
static String |
KEY_TIMEPARAMETER
The parameter that holds the settable time.
|
static String |
KEY_USERCONF
The list of per-user configurations different from default.
|
private static DateFormat |
MDF
The medium date format.
|
private Map<String,Date> |
report
Link of user names to their last report dates.
|
private static DateFormat |
SDF
The short date format.
|
static String |
SEPARATOR
Separator in report blocks.
|
static String |
SERIALIZE
The file where the last report times are serialized.
|
private GlobalGrouping |
set
The parameter set we use.
|
static String |
TABSEP
Separator of table columns.
|
private Map<String,Map<String,String>> |
users
Override default parameters per user.
|
KEY_PASSWORD, KEY_SMTPHOST, KEY_SMTPPORT, KEY_USERNAME, KEY_USESSL, STELLAMAINTENANCE, STELLAROBOTIC, STELLASUPPORT, SYSTEM_MAILDEBUGKEY_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 |
|---|
TargetReport(Map<String,String> prop)
Constructs a new target report.
|
| Modifier and Type | Method and Description |
|---|---|
void |
exit()
On exit, we save the time table.
|
private String |
explanation(Map<String,String> nondef)
Get an explanation of the fields in the report.
|
private Map<String,Date> |
fileLoad(File resource)
Loads a hash map from a file.
|
javax.mail.Address |
getFrom()
Returns the from address.
|
private List<List<String>> |
getGeneralReport(String user,
Date from,
Date to)
Gets a formatted report for a user, spanning the time of last report
until now.
|
long |
getRefreshInterval()
The refresh intervall is one day, but not necessarily a mail is sent each
day.
|
private List<String> |
getReportHead(Map<String,String> nondef)
Gets the head of the report table, basically the queried fields.
|
private List<String> |
getReportHead(String fields)
Gets the head of the report table, basically the queried fields.
|
private List<String> |
getReportLine(String uniq,
String fields)
This prepares one line of the report, for the specified unique object id.
|
private String |
getUserReport(String user,
Date from,
Date to)
Gets a formatted report for a user, spanning the time of last report
until now.
|
void |
init()
Initializes the report.
|
boolean |
isFixedRate()
We want the report to be filed each morning at the same time.
|
private boolean |
mailReports()
Sends all reports.
|
static void |
main(String[] arg)
This runs as a cron job.
|
void |
refresh()
On refresh, we check for each user, if a report should be sent.
|
private void |
setFrom(javax.mail.Address mailfrom)
Sets the from address.
|
private String |
tableFormat(List<List<String>> format)
Formats a table into a single string.
|
close, createStellaRoboticMailer, getAddresses, getStellaMaintenance, getStellaRobotic, getStellaSupport, prepareMail, prepareMail, sendMail, sendMail, sendMail, threadMailclone, 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 SEPARATOR
public static final String TABSEP
public static final String SERIALIZE
public static final String KEY_USERCONF
public static final String KEY_PARAMETERS
public static final String KEY_TIMEPARAMETER
public static final String KEY_RAPARAMETER
public static final String KEY_DEPARAMETER
public static final String KEY_REPORTCYCLE
public static final String KEY_GENERALCYCLE
public static final String KEY_REPORTFIELD
public static final String KEY_REPORTGENERAL
public static final String KEY_REPORTFAILURE
public static final String KEY_EXPLANATION
public static final String KEY_TELESCOPE
public static final String KEY_FROM
public static final String KEY_GENERALTO
public static final String KEY_CC
public static final String KEY_BCC
public static final String KEY_DEBUG
private static final String DEFTELESCOPE
private static final String DEFTIMEPARAMETER
private static final String DEFRAPARAMETER
private static final String DEFDEPARAMETER
private static final boolean DEFDEBUG
private static final String DEFFROM
private static final String DEFGENERALTO
private static final double DEFREPORTCYCLE
private static final double DEFGENERALCYCLE
private static final String DEFREPORTFIELD
private static final String DEFREPORTGENERAL
private static final boolean DEFREPORTFAILURE
private static final boolean DEFEXPLANATION
private static final DateFormat SDF
private static final DateFormat MDF
private GlobalGrouping set
private Date general
private javax.mail.Address from
public void init()
init in interface Initializableinit in class Mailerpublic void exit()
exit in interface ExitCleaningprivate void setFrom(javax.mail.Address mailfrom)
public javax.mail.Address getFrom()
public boolean isFixedRate()
public long getRefreshInterval()
public void refresh()
report table. If no entry for
the user exists, or if the entry is outdated, a report is generated and
the new date stored in report. If the report is not empty, it is readilly
sent to the user. If no last report date for a user exists, we go back
the specified number of days.private boolean mailReports()
private List<List<String>> getGeneralReport(String user, Date from, Date to)
select obs.objid,success from obs,task,proposal,done where
dateobs<'2009-05-14 12:32:00' and dateobs > '2009-05-13 12:32:00'
and pi='Strassmeier' and obs.object=task.object and
task.propid=proposal.propid and done.object=obs.objid;
to retrieve the list of unique id's, which are then used in
getReportLine(java.lang.String, java.lang.String)InitExceptionprivate String getUserReport(String user, Date from, Date to)
select obs.objid,success from obs,task,proposal,done where
dateobs<'2009-05-14 12:32:00' and dateobs > '2009-05-13 12:32:00'
and pi='Strassmeier' and obs.object=task.object and
task.propid=proposal.propid and done.object=obs.objid;
to retrieve the list of unique id's, which are then used in
getReportLine(java.lang.String, java.lang.String)private String tableFormat(List<List<String>> format)
private String explanation(Map<String,String> nondef)
private List<String> getReportHead(Map<String,String> nondef)
private List<String> getReportHead(String fields)
private List<String> getReportLine(String uniq, String fields)
public static void main(String[] arg)