com.martealert
Class martealertCalendar

java.lang.Object
  extended byjava.util.Calendar
      extended byjava.util.GregorianCalendar
          extended bycom.martealert.martealertCalendar
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class martealertCalendar
extends java.util.GregorianCalendar

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.GregorianCalendar
AD, BC
 
Fields inherited from class java.util.Calendar
AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
martealertCalendar()
          Creates a new instance of preludeCalendar
martealertCalendar(java.lang.String s)
          Creates a new instance of preludeCalendar initialized from a string s.
 
Method Summary
 martealertCalendar add(java.util.GregorianCalendar cal)
          Adds this to cal and returns result.
static martealertCalendar add(java.util.GregorianCalendar sum1, java.util.GregorianCalendar sum2)
          Adds Calendar sum1 to Calendar sum2 and returns a GregorianCalendar.
static java.lang.String compressTime(java.lang.String timestamp)
          Convert a String with PostgreSQL timestamp "YYYY-MM-DD HH:mm:SS.d" into a short timestamp format: If current time year equals to Postgre timestamp year, short format is: "MM-DD HH:mm:SS" If furthermore current time month equals to Postgre timestamp month, short format is: "DD HH:mm:SS" If furthermore current time day of month equals to Postgre timestamp day, short format is: "HH:mm:SS"
static java.lang.String expandTime(java.lang.String shortTime)
          Get expanded time from a date in a shorter format than ISO.
static java.lang.String getCurrentTime()
          Get current system time in PostgreSQL format: "YYYY-MM-DD HH:mm:SS"
static java.lang.String getFTS(java.sql.Connection con, java.lang.String LTS, java.lang.String interval)
          Get FTS querying the database, knowing LTS.
static java.lang.String getFTS(int year, int month, int date, int hour, int minutes, int seconds)
          Returns FTS (First time sign), passing interval length in integers.
static java.sql.Timestamp getLocalTimeFromGMT(int i, martealertTable table)
          Get local time from date (LTS) in row number (int i) of martealertTable passes as param.
static java.sql.Timestamp getLocalTimeFromGMT(martealertTable table)
          Get local time from date (LTS) in first row of martealertTable passes as param.
static java.lang.String getLTS(java.sql.Connection con)
          Get LTS (current time) from the database.
static java.lang.String getPostgreTime(java.util.GregorianCalendar time)
          Convert a GregorianCalendar time into PostgreSQL format: "YYYY-MM-DD HH:mm:SS.d"
 java.sql.Timestamp getTimestamp()
          Get date in Timestamp format from this martealertCalendar.
 martealertCalendar substract(java.util.GregorianCalendar cal)
          Substract GregorianCalendar cal to this and returns a GregorianCalendar.
static martealertCalendar substract(java.util.GregorianCalendar op1, java.util.GregorianCalendar op2)
          Substract Calendar op1 to Calendar op2 and returns a GregorianCalendar
 java.lang.String toDateString()
          Return this martealertCalendar date in String format.
 java.lang.String toString()
          Return this martealertCalendar in String format.
 
Methods inherited from class java.util.GregorianCalendar
add, computeFields, computeTime, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, hashCode, isLeapYear, roll, roll, setGregorianChange
 
Methods inherited from class java.util.Calendar
after, before, clear, clear, clone, complete, get, getAvailableLocales, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

martealertCalendar

public martealertCalendar()
Creates a new instance of preludeCalendar


martealertCalendar

public martealertCalendar(java.lang.String s)
Creates a new instance of preludeCalendar initialized from a string s.

Parameters:
s - String with date in ISO format: YYYY-MM-DD HH:mm:SS.d
Method Detail

getTimestamp

public java.sql.Timestamp getTimestamp()
Get date in Timestamp format from this martealertCalendar.

Returns:
java.sql.Timestamp Object with date of this object.

toString

public java.lang.String toString()
Return this martealertCalendar in String format.

Returns:
String with ISO date format: "YYYY-MM-DD HH:mm:SS.0"

toDateString

public java.lang.String toDateString()
Return this martealertCalendar date in String format.

Returns:
String with only year, month and date in format: "YYYY-MM-DD"

add

public martealertCalendar add(java.util.GregorianCalendar cal)
Adds this to cal and returns result.

Parameters:
cal - GregorianCalendar added to this.
Returns:
result of addition.

add

