|
|
@ -14,13 +14,13 @@
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.gtask.data;
|
|
|
|
package net.micode.notes.gtask.data;// 定义了一个抽象类 Node
|
|
|
|
|
|
|
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
public abstract class Node {
|
|
|
|
public abstract class Node {// 定义了一些静态变量
|
|
|
|
public static final int SYNC_ACTION_NONE = 0;
|
|
|
|
public static final int SYNC_ACTION_NONE = 0;
|
|
|
|
|
|
|
|
|
|
|
|
public static final int SYNC_ACTION_ADD_REMOTE = 1;
|
|
|
|
public static final int SYNC_ACTION_ADD_REMOTE = 1;
|
|
|
@ -38,7 +38,7 @@ public abstract class Node {
|
|
|
|
public static final int SYNC_ACTION_UPDATE_CONFLICT = 7;
|
|
|
|
public static final int SYNC_ACTION_UPDATE_CONFLICT = 7;
|
|
|
|
|
|
|
|
|
|
|
|
public static final int SYNC_ACTION_ERROR = 8;
|
|
|
|
public static final int SYNC_ACTION_ERROR = 8;
|
|
|
|
|
|
|
|
// 定义了一些实例变量
|
|
|
|
private String mGid;
|
|
|
|
private String mGid;
|
|
|
|
|
|
|
|
|
|
|
|
private String mName;
|
|
|
|
private String mName;
|
|
|
@ -47,38 +47,38 @@ public abstract class Node {
|
|
|
|
|
|
|
|
|
|
|
|
private boolean mDeleted;
|
|
|
|
private boolean mDeleted;
|
|
|
|
|
|
|
|
|
|
|
|
public Node() {
|
|
|
|
public Node() {// 构造函数,初始化实例变量
|
|
|
|
mGid = null;
|
|
|
|
mGid = null;
|
|
|
|
mName = "";
|
|
|
|
mName = "";
|
|
|
|
mLastModified = 0;
|
|
|
|
mLastModified = 0;
|
|
|
|
mDeleted = false;
|
|
|
|
mDeleted = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract JSONObject getCreateAction(int actionId);
|
|
|
|
public abstract JSONObject getCreateAction(int actionId);// 抽象方法,获取创建操作的 JSONObject 对象
|
|
|
|
|
|
|
|
|
|
|
|
public abstract JSONObject getUpdateAction(int actionId);
|
|
|
|
public abstract JSONObject getUpdateAction(int actionId);// 抽象方法,获取更新操作的 JSONObject 对象
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void setContentByRemoteJSON(JSONObject js);
|
|
|
|
public abstract void setContentByRemoteJSON(JSONObject js);// 抽象方法,根据远程服务器上的 JSON 对象设置节点的内容
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void setContentByLocalJSON(JSONObject js);
|
|
|
|
public abstract void setContentByLocalJSON(JSONObject js);// 抽象方法,根据本地 JSON 对象设置节点的内容
|
|
|
|
|
|
|
|
|
|
|
|
public abstract JSONObject getLocalJSONFromContent();
|
|
|
|
public abstract JSONObject getLocalJSONFromContent();// 抽象方法,从内容中获取本地 JSON 对象
|
|
|
|
|
|
|
|
|
|
|
|
public abstract int getSyncAction(Cursor c);
|
|
|
|
public abstract int getSyncAction(Cursor c);// 抽象方法,获取同步操作类型
|
|
|
|
|
|
|
|
|
|
|
|
public void setGid(String gid) {
|
|
|
|
public void setGid(String gid) {// 设置、获取实例变量 mGid
|
|
|
|
this.mGid = gid;
|
|
|
|
this.mGid = gid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
public void setName(String name) {// 设置、获取实例变量 mName
|
|
|
|
this.mName = name;
|
|
|
|
this.mName = name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setLastModified(long lastModified) {
|
|
|
|
public void setLastModified(long lastModified) {// 设置、获取实例变量 mLastModified
|
|
|
|
this.mLastModified = lastModified;
|
|
|
|
this.mLastModified = lastModified;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setDeleted(boolean deleted) {
|
|
|
|
public void setDeleted(boolean deleted) {// 设置、获取实例变量 mDeleted
|
|
|
|
this.mDeleted = deleted;
|
|
|
|
this.mDeleted = deleted;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|