use of ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType in project Gemma by PavlidisLab.
the class ArrayDesignSequenceAssociationCli method audit.
private void audit(ArrayDesign arrayDesign, String note) {
// minor : don't add audit event if no sequences were changed, or --force.
arrayDesignReportService.generateArrayDesignReport(arrayDesign.getId());
AuditEventType eventType = ArrayDesignSequenceUpdateEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(arrayDesign, eventType, note);
}
use of ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType in project Gemma by PavlidisLab.
the class OutlierFlaggingServiceImpl method audit.
private void audit(BioAssay bioAssay, String note) {
AuditEventType eventType = SampleRemovalEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(bioAssay, eventType, note);
}
use of ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType in project Gemma by PavlidisLab.
the class ArrayDesignBioSequenceDetachCli method audit.
private void audit(ArrayDesign arrayDesign) {
super.getArrayDesignReportService().generateArrayDesignReport(arrayDesign.getId());
AuditEventType eventType = ArrayDesignSequenceRemoveEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(arrayDesign, eventType, "Removed sequence associations with CLI");
}
use of ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType in project Gemma by PavlidisLab.
the class AbstractSpringAwareCLI method noNeedToRun.
/**
* @param auditable auditable
* @param eventClass can be null
* @return boolean
*/
protected boolean noNeedToRun(Auditable auditable, Class<? extends AuditEventType> eventClass) {
boolean needToRun = true;
Date skipIfLastRunLaterThan = this.getLimitingDate();
List<AuditEvent> events = this.auditEventService.getEvents(auditable);
// assume okay unless indicated otherwise
boolean okToRun = true;
// count.
for (int j = events.size() - 1; j >= 0; j--) {
AuditEvent event = events.get(j);
if (event == null) {
// legacy of ordered-list which could end up with gaps; should not be needed any more
continue;
}
AuditEventType eventType = event.getEventType();
if (eventType != null && eventClass != null && eventClass.isAssignableFrom(eventType.getClass()) && !eventType.getClass().getSimpleName().startsWith("Fail")) {
if (skipIfLastRunLaterThan != null) {
if (event.getDate().after(skipIfLastRunLaterThan)) {
AbstractCLI.log.info(auditable + ": " + " run more recently than " + skipIfLastRunLaterThan);
errorObjects.add(auditable + ": " + " run more recently than " + skipIfLastRunLaterThan);
needToRun = false;
}
} else {
// it has been run already at some point
needToRun = false;
}
}
}
/*
* Always skip if the object is curatable and troubled
*/
if (auditable instanceof Curatable) {
Curatable curatable = (Curatable) auditable;
// not ok if troubled
okToRun = !curatable.getCurationDetails().getTroubled();
// special case for expression experiments - check associated ADs.
if (okToRun && curatable instanceof ExpressionExperiment) {
ExpressionExperimentService ees = this.getBean(ExpressionExperimentService.class);
for (ArrayDesign ad : ees.getArrayDesignsUsed((ExpressionExperiment) auditable)) {
if (ad.getCurationDetails().getTroubled()) {
// not ok if even one parent AD is troubled, no need to check the remaining ones.
okToRun = false;
break;
}
}
}
if (!okToRun) {
AbstractCLI.log.info(auditable + ": has an active 'trouble' flag");
errorObjects.add(auditable + ": has an active 'trouble' flag");
}
}
return !needToRun || !okToRun;
}
use of ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType in project Gemma by PavlidisLab.
the class ArrayDesignAnnotationFileCli method audit.
private void audit(ArrayDesign arrayDesign, String note) {
SecurityService ss = this.getBean(SecurityService.class);
if (!ss.isEditable(arrayDesign))
return;
AuditEventType eventType = ArrayDesignAnnotationFileEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(arrayDesign, eventType, note);
}
Aggregations