0N/A/*
2362N/A * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage javax.print.attribute.standard;
0N/A
0N/Aimport java.util.Date;
0N/Aimport javax.print.attribute.Attribute;
0N/Aimport javax.print.attribute.DateTimeSyntax;
0N/Aimport javax.print.attribute.PrintRequestAttribute;
0N/Aimport javax.print.attribute.PrintJobAttribute;
0N/A
0N/A/**
0N/A * Class JobHoldUntil is a printing attribute class, a date-time attribute, that
0N/A * specifies the exact date and time at which the job must become a candidate
0N/A * for printing.
0N/A * <P>
0N/A * If the value of this attribute specifies a date-time that is in the future,
0N/A * the printer should add the {@link JobStateReason JobStateReason} value of
0N/A * JOB_HOLD_UNTIL_SPECIFIED to the job's {@link JobStateReasons JobStateReasons}
0N/A * attribute, must move the job to the PENDING_HELD state, and must not schedule
0N/A * the job for printing until the specified date-time arrives.
0N/A * <P>
0N/A * When the specified date-time arrives, the printer must remove the {@link
0N/A * JobStateReason JobStateReason} value of JOB_HOLD_UNTIL_SPECIFIED from the
0N/A * job's {@link JobStateReasons JobStateReasons} attribute, if present. If there
0N/A * are no other job state reasons that keep the job in the PENDING_HELD state,
0N/A * the printer must consider the job as a candidate for processing by moving the
0N/A * job to the PENDING state.
0N/A * <P>
0N/A * If the specified date-time has already passed, the job must be a candidate
0N/A * for processing immediately. Thus, one way to make the job immediately become
0N/A * a candidate for processing is to specify a JobHoldUntil attribute constructed
0N/A * like this (denoting a date-time of January 1, 1970, 00:00:00 GMT):
0N/A * <PRE>
0N/A * JobHoldUntil immediately = new JobHoldUntil (new Date (0L));
0N/A * </PRE>
0N/A * <P>
0N/A * If the client does not supply this attribute in a Print Request and the
0N/A * printer supports this attribute, the printer must use its
0N/A * (implementation-dependent) default JobHoldUntil value at job submission time
0N/A * (unlike most job template attributes that are used if necessary at job
0N/A * processing time).
0N/A * <P>
0N/A * To construct a JobHoldUntil attribute from separate values of the year,
0N/A * month, day, hour, minute, and so on, use a {@link java.util.Calendar
0N/A * Calendar} object to construct a {@link java.util.Date Date} object, then use
0N/A * the {@link java.util.Date Date} object to construct the JobHoldUntil
0N/A * attribute. To convert a JobHoldUntil attribute to separate values of the
0N/A * year, month, day, hour, minute, and so on, create a {@link java.util.Calendar
0N/A * Calendar} object and set it to the {@link java.util.Date Date} from the
0N/A * JobHoldUntil attribute.
0N/A * <P>
0N/A * <B>IPP Compatibility:</B> Although IPP supports a "job-hold-until" attribute
0N/A * specified as a keyword, IPP does not at this time support a "job-hold-until"
0N/A * attribute specified as a date and time. However, the date and time can be
0N/A * converted to one of the standard IPP keywords with some loss of precision;
0N/A * for example, a JobHoldUntil value with today's date and 9:00pm local time
0N/A * might be converted to the standard IPP keyword "night". The category name
0N/A * returned by <CODE>getName()</CODE> gives the IPP attribute name.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/Apublic final class JobHoldUntil extends DateTimeSyntax
0N/A implements PrintRequestAttribute, PrintJobAttribute {
0N/A
0N/A private static final long serialVersionUID = -1664471048860415024L;
0N/A
0N/A
0N/A /**
0N/A * Construct a new job hold until date-time attribute with the given
0N/A * {@link java.util.Date Date} value.
0N/A *
0N/A * @param dateTime {@link java.util.Date Date} value.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
0N/A */
0N/A public JobHoldUntil(Date dateTime) {
0N/A super (dateTime);
0N/A }
0N/A
0N/A /**
0N/A * Returns whether this job hold until attribute is equivalent to the
0N/A * passed in object. To be equivalent, all of the following conditions
0N/A * must be true:
0N/A * <OL TYPE=1>
0N/A * <LI>
0N/A * <CODE>object</CODE> is not null.
0N/A * <LI>
0N/A * <CODE>object</CODE> is an instance of class JobHoldUntil.
0N/A * <LI>
0N/A * This job hold until attribute's {@link java.util.Date Date} value and
0N/A * <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.
0N/A * </OL>
0N/A *
0N/A * @param object Object to compare to.
0N/A *
0N/A * @return True if <CODE>object</CODE> is equivalent to this job hold
0N/A * until attribute, false otherwise.
0N/A */
0N/A public boolean equals(Object object) {
0N/A return (super.equals(object) && object instanceof JobHoldUntil);
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Get the printing attribute class which is to be used as the "category"
0N/A * for this printing attribute value.
0N/A * <P>
0N/A * For class JobHoldUntil, the category is class JobHoldUntil itself.
0N/A *
0N/A * @return Printing attribute class (category), an instance of class
0N/A * {@link java.lang.Class java.lang.Class}.
0N/A */
0N/A public final Class<? extends Attribute> getCategory() {
0N/A return JobHoldUntil.class;
0N/A }
0N/A
0N/A /**
0N/A * Get the name of the category of which this attribute value is an
0N/A * instance.
0N/A * <P>
0N/A * For class JobHoldUntil, the category name is <CODE>"job-hold-until"</CODE>.
0N/A *
0N/A * @return Attribute category name.
0N/A */
0N/A public final String getName() {
0N/A return "job-hold-until";
0N/A }
0N/A
0N/A}