1 package com
.easysw
.cups
;
4 * @version 1.00 06-NOV-2002
5 * @author Easy Software Products
7 * Internet Printing Protocol definitions for the Common UNIX Printing
10 * Copyright 1997-2002 by Easy Software Products.
12 * These coded instructions, statements, and computer programs are the
13 * property of Easy Software Products and are protected by Federal
14 * copyright law. Distribution and use rights are outlined in the file
15 * "LICENSE.txt" which should have been included with this file. If this
16 * file is missing or damaged please contact Easy Software Products
19 * Attn: CUPS Licensing Information
20 * Easy Software Products
21 * 44141 Airport View Drive, Suite 204
22 * Hollywood, Maryland 20636-3111 USA
24 * Voice: (301) 373-9603
25 * EMail: cups-info@cups.org
26 * WWW: http://www.cups.org
31 * A <code>CupsJob</code> object holds job data, and has methods to
32 * process cups job list responses into a usable form.
46 public String job_more_info
;
47 public String job_uri
;
48 public String job_printer_uri
;
49 public long job_printer_up_time
;
50 public String job_name
;
51 public String job_originating_user_name
;
52 public String document_format
;
53 public String job_originating_host_name
;
54 public int job_priority
;
56 public int job_media_sheets_completed
;
57 public int job_k_octets
;
58 public long time_at_creation
;
59 public long time_at_processing
;
60 public long time_at_completed
;
61 public String job_hold_until
;
62 public String job_sheets
;
63 public String job_state_reasons
;
67 * Constructor - set some default values.
75 job_printer_up_time
= 0;
77 job_originating_user_name
= "";
79 job_originating_host_name
= "";
82 job_media_sheets_completed
= 0;
85 time_at_processing
= 0;
86 time_at_completed
= 0;
89 job_state_reasons
= "";
96 * Process an attribute from a cups.doRequest() call
97 * and move the value into a local member.
99 * @see <code>IPPDefs</code>
100 * @see <code>IPPValues</code>
101 * @see <code>IPPAttributes</code>
103 public void updateAttribute( IPPAttribute a
)
108 // Kick out if no values are present.
110 if (a
.values
.size() < 1)
113 val
= (IPPValue
)a
.values
.get(0);
114 if (a
.name
.compareTo("job-more-info") == 0)
116 job_more_info
= val
.text
;
118 else if (a
.name
.compareTo("job-uri") == 0)
122 else if (a
.name
.compareTo("job-printer-up-time") == 0)
124 job_printer_up_time
= val
.integer_value
;
126 else if (a
.name
.compareTo("job-originating-user-name") == 0)
128 job_originating_user_name
= val
.text
;
130 else if (a
.name
.compareTo("document-format") == 0)
132 document_format
= val
.text
;
134 else if (a
.name
.compareTo("job-priority") == 0)
136 job_priority
= val
.integer_value
;
138 else if (a
.name
.compareTo("job-originating-host-name") == 0)
140 job_originating_host_name
= val
.text
;
142 else if (a
.name
.compareTo("job-id") == 0)
144 job_id
= val
.integer_value
;
146 else if (a
.name
.compareTo("job-state") == 0)
148 job_state
= val
.integer_value
;
150 else if (a
.name
.compareTo("job-media-sheets-completed") == 0)
152 job_media_sheets_completed
= val
.integer_value
;
154 else if (a
.name
.compareTo("job-printer-uri") == 0)
156 job_printer_uri
= val
.text
;
158 else if (a
.name
.compareTo("job-name") == 0)
162 else if (a
.name
.compareTo("job-k-octets") == 0)
164 job_k_octets
= val
.integer_value
;
166 else if (a
.name
.compareTo("time-at-creation") == 0)
168 time_at_creation
= val
.integer_value
;
170 else if (a
.name
.compareTo("time-at-processing") == 0)
172 time_at_processing
= val
.integer_value
;
174 else if (a
.name
.compareTo("time-at-completed") == 0)
176 time_at_completed
= val
.integer_value
;
178 else if (a
.name
.compareTo("job-hold-until") == 0)
180 job_hold_until
= val
.text
;
182 else if (a
.name
.compareTo("job-sheets") == 0)
184 job_sheets
= val
.text
;
186 else if (a
.name
.compareTo("job-state-reasons") == 0)
188 job_state_reasons
= val
.text
;
194 * Convert a job status to a string.
196 * @see <code>IPPDefs</code>
198 public String
jobStatusText()
202 case 3: return("Pending");
203 case 4: return("Held");
204 case 5: return("Processing");
205 case 6: return("Stopped");
206 case 7: return("Cancelled");
207 case 8: return("Aborted");
208 case 9: return("Completed");