BookmarkedConference.java

  1. /**
  2.  *
  3.  * Copyright 2003-2007 Jive Software.
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.jivesoftware.smackx.bookmarks;

  18. /**
  19.  * Respresents a Conference Room bookmarked on the server using XEP-0048 Bookmark Storage XEP.
  20.  *
  21.  * @author Derek DeMoro
  22.  */
  23. public class BookmarkedConference implements SharedBookmark {

  24.     private String name;
  25.     private boolean autoJoin;
  26.     private final String jid;

  27.     private String nickname;
  28.     private String password;
  29.     private boolean isShared;

  30.     protected BookmarkedConference(String jid) {
  31.         this.jid = jid;
  32.     }

  33.     protected BookmarkedConference(String name, String jid, boolean autoJoin, String nickname,
  34.             String password)
  35.     {
  36.         this.name = name;
  37.         this.jid = jid;
  38.         this.autoJoin = autoJoin;
  39.         this.nickname = nickname;
  40.         this.password = password;
  41.     }


  42.     /**
  43.      * Returns the display label representing the Conference room.
  44.      *
  45.      * @return the name of the conference room.
  46.      */
  47.     public String getName() {
  48.         return name;
  49.     }

  50.     protected void setName(String name) {
  51.         this.name = name;
  52.     }

  53.     /**
  54.      * Returns true if this conference room should be auto-joined on startup.
  55.      *
  56.      * @return true if room should be joined on startup, otherwise false.
  57.      */
  58.     public boolean isAutoJoin() {
  59.         return autoJoin;
  60.     }

  61.     protected void setAutoJoin(boolean autoJoin) {
  62.         this.autoJoin = autoJoin;
  63.     }

  64.     /**
  65.      * Returns the full JID of this conference room. (ex.dev@conference.jivesoftware.com)
  66.      *
  67.      * @return the full JID of  this conference room.
  68.      */
  69.     public String getJid() {
  70.         return jid;
  71.     }

  72.     /**
  73.      * Returns the nickname to use when joining this conference room. This is an optional
  74.      * value and may return null.
  75.      *
  76.      * @return the nickname to use when joining, null may be returned.
  77.      */
  78.     public String getNickname() {
  79.         return nickname;
  80.     }

  81.     protected void setNickname(String nickname) {
  82.         this.nickname = nickname;
  83.     }

  84.     /**
  85.      * Returns the password to use when joining this conference room. This is an optional
  86.      * value and may return null.
  87.      *
  88.      * @return the password to use when joining this conference room, null may be returned.
  89.      */
  90.     public String getPassword() {
  91.         return password;
  92.     }

  93.     protected void setPassword(String password) {
  94.         this.password = password;
  95.     }

  96.     public boolean equals(Object obj) {
  97.         if(obj == null || !(obj instanceof BookmarkedConference)) {
  98.             return false;
  99.         }
  100.         BookmarkedConference conference = (BookmarkedConference)obj;
  101.         return conference.getJid().equalsIgnoreCase(jid);
  102.     }

  103.     protected void setShared(boolean isShared) {
  104.         this.isShared = isShared;
  105.     }

  106.     public boolean isShared() {
  107.         return isShared;
  108.     }
  109. }