View Javadoc
1   /*
2    * This file is part of Waarp Project (named also Waarp or GG).
3    *
4    *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
5    *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    *
8    *  All Waarp Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   *
13   * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License along with
18   * Waarp . If not, see <http://www.gnu.org/licenses/>.
19   */
20  
21  package org.waarp.openr66.pojo;
22  
23  import javax.xml.bind.annotation.XmlAccessType;
24  import javax.xml.bind.annotation.XmlAccessorType;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlType;
27  
28  import static org.waarp.openr66.configuration.RuleFileBasedConfiguration.*;
29  import static org.waarp.openr66.database.data.DbRule.*;
30  
31  /**
32   * RuleTask data object
33   */
34  @XmlType(name = XTASK)
35  @XmlAccessorType(XmlAccessType.FIELD)
36  public class RuleTask {
37  
38    @XmlElement(name = TASK_TYPE)
39    private String type;
40  
41    @XmlElement(name = TASK_PATH)
42    private String path;
43  
44    @XmlElement(name = TASK_DELAY)
45    private int delay;
46  
47    public RuleTask() {
48      // Nothing
49    }
50  
51    public RuleTask(final String type, final String path, final int delay) {
52      this.type = type;
53      this.path = path;
54      this.delay = delay;
55    }
56  
57    public final String getXML() {
58      String res = "<task>";
59      res = res + "<type>" + type + "</type>";
60      res = res + "<path>" + path + "</path>";
61      res = res + "<delay>" + delay + "</delay>";
62      return res + "</task>";
63    }
64  
65    @Override
66    public final String toString() {
67      return getXML();
68    }
69  
70    public final String getType() {
71      return type;
72    }
73  
74    public final void setType(final String type) {
75      this.type = type;
76    }
77  
78    public final String getPath() {
79      return path;
80    }
81  
82    public final void setPath(final String path) {
83      this.path = path;
84    }
85  
86    public final int getDelay() {
87      return delay;
88    }
89  
90    public final void setDelay(final int delay) {
91      this.delay = delay;
92    }
93  }