Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.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;3132/**33* Class {@code JobStateReason} is a printing attribute class, an enumeration,34* that provides additional information about the job's current state, i.e.,35* information that augments the value of the job's {@link JobState JobState}36* attribute. Class {@code JobStateReason} defines standard job state reason37* values. A Print Service implementation only needs to report those job state38* reasons which are appropriate for the particular implementation; it does not39* have to report every defined job state reason.40* <p>41* Instances of {@code JobStateReason} do not appear in a Print Job's attribute42* set directly. Rather, a {@link JobStateReasons JobStateReasons} attribute43* appears in the Print Job's attribute set. The44* {@link JobStateReasons JobStateReasons} attribute contains zero, one, or more45* than one {@code JobStateReason} objects which pertain to the Print Job's46* status. The printer adds a JobStateReason object to the Print Job's47* {@link JobStateReasons JobStateReasons} attribute when the corresponding48* condition becomes true of the Print Job, and the printer removes the49* {@code JobStateReason} object again when the corresponding condition becomes50* false, regardless of whether the Print Job's overall51* {@link JobState JobState} also changed.52* <p>53* <b>IPP Compatibility:</b> The category name returned by {@code getName()} is54* the IPP attribute name. The enumeration's integer value is the IPP enum55* value. The {@code toString()} method returns the IPP string representation of56* the attribute value.57*58* @author Alan Kaminsky59*/60public class JobStateReason extends EnumSyntax implements Attribute {6162/**63* Use serialVersionUID from JDK 1.4 for interoperability.64*/65@Serial66private static final long serialVersionUID = -8765894420449009168L;6768/**69* The printer has created the Print Job, but the printer has not finished70* accessing or accepting all the print data yet.71*/72public static final JobStateReason73JOB_INCOMING = new JobStateReason(0);7475/**76* The printer has created the Print Job, but the printer is expecting77* additional print data before it can move the job into the78* {@code PROCESSING} state. If a printer starts processing before it has79* received all data, the printer removes the {@code JOB_DATA_INSUFFICIENT}80* reason, but the {@code JOB_INCOMING} reason remains. If a printer starts81* processing after it has received all data, the printer removes the82* {@code JOB_DATA_INSUFFICIENT} and {@code JOB_INCOMING} reasons at the83* same time.84*/85public static final JobStateReason86JOB_DATA_INSUFFICIENT = new JobStateReason(1);8788/**89* The printer could not access one or more documents passed by reference90* (i.e., the print data representation object is a {@code URL}). This91* reason is intended to cover any file access problem,including file does92* not exist and access denied because of an access control problem. Whether93* the printer aborts the job and moves the job to the {@code ABORTED} job94* state or prints all documents that are accessible and moves the job to95* the {@code COMPLETED} job state and adds the96* {@code COMPLETED_WITH_ERRORS} reason to the job's97* {@link JobStateReasons JobStateReasons} attribute depends on98* implementation and/or site policy. This value should be supported if the99* printer supports doc flavors with {@code URL} print data representation100* objects.101*/102public static final JobStateReason103DOCUMENT_ACCESS_ERROR = new JobStateReason(2);104105/**106* The job was not completely submitted for some unforeseen reason.107* Possibilities include (1) the printer has crashed before the job was108* fully submitted by the client, (2) the printer or the document transfer109* method has crashed in some non-recoverable way before the document data110* was entirely transferred to the printer, (3) the client crashed before111* the job was fully submitted.112*/113public static final JobStateReason114SUBMISSION_INTERRUPTED = new JobStateReason(3);115116/**117* The printer is transmitting the job to the output device.118*/119public static final JobStateReason120JOB_OUTGOING = new JobStateReason(4);121122/**123* The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was124* specified with a date-time that is still in the future. The job must not125* be a candidate for processing until this reason is removed and there are126* no other reasons to hold the job. This value should be supported if the127* {@link JobHoldUntil JobHoldUntil} job template attribute is supported.128*/129public static final JobStateReason130JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5);131132/**133* At least one of the resources needed by the job, such as media, fonts,134* resource objects, etc., is not ready on any of the physical printers for135* which the job is a candidate. This condition may be detected when the job136* is accepted, or subsequently while the job is pending or processing,137* depending on implementation. The job may remain in its current state or138* be moved to the {@code PENDING_HELD} state, depending on implementation139* and/or job scheduling policy.140*/141public static final JobStateReason142RESOURCES_ARE_NOT_READY = new JobStateReason(6);143144/**145* The value of the printer's {@link PrinterStateReasons146* PrinterStateReasons} attribute contains a147* {@link PrinterStateReason PrinterStateReason} value of148* {@code STOPPED_PARTLY}.149*/150public static final JobStateReason151PRINTER_STOPPED_PARTLY = new JobStateReason(7);152153/**154* The value of the printer's {@link PrinterState PrinterState} attribute ia155* {@code STOPPED}.156*/157public static final JobStateReason158PRINTER_STOPPED = new JobStateReason(8);159160/**161* The job is in the {@code PROCESSING} state, but more specifically, the162* printer ia interpreting the document data.163*/164public static final JobStateReason165JOB_INTERPRETING = new JobStateReason(9);166167/**168* The job is in the {@code PROCESSING} state, but more specifically, the169* printer has queued the document data.170*/171public static final JobStateReason JOB_QUEUED = new JobStateReason(10);172173/**174* The job is in the {@code PROCESSING} state, but more specifically, the175* printer is interpreting document data and producing another electronic176* representation.177*/178public static final JobStateReason179JOB_TRANSFORMING = new JobStateReason(11);180181/**182* The job is in the {@code PENDING_HELD}, {@code PENDING}, or183* {@code PROCESSING} state, but more specifically, the printer has184* completed enough processing of the document to be able to start marking185* and the job is waiting for the marker. Systems that require human186* intervention to release jobs put the job into the {@code PENDING_HELD}187* job state. Systems that automatically select a job to use the marker put188* the job into the {@code PENDING} job state or keep the job in the189* {@code PROCESSING} job state while waiting for the marker, depending on190* implementation. All implementations put the job into (or back into) the191* {@code PROCESSING} state when marking does begin.192*/193public static final JobStateReason194JOB_QUEUED_FOR_MARKER = new JobStateReason(12);195196/**197* The output device is marking media. This value is useful for printers198* which spend a great deal of time processing (1) when no marking is199* happening and then want to show that marking is now happening or (2) when200* the job is in the process of being canceled or aborted while the job201* remains in the {@code PROCESSING} state, but the marking has not yet202* stopped so that impression or sheet counts are still increasing for the203* job.204*/205public static final JobStateReason206JOB_PRINTING = new JobStateReason(13);207208/**209* The job was canceled by the owner of the job, i.e., by a user whose210* authenticated identity is the same as the value of the originating user211* that created the Print Job, or by some other authorized end-user, such as212* a member of the job owner's security group. This value should be213* supported.214*/215public static final JobStateReason216JOB_CANCELED_BY_USER = new JobStateReason(14);217218/**219* The job was canceled by the operator, i.e., by a user who has been220* authenticated as having operator privileges (whether local or remote). If221* the security policy is to allow anyone to cancel anyone's job, then this222* value may be used when the job is canceled by someone other than the223* owner of the job. For such a security policy, in effect, everyone is an224* operator as far as canceling jobs is concerned. This value should be225* supported if the implementation permits canceling by someone other than226* the owner of the job.227*/228public static final JobStateReason229JOB_CANCELED_BY_OPERATOR = new JobStateReason(15);230231/**232* The job was canceled by an unidentified local user, i.e., a user at a233* console at the device. This value should be supported if the234* implementation supports canceling jobs at the console.235*/236public static final JobStateReason237JOB_CANCELED_AT_DEVICE = new JobStateReason(16);238239/**240* The job was aborted by the system. Either the job (1) is in the process241* of being aborted, (2) has been aborted by the system and placed in the242* {@code ABORTED} state, or (3) has been aborted by the system and placed243* in the {@code PENDING_HELD} state, so that a user or operator can244* manually try the job again. This value should be supported.245*/246public static final JobStateReason247ABORTED_BY_SYSTEM = new JobStateReason(17);248249/**250* The job was aborted by the system because the printer determined while251* attempting to decompress the document's data that the compression is252* actually not among those supported by the printer. This value must be253* supported, since {@link Compression Compression} is a required doc254* description attribute.255*/256public static final JobStateReason257UNSUPPORTED_COMPRESSION = new JobStateReason(18);258259/**260* The job was aborted by the system because the printer encountered an261* error in the document data while decompressing it. If the printer posts262* this reason, the document data has already passed any tests that would263* have led to the {@code UNSUPPORTED_COMPRESSION} job state reason.264*/265public static final JobStateReason266COMPRESSION_ERROR = new JobStateReason(19);267268/**269* The job was aborted by the system because the document data's document270* format (doc flavor) is not among those supported by the printer. If the271* client specifies a doc flavor with a MIME type of272* {@code "application/octet-stream"}, the printer may abort the job if the273* printer cannot determine the document data's actual format through274* auto-sensing (even if the printer supports the document format if275* specified explicitly). This value must be supported, since a doc flavor276* is required to be specified for each doc.277*/278public static final JobStateReason279UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20);280281/**282* The job was aborted by the system because the printer encountered an283* error in the document data while processing it. If the printer posts this284* reason, the document data has already passed any tests that would have285* led to the {@code UNSUPPORTED_DOCUMENT_FORMAT} job state reason.286*/287public static final JobStateReason288DOCUMENT_FORMAT_ERROR = new JobStateReason(21);289290/**291* The requester has canceled the job or the printer has aborted the job,292* but the printer is still performing some actions on the job until a293* specified stop point occurs or job termination/cleanup is completed.294* <p>295* If the implementation requires some measurable time to cancel the job in296* the {@code PROCESSING} or {@code PROCESSING_STOPPED} job states, the297* printer must use this reason to indicate that the printer is still298* performing some actions on the job while the job remains in the299* {@code PROCESSING} or {@code PROCESSING_STOPPED} state. After all the300* job's job description attributes have stopped incrementing, the printer301* moves the job from the PROCESSING state to the {@code CANCELED} or302* {@code ABORTED} job states.303*/304public static final JobStateReason305PROCESSING_TO_STOP_POINT = new JobStateReason(22);306307/**308* The printer is off-line and accepting no jobs. All {@code PENDING} jobs309* are put into the {@code PENDING_HELD} state. This situation could be true310* if the service's or document transform's input is impaired or broken.311*/312public static final JobStateReason313SERVICE_OFF_LINE = new JobStateReason(23);314315/**316* The job completed successfully. This value should be supported.317*/318public static final JobStateReason319JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24);320321/**322* The job completed with warnings. This value should be supported if the323* implementation detects warnings.324*/325public static final JobStateReason326JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25);327328/**329* The job completed with errors (and possibly warnings too). This value330* should be supported if the implementation detects errors.331*/332public static final JobStateReason333JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26);334335/**336* This job is retained and is currently able to be restarted. If337* {@code JOB_RESTARTABLE} is contained in the job's338* {@link JobStateReasons JobStateReasons} attribute, then the printer must339* accept a request to restart that job. This value should be supported if340* restarting jobs is supported. <i>[The capability for restarting jobs is341* not in the Java Print Service API at present.]</i>342*/343public static final JobStateReason344JOB_RESTARTABLE = new JobStateReason(27);345346/**347* The job has been forwarded to a device or print system that is unable to348* send back status. The printer sets the job's {@link JobState JobState}349* attribute to {@code COMPLETED} and adds the {@code QUEUED_IN_DEVICE}350* reason to the job's {@link JobStateReasons JobStateReasons} attribute to351* indicate that the printer has no additional information about the job and352* never will have any better information.353*/354public static final JobStateReason355QUEUED_IN_DEVICE = new JobStateReason(28);356357/**358* Construct a new job state reason enumeration value with the given integer359* value.360*361* @param value Integer value362*/363protected JobStateReason(int value) {364super (value);365}366367/**368* The string table for class {@code JobStateReason}.369*/370private static final String[] myStringTable = {371"job-incoming",372"job-data-insufficient",373"document-access-error",374"submission-interrupted",375"job-outgoing",376"job-hold-until-specified",377"resources-are-not-ready",378"printer-stopped-partly",379"printer-stopped",380"job-interpreting",381"job-queued",382"job-transforming",383"job-queued-for-marker",384"job-printing",385"job-canceled-by-user",386"job-canceled-by-operator",387"job-canceled-at-device",388"aborted-by-system",389"unsupported-compression",390"compression-error",391"unsupported-document-format",392"document-format-error",393"processing-to-stop-point",394"service-off-line",395"job-completed-successfully",396"job-completed-with-warnings",397"job-completed-with-errors",398"job-restartable",399"queued-in-device"};400401/**402* The enumeration value table for class {@code JobStateReason}.403*/404private static final JobStateReason[] myEnumValueTable = {405JOB_INCOMING,406JOB_DATA_INSUFFICIENT,407DOCUMENT_ACCESS_ERROR,408SUBMISSION_INTERRUPTED,409JOB_OUTGOING,410JOB_HOLD_UNTIL_SPECIFIED,411RESOURCES_ARE_NOT_READY,412PRINTER_STOPPED_PARTLY,413PRINTER_STOPPED,414JOB_INTERPRETING,415JOB_QUEUED,416JOB_TRANSFORMING,417JOB_QUEUED_FOR_MARKER,418JOB_PRINTING,419JOB_CANCELED_BY_USER,420JOB_CANCELED_BY_OPERATOR,421JOB_CANCELED_AT_DEVICE,422ABORTED_BY_SYSTEM,423UNSUPPORTED_COMPRESSION,424COMPRESSION_ERROR,425UNSUPPORTED_DOCUMENT_FORMAT,426DOCUMENT_FORMAT_ERROR,427PROCESSING_TO_STOP_POINT,428SERVICE_OFF_LINE,429JOB_COMPLETED_SUCCESSFULLY,430JOB_COMPLETED_WITH_WARNINGS,431JOB_COMPLETED_WITH_ERRORS,432JOB_RESTARTABLE,433QUEUED_IN_DEVICE};434435/**436* Returns the string table for class {@code JobStateReason}.437*/438protected String[] getStringTable() {439return myStringTable.clone();440}441442/**443* Returns the enumeration value table for class {@code JobStateReason}.444*/445protected EnumSyntax[] getEnumValueTable() {446return (EnumSyntax[])myEnumValueTable.clone();447}448449/**450* Get the printing attribute class which is to be used as the "category"451* for this printing attribute value.452* <p>453* For class {@code JobStateReason} and any vendor-defined subclasses, the454* category is class {@code JobStateReason} itself.455*456* @return printing attribute class (category), an instance of class457* {@link Class java.lang.Class}458*/459public final Class<? extends Attribute> getCategory() {460return JobStateReason.class;461}462463/**464* Get the name of the category of which this attribute value is an465* instance.466* <p>467* For class {@code JobStateReason} and any vendor-defined subclasses, the468* category name is {@code "job-state-reason"}.469*470* @return attribute category name471*/472public final String getName() {473return "job-state-reason";474}475}476477478