package cn.com.basic.face.service.sync.up;
|
|
public abstract class BaseSync {
|
|
private BaseSync next;
|
public boolean syncComplete = false;
|
|
public boolean getSyncComplete() {
|
return syncComplete;
|
}
|
|
public void setNext(BaseSync next) {
|
this.next = next;
|
}
|
|
public void sync() {
|
//System.out.println("sync."+this.getClass().getName()+" 正在向上同步");
|
if (hasMore()) {
|
syncComplete = false;
|
doSync();
|
} else {
|
syncComplete = true;
|
if (next != null) {
|
next.sync();
|
}
|
}
|
}
|
|
public abstract void doSync();
|
|
public abstract boolean hasMore();
|
|
public void setSyncComplete(boolean syncComplete) {
|
this.syncComplete = syncComplete;
|
}
|
|
public void setAllSyncComplete(boolean syncComplete) {
|
this.syncComplete = syncComplete;
|
if (next != null) {
|
next.setSyncComplete(syncComplete);
|
}
|
}
|
|
public boolean lastUpSyncComplete() {
|
BaseSync last = this;
|
while (last.next != null) {
|
last = last.next;
|
}
|
return last.getSyncComplete();
|
}
|
|
public BaseSync getNext() {
|
return next;
|
}
|
}
|