KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > filter > FilterAction


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.core.filter;
17
18 import org.columba.core.config.DefaultItem;
19 import org.columba.core.xml.XmlElement;
20
21 /**
22  *
23  * @author frd
24  *
25  * wrapper class for filter actions
26  *
27  */

28
29 // example configuration (tree.xml)
30
//
31
// <actionlist>
32
// <action uid="122" type="Move Message"></action>
33
// </actionlist>
34
public class FilterAction extends DefaultItem implements IFilterAction {
35     /**
36      * Constructor for FilterAction
37      *
38      * XmlElement root is "actionlist"
39      *
40      * @see org.columba.core.config.DefaultItem#DefaultItem(XmlElement)
41      */

42     public FilterAction(XmlElement root) {
43         super(root);
44     }
45
46     /* (non-Javadoc)
47    * @see org.columba.core.filter.IFilterAction#getUid()
48    */

49     public String JavaDoc getUid() {
50         if (contains("uid") == false) {
51             // folder uid doesn't exist
52
// -> create default value
53
setString("uid", "101");
54
55             return get("uid");
56         } else {
57             return get("uid");
58         }
59     }
60
61     /* (non-Javadoc)
62    * @see org.columba.core.filter.IFilterAction#setUid(java.lang.String)
63    */

64     public void setUid(String JavaDoc id) {
65         setString("uid", id);
66     }
67
68     /* (non-Javadoc)
69    * @see org.columba.core.filter.IFilterAction#getAction()
70    */

71     public String JavaDoc getAction() {
72         return get("type");
73     }
74
75     /* (non-Javadoc)
76    * @see org.columba.core.filter.IFilterAction#setAction(java.lang.String)
77    */

78     public void setAction(String JavaDoc s) {
79         setString("type", s);
80     }
81
82 }
Popular Tags