< prev index next >

src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2014, 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 package javax.print.attribute.standard;
  26 
  27 import javax.print.attribute.EnumSyntax;
  28 import javax.print.attribute.Attribute;

  29 
  30 /**
  31  * Class Severity is a printing attribute class, an enumeration, that denotes
  32  * the severity of a {@link PrinterStateReason PrinterStateReason} attribute.
  33  * <P>
  34  * Instances of Severity do not appear in a Print Service's attribute set
  35  * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}

  36  * attribute appears in the Print Service's attribute set.
  37  *  The {@link PrinterStateReasons
  38  * PrinterStateReasons} attribute contains zero, one, or more than one {@link
  39  * PrinterStateReason PrinterStateReason} objects which pertain to the Print
  40  * Service's status, and each {@link PrinterStateReason PrinterStateReason}
  41  * object is associated with a Severity level of REPORT (least severe),
  42  * WARNING, or ERROR (most severe).
  43  * The printer adds a {@link PrinterStateReason
  44  * PrinterStateReason} object to the Print Service's
  45  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
  46  * corresponding condition becomes true
  47  * of the printer, and the printer removes the {@link PrinterStateReason
  48  * PrinterStateReason} object again when the corresponding condition becomes
  49  * false, regardless of whether the Print Service's overall
  50  * {@link PrinterState PrinterState} also changed.
  51  * <P>
  52  * <B>IPP Compatibility:</B>
  53  * {@code Severity.toString()} returns either "error", "warning", or
  54  * "report".  The string values returned by
  55  * each individual {@link PrinterStateReason} and
  56  * associated {@link Severity} object's {@code toString()}
  57  * methods, concatenated together with a hyphen ({@code "-"}) in
  58  * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
  59  * The category name returned by {@code getName()} gives the IPP
  60  * attribute name.
  61  *
  62  * @author  Alan Kaminsky
  63  */
  64 public final class Severity extends EnumSyntax implements Attribute {
  65 



  66     private static final long serialVersionUID = 8781881462717925380L;
  67 
  68     /**
  69      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
  70      * "report" (least severe). An implementation may choose to omit some or
  71      * all reports.
  72      * Some reports specify finer granularity about the printer state;
  73      * others serve as a precursor to a warning. A report must contain nothing
  74      * that could affect the printed output.
  75      */
  76     public static final Severity REPORT = new Severity (0);
  77 
  78     /**
  79      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
  80      * "warning." An implementation may choose to omit some or all warnings.
  81      * Warnings serve as a precursor to an error. A warning must contain
  82      * nothing  that prevents a job from completing, though in some cases the
  83      * output may be of lower quality.
  84      */
  85     public static final Severity WARNING = new Severity (1);
  86 
  87     /**
  88      * Indicates that the {@link PrinterStateReason PrinterStateReason} is an
  89      * "error" (most severe). An implementation must include all errors.
  90      * If this attribute contains one or more errors, the printer's
  91      * {@link PrinterState PrinterState} must be STOPPED.
  92      */
  93     public static final Severity ERROR = new Severity (2);
  94 
  95     /**
  96      * Construct a new severity enumeration value with the given integer
  97      * value.
  98      *
  99      * @param  value  Integer value.
 100      */
 101     protected Severity(int value) {
 102         super (value);
 103     }
 104 



 105     private static final String[] myStringTable = {
 106         "report",
 107         "warning",
 108         "error"
 109     };
 110 



 111     private static final Severity[] myEnumValueTable = {
 112         REPORT,
 113         WARNING,
 114         ERROR
 115     };
 116 
 117     /**
 118      * Returns the string table for class Severity.
 119      */
 120     protected String[] getStringTable() {
 121         return myStringTable;
 122     }
 123 
 124     /**
 125      * Returns the enumeration value table for class Severity.
 126      */
 127     protected EnumSyntax[] getEnumValueTable() {
 128         return myEnumValueTable;
 129     }
 130 
 131 
 132     /**
 133      * Get the printing attribute class which is to be used as the "category"
 134      * for this printing attribute value.
 135      * <P>
 136      * For class Severity, the category is class Severity itself.

 137      *
 138      * @return  Printing attribute class (category), an instance of class
 139      *          {@link java.lang.Class java.lang.Class}.
 140      */
 141     public final Class<? extends Attribute> getCategory() {
 142         return Severity.class;
 143     }
 144 
 145     /**
 146      * Get the name of the category of which this attribute value is an
 147      * instance.
 148      * <P>
 149      * For class Severit, the category name is {@code "severity"}.
 150      *
 151      * @return  Attribute category name.
 152      */
 153     public final String getName() {
 154         return "severity";
 155     }
 156 
 157 }
   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 
  31 /**
  32  * Class {@code Severity} is a printing attribute class, an enumeration, that
  33  * denotes the severity of a {@link PrinterStateReason PrinterStateReason}
  34  * attribute.
  35  * <p>
  36  * Instances of {@code Severity} do not appear in a Print Service's attribute
  37  * set directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}
  38  * attribute appears in the Print Service's attribute set.
  39  * The {@link PrinterStateReasons PrinterStateReasons} attribute contains zero,
  40  * one, or more than one {@link PrinterStateReason PrinterStateReason} objects
  41  * which pertain to the Print Service's status, and each
  42  * {@link PrinterStateReason PrinterStateReason} object is associated with a
  43  * Severity level of {@code REPORT} (least severe), {@code WARNING}, or
  44  * {@code ERROR} (most severe). The printer adds a
  45  * {@link PrinterStateReason PrinterStateReason} object to the Print Service's

  46  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
  47  * corresponding condition becomes true of the printer, and the printer removes
  48  * the {@link PrinterStateReason PrinterStateReason} object again when the
  49  * corresponding condition becomes false, regardless of whether the Print
  50  * Service's overall {@link PrinterState PrinterState} also changed.
  51  * <p>
  52  * <b>IPP Compatibility:</b> {@code Severity.toString()} returns either "error",
  53  * "warning", or "report". The string values returned by each individual
  54  * {@link PrinterStateReason} and associated {@link Severity} object's
  55  * {@code toString()} methods, concatenated together with a hyphen ({@code "-"})
  56  * in between, gives the IPP keyword value for a {@link PrinterStateReasons}.
  57  * The category name returned by {@code getName()} gives the IPP attribute name.




  58  *
  59  * @author Alan Kaminsky
  60  */
  61 public final class Severity extends EnumSyntax implements Attribute {
  62 
  63     /**
  64      * Use serialVersionUID from JDK 1.4 for interoperability.
  65      */
  66     private static final long serialVersionUID = 8781881462717925380L;
  67 
  68     /**
  69      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
  70      * "report" (least severe). An implementation may choose to omit some or all
  71      * reports. Some reports specify finer granularity about the printer state;

  72      * others serve as a precursor to a warning. A report must contain nothing
  73      * that could affect the printed output.
  74      */
  75     public static final Severity REPORT = new Severity (0);
  76 
  77     /**
  78      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
  79      * "warning." An implementation may choose to omit some or all warnings.
  80      * Warnings serve as a precursor to an error. A warning must contain nothing
  81      * that prevents a job from completing, though in some cases the output may
  82      * be of lower quality.
  83      */
  84     public static final Severity WARNING = new Severity (1);
  85 
  86     /**
  87      * Indicates that the {@link PrinterStateReason PrinterStateReason} is an
  88      * "error" (most severe). An implementation must include all errors. If this
  89      * attribute contains one or more errors, the printer's
  90      * {@link PrinterState PrinterState} must be {@code STOPPED}.
  91      */
  92     public static final Severity ERROR = new Severity (2);
  93 
  94     /**
  95      * Construct a new severity enumeration value with the given integer value.

  96      *
  97      * @param  value Integer value
  98      */
  99     protected Severity(int value) {
 100         super (value);
 101     }
 102 
 103     /**
 104      * The string table for class {@code Severity}.
 105      */
 106     private static final String[] myStringTable = {
 107         "report",
 108         "warning",
 109         "error"
 110     };
 111 
 112     /**
 113      * The enumeration value table for class {@code Severity}.
 114      */
 115     private static final Severity[] myEnumValueTable = {
 116         REPORT,
 117         WARNING,
 118         ERROR
 119     };
 120 
 121     /**
 122      * Returns the string table for class {@code Severity}.
 123      */
 124     protected String[] getStringTable() {
 125         return myStringTable;
 126     }
 127 
 128     /**
 129      * Returns the enumeration value table for class {@code Severity}.
 130      */
 131     protected EnumSyntax[] getEnumValueTable() {
 132         return myEnumValueTable;
 133     }
 134 

 135     /**
 136      * Get the printing attribute class which is to be used as the "category"
 137      * for this printing attribute value.
 138      * <p>
 139      * For class {@code Severity}, the category is class
 140      * {@code Severity} itself.
 141      *
 142      * @return printing attribute class (category), an instance of class
 143      *         {@link Class java.lang.Class}
 144      */
 145     public final Class<? extends Attribute> getCategory() {
 146         return Severity.class;
 147     }
 148 
 149     /**
 150      * Get the name of the category of which this attribute value is an
 151      * instance.
 152      * <p>
 153      * For class {@code Severity}, the category name is {@code "severity"}.
 154      *
 155      * @return attribute category name
 156      */
 157     public final String getName() {
 158         return "severity";
 159     }

 160 }
< prev index next >