Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java
41171 views
/*1* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.print.attribute.standard;2627import java.io.Serial;2829import javax.print.attribute.Attribute;30import javax.print.attribute.EnumSyntax;31import javax.print.attribute.PrintJobAttribute;3233/**34* {@code JobState} is a printing attribute class, an enumeration, that35* identifies the current state of a print job. Class {@code JobState} defines36* standard job state values. A Print Service implementation only needs to37* report those job states which are appropriate for the particular38* implementation; it does not have to report every defined job state. The39* {@link JobStateReasons JobStateReasons} attribute augments the40* {@code JobState} attribute to give more detailed information about the job in41* the given job state.42* <p>43* <b>IPP Compatibility:</b> The category name returned by {@code getName()} is44* the IPP attribute name. The enumeration's integer value is the IPP enum45* value. The {@code toString()} method returns the IPP string representation of46* the attribute value.47*48* @author Alan Kaminsky49*/50public class JobState extends EnumSyntax implements PrintJobAttribute {5152/**53* Use serialVersionUID from JDK 1.4 for interoperability.54*/55@Serial56private static final long serialVersionUID = 400465010094018920L;5758/**59* The job state is unknown.60*/61public static final JobState UNKNOWN = new JobState(0);6263/**64* The job is a candidate to start processing, but is not yet processing.65*/66public static final JobState PENDING = new JobState(3);6768/**69* The job is not a candidate for processing for any number of reasons but70* will return to the {@code PENDING} state as soon as the reasons are no71* longer present. The job's {@link JobStateReasons JobStateReasons}72* attribute must indicate why the job is no longer a candidate for73* processing.74*/75public static final JobState PENDING_HELD = new JobState(4);7677/**78* The job is processing. One or more of the following activities is79* occurring:80* <ol type=1>81* <li>The job is using, or is attempting to use, one or more purely82* software processes that are analyzing, creating, or interpreting a PDL,83* etc.84* <li>The job is using, or is attempting to use, one or more hardware85* devices that are interpreting a PDL, making marks on a medium, and/or86* performing finishing, such as stapling, etc.87* <li>The printer has made the job ready for printing, but the output88* device is not yet printing it, either because the job hasn't reached89* the output device or because the job is queued in the output device or90* some other spooler, awaiting the output device to print it.91* </ol>92* When the job is in the {@code PROCESSING} state, the entire job state93* includes the detailed status represented in the printer's94* {@link PrinterState PrinterState} and95* {@link PrinterStateReasons PrinterStateReasons} attributes.96* <p>97* Implementations may, though they need not, include additional values in98* the job's {@link JobStateReasons JobStateReasons} attribute to indicate99* the progress of the job, such as adding the {@code JOB_PRINTING} value to100* indicate when the output device is actually making marks on paper and/or101* the {@code PROCESSING_TO_STOP_POINT} value to indicate that the printer102* is in the process of canceling or aborting the job.103*/104public static final JobState PROCESSING = new JobState (5);105106/**107* The job has stopped while processing for any number of reasons and will108* return to the {@code PROCESSING} state as soon as the reasons are no109* longer present.110* <p>111* The job's {@link JobStateReasons JobStateReasons} attribute may indicate112* why the job has stopped processing. For example, if the output device is113* stopped, the {@code PRINTER_STOPPED} value may be included in the job's114* {@link JobStateReasons JobStateReasons} attribute.115* <p>116* <i>Note:</i> When an output device is stopped, the device usually117* indicates its condition in human readable form locally at the device. A118* client can obtain more complete device status remotely by querying the119* printer's {@link PrinterState PrinterState} and120* {@link PrinterStateReasons PrinterStateReasons} attributes.121*/122public static final JobState PROCESSING_STOPPED = new JobState (6);123124/**125* The job has been canceled by some human agency, the printer has completed126* canceling the job, and all job status attributes have reached their final127* values for the job. While the printer is canceling the job, the job128* remains in its current state, but the job's {@link JobStateReasons129* JobStateReasons} attribute should contain the130* {@code PROCESSING_TO_STOP_POINT} value and one of the131* {@code CANCELED_BY_USER}, {@code CANCELED_BY_OPERATOR}, or132* {@code CANCELED_AT_DEVICE} values. When the job moves to the133* {@code CANCELED} state, the {@code PROCESSING_TO_STOP_POINT} value, if134* present, must be removed, but the CANCELED_BY_<i>xxx</i> value, if135* present, must remain.136*/137public static final JobState CANCELED = new JobState (7);138139/**140* The job has been aborted by the system (usually while the job was in the141* {@code PROCESSING} or {@code PROCESSING_STOPPED} state), the printer has142* completed aborting the job, and all job status attributes have reached143* their final values for the job. While the printer is aborting the job,144* the job remains in its current state, but the job's145* {@link JobStateReasons JobStateReasons} attribute should contain the146* {@code PROCESSING_TO_STOP_POINT} and {@code ABORTED_BY_SYSTEM} values.147* When the job moves to the {@code ABORTED} state, the148* {@code PROCESSING_TO_STOP_POINT} value, if present, must be removed, but149* the {@code ABORTED_BY_SYSTEM} value, if present, must remain.150*/151public static final JobState ABORTED = new JobState (8);152153/**154* The job has completed successfully or with warnings or errors after155* processing, all of the job media sheets have been successfully stacked in156* the appropriate output bin(s), and all job status attributes have reached157* their final values for the job. The job's158* {@link JobStateReasons JobStateReasons} attribute should contain one of159* these values: {@code COMPLETED_SUCCESSFULLY},160* {@code COMPLETED_WITH_WARNINGS}, or {@code COMPLETED_WITH_ERRORS}.161*/162public static final JobState COMPLETED = new JobState (9);163164// Hidden constructors.165166/**167* Construct a new job state enumeration value with the given integer value.168*169* @param value Integer value170*/171protected JobState(int value) {172super (value);173}174175/**176* The string table for class {@code JobState}.177*/178private static final String[] myStringTable =179{"unknown",180null,181null,182"pending",183"pending-held",184"processing",185"processing-stopped",186"canceled",187"aborted",188"completed"};189190/**191* The enumeration value table for class {@code JobState}.192*/193private static final JobState[] myEnumValueTable =194{UNKNOWN,195null,196null,197PENDING,198PENDING_HELD,199PROCESSING,200PROCESSING_STOPPED,201CANCELED,202ABORTED,203COMPLETED};204205/**206* Returns the string table for class {@code JobState}.207*/208protected String[] getStringTable() {209return myStringTable;210}211212/**213* Returns the enumeration value table for class {@code JobState}.214*/215protected EnumSyntax[] getEnumValueTable() {216return myEnumValueTable;217}218219/**220* Get the printing attribute class which is to be used as the "category"221* for this printing attribute value.222* <p>223* For class {@code JobState} and any vendor-defined subclasses, the224* category is class {@code JobState} itself.225*226* @return printing attribute class (category), an instance of class227* {@link Class java.lang.Class}228*/229public final Class<? extends Attribute> getCategory() {230return JobState.class;231}232233/**234* Get the name of the category of which this attribute value is an235* instance.236* <p>237* For class {@code JobState} and any vendor-defined subclasses, the238* category name is {@code "job-state"}.239*240* @return attribute category name241*/242public final String getName() {243return "job-state";244}245}246247248