public class ScheduledScrapingSession
extends java.lang.Object
implements com.screenscraper.client.util.WebConstants, java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log |
APD_LOG_CONTENTS, APD_NUM_LOG_LINES_TO_DISPLAY, APD_RUN_RUNNING_SESSION_TAB, APD_RUNNABLE_SESSION_TAB, APD_SCHEDULED_SCRAPING_SESSION_DATA, APD_SCHEDULED_SESSION_TAB, APD_SCRAPEABLE_SESSION_ID, APD_SCRAPING_SESSION_ID, APD_TAB_TO_SELECT, APE_DISPLAY_ENTER_REGISTRATION_INFORMATION_DIALOG, APE_DISPLAY_IMPORT_DIALOG, APE_DISPLAY_NOTES_DIALOG, APE_DISPLAY_PEEK_LOG_DIALOG, APE_DISPLAY_SCRAPING_SESSION_SCHEDULER_DIALOG, APE_DISPLAY_SETTINGS_DIALOG, APE_HIDE_REGISTRATION_BUTTON, APE_REFRESH_TABLE, APE_SCHEDULE_SCRAPING_SESSION, APE_SELECT_RUN_RUNNING_TAB_AND_REFRESH_TABLE, APE_SELECT_RUNNABLE_TAB_AND_REFRESH_TABLE, APE_SELECT_SHEDULED_TAB_AND_REFRESH_TABLE, APE_SELECT_TAB, DEFAULT_REPEAT_DAYS, DEFAULT_REPEAT_HOURS, DEFAULT_REPEAT_MINUTES, DEFAULT_REPEAT_SECONDS, DEFAULT_THRESHOLD_RECORD_COUNT, DEFAULT_THRESHOLD_TIME, DEFAULT_TIMEOUT, DOWNLOAD_FILE_TYPE_SCRAPING_SESSION, ENABLED, ERROR_MESSAGE, FOLDER_NAME, GUI_DIALOG_BOX_SCHEDULE_SCRAPING_SESSION, GUI_PANEL_MAIN_CONTENT, GUI_PANEL_RUN_RUNNING_SCRAPING_SESSIONS, GUI_PANEL_RUNNABLE_SCRAPING_SESSIONS, GUI_PANEL_SCHEDULED_SCRAPING_SESSIONS, GUI_PANEL_TOP_NAV, GUI_SCREENSCRAPER_WEB, GUI_SETTINGS_DIALOG, IS_ERROR, NUM_DUPLICATE_RECORDS, NUM_ERROR_RECORDS, NUM_NEW_RECORDS, NUM_RECORDS, NUM_UPDATED_RECORDS, PREVIOUS_NUM_RECORDS, PREVIOUS_RUNNING_TIME, PREVIOUS_RUNNING_TIME_MACHINE_READABLE, REPEAT_DAYS, REPEAT_HOURS, REPEAT_MINUTES, REPEAT_SECONDS, RUNNING_TIME, RUNNING_TIME_MACHINE_READABLE, SCHEDULE_DATE, SCHEDULE_TIME, SCHEDULED_SCRAPING_SESSION_ID, SCRAPEABLE_SESSION_ID, SCRAPING_SESSION_ID, SCRAPING_SESSION_NAME, SCRAPING_SESSIONS, SECONDS_IN_A_DAY, SECONDS_IN_A_MINUTE, SECONDS_IN_AN_HOUR, SETTABLE_SESSION_VARIABLES, START_TIME, START_TIME_MACHINE_READABLE, STATUS, STATUS_COMPLETED, STATUS_IN_PROCESS, STATUS_INTERRUPTED, STATUS_NOT_STARTED, STATUS_UNKNOWN, THRESHOLD_RECORD_COUNT, THRESHOLD_TIME, TIMEOUT
Constructor and Description |
---|
ScheduledScrapingSession(int scheduledScrapingSessionID,
ScrapingSession scrapingSession,
int timeout,
java.util.Date timeToRun,
long frequency,
int relativeTimeThreshold,
int relativeRecordsScrapedThreshold,
java.lang.String settableSessionVariables,
boolean enabled)
Constructs the object with all fields.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object scheduledScrapingSession)
So that these things can be sorted.
|
void |
dumpToLog()
Dumps information about this to the log.
|
static java.util.Date |
ensureDateIsInTheFuture(java.util.Date date)
Ensures that the given date is in the future.
|
boolean |
equals(java.lang.Object obj)
We override this so that we can easily check for duplicates.
|
static java.util.Date |
getDateFromDateAndTimeStrings(java.lang.String date,
java.lang.String time)
A helper method that generates a
Date from properly
formatted date and time strings. |
boolean |
getEnabled()
Gets whether or not the scheduled scraping session is enabled.
|
long |
getFrequency()
Gets the number of milliseconds between the times the scraping session
is to run.
|
boolean |
getHasBeenProcessed()
Gets whether or not this object has been processed.
|
java.lang.String |
getHumanReadableSettableSessionVariables()
Gets a human-readable list of session variables to be set
when the scraping session is run.
|
int |
getID()
Gets the ID of the scheduled scraping session.
|
static long |
getMillisecondsForDaysHoursMinutesSeconds(int days,
int hours,
int minutes,
int seconds)
Given a number of days, hours, minutes and seconds, returns
the corresponding number of milliseconds.
|
int |
getRelativeRecordsScrapedThreshold()
Gets the records scraped threshold to use for the scraping session.
|
int |
getRelativeTimeThreshold()
Gets the time threshold to use for the scraping session.
|
ScrapingSession |
getScrapingSession()
Gets a reference to the scraping session corresponding to this object.
|
java.lang.String |
getSettableSessionVariables()
Gets a URL-encoded string containing session variables to be set
when the scraping session is run.
|
int |
getTimeout()
Gets how long the scraping session should run before it times out.
|
java.util.Date |
getTimeToRun()
Gets the date when the scraping session is to run.
|
boolean |
isTimeToRun()
Indicates whether or not it's time for the session to be run.
|
void |
nullScrapingSessionReference()
Nulls out the reference this object has to its corresponding
ScrapingSession object. |
void |
runScrapingSession()
Runs the
ScrapingSession held by this object. |
void |
save()
Saves the object.
|
void |
setData(java.util.HashMap params)
Sets the params for the object by deriving them from a
HashMap that
would have beeen passed up from the client. |
void |
setEnabled(boolean enabled)
Sets whether or not the scheduled scraping session is enabled.
|
void |
setScrapingSession(ScrapingSession scrapingSession)
Sets a reference to the scraping session corresponding to this object.
|
java.util.HashMap |
toHashMap()
Gets the object as a
HashMap so that it can be used
on the client-side. |
public ScheduledScrapingSession(int scheduledScrapingSessionID, ScrapingSession scrapingSession, int timeout, java.util.Date timeToRun, long frequency, int relativeTimeThreshold, int relativeRecordsScrapedThreshold, java.lang.String settableSessionVariables, boolean enabled)
public void setData(@NotNull java.util.HashMap params)
HashMap
that
would have beeen passed up from the client.params
- The HashMap
containing the data to be set.public int getID()
@Nullable public ScrapingSession getScrapingSession()
ScrapingSession
.public void setScrapingSession(ScrapingSession scrapingSession)
scrapingSession
- A ScrapingSession
.@Nullable public java.util.Date getTimeToRun()
Date
public int getTimeout()
public long getFrequency()
public int getRelativeTimeThreshold()
public int getRelativeRecordsScrapedThreshold()
@Nullable public java.lang.String getSettableSessionVariables()
@NotNull public java.lang.String getHumanReadableSettableSessionVariables()
public boolean getEnabled()
public void setEnabled(boolean enabled)
enabled
- A boolean.public void save()
public static long getMillisecondsForDaysHoursMinutesSeconds(int days, int hours, int minutes, int seconds)
days
- The number of days.hours
- The number of hours.minutes
- The number of minutes.seconds
- The number of seconds.@NotNull public java.util.HashMap toHashMap()
HashMap
so that it can be used
on the client-side.HashMap
containing the ScheduledScrapingSession
data.@Nullable public static java.util.Date getDateFromDateAndTimeStrings(java.lang.String date, java.lang.String time)
Date
from properly
formatted date and time strings. One or both strings may be null.date
- The date to parse.time
- The time to parse.Date
.@NotNull public static java.util.Date ensureDateIsInTheFuture(@NotNull java.util.Date date)
date
- The Date
to check.public int compareTo(java.lang.Object scheduledScrapingSession)
compareTo
in interface java.lang.Comparable
scheduledScrapingSession
- The object to compare to.public boolean isTimeToRun()
public boolean getHasBeenProcessed()
public void runScrapingSession()
ScrapingSession
held by this object.public void nullScrapingSessionReference()
ScrapingSession
object.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare.public void dumpToLog()