KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > JobOriginatingUserName


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
9 import java.util.Locale JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.TextSyntax JavaDoc;
13 import javax.print.attribute.PrintJobAttribute JavaDoc;
14
15 /**
16  * Class JobOriginatingUserName is a printing attribute class, a text
17  * attribute, that contains the name of the end user that submitted the
18  * print job. If possible, the printer sets this attribute to the most
19  * authenticated printable user name that it can obtain from the
20  * authentication service that authenticated the submitted Print Request.
21  * If such is not available, the printer uses the value of the
22  * {@link RequestingUserName RequestingUserName}
23  * attribute supplied by the client in the Print Request's attribute set.
24  * If no authentication service is available, and the client did not supply
25  * a {@link RequestingUserName RequestingUserName} attribute,
26  * the printer sets the JobOriginatingUserName attribute to an empty
27  * (zero-length) string.
28  * <P>
29  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
30  * locale gives the IPP natural language. The category name returned by
31  * <CODE>getName()</CODE> gives the IPP attribute name.
32  * <P>
33  *
34  * @author Alan Kaminsky
35  */

36 public final class JobOriginatingUserName extends TextSyntax JavaDoc
37     implements PrintJobAttribute JavaDoc {
38        
39     private static final long serialVersionUID = -8052537926362933477L;
40
41     /**
42      * Constructs a new job originating user name attribute with the given
43      * user name and locale.
44      *
45      * @param userName User name.
46      * @param locale Natural language of the text string. null
47      * is interpreted to mean the default locale as returned
48      * by <code>Locale.getDefault()</code>
49      *
50      * @exception NullPointerException
51      * (unchecked exception) Thrown if <CODE>userName</CODE> is null.
52      */

53     public JobOriginatingUserName(String JavaDoc userName, Locale JavaDoc locale) {
54     super (userName, locale);
55     }
56
57     /**
58      * Returns whether this job originating user name attribute is equivalent to
59      * the passed in object. To be equivalent, all of the following conditions
60      * must be true:
61      * <OL TYPE=1>
62      * <LI>
63      * <CODE>object</CODE> is not null.
64      * <LI>
65      * <CODE>object</CODE> is an instance of class JobOriginatingUserName.
66      * <LI>
67      * This job originating user name attribute's underlying string and
68      * <CODE>object</CODE>'s underlying string are equal.
69      * <LI>
70      * This job originating user name attribute's locale and
71      * <CODE>object</CODE>'s locale are equal.
72      * </OL>
73      *
74      * @param object Object to compare to.
75      *
76      * @return True if <CODE>object</CODE> is equivalent to this job
77      * originating user name attribute, false otherwise.
78      */

79     public boolean equals(Object JavaDoc object) {
80     return (super.equals (object) &&
81         object instanceof JobOriginatingUserName JavaDoc);
82     }
83
84     /**
85      * Get the printing attribute class which is to be used as the "category"
86      * for this printing attribute value.
87      * <P>
88      * For class JobOriginatingUserName, the
89      * category is class JobOriginatingUserName itself.
90      *
91      * @return Printing attribute class (category), an instance of class
92      * {@link java.lang.Class java.lang.Class}.
93      */

94     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
95     return JobOriginatingUserName JavaDoc.class;
96     }
97
98     /**
99      * Get the name of the category of which this attribute value is an
100      * instance.
101      * <P>
102      * For class JobOriginatingUserName, the
103      * category name is <CODE>"job-originating-user-name"</CODE>.
104      *
105      * @return Attribute category name.
106      */

107     public final String JavaDoc getName() {
108     return "job-originating-user-name";
109     }
110
111 }
112
Popular Tags