Package sk.iway.iwcm.system.jpa
Class DefaultTimeValueConverter
java.lang.Object
sk.iway.iwcm.system.jpa.DefaultTimeValueConverter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Date
combineDateWithTime
(long date, long time) static Date
combineDateWithTime
(Date date, Date time) Combine yyyy-mm-dd from input "date" with hh:mm:ss from input "time" and return new date.convertToDatabaseColumn
(Date oldDate) convertToEntityAttribute
(Date oldDate) static Date
getValidTimeValue
(int hours, int minutes) Create valid date where day/month/year is set to 01.01.2000, seconds are set at 0 and hours/minutes are set using input values.static Date
getValidTimeValue
(int hours, int minutes, int seconds) Create valid date where day/month/year is set to 01.01.2000 and seconds/hours/minutes are set using input values.static Date
getValidTimeValue
(Date oldDate) If input oldValue is null, it will be returned default Date 01-01-2000 00:00:00.
-
Constructor Details
-
DefaultTimeValueConverter
public DefaultTimeValueConverter()
-
-
Method Details
-
convertToDatabaseColumn
-
convertToEntityAttribute
-
getValidTimeValue
If input oldValue is null, it will be returned default Date 01-01-2000 00:00:00. If input oldValue isnt null, value of hours/minutes/seconds will remain, but value of day/month/year will be set on default value 01-01-2000 (rest is same).- Parameters:
oldDate
- value of date we need to correct- Returns:
- valid date for TIME_HM and TIME_HMS DataTableColumnTypes
-
getValidTimeValue
Create valid date where day/month/year is set to 01.01.2000, seconds are set at 0 and hours/minutes are set using input values.- Parameters:
hours
- number of hours we want to set into dateminutes
- number of minutes we want to set into date- Returns:
- valid date for TIME_HM and TIME_HMS DataTableColumnTypes
-
getValidTimeValue
Create valid date where day/month/year is set to 01.01.2000 and seconds/hours/minutes are set using input values.- Parameters:
hours
- number of hours we want to set into dateminutes
- number of minutes we want to set into dateseconds
- number of seconds we want to set into date- Returns:
- valid date for TIME_HM and TIME_HMS DataTableColumnTypes
-
combineDateWithTime
Combine yyyy-mm-dd from input "date" with hh:mm:ss from input "time" and return new date. Milliseconds are default set to 0. If any of iput values is null, null will be returned.- Parameters:
date
- date value representing yyyy-mm-dd in new datetime
- date value representing hh:mm:ss in new date- Returns:
- date value represent date time combination
-
combineDateWithTime
-