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

📄 account.java

📁 moblie syncml mail javame
💻 JAVA
字号:
/*
 * Funambol is a mobile platform developed by Funambol, Inc. 
 * Copyright (C) 2003 - 2007 Funambol, Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by
 * the Free Software Foundation with the addition of the following permission 
 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
 * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
 * 
 * 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 Affero General Public License 
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 * 
 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Powered by Funambol" logo. If the display of the logo is not reasonably 
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by Funambol".
 */

package com.funambol.mailclient;

/**
 * This class is a container for the information related to a
 * mail account.<p>
 */
public class Account {
    
    //---------------------------------------------------------------- Constants

    public static String DEFAULT_URL = "http://my.funambol.com/sync";

    //------------------------------------------------------------- Private Data

    /**
     * Address of the mail server, specified as a URL.
     */
    private String url;

    /** Username on the server */
    private String user;

    /** Password to use */
    private String password;

    /** Visible Name for this Account */
    private String name;

    /** Email address for this Account */
    private String address;

    /**
     * Remote URI: it depends on the underlying transport.
     * Can be the source URI for syncml, the personal namespace for IMAP, etc.
     */
    private String remoteURI;
    
    /** Remote URI for PIM*/
    private String pimRemoteURI;

    //------------------------------------------------------------- Constructors

    /**
     * Creates a new instance of Account, with default values.<p>
     */
    public Account() {
        url = DEFAULT_URL;
        user = "";
        password = "";
        name = "";
        address = "";
        remoteURI = "mail";
        pimRemoteURI = "card";
    }
    
    //----------------------------------------------------------- Public Methods
    
    /** Returns the server url. */
    public String getUrl() {
        return this.url;
    }
    
    /** Returns the username for this Account */
    public String getUser() {
        return this.user;
    }
    
    /** Returns the password for this Account */
    public String getPassword() {
        return this.password;
    }

    /** Returns the visible name for this Account */
    public String getName() {
        return this.name;
    }

    /** Returns the email address name for this Account */
    public String getAddress() {
        return this.address;
    }
    
    /** Returns the remote URI for this Account */
    public String getRemoteURI() {
        return this.remoteURI;
    }
    /**
     * Address of the mail server, specified as a URL
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /** Sets the username for this Account */
    public void setUser(String user) {
        this.user = user;
    }
    
    /** Sets the password for this Account */
    public void setPassword(String password) {
        this.password = password;
    }

    /** Sets the visible name for this Account */
    public void setName(String name) {
        this.name = name;
    }
    
    /** Sets the email address name for this Account */
    public void setAddress(String addr) {
        this.address = addr;
    }

    /** Sets the the remote URI for this Account */
    public void setRemoteURI(String uri) {
        this.remoteURI = uri;
    }
    
    /** Gets the the remote PIM URI for this Account */
    public String getPimRemoteURI() {
        return this.pimRemoteURI;
    }

    /** Sets the the remote PIM URI for this Account */
    public void setPimRemoteURI(String pimRemoteURI) {
        this.pimRemoteURI = pimRemoteURI;
    }
 
    /**
     * Returns true if the account has been set.
     * The account is considered set if the url is different from DEFAULT_URL
     * and if the username and password are not empty.
     */
    public boolean isSet() {
        if ("".equals(user) || "".equals(password)) {
            return false;
        } else {
            return true;
        }
    }

    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("User: ").append(user)
          .append("\nUrl: ").append(url)
          .append("\nAddress: ").append(address)
          //.append("Password: ").append(password)
          .append("\nName: ").append(name)
          .append("\nRemote URI: ").append(remoteURI)
          .append("\nPIM Remote URI: ").append(pimRemoteURI);

        return sb.toString();
    }
}

⌨️ 快捷键说明

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