1 package com
.easysw
.cups
;
4 * @version 1.00 06-NOV-2002
7 * Internet Printing Protocol definitions for the Common UNIX Printing
10 * Copyright 2007 by Apple Inc.
11 * Copyright 1997-2002 by Easy Software Products.
13 * These coded instructions, statements, and computer programs are the
14 * property of Apple Inc. and are protected by Federal copyright
15 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
16 * which should have been included with this file. If this file is
17 * file is missing or damaged, see the license at "http://www.cups.org/".
22 * A <code>CupsJob</code> object holds job data, and has methods to
23 * process cups job list responses into a usable form.
37 public String job_more_info
;
38 public String job_uri
;
39 public String job_printer_uri
;
40 public long job_printer_up_time
;
41 public String job_name
;
42 public String job_originating_user_name
;
43 public String document_format
;
44 public String job_originating_host_name
;
45 public int job_priority
;
47 public int job_media_sheets_completed
;
48 public int job_k_octets
;
49 public long time_at_creation
;
50 public long time_at_processing
;
51 public long time_at_completed
;
52 public String job_hold_until
;
53 public String job_sheets
;
54 public String job_state_reasons
;
58 * Constructor - set some default values.
66 job_printer_up_time
= 0;
68 job_originating_user_name
= "";
70 job_originating_host_name
= "";
73 job_media_sheets_completed
= 0;
76 time_at_processing
= 0;
77 time_at_completed
= 0;
80 job_state_reasons
= "";
87 * Process an attribute from a cups.doRequest() call
88 * and move the value into a local member.
90 * @see <code>IPPDefs</code>
91 * @see <code>IPPValues</code>
92 * @see <code>IPPAttributes</code>
94 public void updateAttribute( IPPAttribute a
)
99 // Kick out if no values are present.
101 if (a
.values
.size() < 1)
104 val
= (IPPValue
)a
.values
.get(0);
105 if (a
.name
.compareTo("job-more-info") == 0)
107 job_more_info
= val
.text
;
109 else if (a
.name
.compareTo("job-uri") == 0)
113 else if (a
.name
.compareTo("job-printer-up-time") == 0)
115 job_printer_up_time
= val
.integer_value
;
117 else if (a
.name
.compareTo("job-originating-user-name") == 0)
119 job_originating_user_name
= val
.text
;
121 else if (a
.name
.compareTo("document-format") == 0)
123 document_format
= val
.text
;
125 else if (a
.name
.compareTo("job-priority") == 0)
127 job_priority
= val
.integer_value
;
129 else if (a
.name
.compareTo("job-originating-host-name") == 0)
131 job_originating_host_name
= val
.text
;
133 else if (a
.name
.compareTo("job-id") == 0)
135 job_id
= val
.integer_value
;
137 else if (a
.name
.compareTo("job-state") == 0)
139 job_state
= val
.integer_value
;
141 else if (a
.name
.compareTo("job-media-sheets-completed") == 0)
143 job_media_sheets_completed
= val
.integer_value
;
145 else if (a
.name
.compareTo("job-printer-uri") == 0)
147 job_printer_uri
= val
.text
;
149 else if (a
.name
.compareTo("job-name") == 0)
153 else if (a
.name
.compareTo("job-k-octets") == 0)
155 job_k_octets
= val
.integer_value
;
157 else if (a
.name
.compareTo("time-at-creation") == 0)
159 time_at_creation
= val
.integer_value
;
161 else if (a
.name
.compareTo("time-at-processing") == 0)
163 time_at_processing
= val
.integer_value
;
165 else if (a
.name
.compareTo("time-at-completed") == 0)
167 time_at_completed
= val
.integer_value
;
169 else if (a
.name
.compareTo("job-hold-until") == 0)
171 job_hold_until
= val
.text
;
173 else if (a
.name
.compareTo("job-sheets") == 0)
175 job_sheets
= val
.text
;
177 else if (a
.name
.compareTo("job-state-reasons") == 0)
179 job_state_reasons
= val
.text
;
185 * Convert a job status to a string.
187 * @see <code>IPPDefs</code>
189 public String
jobStatusText()
193 case 3: return("Pending");
194 case 4: return("Held");
195 case 5: return("Processing");
196 case 6: return("Stopped");
197 case 7: return("Cancelled");
198 case 8: return("Aborted");
199 case 9: return("Completed");