use of ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignGeneMappingEvent in project Gemma by PavlidisLab.
the class ArrayDesignReportServiceTest method setup.
@Before
public void setup() throws Exception {
if (!ArrayDesignReportServiceTest.persisted) {
ArrayDesignReportServiceTest.ad = this.getTestPersistentArrayDesign(5, true, false, // not read only.
false);
ads.addUpdateEvent(ArrayDesignReportServiceTest.ad, new ArrayDesignSequenceUpdateEvent(), "sequences");
ads.addUpdateEvent(ArrayDesignReportServiceTest.ad, new ArrayDesignSequenceAnalysisEvent(), "alignment");
ads.addUpdateEvent(ArrayDesignReportServiceTest.ad, new ArrayDesignGeneMappingEvent(), "mapping");
Thread.sleep(100);
ads.addUpdateEvent(ArrayDesignReportServiceTest.ad, new ArrayDesignSequenceAnalysisEvent(), "alignment 2");
ads.addUpdateEvent(ArrayDesignReportServiceTest.ad, new ArrayDesignGeneMappingEvent(), "mapping 2");
Thread.sleep(100);
ArrayDesignReportServiceTest.persisted = true;
}
}
use of ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignGeneMappingEvent in project Gemma by PavlidisLab.
the class TableMaintenanceUtilImpl method updateGene2CsEntries.
@Override
@Transactional
public synchronized void updateGene2CsEntries() {
if (TableMaintenanceUtilImpl.running.get())
return;
TableMaintenanceUtilImpl.log.debug("Running Gene2CS status check");
String annotation = "";
try {
TableMaintenanceUtilImpl.running.set(true);
Gene2CsStatus status = this.getLastGene2CsUpdateStatus();
boolean needToRefresh = false;
if (status == null) {
needToRefresh = true;
}
if (!needToRefresh) {
Collection<Auditable> newObj = auditEventService.getNewSinceDate(status.getLastUpdate());
for (Auditable a : newObj) {
if (a instanceof ArrayDesign) {
needToRefresh = true;
annotation = a + " is new since " + status.getLastUpdate();
TableMaintenanceUtilImpl.log.debug(annotation);
break;
}
}
}
if (!needToRefresh) {
Collection<Auditable> updatedObj = auditEventService.getUpdatedSinceDate(status.getLastUpdate());
for (Auditable a : updatedObj) {
if (a instanceof ArrayDesign) {
for (AuditEvent ae : auditEventService.getEvents(a)) {
if (ae == null)
// legacy of ordered-list which could end up with gaps; should
continue;
// not be needed any more
if (ae.getEventType() != null && ae.getEventType() instanceof ArrayDesignGeneMappingEvent && ae.getDate().after(status.getLastUpdate())) {
needToRefresh = true;
annotation = a + " had probe mapping done since: " + status.getLastUpdate();
TableMaintenanceUtilImpl.log.debug(annotation);
break;
}
}
}
if (needToRefresh)
break;
}
}
if (needToRefresh) {
TableMaintenanceUtilImpl.log.debug("Update of GENE2CS initiated");
this.generateGene2CsEntries();
Gene2CsStatus updatedStatus = this.writeUpdateStatus(annotation, null);
this.sendEmail(updatedStatus);
} else {
TableMaintenanceUtilImpl.log.debug("No update of GENE2CS needed");
}
} catch (Exception e) {
try {
TableMaintenanceUtilImpl.log.info("Error during attempt to check status or update GENE2CS", e);
Gene2CsStatus updatedStatus = this.writeUpdateStatus(annotation, e);
this.sendEmail(updatedStatus);
} catch (IOException e1) {
throw new RuntimeException(e1);
}
} finally {
TableMaintenanceUtilImpl.running.set(false);
}
}
Aggregations