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