View Javadoc
1   package org.fax4j;
2   
3   import org.fax4j.common.Logger;
4   
5   /**
6    * This class holds the fax client action event data.
7    *
8    * @author Sagie Gur-Ari
9    * @version 1.09
10   * @since 0.20b
11   */
12  public final class FaxClientActionEvent extends AbstractFaxEvent {
13      /** The event ID */
14      private final FaxClientActionEventID ID;
15      /** Default serialization UID */
16      private static final long serialVersionUID = 1L;
17  
18      /**
19       * This is the fax client action event ID enum.<br>
20       * This enum holds all the possible event ID.
21       *
22       * @author Sagie Gur-Ari
23       * @version 1.01
24       * @since 0.20b
25       */
26      public enum FaxClientActionEventID {
27          /** The create fax job event ID */
28          CREATE_FAX_JOB,
29          /** The submit fax job event ID */
30          SUBMIT_FAX_JOB,
31          /** The suspend fax job event ID */
32          SUSPEND_FAX_JOB,
33          /** The resume fax job event ID */
34          RESUME_FAX_JOB,
35          /** The cancel fax job event ID */
36          CANCEL_FAX_JOB
37      }
38  
39      /**
40       * This is the class constructor.
41       *
42       * @param id
43       *            The event ID
44       * @param faxJob
45       *            The fax job
46       */
47      public FaxClientActionEvent(FaxClientActionEventID id, FaxJob faxJob) {
48          super(faxJob);
49  
50          // validate values
51          if (id == null) {
52              throw new FaxException("Fax client action event ID not provided.");
53          }
54  
55          // get values
56          this.ID = id;
57      }
58  
59      /**
60       * This function returns the fax client action event ID.
61       *
62       * @return The fax client action event ID
63       */
64      public FaxClientActionEventID getID() {
65          return this.ID;
66      }
67  
68      /**
69       * Returns a String representation of this fax client action event object.
70       *
71       * @return A string representation of this fax client action event object.
72       */
73      @Override
74      public String toString() {
75          // init buffer
76          StringBuilder buffer = new StringBuilder(500);
77          buffer.append("Fax Client Action Event:");
78  
79          // append values
80          buffer.append(Logger.SYSTEM_EOL);
81          buffer.append("ID: ");
82          buffer.append(this.getID());
83          buffer.append(Logger.SYSTEM_EOL);
84          buffer.append(this.getFaxJob());
85  
86          // get text
87          String text = buffer.toString();
88  
89          return text;
90      }
91  }