Search in sources :

Example 1 with RecordDeletedEvent

use of org.openforis.collect.event.RecordDeletedEvent in project collect by openforis.

the class DeleteRecordHandler method execute.

@Override
public RecordEvent execute(DeleteRecordCommand command) {
    try {
        CollectSurvey survey = surveyManager.getById(command.getSurveyId());
        recordManager.delete(command.getRecordId());
        return new RecordDeletedEvent(survey.getName(), command.getRecordId(), new Date(), command.getUsername());
    } catch (RecordPersistenceException e) {
        throw new RuntimeException(e);
    }
}
Also used : RecordDeletedEvent(org.openforis.collect.event.RecordDeletedEvent) CollectSurvey(org.openforis.collect.model.CollectSurvey) RecordPersistenceException(org.openforis.collect.persistence.RecordPersistenceException) Date(java.util.Date)

Example 2 with RecordDeletedEvent

use of org.openforis.collect.event.RecordDeletedEvent in project collect by openforis.

the class RecordController method publishRecordDeletedEvent.

private void publishRecordDeletedEvent(CollectRecord record, RecordStep recordStep, String userName) {
    if (!eventQueue.isEnabled()) {
        return;
    }
    List<RecordDeletedEvent> events = Arrays.asList(new RecordDeletedEvent(record.getSurvey().getName(), record.getId(), new Date(), userName));
    String surveyName = record.getSurvey().getName();
    eventQueue.publish(new RecordTransaction(surveyName, record.getId(), recordStep, events));
}
Also used : RecordDeletedEvent(org.openforis.collect.event.RecordDeletedEvent) Date(java.util.Date) RecordTransaction(org.openforis.collect.event.RecordTransaction)

Example 3 with RecordDeletedEvent

use of org.openforis.collect.event.RecordDeletedEvent in project collect by openforis.

the class DataService method publishRecordDeletedEvent.

private void publishRecordDeletedEvent(CollectRecord record, RecordStep recordStep, String userName) {
    if (!eventQueue.isEnabled()) {
        return;
    }
    List<RecordDeletedEvent> events = Arrays.asList(new RecordDeletedEvent(record.getSurvey().getName(), record.getId(), new Date(), userName));
    String surveyName = record.getSurvey().getName();
    eventQueue.publish(new RecordTransaction(surveyName, record.getId(), recordStep, events));
}
Also used : RecordDeletedEvent(org.openforis.collect.event.RecordDeletedEvent) Date(java.util.Date) RecordTransaction(org.openforis.collect.event.RecordTransaction)

Aggregations

Date (java.util.Date)3 RecordDeletedEvent (org.openforis.collect.event.RecordDeletedEvent)3 RecordTransaction (org.openforis.collect.event.RecordTransaction)2 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 RecordPersistenceException (org.openforis.collect.persistence.RecordPersistenceException)1