KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobHoldUntil.java 1.7 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.Date JavaDoc;
10 import javax.print.attribute.Attribute JavaDoc;
11 import javax.print.attribute.DateTimeSyntax JavaDoc;
12 import javax.print.attribute.PrintRequestAttribute JavaDoc;
13 import javax.print.attribute.PrintJobAttribute JavaDoc;
14
15 /**
16  * Class JobHoldUntil is a printing attribute class, a date-time attribute, that
17  * specifies the exact date and time at which the job must become a candidate
18  * for printing.
19  * <P>
20  * If the value of this attribute specifies a date-time that is in the future,
21  * the printer should add the {@link JobStateReason JobStateReason} value of
22  * JOB_HOLD_UNTIL_SPECIFIED to the job's {@link JobStateReasons JobStateReasons}
23  * attribute, must move the job to the PENDING_HELD state, and must not schedule
24  * the job for printing until the specified date-time arrives.
25  * <P>
26  * When the specified date-time arrives, the printer must remove the {@link
27  * JobStateReason JobStateReason} value of JOB_HOLD_UNTIL_SPECIFIED from the
28  * job's {@link JobStateReasons JobStateReasons} attribute, if present. If there
29  * are no other job state reasons that keep the job in the PENDING_HELD state,
30  * the printer must consider the job as a candidate for processing by moving the
31  * job to the PENDING state.
32  * <P>
33  * If the specified date-time has already passed, the job must be a candidate
34  * for processing immediately. Thus, one way to make the job immediately become
35  * a candidate for processing is to specify a JobHoldUntil attribute constructed
36  * like this (denoting a date-time of January 1, 1970, 00:00:00 GMT):
37  * <PRE>
38  * JobHoldUntil immediately = new JobHoldUntil (new Date (0L));
39  * </PRE>
40  * <P>
41  * If the client does not supply this attribute in a Print Request and the
42  * printer supports this attribute, the printer must use its
43  * (implementation-dependent) default JobHoldUntil value at job submission time
44  * (unlike most job template attributes that are used if necessary at job
45  * processing time).
46  * <P>
47  * To construct a JobHoldUntil attribute from separate values of the year,
48  * month, day, hour, minute, and so on, use a {@link java.util.Calendar
49  * Calendar} object to construct a {@link java.util.Date Date} object, then use
50  * the {@link java.util.Date Date} object to construct the JobHoldUntil
51  * attribute. To convert a JobHoldUntil attribute to separate values of the
52  * year, month, day, hour, minute, and so on, create a {@link java.util.Calendar
53  * Calendar} object and set it to the {@link java.util.Date Date} from the
54  * JobHoldUntil attribute.
55  * <P>
56  * <B>IPP Compatibility:</B> Although IPP supports a "job-hold-until" attribute
57  * specified as a keyword, IPP does not at this time support a "job-hold-until"
58  * attribute specified as a date and time. However, the date and time can be
59  * converted to one of the standard IPP keywords with some loss of precision;
60  * for example, a JobHoldUntil value with today's date and 9:00pm local time
61  * might be converted to the standard IPP keyword "night". The category name
62  * returned by <CODE>getName()</CODE> gives the IPP attribute name.
63  * <P>
64  *
65  * @author Alan Kaminsky
66  */

67 public final class JobHoldUntil extends DateTimeSyntax JavaDoc
68     implements PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
69
70     private static final long serialVersionUID = -1664471048860415024L;
71
72
73     /**
74      * Construct a new job hold until date-time attribute with the given
75      * {@link java.util.Date Date} value.
76      *
77      * @param dateTime {@link java.util.Date Date} value.
78      *
79      * @exception NullPointerException
80      * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
81      */

82     public JobHoldUntil(Date JavaDoc dateTime) {
83     super (dateTime);
84     }
85
86     /**
87      * Returns whether this job hold until attribute is equivalent to the
88      * passed in object. To be equivalent, all of the following conditions
89      * must be true:
90      * <OL TYPE=1>
91      * <LI>
92      * <CODE>object</CODE> is not null.
93      * <LI>
94      * <CODE>object</CODE> is an instance of class JobHoldUntil.
95      * <LI>
96      * This job hold until attribute's {@link java.util.Date Date} value and
97      * <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.
98      * </OL>
99      *
100      * @param object Object to compare to.
101      *
102      * @return True if <CODE>object</CODE> is equivalent to this job hold
103      * until attribute, false otherwise.
104      */

105     public boolean equals(Object JavaDoc object) {
106     return (super.equals(object) && object instanceof JobHoldUntil JavaDoc);
107     }
108
109
110     /**
111      * Get the printing attribute class which is to be used as the "category"
112      * for this printing attribute value.
113      * <P>
114      * For class JobHoldUntil, the category is class JobHoldUntil itself.
115      *
116      * @return Printing attribute class (category), an instance of class
117      * {@link java.lang.Class java.lang.Class}.
118      */

119     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
120     return JobHoldUntil JavaDoc.class;
121     }
122     
123     /**
124      * Get the name of the category of which this attribute value is an
125      * instance.
126      * <P>
127      * For class JobHoldUntil, the category name is <CODE>"job-hold-until"</CODE>.
128      *
129      * @return Attribute category name.
130      */

131     public final String JavaDoc getName() {
132     return "job-hold-until";
133     }
134     
135 }
136
Popular Tags