use of org.esupportail.papercut.domain.PayPapercutTransactionLog in project esup-papercut by EsupPortail.
the class AdminController method archiveAll.
@Transactional
@PostMapping(value = "archiveAll")
public String archiveAll(@PathVariable String papercutContext) {
Page<PayPapercutTransactionLog> txLogsPage = papercutDaoService.findAllPayPapercutTransactionLogs(PageRequest.of(0, 1000));
while (true) {
for (PayPapercutTransactionLog txLog : txLogsPage.getContent()) {
txLog.setArchived(true);
}
if (txLogsPage.hasNext()) {
Pageable pageable = txLogsPage.nextPageable();
txLogsPage = papercutDaoService.findAllPayPapercutTransactionLogs(pageable);
} else {
break;
}
}
return "redirect:/" + papercutContext + "/admin";
}
use of org.esupportail.papercut.domain.PayPapercutTransactionLog in project esup-papercut by EsupPortail.
the class AdminController method archive.
@Transactional
@PostMapping(value = "archive")
public String archive(@RequestParam Long id, @PathVariable String papercutContext) {
PayPapercutTransactionLog txLog = papercutDaoService.findById(id);
txLog.setArchived(true);
return "redirect:/" + papercutContext + "/admin?id=" + id;
}
use of org.esupportail.papercut.domain.PayPapercutTransactionLog in project esup-papercut by EsupPortail.
the class AnonymiseService method anonymiseOldTransactions.
@Scheduled(fixedDelay = 3600000)
public void anonymiseOldTransactions() {
for (String context : config.getContexts().keySet()) {
if (config.getContext(context).getAnonymiseEnabled()) {
log.debug(String.format("anonymiseOldTransactions called for context %s - transactions logs older than %s days will be anonymised", context, config.getContext(context).getAnonymiseOldDays()));
List<PayPapercutTransactionLog> transactionLogs = allContextPapercutDaoService.findOldPayPapercutTransactionLogsNotAnonymised(config.getContext(context).getAnonymiseOldDays());
for (PayPapercutTransactionLog transactionLog : transactionLogs) {
anonymise(transactionLog);
}
if (transactionLogs.size() > 0) {
log.info(transactionLogs.size() + " old transactionLogs anonymised");
}
} else {
log.debug(String.format("Anonymisation of context %s is not Enabled", context));
}
}
}
use of org.esupportail.papercut.domain.PayPapercutTransactionLog in project esup-papercut by EsupPortail.
the class AnonymizeService method anonymizeOldTransactions.
@Scheduled(fixedDelay = 3600000)
public void anonymizeOldTransactions() {
Collection<EsupPapercutContext> availableContexts = esupPapercutConfig.getContexts().values();
for (EsupPapercutContext availableContext : availableContexts) {
if (availableContext.getAnonymization().isEnabled()) {
log.debug("anonymizeOldTransactions called for context : " + availableContext);
List<PayPapercutTransactionLog> transactionLogs = payPapercutTransactionLogRepository.findAllByTransactionDateBeforeAndUidIsNotLike(Date.from(Instant.now().minus(Duration.ofDays(availableContext.getAnonymization().getOldDaysTransactionsLogs()))), "anonymized");
for (PayPapercutTransactionLog transactionLog : transactionLogs) {
anonymizeOneService.anonymize(transactionLog.getId());
}
if (transactionLogs.size() > 0) {
log.info(transactionLogs.size() + " old transactionLogs anonymized for context : " + availableContext);
}
}
}
}
use of org.esupportail.papercut.domain.PayPapercutTransactionLog in project esup-papercut by EsupPortail.
the class AnonymizeOneService method anonymize.
@Transactional
public void anonymize(long id) {
PayPapercutTransactionLog transactionLog = payPapercutTransactionLogRepository.findById(id).get();
transactionLog.setUid("anonymized");
transactionLog.setReference("anonymized");
}
Aggregations