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/JobHoldUntil.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.Calendar;
30
import java.util.Date;
31
32
import javax.print.attribute.Attribute;
33
import javax.print.attribute.DateTimeSyntax;
34
import javax.print.attribute.PrintJobAttribute;
35
import javax.print.attribute.PrintRequestAttribute;
36
37
/**
38
* Class {@code JobHoldUntil} is a printing attribute class, a date-time
39
* attribute, that specifies the exact date and time at which the job must
40
* become a candidate for printing.
41
* <p>
42
* If the value of this attribute specifies a date-time that is in the future,
43
* the printer should add the {@link JobStateReason JobStateReason} value of
44
* {@code JOB_HOLD_UNTIL_SPECIFIED} to the job's
45
* {@link JobStateReasons JobStateReasons} attribute, must move the job to the
46
* {@code PENDING_HELD} state, and must not schedule the job for printing until
47
* the specified date-time arrives.
48
* <p>
49
* When the specified date-time arrives, the printer must remove the
50
* {@link JobStateReason JobStateReason} value of
51
* {@code JOB_HOLD_UNTIL_SPECIFIED} from the job's
52
* {@link JobStateReasons JobStateReasons} attribute, if present. If there are
53
* no other job state reasons that keep the job in the {@code PENDING_HELD}
54
* state, the printer must consider the job as a candidate for processing by
55
* moving the job to the PENDING state.
56
* <p>
57
* If the specified date-time has already passed, the job must be a candidate
58
* for processing immediately. Thus, one way to make the job immediately become
59
* a candidate for processing is to specify a {@code JobHoldUntil} attribute
60
* constructed like this
61
* (denoting a date-time of January 1, 1970, 00:00:00 GMT):
62
* <pre>
63
* JobHoldUntil immediately = new JobHoldUntil (new Date (0L));
64
* </pre>
65
* <p>
66
* If the client does not supply this attribute in a Print Request and the
67
* printer supports this attribute, the printer must use its
68
* (implementation-dependent) default {@code JobHoldUntil} value at job
69
* submission time (unlike most job template attributes that are used if
70
* necessary at job processing time).
71
* <p>
72
* To construct a {@code JobHoldUntil} attribute from separate values of the
73
* year, month, day, hour, minute, and so on, use a {@link Calendar Calendar}
74
* object to construct a {@link Date Date} object, then use the
75
* {@link Date Date} object to construct the {@code JobHoldUntil} attribute. To
76
* convert a {@code JobHoldUntil} attribute to separate values of the year,
77
* month, day, hour, minute, and so on, create a {@link Calendar Calendar}
78
* object and set it to the {@link Date Date} from the {@code JobHoldUntil}
79
* attribute.
80
* <p>
81
* <b>IPP Compatibility:</b> Although IPP supports a "job-hold-until" attribute
82
* specified as a keyword, IPP does not at this time support a "job-hold-until"
83
* attribute specified as a date and time. However, the date and time can be
84
* converted to one of the standard IPP keywords with some loss of precision;
85
* for example, a {@code JobHoldUntil} value with today's date and 9:00pm local
86
* time might be converted to the standard IPP keyword "night". The category
87
* name returned by {@code getName()} gives the IPP attribute name.
88
*
89
* @author Alan Kaminsky
90
*/
91
public final class JobHoldUntil extends DateTimeSyntax
92
implements PrintRequestAttribute, PrintJobAttribute {
93
94
/**
95
* Use serialVersionUID from JDK 1.4 for interoperability.
96
*/
97
@Serial
98
private static final long serialVersionUID = -1664471048860415024L;
99
100
/**
101
* Construct a new job hold until date-time attribute with the given
102
* {@link Date Date} value.
103
*
104
* @param dateTime {@link Date Date} value
105
* @throws NullPointerException if {@code dateTime} is {@code null}
106
*/
107
public JobHoldUntil(Date dateTime) {
108
super (dateTime);
109
}
110
111
/**
112
* Returns whether this job hold until attribute is equivalent to the passed
113
* in object. To be equivalent, all of the following conditions must be
114
* true:
115
* <ol type=1>
116
* <li>{@code object} is not {@code null}.
117
* <li>{@code object} is an instance of class {@code JobHoldUntil}.
118
* <li>This job hold until attribute's {@link Date Date} value and
119
* {@code object}'s {@link Date Date} value are equal.
120
* </ol>
121
*
122
* @param object {@code Object} to compare to
123
* @return {@code true} if {@code object} is equivalent to this job hold
124
* until attribute, {@code false} otherwise
125
*/
126
public boolean equals(Object object) {
127
return (super.equals(object) && object instanceof JobHoldUntil);
128
}
129
130
/**
131
* Get the printing attribute class which is to be used as the "category"
132
* for this printing attribute value.
133
* <p>
134
* For class {@code JobHoldUntil}, the category is class
135
* {@code JobHoldUntil} itself.
136
*
137
* @return printing attribute class (category), an instance of class
138
* {@link Class java.lang.Class}
139
*/
140
public final Class<? extends Attribute> getCategory() {
141
return JobHoldUntil.class;
142
}
143
144
/**
145
* Get the name of the category of which this attribute value is an
146
* instance.
147
* <p>
148
* For class {@code JobHoldUntil}, the category name is
149
* {@code "job-hold-until"}.
150
*
151
* @return attribute category name
152
*/
153
public final String getName() {
154
return "job-hold-until";
155
}
156
}
157
158