Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/JobState.java
38918 views
/*1* Copyright (c) 2000, 2004, 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 javax.print.attribute.Attribute;28import javax.print.attribute.EnumSyntax;29import javax.print.attribute.PrintJobAttribute;3031/**32* JobState is a printing attribute class, an enumeration, that identifies33* the current state of a print job. Class JobState defines standard job state34* values. A Print Service implementation only needs to report those job35* states which are appropriate for the particular implementation; it does not36* have to report every defined job state. The {@link JobStateReasons37* JobStateReasons} attribute augments the JobState attribute to give more38* detailed information about the job in the given job state.39* <P>40* <B>IPP Compatibility:</B> The category name returned by41* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's42* integer value is the IPP enum value. The <code>toString()</code> method43* returns the IPP string representation of the attribute value.44* <P>45*46* @author Alan Kaminsky47*/4849public class JobState extends EnumSyntax implements PrintJobAttribute {5051private static final long serialVersionUID = 400465010094018920L;5253/**54* The job state is unknown.55*/56public static final JobState UNKNOWN = new JobState(0);5758/**59* The job is a candidate to start processing, but is not yet processing.60*/61public static final JobState PENDING = new JobState(3);6263/**64* The job is not a candidate for processing for any number of reasons but65* will return to the PENDING state as soon as the reasons are no longer66* present. The job's {@link JobStateReasons JobStateReasons} attribute must67* indicate why the job is no longer a candidate for processing.68*/69public static final JobState PENDING_HELD = new JobState(4);7071/**72* The job is processing. One or more of the following activities is73* occurring:74* <OL TYPE=1>75* <LI>76* The job is using, or is attempting to use, one or more purely software77* processes that are analyzing, creating, or interpreting a PDL, etc.78* <P>79* <LI>80* The job is using, or is attempting to use, one or more hardware81* devices that are interpreting a PDL, making marks on a medium, and/or82* performing finishing, such as stapling, etc.83* <P>84* <LI>85* The printer has made the job ready for printing, but the output86* device is not yet printing it, either because the job hasn't reached the87* output device or because the job is queued in the output device or some88* other spooler, awaiting the output device to print it.89* </OL>90* <P>91* When the job is in the PROCESSING state, the entire job state includes92* the detailed status represented in the printer's {@link PrinterState93* PrinterState} and {@link PrinterStateReasons PrinterStateReasons}94* attributes.95* <P>96* Implementations may, though they need not, include additional values in97* the job's {@link JobStateReasons JobStateReasons} attribute to indicate98* the progress of the job, such as adding the JOB_PRINTING value to99* indicate when the output device is actually making marks on paper and/or100* the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the101* process of canceling or aborting the job.102*/103public static final JobState PROCESSING = new JobState (5);104105/**106* The job has stopped while processing for any number of reasons and will107* return to the PROCESSING state as soon as the reasons are no longer108* present.109* <P>110* The job's {@link JobStateReasons JobStateReasons} attribute may indicate111* why the job has stopped processing. For example, if the output device is112* stopped, the PRINTER_STOPPED value may be included in the job's {@link113* JobStateReasons JobStateReasons} attribute.114* <P>115* <I>Note:</I> When an output device is stopped, the device usually116* indicates its condition in human readable form locally at the device. A117* client can obtain more complete device status remotely by querying the118* printer's {@link PrinterState PrinterState} and {@link119* PrinterStateReasons PrinterStateReasons} attributes.120*/121public static final JobState PROCESSING_STOPPED = new JobState (6);122123/**124* The job has been canceled by some human agency, the printer has completed125* canceling the job, and all job status attributes have reached their final126* values for the job. While the printer is canceling the job, the job127* remains in its current state, but the job's {@link JobStateReasons128* JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT129* value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or130* CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the131* PROCESSING_TO_STOP_POINT value, if present, must be removed, but the132* CANCELED_BY_<I>xxx</I> value, if present, must remain.133*/134public static final JobState CANCELED = new JobState (7);135136/**137* The job has been aborted by the system (usually while the job was in the138* PROCESSING or PROCESSING_STOPPED state), the printer has completed139* aborting the job, and all job status attributes have reached their final140* values for the job. While the printer is aborting the job, the job141* remains in its current state, but the job's {@link JobStateReasons142* JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT143* and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state,144* the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the145* ABORTED_BY_SYSTEM value, if present, must remain.146*/147public static final JobState ABORTED = new JobState (8);148149/**150* The job has completed successfully or with warnings or errors after151* processing, all of the job media sheets have been successfully stacked in152* the appropriate output bin(s), and all job status attributes have reached153* their final values for the job. The job's {@link JobStateReasons154* JobStateReasons} attribute should contain one of these values:155* COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or156* COMPLETED_WITH_ERRORS.157*/158public static final JobState COMPLETED = new JobState (9);159160// Hidden constructors.161162/**163* Construct a new job state enumeration value with the given integer value.164*165* @param value Integer value.166*/167protected JobState(int value) {168super (value);169}170171private static final String[] myStringTable =172{"unknown",173null,174null,175"pending",176"pending-held",177"processing",178"processing-stopped",179"canceled",180"aborted",181"completed"};182183private static final JobState[] myEnumValueTable =184{UNKNOWN,185null,186null,187PENDING,188PENDING_HELD,189PROCESSING,190PROCESSING_STOPPED,191CANCELED,192ABORTED,193COMPLETED};194195/**196* Returns the string table for class JobState.197*/198protected String[] getStringTable() {199return myStringTable;200}201202/**203* Returns the enumeration value table for class JobState.204*/205protected EnumSyntax[] getEnumValueTable() {206return myEnumValueTable;207}208209/**210* Get the printing attribute class which is to be used as the "category"211* for this printing attribute value.212* <P>213* For class JobState and any vendor-defined subclasses, the category is214* class JobState itself.215*216* @return Printing attribute class (category), an instance of class217* {@link java.lang.Class java.lang.Class}.218*/219public final Class<? extends Attribute> getCategory() {220return JobState.class;221}222223/**224* Get the name of the category of which this attribute value is an225* instance.226* <P>227* For class JobState and any vendor-defined subclasses, the category228* name is <CODE>"job-state"</CODE>.229*230* @return Attribute category name.231*/232public final String getName() {233return "job-state";234}235236}237238239