FileDocCategorySizeDatePackage
SyncResult.javaAPI DocAndroid 1.5 API5817Wed May 06 22:41:54 BST 2009android.content

SyncResult

public final class SyncResult extends Object implements android.os.Parcelable
This class is used to store information about the result of a sync
hide

Fields Summary
public final boolean
syncAlreadyInProgress
public boolean
tooManyDeletions
public boolean
tooManyRetries
public boolean
databaseError
public boolean
fullSyncRequested
public boolean
partialSyncUnavailable
public boolean
moreRecordsToGet
public final SyncStats
stats
public static final SyncResult
ALREADY_IN_PROGRESS
public static final Creator
CREATOR
Constructors Summary
public SyncResult()

        ALREADY_IN_PROGRESS = new SyncResult(true);
    
        this(false);
    
private SyncResult(boolean syncAlreadyInProgress)

        this.syncAlreadyInProgress = syncAlreadyInProgress;
        this.tooManyDeletions = false;
        this.tooManyRetries = false;
        this.fullSyncRequested = false;
        this.partialSyncUnavailable = false;
        this.moreRecordsToGet = false;
        this.stats = new SyncStats();
    
private SyncResult(android.os.Parcel parcel)

        syncAlreadyInProgress = parcel.readInt() != 0;
        tooManyDeletions = parcel.readInt() != 0;
        tooManyRetries = parcel.readInt() != 0;
        databaseError = parcel.readInt() != 0;
        fullSyncRequested = parcel.readInt() != 0;
        partialSyncUnavailable = parcel.readInt() != 0;
        moreRecordsToGet = parcel.readInt() != 0;
        stats = new SyncStats(parcel);
    
Methods Summary
public voidclear()

        if (syncAlreadyInProgress) {
            throw new UnsupportedOperationException(
                    "you are not allowed to clear the ALREADY_IN_PROGRESS SyncStats");
        }
        tooManyDeletions = false;
        tooManyRetries = false;
        databaseError = false;
        fullSyncRequested = false;
        partialSyncUnavailable = false;
        moreRecordsToGet = false;
        stats.clear();
    
public intdescribeContents()


       
        return 0;
    
public booleanhasError()

        return hasSoftError() || hasHardError();
    
public booleanhasHardError()

        return stats.numParseExceptions > 0
                || stats.numConflictDetectedExceptions > 0
                || stats.numAuthExceptions > 0
                || tooManyDeletions
                || tooManyRetries
                || databaseError;
    
public booleanhasSoftError()

        return syncAlreadyInProgress || stats.numIoExceptions > 0;
    
public booleanmadeSomeProgress()

        return ((stats.numDeletes > 0) && !tooManyDeletions)
                || stats.numInserts > 0
                || stats.numUpdates > 0;
    
public java.lang.StringtoDebugString()
Generates a debugging string indicating the status. The string consist of a sequence of code letter followed by the count. Code letters are f - fullSyncRequested, r - partialSyncUnavailable, X - hardError, e - numParseExceptions, c - numConflictDetectedExceptions, a - numAuthExceptions, D - tooManyDeletions, R - tooManyRetries, b - databaseError, x - softError, l - syncAlreadyInProgress, I - numIoExceptions

return
debugging string.

        StringBuffer sb = new StringBuffer();

        if (fullSyncRequested) {
            sb.append("f1");
        }
        if (partialSyncUnavailable) {
            sb.append("r1");
        }
        if (hasHardError()) {
            sb.append("X1");
        }
        if (stats.numParseExceptions > 0) {
            sb.append("e").append(stats.numParseExceptions);
        }
        if (stats.numConflictDetectedExceptions > 0) {
            sb.append("c").append(stats.numConflictDetectedExceptions);
        }
        if (stats.numAuthExceptions > 0) {
            sb.append("a").append(stats.numAuthExceptions);
        }
        if (tooManyDeletions) {
            sb.append("D1");
        }
        if (tooManyRetries) {
            sb.append("R1");
        }
        if (databaseError) {
            sb.append("b1");
        }
        if (hasSoftError()) {
            sb.append("x1");
        }
        if (syncAlreadyInProgress) {
            sb.append("l1");
        }
        if (stats.numIoExceptions > 0) {
            sb.append("I").append(stats.numIoExceptions);
        }
        return sb.toString();
    
public java.lang.StringtoString()

        StringBuilder sb = new StringBuilder();
        sb.append(" syncAlreadyInProgress: ").append(syncAlreadyInProgress);
        sb.append(" tooManyDeletions: ").append(tooManyDeletions);
        sb.append(" tooManyRetries: ").append(tooManyRetries);
        sb.append(" databaseError: ").append(databaseError);
        sb.append(" fullSyncRequested: ").append(fullSyncRequested);
        sb.append(" partialSyncUnavailable: ").append(partialSyncUnavailable);
        sb.append(" moreRecordsToGet: ").append(moreRecordsToGet);
        sb.append(" stats: ").append(stats);
        return sb.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)

        parcel.writeInt(syncAlreadyInProgress ? 1 : 0);
        parcel.writeInt(tooManyDeletions ? 1 : 0);
        parcel.writeInt(tooManyRetries ? 1 : 0);
        parcel.writeInt(databaseError ? 1 : 0);
        parcel.writeInt(fullSyncRequested ? 1 : 0);
        parcel.writeInt(partialSyncUnavailable ? 1 : 0);
        parcel.writeInt(moreRecordsToGet ? 1 : 0);
        stats.writeToParcel(parcel, flags);