Search in sources :

Example 1 with DeleteSmsSubmission

use of org.hisp.dhis.smscompression.models.DeleteSmsSubmission in project dhis2-core by dhis2.

the class DeleteEventSMSListener method postProcess.

@Override
protected SmsResponse postProcess(IncomingSms sms, SmsSubmission submission) throws SMSProcessingException {
    DeleteSmsSubmission subm = (DeleteSmsSubmission) submission;
    Uid eventid = subm.getEvent();
    ProgramStageInstance psi = programStageInstanceService.getProgramStageInstance(eventid.getUid());
    if (psi == null) {
        throw new SMSProcessingException(SmsResponse.INVALID_EVENT.set(eventid));
    }
    programStageInstanceService.deleteProgramStageInstance(psi);
    return SmsResponse.SUCCESS;
}
Also used : Uid(org.hisp.dhis.smscompression.models.Uid) ProgramStageInstance(org.hisp.dhis.program.ProgramStageInstance) DeleteSmsSubmission(org.hisp.dhis.smscompression.models.DeleteSmsSubmission)

Example 2 with DeleteSmsSubmission

use of org.hisp.dhis.smscompression.models.DeleteSmsSubmission in project dhis2-core by dhis2.

the class DeleteEventSMSListenerTest method createDeleteSubmission.

private DeleteSmsSubmission createDeleteSubmission() {
    DeleteSmsSubmission subm = new DeleteSmsSubmission();
    subm.setUserId(user.getUid());
    subm.setEvent(programStageInstance.getUid());
    subm.setSubmissionId(1);
    return subm;
}
Also used : DeleteSmsSubmission(org.hisp.dhis.smscompression.models.DeleteSmsSubmission)

Aggregations

DeleteSmsSubmission (org.hisp.dhis.smscompression.models.DeleteSmsSubmission)2 ProgramStageInstance (org.hisp.dhis.program.ProgramStageInstance)1 Uid (org.hisp.dhis.smscompression.models.Uid)1