Skip to content

\<objectService>.rollback

The \<objectService>.rollback API rolls back all changes of all objects of an object service to its previous sync state.

Volt MX Iris (JavaScript)

Signature

<VMXObjSvc>.rollback(successCallback, failureCallback)

Parameters

ParameterTypeDescriptionRequired
successCallbackFunctionThe function is invoked on successful rollback.Yes
failureCallbackFunctionThe function is invoked on an error with the cause of failure as an argument upon Rollback failure.Yes

Return Type

void

Example

var orgObjectService = new voltmx.sdk.VMXObjSvc("Organization");

function successCallback(result) {
//result contains boolean true
voltmx.print("ObjectService level rollback successful")
}

function failureCallback(error) {
voltmx.print("ObjectService rollback failed with error: " + JSON.stringify(error));
}

orgObjectService.rollback(successCallback, failureCallback);

Android (Java)

Signature

void <VMXObjSvc>.rollback(final VMXCallback callback)

Parameters

ParameterTypeDescriptionRequired
callbackVMXCallbackApplication implements onSuccess and onFailure methods of VMXCallback interface.Yes

Return Type

void

Example

VMXObjSvc orgObjectService = new VMXObjSvc("Organization");

try {
orgObjectService.rollback(new VMXCallback() {

        @Override
        public void onSuccess(Object object) {
            Log.d("ObjectServiceSync", "ObjectService rollback successful");
        }

        @Override
        public void onFailure(Object error) {
            OfflineObjectsException e = (OfflineObjectsException) error;
            Log.e("ObjectServiceSync", "ObjectService rollback failed with error: " + e.getMessage());
        }
    });

} catch (Exception e) {
Log.e("ObjectServiceSync", "ObjectService rollback failed with error:" + e.getMessage());
}

iOS (Objective C)

Signature

void <VMXObjSvc>  
rollback:(VMXSuccessCompletionHandler)onSuccess  
onFailure:(VMXFailureCompletionHandler)onFailure

Parameters

ParameterTypeDescriptionRequired
onSuccessVMXSuccessCompletionHandlerThe method called after a successful rollback.Yes
onFailureVMXFailureCompletionHandlerThe method called on rollback failure.Yes

Return Type

void

Example

VMXObjSvc \* orgObjectService = [
[VMXObjSvc alloc] initWithName: @"Organization"
error: & ;error
];

[orgObjectService rollback: ^ (id object) {
NSLog(@"Object service rollback successful");
}
onFailure: ^ (id object) {
OfflineObjectsError \* error = (OfflineObjectsError) object;
NSLog(@"Rollback failed with error: %@", [error.userInfo localizedDescription]);
}
];