Search in sources :

Example 1 with ArrayDesignGeneMappingEvent

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;
    }
}
Also used : ArrayDesignSequenceAnalysisEvent(ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignSequenceAnalysisEvent) ArrayDesignGeneMappingEvent(ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignGeneMappingEvent) ArrayDesignSequenceUpdateEvent(ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignSequenceUpdateEvent) Before(org.junit.Before)

Example 2 with ArrayDesignGeneMappingEvent

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);
    }
}
Also used : Auditable(ubic.gemma.model.common.Auditable) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Gene2CsStatus(ubic.gemma.persistence.model.Gene2CsStatus) AuditEvent(ubic.gemma.model.common.auditAndSecurity.AuditEvent) ArrayDesignGeneMappingEvent(ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignGeneMappingEvent) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ArrayDesignGeneMappingEvent (ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignGeneMappingEvent)2 Before (org.junit.Before)1 Transactional (org.springframework.transaction.annotation.Transactional)1 Auditable (ubic.gemma.model.common.Auditable)1 AuditEvent (ubic.gemma.model.common.auditAndSecurity.AuditEvent)1 ArrayDesignSequenceAnalysisEvent (ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignSequenceAnalysisEvent)1 ArrayDesignSequenceUpdateEvent (ubic.gemma.model.common.auditAndSecurity.eventType.ArrayDesignSequenceUpdateEvent)1 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)1 Gene2CsStatus (ubic.gemma.persistence.model.Gene2CsStatus)1