Search in sources :

Example 1 with TransferSucceededEvent

use of org.opendatakit.briefcase.model.TransferSucceededEvent in project briefcase by opendatakit.

the class TransferFromServer method pull.

public static void pull(ServerConnectionInfo transferSettings, FormStatus... forms) {
    List<FormStatus> formList = Arrays.asList(forms);
    TransferFromServer action = new TransferFromServer(transferSettings, new TerminationFuture(), formList);
    try {
        boolean allSuccessful = action.doAction();
        if (allSuccessful)
            EventBus.publish(new TransferSucceededEvent(false, formList, transferSettings));
        if (!allSuccessful)
            throw new PullFromServerException(formList);
    } catch (Exception e) {
        EventBus.publish(new TransferFailedEvent(false, formList));
        throw new PullFromServerException(formList);
    }
}
Also used : TransferFailedEvent(org.opendatakit.briefcase.model.TransferFailedEvent) FormStatus(org.opendatakit.briefcase.model.FormStatus) TerminationFuture(org.opendatakit.briefcase.model.TerminationFuture) TransferSucceededEvent(org.opendatakit.briefcase.model.TransferSucceededEvent)

Example 2 with TransferSucceededEvent

use of org.opendatakit.briefcase.model.TransferSucceededEvent in project briefcase by opendatakit.

the class TransferToServer method push.

public static void push(ServerConnectionInfo transferSettings, FormStatus... forms) {
    List<FormStatus> formList = Arrays.asList(forms);
    TransferToServer action = new TransferToServer(transferSettings, new TerminationFuture(), formList);
    try {
        boolean allSuccessful = action.doAction();
        if (allSuccessful)
            EventBus.publish(new TransferSucceededEvent(false, formList, transferSettings));
        if (!allSuccessful)
            throw new PushFromServerException(formList);
    } catch (Exception e) {
        EventBus.publish(new TransferFailedEvent(false, formList));
        throw new PushFromServerException(formList);
    }
}
Also used : TransferFailedEvent(org.opendatakit.briefcase.model.TransferFailedEvent) FormStatus(org.opendatakit.briefcase.model.FormStatus) TerminationFuture(org.opendatakit.briefcase.model.TerminationFuture) TransferSucceededEvent(org.opendatakit.briefcase.model.TransferSucceededEvent)

Aggregations

FormStatus (org.opendatakit.briefcase.model.FormStatus)2 TerminationFuture (org.opendatakit.briefcase.model.TerminationFuture)2 TransferFailedEvent (org.opendatakit.briefcase.model.TransferFailedEvent)2 TransferSucceededEvent (org.opendatakit.briefcase.model.TransferSucceededEvent)2