Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.Serial;
29
30
import javax.print.attribute.Attribute;
31
import javax.print.attribute.EnumSyntax;
32
import javax.print.attribute.PrintJobAttribute;
33
34
/**
35
* {@code JobState} is a printing attribute class, an enumeration, that
36
* identifies the current state of a print job. Class {@code JobState} defines
37
* standard job state values. A Print Service implementation only needs to
38
* report those job states which are appropriate for the particular
39
* implementation; it does not have to report every defined job state. The
40
* {@link JobStateReasons JobStateReasons} attribute augments the
41
* {@code JobState} attribute to give more detailed information about the job in
42
* the given job state.
43
* <p>
44
* <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
45
* the IPP attribute name. The enumeration's integer value is the IPP enum
46
* value. The {@code toString()} method returns the IPP string representation of
47
* the attribute value.
48
*
49
* @author Alan Kaminsky
50
*/
51
public class JobState extends EnumSyntax implements PrintJobAttribute {
52
53
/**
54
* Use serialVersionUID from JDK 1.4 for interoperability.
55
*/
56
@Serial
57
private static final long serialVersionUID = 400465010094018920L;
58
59
/**
60
* The job state is unknown.
61
*/
62
public static final JobState UNKNOWN = new JobState(0);
63
64
/**
65
* The job is a candidate to start processing, but is not yet processing.
66
*/
67
public static final JobState PENDING = new JobState(3);
68
69
/**
70
* The job is not a candidate for processing for any number of reasons but
71
* will return to the {@code PENDING} state as soon as the reasons are no
72
* longer present. The job's {@link JobStateReasons JobStateReasons}
73
* attribute must indicate why the job is no longer a candidate for
74
* processing.
75
*/
76
public static final JobState PENDING_HELD = new JobState(4);
77
78
/**
79
* The job is processing. One or more of the following activities is
80
* occurring:
81
* <ol type=1>
82
* <li>The job is using, or is attempting to use, one or more purely
83
* software processes that are analyzing, creating, or interpreting a PDL,
84
* etc.
85
* <li>The job is using, or is attempting to use, one or more hardware
86
* devices that are interpreting a PDL, making marks on a medium, and/or
87
* performing finishing, such as stapling, etc.
88
* <li>The printer has made the job ready for printing, but the output
89
* device is not yet printing it, either because the job hasn't reached
90
* the output device or because the job is queued in the output device or
91
* some other spooler, awaiting the output device to print it.
92
* </ol>
93
* When the job is in the {@code PROCESSING} state, the entire job state
94
* includes the detailed status represented in the printer's
95
* {@link PrinterState PrinterState} and
96
* {@link PrinterStateReasons PrinterStateReasons} attributes.
97
* <p>
98
* Implementations may, though they need not, include additional values in
99
* the job's {@link JobStateReasons JobStateReasons} attribute to indicate
100
* the progress of the job, such as adding the {@code JOB_PRINTING} value to
101
* indicate when the output device is actually making marks on paper and/or
102
* the {@code PROCESSING_TO_STOP_POINT} value to indicate that the printer
103
* is in the process of canceling or aborting the job.
104
*/
105
public static final JobState PROCESSING = new JobState (5);
106
107
/**
108
* The job has stopped while processing for any number of reasons and will
109
* return to the {@code PROCESSING} state as soon as the reasons are no
110
* longer present.
111
* <p>
112
* The job's {@link JobStateReasons JobStateReasons} attribute may indicate
113
* why the job has stopped processing. For example, if the output device is
114
* stopped, the {@code PRINTER_STOPPED} value may be included in the job's
115
* {@link JobStateReasons JobStateReasons} attribute.
116
* <p>
117
* <i>Note:</i> When an output device is stopped, the device usually
118
* indicates its condition in human readable form locally at the device. A
119
* client can obtain more complete device status remotely by querying the
120
* printer's {@link PrinterState PrinterState} and
121
* {@link PrinterStateReasons PrinterStateReasons} attributes.
122
*/
123
public static final JobState PROCESSING_STOPPED = new JobState (6);
124
125
/**
126
* The job has been canceled by some human agency, the printer has completed
127
* canceling the job, and all job status attributes have reached their final
128
* values for the job. While the printer is canceling the job, the job
129
* remains in its current state, but the job's {@link JobStateReasons
130
* JobStateReasons} attribute should contain the
131
* {@code PROCESSING_TO_STOP_POINT} value and one of the
132
* {@code CANCELED_BY_USER}, {@code CANCELED_BY_OPERATOR}, or
133
* {@code CANCELED_AT_DEVICE} values. When the job moves to the
134
* {@code CANCELED} state, the {@code PROCESSING_TO_STOP_POINT} value, if
135
* present, must be removed, but the CANCELED_BY_<i>xxx</i> value, if
136
* present, must remain.
137
*/
138
public static final JobState CANCELED = new JobState (7);
139
140
/**
141
* The job has been aborted by the system (usually while the job was in the
142
* {@code PROCESSING} or {@code PROCESSING_STOPPED} state), the printer has
143
* completed aborting the job, and all job status attributes have reached
144
* their final values for the job. While the printer is aborting the job,
145
* the job remains in its current state, but the job's
146
* {@link JobStateReasons JobStateReasons} attribute should contain the
147
* {@code PROCESSING_TO_STOP_POINT} and {@code ABORTED_BY_SYSTEM} values.
148
* When the job moves to the {@code ABORTED} state, the
149
* {@code PROCESSING_TO_STOP_POINT} value, if present, must be removed, but
150
* the {@code ABORTED_BY_SYSTEM} value, if present, must remain.
151
*/
152
public static final JobState ABORTED = new JobState (8);
153
154
/**
155
* The job has completed successfully or with warnings or errors after
156
* processing, all of the job media sheets have been successfully stacked in
157
* the appropriate output bin(s), and all job status attributes have reached
158
* their final values for the job. The job's
159
* {@link JobStateReasons JobStateReasons} attribute should contain one of
160
* these values: {@code COMPLETED_SUCCESSFULLY},
161
* {@code COMPLETED_WITH_WARNINGS}, or {@code COMPLETED_WITH_ERRORS}.
162
*/
163
public static final JobState COMPLETED = new JobState (9);
164
165
// Hidden constructors.
166
167
/**
168
* Construct a new job state enumeration value with the given integer value.
169
*
170
* @param value Integer value
171
*/
172
protected JobState(int value) {
173
super (value);
174
}
175
176
/**
177
* The string table for class {@code JobState}.
178
*/
179
private static final String[] myStringTable =
180
{"unknown",
181
null,
182
null,
183
"pending",
184
"pending-held",
185
"processing",
186
"processing-stopped",
187
"canceled",
188
"aborted",
189
"completed"};
190
191
/**
192
* The enumeration value table for class {@code JobState}.
193
*/
194
private static final JobState[] myEnumValueTable =
195
{UNKNOWN,
196
null,
197
null,
198
PENDING,
199
PENDING_HELD,
200
PROCESSING,
201
PROCESSING_STOPPED,
202
CANCELED,
203
ABORTED,
204
COMPLETED};
205
206
/**
207
* Returns the string table for class {@code JobState}.
208
*/
209
protected String[] getStringTable() {
210
return myStringTable;
211
}
212
213
/**
214
* Returns the enumeration value table for class {@code JobState}.
215
*/
216
protected EnumSyntax[] getEnumValueTable() {
217
return myEnumValueTable;
218
}
219
220
/**
221
* Get the printing attribute class which is to be used as the "category"
222
* for this printing attribute value.
223
* <p>
224
* For class {@code JobState} and any vendor-defined subclasses, the
225
* category is class {@code JobState} itself.
226
*
227
* @return printing attribute class (category), an instance of class
228
* {@link Class java.lang.Class}
229
*/
230
public final Class<? extends Attribute> getCategory() {
231
return JobState.class;
232
}
233
234
/**
235
* Get the name of the category of which this attribute value is an
236
* instance.
237
* <p>
238
* For class {@code JobState} and any vendor-defined subclasses, the
239
* category name is {@code "job-state"}.
240
*
241
* @return attribute category name
242
*/
243
public final String getName() {
244
return "job-state";
245
}
246
}
247
248