org.ccsds.moims.mo.mpd.structures.StandingOrder Maven / Gradle / Ivy
The newest version!
package org.ccsds.moims.mo.mpd.structures;
/**
* A StandingOrder is a data structure that holds the details of a standing
* order. This includes a reference to the user who owns the product order,
* the product filter, how the products are to be delivered to the user and
* the current status of the order.
*/
public final class StandingOrder implements org.ccsds.moims.mo.mal.structures.Composite {
private static final long serialVersionUID = 2533274807173321L;
/**
* The TypeId of this Element as a long.
*/
public static final Long SHORT_FORM = 2533274807173321L;
/**
* The TypeId of this Element.
*/
public static final org.ccsds.moims.mo.mal.TypeId TYPE_ID = new org.ccsds.moims.mo.mal.TypeId(SHORT_FORM);
/**
* Reference to the user that is the owner of the product order.
*/
private org.ccsds.moims.mo.mal.structures.Identifier user;
/**
* Specifies the filter criteria for the standing order, including the product
* type and optional filters on product source and metadata parameters.
*/
private org.ccsds.moims.mo.mpd.structures.ProductFilter productFilter;
/**
* Period of time over which the standing order is required to be active.
*/
private org.ccsds.moims.mo.mpd.structures.TimeWindow validityPeriod;
/**
* Specifies how the product is to be delivered: via the service interface
* or by file transfer.
*/
private org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum deliveryMethod;
/**
* Delivery address for file transfer. Not required if deliveryMethod is
* SERVICE.
*/
private org.ccsds.moims.mo.mal.structures.URI deliverTo;
/**
* Any additional notes.
*/
private String comments;
/**
* Default constructor for StandingOrder.
*
*/
public StandingOrder() {
}
/**
* Constructor that initialises the values of the structure.
*
* @param user Reference to the user that is the owner of the product order.
* @param productFilter Specifies the filter criteria for the standing order,
* including the product type and optional filters on product source and metadata
* parameters.
* @param validityPeriod Period of time over which the standing order is required
* to be active.
* @param deliveryMethod Specifies how the product is to be delivered: via
* the service interface or by file transfer.
* @param deliverTo Delivery address for file transfer. Not required if deliveryMethod
* is SERVICE.
* @param comments Any additional notes.
*/
public StandingOrder(org.ccsds.moims.mo.mal.structures.Identifier user,
org.ccsds.moims.mo.mpd.structures.ProductFilter productFilter,
org.ccsds.moims.mo.mpd.structures.TimeWindow validityPeriod,
org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum deliveryMethod,
org.ccsds.moims.mo.mal.structures.URI deliverTo,
String comments) {
this.user = user;
this.productFilter = productFilter;
this.validityPeriod = validityPeriod;
this.deliveryMethod = deliveryMethod;
this.deliverTo = deliverTo;
this.comments = comments;
}
/**
* Constructor that initialises the non-nullable values of the structure.
*
* @param user Reference to the user that is the owner of the product order.
* @param deliveryMethod Specifies how the product is to be delivered: via
* the service interface or by file transfer.
* @param comments Any additional notes.
*/
public StandingOrder(org.ccsds.moims.mo.mal.structures.Identifier user,
org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum deliveryMethod,
String comments) {
this.user = user;
this.productFilter = null;
this.validityPeriod = null;
this.deliveryMethod = deliveryMethod;
this.deliverTo = null;
this.comments = comments;
}
/**
* Creates an instance of this type using the default constructor. It is a
* generic factory method.
*
* @return A new instance of this type with default field values.
*/
public org.ccsds.moims.mo.mal.structures.Element createElement() {
return new org.ccsds.moims.mo.mpd.structures.StandingOrder();
}
/**
* Returns the field user.
*
* @return The field user.
*/
public org.ccsds.moims.mo.mal.structures.Identifier getUser() {
return user;
}
/**
* Sets the field user.
*
* @param __newValue The new value.
*/
@Deprecated
public void setUser(org.ccsds.moims.mo.mal.structures.Identifier __newValue) {
user = __newValue;
}
/**
* Returns the field productFilter.
*
* @return The field productFilter.
*/
public org.ccsds.moims.mo.mpd.structures.ProductFilter getProductFilter() {
return productFilter;
}
/**
* Sets the field productFilter.
*
* @param __newValue The new value.
*/
@Deprecated
public void setProductFilter(org.ccsds.moims.mo.mpd.structures.ProductFilter __newValue) {
productFilter = __newValue;
}
/**
* Returns the field validityPeriod.
*
* @return The field validityPeriod.
*/
public org.ccsds.moims.mo.mpd.structures.TimeWindow getValidityPeriod() {
return validityPeriod;
}
/**
* Sets the field validityPeriod.
*
* @param __newValue The new value.
*/
@Deprecated
public void setValidityPeriod(org.ccsds.moims.mo.mpd.structures.TimeWindow __newValue) {
validityPeriod = __newValue;
}
/**
* Returns the field deliveryMethod.
*
* @return The field deliveryMethod.
*/
public org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum getDeliveryMethod() {
return deliveryMethod;
}
/**
* Sets the field deliveryMethod.
*
* @param __newValue The new value.
*/
@Deprecated
public void setDeliveryMethod(org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum __newValue) {
deliveryMethod = __newValue;
}
/**
* Returns the field deliverTo.
*
* @return The field deliverTo.
*/
public org.ccsds.moims.mo.mal.structures.URI getDeliverTo() {
return deliverTo;
}
/**
* Sets the field deliverTo.
*
* @param __newValue The new value.
*/
@Deprecated
public void setDeliverTo(org.ccsds.moims.mo.mal.structures.URI __newValue) {
deliverTo = __newValue;
}
/**
* Returns the field comments.
*
* @return The field comments.
*/
public String getComments() {
return comments;
}
/**
* Sets the field comments.
*
* @param __newValue The new value.
*/
@Deprecated
public void setComments(String __newValue) {
comments = __newValue;
}
/**
* Compares this object to the specified object. The result is true if and
* only if the argument is not null and is the same type that contains the
* same value as this object.
*
* @param obj The object to compare with.
* @return true if the objects are the same; false otherwise.
*/
public boolean equals(Object obj) {
if (obj instanceof StandingOrder) {
StandingOrder other = (StandingOrder) obj;
if (user == null) {
if (other.user != null) {
return false;
}
} else {
if (! user.equals(other.user)) {
return false;
}
}
if (productFilter == null) {
if (other.productFilter != null) {
return false;
}
} else {
if (! productFilter.equals(other.productFilter)) {
return false;
}
}
if (validityPeriod == null) {
if (other.validityPeriod != null) {
return false;
}
} else {
if (! validityPeriod.equals(other.validityPeriod)) {
return false;
}
}
if (deliveryMethod == null) {
if (other.deliveryMethod != null) {
return false;
}
} else {
if (! deliveryMethod.equals(other.deliveryMethod)) {
return false;
}
}
if (deliverTo == null) {
if (other.deliverTo != null) {
return false;
}
} else {
if (! deliverTo.equals(other.deliverTo)) {
return false;
}
}
if (comments == null) {
if (other.comments != null) {
return false;
}
} else {
if (! comments.equals(other.comments)) {
return false;
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object.
*
* @return a hash code value for this object.
*/
public int hashCode() {
int hash = 7;
hash = 83 * hash + (user != null ? user.hashCode() : 0);
hash = 83 * hash + (productFilter != null ? productFilter.hashCode() : 0);
hash = 83 * hash + (validityPeriod != null ? validityPeriod.hashCode() : 0);
hash = 83 * hash + (deliveryMethod != null ? deliveryMethod.hashCode() : 0);
hash = 83 * hash + (deliverTo != null ? deliverTo.hashCode() : 0);
hash = 83 * hash + (comments != null ? comments.hashCode() : 0);
return hash;
}
/**
* Returns a String object representing this type"s value.
*
* @return a string representation of the value of this object.
*/
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("(StandingOrder: ");
buf.append("user=");
buf.append(user);
buf.append(", productFilter=");
buf.append(productFilter);
buf.append(", validityPeriod=");
buf.append(validityPeriod);
buf.append(", deliveryMethod=");
buf.append(deliveryMethod);
buf.append(", deliverTo=");
buf.append(deliverTo);
buf.append(", comments=");
buf.append(comments);
buf.append(')');
return buf.toString();
}
/**
* Encodes the value of this object using the provided MALEncoder.
*
* @param encoder The encoder to use for encoding.
* @throws org.ccsds.moims.mo.mal.MALException if any encoding errors are
* detected.
*/
public void encode(org.ccsds.moims.mo.mal.MALEncoder encoder) throws org.ccsds.moims.mo.mal.MALException {
if (user == null) {
throw new org.ccsds.moims.mo.mal.MALException("The field 'user' cannot be null!");
}
if (deliveryMethod == null) {
throw new org.ccsds.moims.mo.mal.MALException("The field 'deliveryMethod' cannot be null!");
}
if (comments == null) {
throw new org.ccsds.moims.mo.mal.MALException("The field 'comments' cannot be null!");
}
encoder.encodeIdentifier(user);
encoder.encodeNullableElement(productFilter);
encoder.encodeNullableElement(validityPeriod);
encoder.encodeElement(deliveryMethod);
encoder.encodeNullableURI(deliverTo);
encoder.encodeString(comments);
}
/**
* Decodes the value of this object using the provided MALDecoder.
*
* @param decoder The decoder to use for decoding.
* @return Returns this object.
* @throws org.ccsds.moims.mo.mal.MALException if any decoding errors are
* detected.
*/
public org.ccsds.moims.mo.mal.structures.Element decode(org.ccsds.moims.mo.mal.MALDecoder decoder) throws org.ccsds.moims.mo.mal.MALException {
user = decoder.decodeIdentifier();
productFilter = (org.ccsds.moims.mo.mpd.structures.ProductFilter) decoder.decodeNullableElement(new org.ccsds.moims.mo.mpd.structures.ProductFilter());
validityPeriod = (org.ccsds.moims.mo.mpd.structures.TimeWindow) decoder.decodeNullableElement(new org.ccsds.moims.mo.mpd.structures.TimeWindow());
deliveryMethod = (org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum) decoder.decodeElement(org.ccsds.moims.mo.mpd.structures.DeliveryMethodEnum.SERVICE);
deliverTo = decoder.decodeNullableURI();
comments = decoder.decodeString();
return this;
}
/**
* Returns the TypeId of this element.
*
* @return The TypeId of this element.
*/
public org.ccsds.moims.mo.mal.TypeId getTypeId() {
return TYPE_ID;
}
}