Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.Serial;
29
import java.util.Locale;
30
31
import javax.print.attribute.Attribute;
32
import javax.print.attribute.PrintJobAttribute;
33
import javax.print.attribute.TextSyntax;
34
35
/**
36
* Class {@code JobOriginatingUserName} is a printing attribute class, a text
37
* attribute, that contains the name of the end user that submitted the print
38
* job. If possible, the printer sets this attribute to the most authenticated
39
* printable user name that it can obtain from the authentication service that
40
* authenticated the submitted Print Request. If such is not available, the
41
* printer uses the value of the {@link RequestingUserName RequestingUserName}
42
* attribute supplied by the client in the Print Request's attribute set. If no
43
* authentication service is available, and the client did not supply a
44
* {@link RequestingUserName RequestingUserName} attribute, the printer sets the
45
* JobOriginatingUserName attribute to an empty (zero-length) string.
46
* <p>
47
* <b>IPP Compatibility:</b> The string value gives the IPP name value. The
48
* locale gives the IPP natural language. The category name returned by
49
* {@code getName()} gives the IPP attribute name.
50
*
51
* @author Alan Kaminsky
52
*/
53
public final class JobOriginatingUserName extends TextSyntax
54
implements PrintJobAttribute {
55
56
/**
57
* Use serialVersionUID from JDK 1.4 for interoperability.
58
*/
59
@Serial
60
private static final long serialVersionUID = -8052537926362933477L;
61
62
/**
63
* Constructs a new job originating user name attribute with the given user
64
* name and locale.
65
*
66
* @param userName user name
67
* @param locale natural language of the text string. {@code null} is
68
* interpreted to mean the default locale as returned by
69
* {@code Locale.getDefault()}
70
* @throws NullPointerException if {@code userName} is {@code null}
71
*/
72
public JobOriginatingUserName(String userName, Locale locale) {
73
super (userName, locale);
74
}
75
76
/**
77
* Returns whether this job originating user name attribute is equivalent to
78
* the passed in object. To be equivalent, all of the following conditions
79
* must be true:
80
* <ol type=1>
81
* <li>{@code object} is not {@code null}.
82
* <li>{@code object} is an instance of class
83
* {@code JobOriginatingUserName}.
84
* <li>This job originating user name attribute's underlying string and
85
* {@code object}'s underlying string are equal.
86
* <li>This job originating user name attribute's locale and
87
* {@code object}'s locale are equal.
88
* </ol>
89
*
90
* @param object {@code Object} to compare to
91
* @return {@code true} if {@code object} is equivalent to this job
92
* originating user name attribute, {@code false} otherwise
93
*/
94
public boolean equals(Object object) {
95
return (super.equals (object) &&
96
object instanceof JobOriginatingUserName);
97
}
98
99
/**
100
* Get the printing attribute class which is to be used as the "category"
101
* for this printing attribute value.
102
* <p>
103
* For class {@code JobOriginatingUserName}, the category is class
104
* {@code JobOriginatingUserName} itself.
105
*
106
* @return printing attribute class (category), an instance of class
107
* {@link Class java.lang.Class}
108
*/
109
public final Class<? extends Attribute> getCategory() {
110
return JobOriginatingUserName.class;
111
}
112
113
/**
114
* Get the name of the category of which this attribute value is an
115
* instance.
116
* <p>
117
* For class {@code JobOriginatingUserName}, the category name is
118
* {@code "job-originating-user-name"}.
119
*
120
* @return attribute category name
121
*/
122
public final String getName() {
123
return "job-originating-user-name";
124
}
125
}
126
127