public static martealertCalendar add(java.util.GregorianCalendar sum1,
                                     java.util.GregorianCalendar sum2)
Adds Calendar sum1 to Calendar sum2 and returns a GregorianCalendar.

Parameters:
sum1 - GregorianCalendar added to sum2.
sum2 - GregorianCalendar added to sum1.
Returns:
result of addition.

substract

public martealertCalendar substract(java.util.GregorianCalendar cal)
Substract GregorianCalendar cal to this and returns a GregorianCalendar.

Parameters:
cal - GregorianCalendar substracted to this.
Returns:
result of substraction = this - cal.

substract

public static martealertCalendar substract(java.util.GregorianCalendar op1,
                                           java.util.GregorianCalendar op2)
Substract Calendar op1 to Calendar op2 and returns a GregorianCalendar

Parameters:
op1 - GregorianCalendar source.
op2 - GregorianCalendar substracted to op1.
Returns:
result of substraction = op1 - op2.

getLocalTimeFromGMT

public static java.sql.Timestamp getLocalTimeFromGMT(martealertTable table)
Get local time from date (LTS) in first row of martealertTable passes as param.

Parameters:
table - martealertTable from which is obtained local time.
Returns:
Timestamp with local time.

getLocalTimeFromGMT

public static java.sql.Timestamp getLocalTimeFromGMT(int i,
                                                     martealertTable table)
Get local time from date (LTS) in row number (int i) of martealertTable passes as param.

Parameters:
i - int to indicate number of row to get time.
table - martealertTable from which is obtained local time.
Returns:
Timestamp with local time.

getCurrentTime

public static java.lang.String getCurrentTime()
Get current system time in PostgreSQL format: "YYYY-MM-DD HH:mm:SS"

Returns:
String with current system time in specified format.

getPostgreTime

public static java.lang.String getPostgreTime(java.util.GregorianCalendar time)
Convert a GregorianCalendar time into PostgreSQL format: "YYYY-MM-DD HH:mm:SS.d"

Returns:
String with time in specified format.

compressTime

public static java.lang.String compressTime(java.lang.String timestamp)
Convert a String with PostgreSQL timestamp "YYYY-MM-DD HH:mm:SS.d" into a short timestamp format: If current time year equals to Postgre timestamp year, short format is: "MM-DD HH:mm:SS" If furthermore current time month equals to Postgre timestamp month, short format is: "DD HH:mm:SS" If furthermore current time day of month equals to Postgre timestamp day, short format is: "HH:mm:SS"

Parameters:
timestamp - String in PostgreSQL timestamp format to be shorted depending on current time.
Returns:
String with time in specified format.

expandTime

public static java.lang.String expandTime(java.lang.String shortTime)
Get expanded time from a date in a shorter format than ISO.

Parameters:
shortTime - String with date in a short format.
Returns:
String with time in ISO format.

getFTS

public static java.lang.String getFTS(int year,
                                      int month,
                                      int date,
                                      int hour,
                                      int minutes,
                                      int seconds)
Returns FTS (First time sign), passing interval length in integers. Time interval is [FTS, LTS]. LTS is calculated inside this method getting system time.

Parameters:
year - Number of years of the interval length.
month - Number of months of the interval length.
date - Number of days of the interval length.
hour - Number of hours of the interval length.
minutes - Number of minutes of the interval length.
seconds - Number of seconds of the interval length.
Returns:
String with first time sign (FTS).

getLTS

public static java.lang.String getLTS(java.sql.Connection con)
                               throws java.sql.SQLException
Get LTS (current time) from the database.

Parameters:
con - Connection to database.
Returns:
String with current time in ISO format.
Throws:
java.sql.SQLException - SQL Syntax error.

getFTS

public static java.lang.String getFTS(java.sql.Connection con,
                                      java.lang.String LTS,
                                      java.lang.String interval)
                               throws java.sql.SQLException
Get FTS querying the database, knowing LTS.

Parameters:
con - Connection to database.
LTS - String with last time seen.
interval - Lenght of interval time between FTS and LTS.
Returns:
String with current time in ISO format.
Throws:
java.sql.SQLException - SQL Syntax error.


e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


DISEÑO DE UNA PLATAFORMA DE GESTIÓN Y MONITORIZACIÓN DE EVENTOS DE SEGURIDAD

: Galera Ruiz, Alejandro David
: Ingeniería Telecomunicación
Contenido del proyecto: