KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > ui > web > admin > services > servicetypes > MailActionType


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13 package org.ejbca.ui.web.admin.services.servicetypes;
14
15 import java.io.IOException JavaDoc;
16 import java.util.ArrayList JavaDoc;
17 import java.util.Properties JavaDoc;
18
19 import org.ejbca.core.model.services.actions.MailAction;
20
21 /**
22  * Action type describing the mail notification action
23  *
24  * @author Philip Vendil
25  *
26  * $id$
27  */

28 public class MailActionType extends ActionType {
29     
30     public static final String JavaDoc NAME = "MAILNOTIFICATIONACTION";
31
32     public MailActionType(){
33         super("mailaction.jsp", NAME, true);
34     }
35     
36     private String JavaDoc senderAddress = "";
37     private String JavaDoc recieverAddress = "";
38     
39     public String JavaDoc getRecieverAddress() {
40         return recieverAddress;
41     }
42
43
44     public void setRecieverAddress(String JavaDoc recieverAddress) {
45         this.recieverAddress = recieverAddress;
46     }
47
48
49     public String JavaDoc getSenderAddress() {
50         return senderAddress;
51     }
52
53
54     public void setSenderAddress(String JavaDoc senderAddress) {
55         this.senderAddress = senderAddress;
56     }
57
58
59
60     
61     
62     /**
63      * @see org.ejbca.ui.web.admin.services.servicetypes.ServiceType#getClassPath()
64      */

65     public String JavaDoc getClassPath() {
66         return "org.ejbca.core.model.services.actions.MailAction";
67     }
68
69     /**
70      * @see org.ejbca.ui.web.admin.services.servicetypes.ServiceType#getProperties()
71      */

72     public Properties JavaDoc getProperties(ArrayList JavaDoc errorMessages) throws IOException JavaDoc {
73         Properties JavaDoc properties = new Properties JavaDoc();
74         if(senderAddress == null || senderAddress.trim().equals("")){
75             errorMessages.add("MAILACTIONSENDERADDRESSERR");
76         }
77         properties.setProperty(MailAction.PROP_SENDERADDRESS, senderAddress);
78         properties.setProperty(MailAction.PROP_RECIEVERADDRESS, recieverAddress);
79         
80         return properties;
81     }
82
83     /**
84      * @see org.ejbca.ui.web.admin.services.servicetypes.ServiceType#isCustom()
85      */

86     public boolean isCustom() {
87         return false;
88     }
89
90     /**
91      * @see org.ejbca.ui.web.admin.services.servicetypes.ServiceType#setProperties(java.util.Properties)
92      */

93     public void setProperties(Properties JavaDoc properties) throws IOException JavaDoc {
94        senderAddress = properties.getProperty(MailAction.PROP_SENDERADDRESS, "");
95        recieverAddress = properties.getProperty(MailAction.PROP_RECIEVERADDRESS, "");
96
97     }
98
99 }
100
Popular Tags