Chcekpoint - needs docs cleaning and tests
This commit is contained in:
buisnesslogic/src
main
java
com
plannaplan
test
java
com
plannaplan
restservice/src/main/java/com/plannaplan
@ -2,6 +2,8 @@ package com.plannaplan.entities;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@ -11,6 +13,8 @@ import javax.persistence.Id;
|
||||
import com.plannaplan.models.TourData;
|
||||
import com.plannaplan.types.AppState;
|
||||
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
|
||||
/**
|
||||
* entity that keeps app configurations
|
||||
*/
|
||||
@ -115,4 +119,26 @@ public class AppConfig {
|
||||
return AppState.NO_TOUR;
|
||||
}
|
||||
|
||||
public CronTrigger getFirstTourEndCron() {
|
||||
return getCron(this.firstTourEnd);
|
||||
}
|
||||
|
||||
public CronTrigger getSecondTourEndCron() {
|
||||
return getCron(this.secondTourEnd);
|
||||
}
|
||||
|
||||
public CronTrigger getFirstTourStartCron() {
|
||||
return getCron(this.firstTourStart);
|
||||
}
|
||||
|
||||
public CronTrigger getSecondTourStartCron() {
|
||||
return getCron(this.secondTourStart);
|
||||
}
|
||||
|
||||
private CronTrigger getCron(Date date) {
|
||||
final LocalDate tourEnd = date.toLocalDate();
|
||||
return new CronTrigger("0 0 0 " + tourEnd.getDayOfMonth() + " " + tourEnd.getMonthValue() + " ?",
|
||||
TimeZone.getTimeZone(TimeZone.getDefault().getID()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user