-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #567 from Heigvd/dev
- URL changes - text editor fix - icon picker review - some links can be opened in a new tab browser - schedule job monitoring
- Loading branch information
Showing
222 changed files
with
4,609 additions
and
5,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...-api/src/main/java/ch/colabproject/colab/api/controller/monitoring/CronJobLogManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* The coLAB project | ||
* Copyright (C) 2021-2023 AlbaSim, MEI, HEIG-VD, HES-SO | ||
* | ||
* Licensed under the MIT License | ||
*/ | ||
package ch.colabproject.colab.api.controller.monitoring; | ||
|
||
import ch.colabproject.colab.api.model.monitoring.CronJobLog; | ||
import ch.colabproject.colab.api.model.monitoring.CronJobLogName; | ||
import ch.colabproject.colab.api.persistence.jpa.monitoring.CronJobLogDao; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.ejb.LocalBean; | ||
import javax.ejb.Stateless; | ||
import javax.ejb.TransactionAttribute; | ||
import javax.ejb.TransactionAttributeType; | ||
import javax.inject.Inject; | ||
import java.time.OffsetDateTime; | ||
|
||
/** | ||
* Logic to manage cron job logging | ||
* | ||
* @author mikkelvestergaard | ||
*/ | ||
@Stateless | ||
@LocalBean | ||
public class CronJobLogManager { | ||
|
||
/** | ||
* logger | ||
*/ | ||
private static final Logger logger = LoggerFactory.getLogger(CronJobLogManager.class); | ||
|
||
/** | ||
* CronJobLog persistence | ||
*/ | ||
@Inject | ||
private CronJobLogDao cronJobLogDao; | ||
|
||
/** | ||
* Create a new cronJobLog with given cronJobLogName | ||
* | ||
* @param jobLogName name of the cronJobLog to create | ||
* | ||
* @return created cronJobLog | ||
*/ | ||
private CronJobLog createCronJobLog(CronJobLogName jobLogName) { | ||
CronJobLog cronJobLog = new CronJobLog(); | ||
cronJobLog.setJobName(jobLogName); | ||
cronJobLogDao.persistCronJobLog(cronJobLog); | ||
|
||
return cronJobLog; | ||
} | ||
|
||
/** | ||
* Update a cronJobLog's lastRunTime | ||
* | ||
* @param jobName name of cronJob to update | ||
*/ | ||
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) | ||
public void updateCronJobLogLastRunTime(CronJobLogName jobName) { | ||
logger.debug("Update cronJobLog lastRunTime {}", jobName); | ||
|
||
CronJobLog cronJobLog = cronJobLogDao.findCronJobLogByName(jobName); | ||
|
||
if (cronJobLog == null) { | ||
cronJobLog = createCronJobLog(jobName); | ||
} | ||
|
||
OffsetDateTime now = OffsetDateTime.now(); | ||
cronJobLog.setLastRunTime(now); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.