/** * Creates an instant for the given date. * * @param time the date for which to create instant, or {@code null}. * @return the instant, or {@code null} if the given time was null. * @throws UnsupportedOperationException if the temporal factory is not available on the classpath. */ public static Instant createInstant(final Date time) throws UnsupportedOperationException { return (time != null) ? createInstant(getTemporalFactory(), time) : null; }
/** * Sets the date and time or range of date and time on or over which the process step occurred. * * @param newValue the new date. * * @deprecated As of ISO 19115-1:2014, replaced by {@link #setStepDateTime(TemporalPrimitive)}. */ @Deprecated public void setDate(final Date newValue) { setStepDateTime(TemporalUtilities.createInstant(newValue)); }
/** * Creates an instant for the given date. * * @param time the date for which to create instant, or {@code null}. * @return the instant, or {@code null} if the given time was null. * @throws UnsupportedOperationException if the temporal factory is not available on the classpath. */ public static Instant createInstant(final Date time) throws UnsupportedOperationException { return (time != null) ? createInstant(getTemporalFactory(), time) : null; }
/** * Creates a period for the given begin and end dates. The given arguments can be null if the * {@link TemporalFactory#createInstant(Date)} method accepts null dates, which stand for * undetermined position. * * @param begin the begin date, inclusive. * @param end the end date, inclusive. * @return the period. * @throws UnsupportedOperationException if the temporal factory is not available on the classpath. */ public static Period createPeriod(final Date begin, final Date end) throws UnsupportedOperationException { final TemporalFactory factory = getTemporalFactory(); return factory.createPeriod(createInstant(factory, begin), createInstant(factory, end)); }
/** * Creates a period for the given begin and end dates. The given arguments can be null if the * {@link TemporalFactory#createInstant(Date)} method accepts null dates, which stand for * undetermined position. * * @param begin the begin date, inclusive. * @param end the end date, inclusive. * @return the period. * @throws UnsupportedOperationException if the temporal factory is not available on the classpath. */ public static Period createPeriod(final Date begin, final Date end) throws UnsupportedOperationException { final TemporalFactory factory = getTemporalFactory(); return factory.createPeriod(createInstant(factory, begin), createInstant(factory, end)); } }
/** * Sets the temporal extent to the specified values. This convenience method creates a temporal * primitive for the given dates, then invokes {@link #setExtent(TemporalPrimitive)}. * * <p><b>Note:</b> this method is available only if the {@code sis-temporal} module is available on the classpath, * or any other module providing an implementation of the {@code TemporalFactory} interface.</p> * * @param startTime the start date and time for the content of the dataset, or {@code null} if none. * @param endTime the end date and time for the content of the dataset, or {@code null} if none. * @throws UnsupportedOperationException if no implementation of {@code TemporalFactory} has been found * on the classpath. */ public void setBounds(final Date startTime, final Date endTime) throws UnsupportedOperationException { TemporalPrimitive value = null; if (startTime != null || endTime != null) { if (endTime == null || endTime.equals(startTime)) { value = TemporalUtilities.createInstant(startTime); } else if (startTime == null) { value = TemporalUtilities.createInstant(endTime); } else { value = TemporalUtilities.createPeriod(startTime, endTime); } } setExtent(value); }
/** * Sets the temporal extent to the specified values. This convenience method creates a temporal * primitive for the given dates, then invokes {@link #setExtent(TemporalPrimitive)}. * * <p><b>Note:</b> this method is available only if the {@code sis-temporal} module is available on the classpath, * or any other module providing an implementation of the {@code TemporalFactory} interface.</p> * * @param startTime the start date and time for the content of the dataset, or {@code null} if none. * @param endTime the end date and time for the content of the dataset, or {@code null} if none. * @throws UnsupportedOperationException if no implementation of {@code TemporalFactory} has been found * on the classpath. */ public void setBounds(final Date startTime, final Date endTime) throws UnsupportedOperationException { TemporalPrimitive value = null; if (startTime != null || endTime != null) { if (endTime == null || endTime.equals(startTime)) { value = TemporalUtilities.createInstant(startTime); } else if (startTime == null) { value = TemporalUtilities.createInstant(endTime); } else { value = TemporalUtilities.createPeriod(startTime, endTime); } } setExtent(value); }
/** * Sets the value from the {@link TimeInstant}. * This method is called at unmarshalling-time by JAXB. * * @param instant the wrapper to set. */ public final void setTimeInstant(final TimeInstant instant) { metadata = null; // Cleaned first in case of failure. if (instant != null) { final Date position = XmlUtilities.toDate(Context.current(), instant.timePosition); if (position != null) try { metadata = TemporalUtilities.createInstant(position); instant.copyIdTo(metadata); } catch (UnsupportedOperationException e) { warningOccured("setTimeInstant", e); } } }
/** * Sets the value from the {@link TimeInstant}. * This method is called at unmarshalling-time by JAXB. * * @param instant the wrapper to set. */ public void setTimeInstant(final TimeInstant instant) { metadata = null; // Cleaned first in case of failure. if (instant != null) { final Date position = XmlUtilities.toDate(Context.current(), instant.timePosition); if (position != null) try { metadata = TemporalUtilities.createInstant(position); instant.copyIdTo(metadata); } catch (UnsupportedOperationException e) { warningOccured("setTimeInstant", e); } } }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(ProcessStep) */ public DefaultProcessStep(final ProcessStep object) { super(object); if (object != null) { description = object.getDescription(); rationale = object.getRationale(); stepDateTime = TemporalUtilities.createInstant(object.getDate()); processors = copyCollection(object.getProcessors(), ResponsibleParty.class); sources = copyCollection(object.getSources(), Source.class); outputs = copyCollection(object.getOutputs(), Source.class); processingInformation = object.getProcessingInformation(); reports = copyCollection(object.getReports(), ProcessStepReport.class); if (object instanceof DefaultProcessStep) { references = copyCollection(((DefaultProcessStep) object).getReferences(), Citation.class); scope = ((DefaultProcessStep) object).getScope(); } } }