1. /*
  2. * @(#)JobOriginatingUserName.java 1.7 03/01/23
  3. *
  4. * Copyright 2003 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 java.util.Locale;
  9. import javax.print.attribute.TextSyntax;
  10. import javax.print.attribute.PrintJobAttribute;
  11. /**
  12. * Class JobOriginatingUserName is a printing attribute class, a text
  13. * attribute, that contains the name of the end user that submitted the
  14. * print job. If possible, the printer sets this attribute to the most
  15. * authenticated printable user name that it can obtain from the
  16. * authentication service that authenticated the submitted Print Request.
  17. * If such is not available, the printer uses the value of the
  18. * {@link RequestingUserName RequestingUserName}
  19. * attribute supplied by the client in the Print Request's attribute set.
  20. * If no authentication service is available, and the client did not supply
  21. * a {@link RequestingUserName RequestingUserName} attribute,
  22. * the printer sets the JobOriginatingUserName attribute to an empty
  23. * (zero-length) string.
  24. * <P>
  25. * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  26. * locale gives the IPP natural language. The category name returned by
  27. * <CODE>getName()</CODE> gives the IPP attribute name.
  28. * <P>
  29. *
  30. * @author Alan Kaminsky
  31. */
  32. public final class JobOriginatingUserName extends TextSyntax
  33. implements PrintJobAttribute {
  34. /**
  35. * Constructs a new job originating user name attribute with the given
  36. * user name and locale.
  37. *
  38. * @param userName User name.
  39. * @param locale Natural language of the text string. null
  40. * is interpreted to mean the default locale as returned
  41. * by <code>Locale.getDefault()</code>
  42. *
  43. * @exception NullPointerException
  44. * (unchecked exception) Thrown if <CODE>userName</CODE> is null.
  45. */
  46. public JobOriginatingUserName(String userName, Locale locale) {
  47. super (userName, locale);
  48. }
  49. /**
  50. * Returns whether this job originating user name attribute is equivalent to
  51. * the passed in object. To be equivalent, all of the following conditions
  52. * must be true:
  53. * <OL TYPE=1>
  54. * <LI>
  55. * <CODE>object</CODE> is not null.
  56. * <LI>
  57. * <CODE>object</CODE> is an instance of class JobOriginatingUserName.
  58. * <LI>
  59. * This job originating user name attribute's underlying string and
  60. * <CODE>object</CODE>'s underlying string are equal.
  61. * <LI>
  62. * This job originating user name attribute's locale and
  63. * <CODE>object</CODE>'s locale are equal.
  64. * </OL>
  65. *
  66. * @param object Object to compare to.
  67. *
  68. * @return True if <CODE>object</CODE> is equivalent to this job
  69. * originating user name attribute, false otherwise.
  70. */
  71. public boolean equals(Object object) {
  72. return (super.equals (object) &&
  73. object instanceof JobOriginatingUserName);
  74. }
  75. /**
  76. * Get the printing attribute class which is to be used as the "category"
  77. * for this printing attribute value.
  78. * <P>
  79. * For class JobOriginatingUserName, the
  80. * category is class JobOriginatingUserName itself.
  81. *
  82. * @return Printing attribute class (category), an instance of class
  83. * {@link java.lang.Class java.lang.Class}.
  84. */
  85. public final Class getCategory() {
  86. return JobOriginatingUserName.class;
  87. }
  88. /**
  89. * Get the name of the category of which this attribute value is an
  90. * instance.
  91. * <P>
  92. * For class JobOriginatingUserName, the
  93. * category name is <CODE>"job-originating-user-name"</CODE>.
  94. *
  95. * @return Attribute category name.
  96. */
  97. public final String getName() {
  98. return "job-originating-user-name";
  99. }
  100. }