use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ExpressionExperimentDetailsValueObject method auditEvents2SampleRemovedFlags.
public void auditEvents2SampleRemovedFlags(Collection<AuditEvent> s) {
Collection<AuditEventValueObject> converted = new HashSet<>();
for (AuditEvent ae : s) {
converted.add(new AuditEventValueObject(ae));
}
this.sampleRemovedFlags = converted;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ArrayDesignReportServiceImpl method getLastEvent.
private String getLastEvent(Long id, Class<? extends AuditEventType> eventType) {
ArrayDesign ad = arrayDesignService.load(id);
if (ad == null)
return "";
List<AuditEvent> events2 = auditEventService.getEvents(ad);
String analysisEventString;
List<AuditEvent> events = new ArrayList<>();
for (AuditEvent event : events2) {
if (event == null)
// legacy of ordered-list which could end up with gaps; should not be needed
continue;
// any more
if (event.getEventType() != null && eventType.isAssignableFrom(event.getEventType().getClass())) {
events.add(event);
}
}
if (events.size() == 0) {
return "[None]";
}
// add the most recent events to the report. There should always be at least one creation event.
AuditEvent lastEvent = events.get(events.size() - 1);
analysisEventString = DateFormatUtils.format(lastEvent.getDate(), "yyyy.MMM.dd hh:mm aa");
return analysisEventString;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ArrayDesignReportServiceImpl method fillEventInformation.
/**
* Fill in event information
*/
@Override
public void fillEventInformation(Collection<ArrayDesignValueObject> adVos) {
if (adVos == null || adVos.size() == 0)
return;
StopWatch watch = new StopWatch();
watch.start();
Collection<Long> ids = new ArrayList<>();
for (Object object : adVos) {
ArrayDesignValueObject adVo = (ArrayDesignValueObject) object;
Long id = adVo.getId();
if (id == null)
continue;
ids.add(id);
}
if (ids.size() == 0)
return;
Collection<Class<? extends AuditEventType>> typesToGet = Arrays.asList(eventTypes);
Collection<ArrayDesign> arrayDesigns = arrayDesignService.load(ids);
Map<Long, ArrayDesign> idMap = EntityUtils.getIdMap(arrayDesigns);
Map<Class<? extends AuditEventType>, Map<Auditable, AuditEvent>> events = auditEventService.getLastEvents(arrayDesigns, typesToGet);
Map<Auditable, AuditEvent> geneMappingEvents = events.get(ArrayDesignGeneMappingEvent.class);
Map<Auditable, AuditEvent> sequenceUpdateEvents = events.get(ArrayDesignSequenceUpdateEvent.class);
Map<Auditable, AuditEvent> sequenceAnalysisEvents = events.get(ArrayDesignSequenceAnalysisEvent.class);
Map<Auditable, AuditEvent> repeatAnalysisEvents = events.get(ArrayDesignRepeatAnalysisEvent.class);
for (ArrayDesignValueObject adVo : adVos) {
Long id = adVo.getId();
ArrayDesign ad = idMap.get(id);
if (geneMappingEvents.containsKey(ad)) {
AuditEvent event = geneMappingEvents.get(ad);
if (event != null) {
adVo.setLastGeneMapping(event.getDate());
}
}
if (sequenceUpdateEvents.containsKey(ad)) {
AuditEvent event = sequenceUpdateEvents.get(ad);
if (event != null) {
adVo.setLastSequenceUpdate(event.getDate());
}
}
if (sequenceAnalysisEvents.containsKey(ad)) {
AuditEvent event = sequenceAnalysisEvents.get(ad);
if (event != null) {
adVo.setLastSequenceAnalysis(event.getDate());
}
}
if (repeatAnalysisEvents.containsKey(ad)) {
AuditEvent event = repeatAnalysisEvents.get(ad);
if (event != null) {
adVo.setLastRepeatMask(event.getDate());
}
}
}
watch.stop();
if (watch.getTime() > 1000)
ArrayDesignReportServiceImpl.log.info("Added event information in " + watch.getTime() + "ms");
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class BatchInfoPopulationServiceImpl method needToRun.
/**
* @param ee ee
* @return true if it needs processing
*/
private boolean needToRun(ExpressionExperiment ee) {
ExpressionExperimentValueObject eevo = expressionExperimentService.loadValueObject(ee);
assert eevo != null;
if (StringUtils.isBlank(eevo.getAccession())) {
BatchInfoPopulationServiceImpl.log.info(ee + " lacks an external accession to use for fetching, will not attempt to fetch raw data files.");
return false;
}
if (eevo.getTechnologyType().equals("NONE")) {
BatchInfoPopulationServiceImpl.log.info(ee + " has technology type 'NONE', will not attempt to fetch raw data files");
return false;
}
AuditEvent e = auditEventService.getLastEvent(ee, BatchInformationFetchingEvent.class);
if (e == null)
return true;
if (FailedBatchInformationFetchingEvent.class.isAssignableFrom(e.getClass()))
// worth trying
return true;
// on occasions the files appear or were missed the first time ...? GSE20842
if (FailedBatchInformationMissingEvent.class.isAssignableFrom(e.getClass())) {
RawDataFetcher fetcher = new RawDataFetcher();
return fetcher.checkForFile(ee.getAccession().getAccession());
}
// already did it.
return false;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ArrayDesignSequenceManipulatingCli method needToRun.
/**
* @param eventClass e.g., ArrayDesignSequenceAnalysisEvent.class
* @return true if skipIfLastRunLaterThan is null, or there is no record of a previous analysis, or if the last
* analysis was run before skipIfLastRunLaterThan. false otherwise.
*/
boolean needToRun(Date skipIfLastRunLaterThan, ArrayDesign arrayDesign, Class<? extends ArrayDesignAnalysisEvent> eventClass) {
if (skipIfLastRunLaterThan == null)
return true;
if (!autoSeek)
return true;
ArrayDesign subsumingArrayDesign = arrayDesign.getSubsumingArrayDesign();
if (subsumingArrayDesign != null) {
boolean needToRunSubsumer = this.needToRun(skipIfLastRunLaterThan, subsumingArrayDesign, eventClass);
if (!needToRunSubsumer) {
AbstractCLI.log.info("Subsumer " + subsumingArrayDesign + " was run more recently than " + skipIfLastRunLaterThan);
return false;
}
}
if (autoSeek) {
return this.needToAutoRun(arrayDesign, eventClass);
}
List<AuditEvent> events = this.getEvents(arrayDesign, eventClass);
if (events.size() == 0) {
// always do it, it's never been done.
return true;
}
// return true if the last time was older than the limit time.
AuditEvent lastEvent = events.get(events.size() - 1);
return lastEvent.getDate().before(skipIfLastRunLaterThan);
}
Aggregations