home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPJob.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  7.8 KB  |  380 lines

  1. import java.io.ByteArrayOutputStream;
  2. import java.io.PrintStream;
  3. import java.util.Date;
  4. import java.util.Hashtable;
  5.  
  6. public class JDPJob {
  7.    JDPSubsystemMgr manager;
  8.    JDPActiveJob activeJob;
  9.    Hashtable info;
  10.    StringBuffer jobLog;
  11.    boolean jobChanged = false;
  12.    public static final int CREATED = 1;
  13.    public static final int QUEUED = 2;
  14.    public static final int QUEUEDHELD = 3;
  15.    public static final int ACTIVE = 4;
  16.    public static final int ACTIVEHELD = 5;
  17.    public static final int INCOMPLETE = 9;
  18.    public static final int COMPLETE = 10;
  19.  
  20.    public JDPJob(JDPSubsystemMgr var1, String var2) {
  21.       this.manager = var1;
  22.       this.info = new Hashtable();
  23.       this.jobLog = new StringBuffer();
  24.       this.setJobName(var2);
  25.       this.setSubsystem("");
  26.       this.setEventType("");
  27.       this.setJobStatus(1);
  28.       this.setJobPriority(5);
  29.       this.setJobQueuePriority(5);
  30.       this.setJobNumber(var1.getNextJobNumber());
  31.       this.setNotifyUser(-1);
  32.       this.setNotifyVia("");
  33.       this.setNotifyOn("");
  34.       this.setLogEvent("F");
  35.       this.setLogEventNow(false);
  36.       this.setNotifyNow(false);
  37.       this.setSkipJobLog(false);
  38.    }
  39.  
  40.    public JDPJob(JDPSubsystemMgr var1, String var2, int var3) {
  41.       this.manager = var1;
  42.       this.info = new Hashtable();
  43.       this.jobLog = new StringBuffer();
  44.       this.setJobName(var2);
  45.       this.setSubsystem("");
  46.       this.setEventType("");
  47.       this.setJobStatus(1);
  48.       this.setJobPriority(5);
  49.       this.setJobQueuePriority(5);
  50.       this.setJobNumber(var3);
  51.       this.setNotifyUser(-1);
  52.       this.setNotifyVia("");
  53.       this.setNotifyOn("");
  54.       this.setLogEvent("F");
  55.       this.setLogEventNow(false);
  56.       this.setNotifyNow(false);
  57.       this.setSkipJobLog(false);
  58.    }
  59.  
  60.    public JDPActiveJob getActiveJob() {
  61.       return this.activeJob;
  62.    }
  63.  
  64.    public void setActiveJob(JDPActiveJob var1) {
  65.       this.activeJob = var1;
  66.    }
  67.  
  68.    public void setInstance(Object var1) {
  69.       if (this.activeJob != null) {
  70.          this.activeJob.thisInstance = var1;
  71.       }
  72.  
  73.    }
  74.  
  75.    public Object getInstance() {
  76.       return this.activeJob != null ? this.activeJob.thisInstance : null;
  77.    }
  78.  
  79.    public String getJobName() {
  80.       return (String)this.info.get("JobName");
  81.    }
  82.  
  83.    public void setJobName(String var1) {
  84.       this.info.put("JobName", var1);
  85.    }
  86.  
  87.    public String getJDPSystem() {
  88.       return (String)this.info.get("JDPSystem");
  89.    }
  90.  
  91.    public void setJDPSystem(String var1) {
  92.       this.info.put("JDPSystem", var1);
  93.    }
  94.  
  95.    public int getJobNumber() {
  96.       return (Integer)this.info.get("JobNumber");
  97.    }
  98.  
  99.    void setJobNumber(int var1) {
  100.       this.info.put("JobNumber", new Integer(var1));
  101.    }
  102.  
  103.    public String getJobOwner() {
  104.       return (String)this.info.get("JobOwner");
  105.    }
  106.  
  107.    public void setJobOwner(String var1) {
  108.       this.info.put("JobOwner", var1);
  109.    }
  110.  
  111.    public String getJobQueue() {
  112.       return (String)this.info.get("JobQueue");
  113.    }
  114.  
  115.    public void setJobQueue(String var1) {
  116.       this.info.put("JobQueue", var1);
  117.       this.setJobChanged(true);
  118.    }
  119.  
  120.    public String getSubsystem() {
  121.       return (String)this.info.get("Subsystem");
  122.    }
  123.  
  124.    public void setSubsystem(String var1) {
  125.       this.info.put("Subsystem", var1);
  126.       this.setJobChanged(true);
  127.    }
  128.  
  129.    public String getJobLog() {
  130.       return this.jobLog.toString();
  131.    }
  132.  
  133.    public StringBuffer getJobLogBuffer() {
  134.       return this.jobLog;
  135.    }
  136.  
  137.    public void appendJobLog(String var1) {
  138.       if (var1 == null) {
  139.          var1 = "null";
  140.       }
  141.  
  142.       this.jobLog.append(var1);
  143.       if (!var1.endsWith("\r\n")) {
  144.          this.jobLog.append("\r\n");
  145.       }
  146.  
  147.       this.setJobChanged(true);
  148.    }
  149.  
  150.    public void logException(Exception var1) {
  151.       ByteArrayOutputStream var2 = new ByteArrayOutputStream();
  152.       PrintStream var3 = new PrintStream(var2);
  153.       ((Throwable)var1).printStackTrace(var3);
  154.       this.appendJobLog(var2.toString());
  155.    }
  156.  
  157.    public int getJobPriority() {
  158.       return (Integer)this.info.get("JobPriority");
  159.    }
  160.  
  161.    public void setJobPriority(int var1) {
  162.       this.info.put("JobPriority", new Integer(var1));
  163.       this.setJobChanged(true);
  164.    }
  165.  
  166.    public int getJobQueuePriority() {
  167.       return this.info.get("JobQueuePriority") == null ? 5 : (Integer)this.info.get("JobQueuePriority");
  168.    }
  169.  
  170.    public void setJobQueuePriority(int var1) {
  171.       this.info.put("JobQueuePriority", new Integer(var1));
  172.       this.setJobChanged(true);
  173.    }
  174.  
  175.    public String getEventType() {
  176.       return (String)this.info.get("EventType");
  177.    }
  178.  
  179.    public void setEventType(String var1) {
  180.       this.info.put("EventType", var1);
  181.    }
  182.  
  183.    public String getObjectType() {
  184.       return (String)this.info.get("ObjectType");
  185.    }
  186.  
  187.    public void setObjectType(String var1) {
  188.       this.info.put("ObjectType", var1);
  189.    }
  190.  
  191.    public String getObject() {
  192.       return (String)this.info.get("Object");
  193.    }
  194.  
  195.    public void setObject(String var1) {
  196.       this.info.put("Object", var1);
  197.    }
  198.  
  199.    public String getObjectParm() {
  200.       return (String)this.info.get("ObjectParm");
  201.    }
  202.  
  203.    public void setObjectParm(String var1) {
  204.       this.info.put("ObjectParm", var1);
  205.    }
  206.  
  207.    public String getObjectConstructor() {
  208.       return (String)this.info.get("ObjectConstructor");
  209.    }
  210.  
  211.    public void setObjectConstructor(String var1) {
  212.       this.info.put("ObjectConstructor", var1);
  213.    }
  214.  
  215.    public int getNotifyUser() {
  216.       return this.info.get("NotifyUser") == null ? -1 : (Integer)this.info.get("NotifyUser");
  217.    }
  218.  
  219.    public void setNotifyUser(int var1) {
  220.       this.info.put("NotifyUser", new Integer(var1));
  221.    }
  222.  
  223.    public String getNotifyVia() {
  224.       return (String)this.info.get("NotifyVia");
  225.    }
  226.  
  227.    public void setNotifyVia(String var1) {
  228.       this.info.put("NotifyVia", var1);
  229.    }
  230.  
  231.    public String getNotifyOn() {
  232.       return (String)this.info.get("NotifyOn");
  233.    }
  234.  
  235.    public void setNotifyOn(String var1) {
  236.       this.info.put("NotifyOn", var1);
  237.    }
  238.  
  239.    public boolean getNotifyNow() {
  240.       return (Boolean)this.info.get("NotifyNow");
  241.    }
  242.  
  243.    public void setNotifyNow(boolean var1) {
  244.       this.info.put("NotifyNow", new Boolean(var1));
  245.    }
  246.  
  247.    public String getLogEvent() {
  248.       return (String)this.info.get("LogEvent");
  249.    }
  250.  
  251.    public void setLogEvent(String var1) {
  252.       this.info.put("LogEvent", var1);
  253.    }
  254.  
  255.    public boolean getLogEventNow() {
  256.       return (Boolean)this.info.get("LogEventNow");
  257.    }
  258.  
  259.    public void setSkipJobLog(boolean var1) {
  260.       this.info.put("SkipJobLog", new Boolean(var1));
  261.    }
  262.  
  263.    public boolean getSkipJobLog() {
  264.       return (Boolean)this.info.get("SkipJobLog");
  265.    }
  266.  
  267.    public void setLogEventNow(boolean var1) {
  268.       this.info.put("LogEventNow", new Boolean(var1));
  269.    }
  270.  
  271.    public Date getQueuedDate() {
  272.       return (Date)this.info.get("QueuedDate");
  273.    }
  274.  
  275.    public void setQueuedDate(Date var1) {
  276.       this.info.put("QueuedDate", var1);
  277.    }
  278.  
  279.    public long getQueuedTime() {
  280.       return this.info.get("QueuedTime") == null ? 0L : (Long)this.info.get("QueuedTime");
  281.    }
  282.  
  283.    public void setQueuedTime(long var1) {
  284.       this.info.put("QueuedTime", new Long(var1));
  285.    }
  286.  
  287.    public Date getStartDate() {
  288.       return (Date)this.info.get("StartDate");
  289.    }
  290.  
  291.    public void setStartDate(Date var1) {
  292.       this.info.put("StartDate", var1);
  293.    }
  294.  
  295.    public long getStartTime() {
  296.       return this.info.get("StartTime") == null ? 0L : (Long)this.info.get("StartTime");
  297.    }
  298.  
  299.    public void setStartTime(long var1) {
  300.       this.info.put("StartTime", new Long(var1));
  301.    }
  302.  
  303.    public Date getEndDate() {
  304.       return (Date)this.info.get("EndDate");
  305.    }
  306.  
  307.    public void setEndDate(Date var1) {
  308.       this.info.put("EndDate", var1);
  309.    }
  310.  
  311.    public long getEndTime() {
  312.       return this.info.get("EndTime") == null ? 0L : (Long)this.info.get("EndTime");
  313.    }
  314.  
  315.    public void setEndTime(long var1) {
  316.       this.info.put("EndTime", new Long(var1));
  317.    }
  318.  
  319.    public boolean getJobChanged() {
  320.       return this.jobChanged;
  321.    }
  322.  
  323.    void setJobChanged(boolean var1) {
  324.       this.jobChanged = var1;
  325.       if (this.jobChanged) {
  326.          this.manager.requestUpdate();
  327.       }
  328.  
  329.    }
  330.  
  331.    public int getJobStatus() {
  332.       return this.info.get("JobStatus") == null ? 1 : (Integer)this.info.get("JobStatus");
  333.    }
  334.  
  335.    boolean setJobStatus(int var1) {
  336.       if (var1 >= 1 && var1 <= 10) {
  337.          if (var1 == 1) {
  338.             this.info.put("JobStatus", new Integer(var1));
  339.             this.setJobChanged(true);
  340.             return true;
  341.          } else {
  342.             int var2 = this.getJobStatus();
  343.             if (var2 != 1 || var1 != 2 && var1 != 3 && var1 != 9) {
  344.                if (var2 != 2 || var1 != 1 && var1 != 3 && var1 != 4 && var1 != 10 && var1 != 9) {
  345.                   if (var2 != 3 || var1 != 2 && var1 != 10 && var1 != 9) {
  346.                      if (var2 != 4 || var1 != 5 && var1 != 10 && var1 != 9) {
  347.                         if (var2 != 5 || var1 != 4 && var1 != 10) {
  348.                            return false;
  349.                         } else {
  350.                            this.info.put("JobStatus", new Integer(var1));
  351.                            this.setJobChanged(true);
  352.                            return true;
  353.                         }
  354.                      } else {
  355.                         this.info.put("JobStatus", new Integer(var1));
  356.                         this.setJobChanged(true);
  357.                         return true;
  358.                      }
  359.                   } else {
  360.                      this.info.put("JobStatus", new Integer(var1));
  361.                      this.setJobChanged(true);
  362.                      return true;
  363.                   }
  364.                } else {
  365.                   this.info.put("JobStatus", new Integer(var1));
  366.                   this.setJobChanged(true);
  367.                   return true;
  368.                }
  369.             } else {
  370.                this.info.put("JobStatus", new Integer(var1));
  371.                this.setJobChanged(true);
  372.                return true;
  373.             }
  374.          }
  375.       } else {
  376.          return false;
  377.       }
  378.    }
  379. }
  380.