Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import java.util.Locale;2728import javax.print.attribute.Attribute;29import javax.print.attribute.TextSyntax;30import javax.print.attribute.PrintJobAttribute;3132/**33* Class JobOriginatingUserName is a printing attribute class, a text34* attribute, that contains the name of the end user that submitted the35* print job. If possible, the printer sets this attribute to the most36* authenticated printable user name that it can obtain from the37* authentication service that authenticated the submitted Print Request.38* If such is not available, the printer uses the value of the39* {@link RequestingUserName RequestingUserName}40* attribute supplied by the client in the Print Request's attribute set.41* If no authentication service is available, and the client did not supply42* a {@link RequestingUserName RequestingUserName} attribute,43* the printer sets the JobOriginatingUserName attribute to an empty44* (zero-length) string.45* <P>46* <B>IPP Compatibility:</B> The string value gives the IPP name value. The47* locale gives the IPP natural language. The category name returned by48* <CODE>getName()</CODE> gives the IPP attribute name.49* <P>50*51* @author Alan Kaminsky52*/53public final class JobOriginatingUserName extends TextSyntax54implements PrintJobAttribute {5556private static final long serialVersionUID = -8052537926362933477L;5758/**59* Constructs a new job originating user name attribute with the given60* user name and locale.61*62* @param userName User name.63* @param locale Natural language of the text string. null64* is interpreted to mean the default locale as returned65* by <code>Locale.getDefault()</code>66*67* @exception NullPointerException68* (unchecked exception) Thrown if <CODE>userName</CODE> is null.69*/70public JobOriginatingUserName(String userName, Locale locale) {71super (userName, locale);72}7374/**75* Returns whether this job originating user name attribute is equivalent to76* the passed in object. To be equivalent, all of the following conditions77* must be true:78* <OL TYPE=1>79* <LI>80* <CODE>object</CODE> is not null.81* <LI>82* <CODE>object</CODE> is an instance of class JobOriginatingUserName.83* <LI>84* This job originating user name attribute's underlying string and85* <CODE>object</CODE>'s underlying string are equal.86* <LI>87* This job originating user name attribute's locale and88* <CODE>object</CODE>'s locale are equal.89* </OL>90*91* @param object Object to compare to.92*93* @return True if <CODE>object</CODE> is equivalent to this job94* originating user name attribute, false otherwise.95*/96public boolean equals(Object object) {97return (super.equals (object) &&98object instanceof JobOriginatingUserName);99}100101/**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, the106* category is class JobOriginatingUserName itself.107*108* @return Printing attribute class (category), an instance of class109* {@link java.lang.Class java.lang.Class}.110*/111public final Class<? extends Attribute> getCategory() {112return JobOriginatingUserName.class;113}114115/**116* Get the name of the category of which this attribute value is an117* instance.118* <P>119* For class JobOriginatingUserName, the120* category name is <CODE>"job-originating-user-name"</CODE>.121*122* @return Attribute category name.123*/124public final String getName() {125return "job-originating-user-name";126}127128}129130131