View Javadoc

1   /*
2    * Copyright 2005-2010 The Kuali Foundation
3    * 
4    * 
5    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.kuali.rice.kew.mail.service.impl;
18  import java.util.List;
19  import javax.mail.Address;
20  import javax.mail.internet.AddressException;
21  import javax.mail.internet.InternetAddress;
22  
23  /**
24   * The cc addresses of an email message.
25   *
26   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
27   */
28  public class EmailCcList {
29  
30      private List<String> ccAddresses;
31      
32      public EmailCcList(List<String> ccAddresses) {
33          this.ccAddresses = ccAddresses;
34      }
35  
36      public List<String> getCcAddresses() {
37          return ccAddresses;
38      }
39  
40      public Address[] getToAddressesAsAddressArray() throws AddressException {
41  	Address[] recipientAddresses = new Address[this.ccAddresses.size()];
42  	for (int i = 0; i < recipientAddresses.length; i++) {
43  	    recipientAddresses[i] = new InternetAddress((String) this.ccAddresses.get(i));
44  	 }
45          return recipientAddresses;
46      }
47      
48      public void setCcAddress(List<String> ccAddresses) {
49          this.ccAddresses = ccAddresses;
50      }
51  
52  }