1 /*
   2  * Copyright (c) 2000, 2017, 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 javax.print.attribute.Attribute;
  29 import javax.print.attribute.EnumSyntax;
  30 import javax.print.attribute.PrintServiceAttribute;
  31 
  32 /**
  33  * Class {@code PrinterIsAcceptingJobs} is a printing attribute class, an
  34  * enumeration, that indicates whether the printer is currently able to accept
  35  * jobs. This value is independent of the {@link PrinterState PrinterState} and
  36  * {@link PrinterStateReasons PrinterStateReasons} attributes because its value
  37  * does not affect the current job; rather it affects future jobs. If the value
  38  * is {@code NOT_ACCEPTING_JOBS}, the printer will reject jobs even when the
  39  * {@link PrinterState PrinterState} is {@code IDLE}. If value is
  40  * {@code ACCEPTING_JOBS}, the Printer will accept jobs even when the
  41  * {@link PrinterState PrinterState} is {@code STOPPED}.
  42  * <p>
  43  * <b>IPP Compatibility:</b> The IPP boolean value is "true" for
  44  * {@code ACCEPTING_JOBS} and "false" for {@code NOT_ACCEPTING_JOBS}. The
  45  * category name returned by {@code getName()} is the IPP attribute name. The
  46  * enumeration's integer value is the IPP enum value. The {@code toString()}
  47  * method returns the IPP string representation of the attribute value.
  48  *
  49  * @author Alan Kaminsky
  50  */
  51 public final class PrinterIsAcceptingJobs extends EnumSyntax
  52         implements PrintServiceAttribute {
  53 
  54     /**
  55      * Use serialVersionUID from JDK 1.4 for interoperability.
  56      */
  57     private static final long serialVersionUID = -5052010680537678061L;
  58 
  59     /**
  60      * The printer is currently rejecting any jobs sent to it.
  61      */
  62     public static final PrinterIsAcceptingJobs
  63         NOT_ACCEPTING_JOBS = new PrinterIsAcceptingJobs(0);
  64 
  65     /**
  66      * The printer is currently accepting jobs.
  67      */
  68     public static final PrinterIsAcceptingJobs
  69         ACCEPTING_JOBS = new PrinterIsAcceptingJobs(1);
  70 
  71     /**
  72      * Construct a new printer is accepting jobs enumeration value with the
  73      * given integer value.
  74      *
  75      * @param  value Integer value
  76      */
  77     protected PrinterIsAcceptingJobs(int value) {
  78         super (value);
  79     }
  80 
  81     /**
  82      * The string table for class {@code PrinterIsAcceptingJobs}.
  83      */
  84     private static final String[] myStringTable = {
  85         "not-accepting-jobs",
  86         "accepting-jobs"
  87     };
  88 
  89     /**
  90      * The enumeration value table for class {@code PrinterIsAcceptingJobs}.
  91      */
  92     private static final PrinterIsAcceptingJobs[] myEnumValueTable = {
  93         NOT_ACCEPTING_JOBS,
  94         ACCEPTING_JOBS
  95     };
  96 
  97     /**
  98      * Returns the string table for class {@code PrinterIsAcceptingJobs}.
  99      */
 100     protected String[] getStringTable() {
 101         return myStringTable;
 102     }
 103 
 104     /**
 105      * Returns the enumeration value table for class
 106      * {@code PrinterIsAcceptingJobs}.
 107      */
 108     protected EnumSyntax[] getEnumValueTable() {
 109         return myEnumValueTable;
 110     }
 111 
 112     /**
 113      * Get the printing attribute class which is to be used as the "category"
 114      * for this printing attribute value.
 115      * <p>
 116      * For class {@code PrinterIsAcceptingJobs}, the category is class
 117      * {@code PrinterIsAcceptingJobs} itself.
 118      *
 119      * @return printing attribute class (category), an instance of class
 120      *         {@link Class java.lang.Class}
 121      */
 122     public final Class<? extends Attribute> getCategory() {
 123         return PrinterIsAcceptingJobs.class;
 124     }
 125 
 126     /**
 127      * Get the name of the category of which this attribute value is an
 128      * instance.
 129      * <p>
 130      * For class {@code PrinterIsAcceptingJobs}, the category name is
 131      * {@code "printer-is-accepting-jobs"}.
 132      *
 133      * @return attribute category name
 134      */
 135     public final String getName() {
 136         return "printer-is-accepting-jobs";
 137     }
 138 }