⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syncitem.java

📁 SyncML的java实现类库 funambol公司发布的
💻 JAVA
字号:
/*
 * Copyright (C) 2006-2007 Funambol
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */

package com.funambol.syncml.spds;

/**
 * This class is a container for the items exchanged between the SyncManager
 * and the SyncSources
 */
public class SyncItem {
    
    //----------------------------------------------------------------- Constants
    public static final char STATE_NEW = 'N';
    public static final char STATE_UPDATED = 'U';
    public static final char STATE_DELETED = 'D';
    public static final char STATE_UNDEF = ' ';

    //-------------------------------------------------------------- Private data

    /** The key of this item.  */
    private String key;
    
    /** The mime-type of this item. Default is text/plain.  */
    private String type;
    
    /** The state of this item ([N]ew, [U]pdated, [D]eleted) */
    private char state;

    /** The name of the parent folder of the item.  */
    private String parent;
    
    /** The content of this item */
    private byte[] content;
    
    //------------------------------------------------------------- Constructors
    
    /**
     * Basic constructor. Only the key is required, the others
     * are set to a default and can be set later.
     */
    public SyncItem(String key) {
        this(key, "text/plain", STATE_NEW, null, null);
    }
    
    /**
     * Full contructor. All the item's fields are passed by the caller.
     */
    public SyncItem(String key, String type, char state,
                    String parent, byte[] content) {
        this.key = key;
        this.type = type;
        this.state = state;
        this.parent = parent;
        this.content = content;
    }

    /**
     * Copy constructor. The item is created using the values from another
     * one.
     */
    public SyncItem(SyncItem that) {
        this.key = that.key;
        this.type = that.type;
        this.state = that.state;
        this.parent = that.parent;
        this.content = that.content;
    }

    //----------------------------------------------------------- Public methods
    
    /**
     * Get the current key
     */
    public String getKey() {
        return this.key;
    }
    
    /**
     * Set the current key
     */
    public void setKey(String key) {
        this.key = key;
    }
    
    /**
     * Get the item type
     */
    public String getType() {
        return this.type;
    }
    
    /**
     * Set the item type
     */
    public void setType(String type) {
        this.type = type;
    }
    
    /**
     * Get the item state
     */
    public char getState() {
        return this.state;
    }
    
    /**
     * Set the item state
     */
    public void setState(char state) {
        this.state = state;
    }
    
    /**
     * Get the item parent
     */
    public String getParent() {
        return this.parent;
    }
    
    /**
     * Set the item parent
     */
    public void setParent(String parent) {
        this.parent = parent;
    }

    /**
     * Get the content of this item
     */
    public byte[] getContent() {
        return this.content;
    }
    
    /**
     * Set the content of this item
     */
    public void setContent(byte[] content) {
        this.content = content;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -