001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import java.util.Locale;
028
029 import javax.print.attribute.Attribute;
030 import javax.print.attribute.TextSyntax;
031 import javax.print.attribute.PrintJobAttribute;
032
033 /**
034 * Class JobOriginatingUserName is a printing attribute class, a text
035 * attribute, that contains the name of the end user that submitted the
036 * print job. If possible, the printer sets this attribute to the most
037 * authenticated printable user name that it can obtain from the
038 * authentication service that authenticated the submitted Print Request.
039 * If such is not available, the printer uses the value of the
040 * {@link RequestingUserName RequestingUserName}
041 * attribute supplied by the client in the Print Request's attribute set.
042 * If no authentication service is available, and the client did not supply
043 * a {@link RequestingUserName RequestingUserName} attribute,
044 * the printer sets the JobOriginatingUserName attribute to an empty
045 * (zero-length) string.
046 * <P>
047 * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
048 * locale gives the IPP natural language. The category name returned by
049 * <CODE>getName()</CODE> gives the IPP attribute name.
050 * <P>
051 *
052 * @author Alan Kaminsky
053 */
054 public final class JobOriginatingUserName extends TextSyntax implements
055 PrintJobAttribute {
056
057 private static final long serialVersionUID = -8052537926362933477L;
058
059 /**
060 * Constructs a new job originating user name attribute with the given
061 * user name and locale.
062 *
063 * @param userName User name.
064 * @param locale Natural language of the text string. null
065 * is interpreted to mean the default locale as returned
066 * by <code>Locale.getDefault()</code>
067 *
068 * @exception NullPointerException
069 * (unchecked exception) Thrown if <CODE>userName</CODE> is null.
070 */
071 public JobOriginatingUserName(String userName, Locale locale) {
072 super (userName, locale);
073 }
074
075 /**
076 * Returns whether this job originating user name attribute is equivalent to
077 * the passed in object. To be equivalent, all of the following conditions
078 * must be true:
079 * <OL TYPE=1>
080 * <LI>
081 * <CODE>object</CODE> is not null.
082 * <LI>
083 * <CODE>object</CODE> is an instance of class JobOriginatingUserName.
084 * <LI>
085 * This job originating user name attribute's underlying string and
086 * <CODE>object</CODE>'s underlying string are equal.
087 * <LI>
088 * This job originating user name attribute's locale and
089 * <CODE>object</CODE>'s locale are equal.
090 * </OL>
091 *
092 * @param object Object to compare to.
093 *
094 * @return True if <CODE>object</CODE> is equivalent to this job
095 * originating user name attribute, false otherwise.
096 */
097 public boolean equals(Object object) {
098 return (super .equals(object) && object instanceof JobOriginatingUserName);
099 }
100
101 /**
102 * Get the printing attribute class which is to be used as the "category"
103 * for this printing attribute value.
104 * <P>
105 * For class JobOriginatingUserName, the
106 * category is class JobOriginatingUserName itself.
107 *
108 * @return Printing attribute class (category), an instance of class
109 * {@link java.lang.Class java.lang.Class}.
110 */
111 public final Class<? extends Attribute> getCategory() {
112 return JobOriginatingUserName.class;
113 }
114
115 /**
116 * Get the name of the category of which this attribute value is an
117 * instance.
118 * <P>
119 * For class JobOriginatingUserName, the
120 * category name is <CODE>"job-originating-user-name"</CODE>.
121 *
122 * @return Attribute category name.
123 */
124 public final String getName() {
125 return "job-originating-user-name";
126 }
127
128 }
|