Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java
41171 views
/*1* Copyright (c) 2000, 2021, 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*/2425package javax.print.attribute.standard;2627import java.io.Serial;28import java.util.Locale;2930import javax.print.attribute.Attribute;31import javax.print.attribute.PrintJobAttribute;32import javax.print.attribute.TextSyntax;3334/**35* Class {@code JobOriginatingUserName} is a printing attribute class, a text36* attribute, that contains the name of the end user that submitted the print37* job. If possible, the printer sets this attribute to the most authenticated38* printable user name that it can obtain from the authentication service that39* authenticated the submitted Print Request. If such is not available, the40* printer uses the value of the {@link RequestingUserName RequestingUserName}41* attribute supplied by the client in the Print Request's attribute set. If no42* authentication service is available, and the client did not supply a43* {@link RequestingUserName RequestingUserName} attribute, the printer sets the44* JobOriginatingUserName attribute to an empty (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()} gives the IPP attribute name.49*50* @author Alan Kaminsky51*/52public final class JobOriginatingUserName extends TextSyntax53implements PrintJobAttribute {5455/**56* Use serialVersionUID from JDK 1.4 for interoperability.57*/58@Serial59private static final long serialVersionUID = -8052537926362933477L;6061/**62* Constructs a new job originating user name attribute with the given user63* name and locale.64*65* @param userName user name66* @param locale natural language of the text string. {@code null} is67* interpreted to mean the default locale as returned by68* {@code Locale.getDefault()}69* @throws NullPointerException if {@code userName} is {@code null}70*/71public JobOriginatingUserName(String userName, Locale locale) {72super (userName, locale);73}7475/**76* Returns whether this job originating user name attribute is equivalent to77* the passed in object. To be equivalent, all of the following conditions78* must be true:79* <ol type=1>80* <li>{@code object} is not {@code null}.81* <li>{@code object} is an instance of class82* {@code JobOriginatingUserName}.83* <li>This job originating user name attribute's underlying string and84* {@code object}'s underlying string are equal.85* <li>This job originating user name attribute's locale and86* {@code object}'s locale are equal.87* </ol>88*89* @param object {@code Object} to compare to90* @return {@code true} if {@code object} is equivalent to this job91* originating user name attribute, {@code false} otherwise92*/93public boolean equals(Object object) {94return (super.equals (object) &&95object instanceof JobOriginatingUserName);96}9798/**99* Get the printing attribute class which is to be used as the "category"100* for this printing attribute value.101* <p>102* For class {@code JobOriginatingUserName}, the category is class103* {@code JobOriginatingUserName} itself.104*105* @return printing attribute class (category), an instance of class106* {@link Class java.lang.Class}107*/108public final Class<? extends Attribute> getCategory() {109return JobOriginatingUserName.class;110}111112/**113* Get the name of the category of which this attribute value is an114* instance.115* <p>116* For class {@code JobOriginatingUserName}, the category name is117* {@code "job-originating-user-name"}.118*119* @return attribute category name120*/121public final String getName() {122return "job-originating-user-name";123}124}125126127