Home | History | Annotate | Download | only in bookmark
      1 /**
      2  * $Revision$
      3  * $Date$
      4  *
      5  * Copyright 2003-2007 Jive Software.
      6  *
      7  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
      8  * you may not use this file except in compliance with the License.
      9  * You may obtain a copy of the License at
     10  *
     11  *     http://www.apache.org/licenses/LICENSE-2.0
     12  *
     13  * Unless required by applicable law or agreed to in writing, software
     14  * distributed under the License is distributed on an "AS IS" BASIS,
     15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16  * See the License for the specific language governing permissions and
     17  * limitations under the License.
     18  */
     19 
     20 package org.jivesoftware.smackx.bookmark;
     21 
     22 /**
     23  * Respresents a Conference Room bookmarked on the server using JEP-0048 Bookmark Storage JEP.
     24  *
     25  * @author Derek DeMoro
     26  */
     27 public class BookmarkedConference implements SharedBookmark {
     28 
     29     private String name;
     30     private boolean autoJoin;
     31     private final String jid;
     32 
     33     private String nickname;
     34     private String password;
     35     private boolean isShared;
     36 
     37     protected BookmarkedConference(String jid) {
     38         this.jid = jid;
     39     }
     40 
     41     protected BookmarkedConference(String name, String jid, boolean autoJoin, String nickname,
     42             String password)
     43     {
     44         this.name = name;
     45         this.jid = jid;
     46         this.autoJoin = autoJoin;
     47         this.nickname = nickname;
     48         this.password = password;
     49     }
     50 
     51 
     52     /**
     53      * Returns the display label representing the Conference room.
     54      *
     55      * @return the name of the conference room.
     56      */
     57     public String getName() {
     58         return name;
     59     }
     60 
     61     protected void setName(String name) {
     62         this.name = name;
     63     }
     64 
     65     /**
     66      * Returns true if this conference room should be auto-joined on startup.
     67      *
     68      * @return true if room should be joined on startup, otherwise false.
     69      */
     70     public boolean isAutoJoin() {
     71         return autoJoin;
     72     }
     73 
     74     protected void setAutoJoin(boolean autoJoin) {
     75         this.autoJoin = autoJoin;
     76     }
     77 
     78     /**
     79      * Returns the full JID of this conference room. (ex.dev (at) conference.jivesoftware.com)
     80      *
     81      * @return the full JID of  this conference room.
     82      */
     83     public String getJid() {
     84         return jid;
     85     }
     86 
     87     /**
     88      * Returns the nickname to use when joining this conference room. This is an optional
     89      * value and may return null.
     90      *
     91      * @return the nickname to use when joining, null may be returned.
     92      */
     93     public String getNickname() {
     94         return nickname;
     95     }
     96 
     97     protected void setNickname(String nickname) {
     98         this.nickname = nickname;
     99     }
    100 
    101     /**
    102      * Returns the password to use when joining this conference room. This is an optional
    103      * value and may return null.
    104      *
    105      * @return the password to use when joining this conference room, null may be returned.
    106      */
    107     public String getPassword() {
    108         return password;
    109     }
    110 
    111     protected void setPassword(String password) {
    112         this.password = password;
    113     }
    114 
    115     public boolean equals(Object obj) {
    116         if(obj == null || !(obj instanceof BookmarkedConference)) {
    117             return false;
    118         }
    119         BookmarkedConference conference = (BookmarkedConference)obj;
    120         return conference.getJid().equalsIgnoreCase(jid);
    121     }
    122 
    123     protected void setShared(boolean isShared) {
    124         this.isShared = isShared;
    125     }
    126 
    127     public boolean isShared() {
    128         return isShared;
    129     }
    130 }
    131