1 5 package org.exoplatform.services.communication.message; 6 7 import java.util.ArrayList ; 8 import java.util.List ; 9 16 public class AccountConfiguration { 17 private ArrayList accounts_ ; 18 private String userName_ ; 19 private String replyTo_ ; 20 21 public AccountConfiguration(String userName) { 22 userName_ = userName ; 23 accounts_ = new ArrayList () ; 24 } 25 26 public String getReplyTo() { return replyTo_ ; } 27 public void setReplyTo(String replyTo) {replyTo_ = replyTo ; } 28 29 public List getAccounts() { return accounts_ ; } 30 31 public Account getAccount(String name) { 32 for (int i = 0; i < accounts_.size() ; i++) { 33 Account account =(Account) accounts_.get(i) ; 34 if (name.equals(account.getAccountName())) return account ; 35 } 36 return null ; 37 } 38 39 public Account removeAccount(String name) { 40 for (int i = 0; i < accounts_.size() ; i++) { 41 Account account =(Account) accounts_.get(i) ; 42 if (name.equals(account.getAccountName())) { 43 accounts_.remove(i) ; 44 return account ; 45 } 46 } 47 return null ; 48 } 49 50 public void addAccount(Account account) { 51 accounts_.add(account) ; 52 } 53 54 public Account getDefaultAccount() { 55 if(accounts_.size() > 0) 56 return (Account) accounts_.get(0) ; 57 return null; 58 } 59 } | Popular Tags |