1. /*
  2. * @(#)JobPriority.java 1.7 04/05/05
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.Attribute;
  9. import javax.print.attribute.IntegerSyntax;
  10. import javax.print.attribute.PrintRequestAttribute;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class JobPriority is an integer valued printing attribute class that
  14. * specifies a print job's priority.
  15. * <P>
  16. * If a JobPriority attribute is specified for a Print Job, it specifies a
  17. * priority for scheduling the job. A higher value specifies a higher priority.
  18. * The value 1 indicates the lowest possible priority. The value 100 indicates
  19. * the highest possible priority. Among those jobs that are ready to print, a
  20. * printer must print all jobs with a priority value of <I>n</I> before printing
  21. * those with a priority value of <I>n</I>-1 for all <I>n.</I>
  22. * <P>
  23. * If the client does not specify a JobPriority attribute for a Print Job and
  24. * the printer does support the JobPriority attribute, the printer must use an
  25. * implementation-defined default JobPriority value.
  26. * <P>
  27. * The client can always specify any job priority value from 1 to 100 for a job.
  28. * However, a Print Service instance may support fewer than 100 different
  29. * job priority levels. If this is the case, the Print Service instance
  30. * automatically maps the client-specified job priority value to one of the
  31. * supported job priority levels, dividing the 100 job priority values equally
  32. * among the available job priority levels.
  33. * <P>
  34. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  35. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  36. * name.
  37. * <P>
  38. *
  39. * @author Alan Kaminsky
  40. */
  41. public final class JobPriority extends IntegerSyntax
  42. implements PrintRequestAttribute, PrintJobAttribute {
  43. private static final long serialVersionUID = -4599900369040602769L;
  44. /**
  45. * Construct a new job priority attribute with the given integer value.
  46. *
  47. * @param value Integer value.
  48. *
  49. * @exception IllegalArgumentException
  50. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
  51. * or greater than 100.
  52. */
  53. public JobPriority(int value) {
  54. super (value, 1, 100);
  55. }
  56. /**
  57. * Returns whether this job priority attribute is equivalent to the passed
  58. * in object. To be equivalent, all of the following conditions must be
  59. * true:
  60. * <OL TYPE=1>
  61. * <LI>
  62. * <CODE>object</CODE> is not null.
  63. * <LI>
  64. * <CODE>object</CODE> is an instance of class JobPriority.
  65. * <LI>
  66. * This job priority attribute's value and <CODE>object</CODE>'s value
  67. * are equal.
  68. * </OL>
  69. *
  70. * @param object Object to compare to.
  71. *
  72. * @return True if <CODE>object</CODE> is equivalent to this job
  73. * priority attribute, false otherwise.
  74. */
  75. public boolean equals(Object object) {
  76. return (super.equals (object) && object instanceof JobPriority);
  77. }
  78. /**
  79. * Get the printing attribute class which is to be used as the "category"
  80. * for this printing attribute value.
  81. * <P>
  82. * For class JobPriority, the category is class JobPriority itself.
  83. *
  84. * @return Printing attribute class (category), an instance of class
  85. * {@link java.lang.Class java.lang.Class}.
  86. */
  87. public final Class<? extends Attribute> getCategory() {
  88. return JobPriority.class;
  89. }
  90. /**
  91. * Get the name of the category of which this attribute value is an
  92. * instance.
  93. * <P>
  94. * For class JobPriority, the category name is <CODE>"job-priority"</CODE>.
  95. *
  96. * @return Attribute category name.
  97. */
  98. public final String getName() {
  99. return "job-priority";
  100. }
  101. }