All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vendasta.salesorders.v1.internal.DeclineSalesOrderRequest Maven / Gradle / Ivy

The newest version!
package com.vendasta.salesorders.v1.internal;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import com.vendasta.salesorders.v1.generated.ApiProto;

/**
 * Request for declining a order
 **/
public final class DeclineSalesOrderRequest {




	private final String orderId;
	private final String businessId;
	private final String declinedReason;
	

	private DeclineSalesOrderRequest (
		final String orderId,
		final String businessId,
		final String declinedReason)
		
	{
		this.orderId = orderId;
		this.businessId = businessId;
		this.declinedReason = declinedReason;
		
	}
	
	/**
	 * Unique identifier of an order
      * @return The final value of orderId on the object
	 **/
	public String getOrderId() {
		return this.orderId;
	}
	
	/**
	 * The business the order belongs to
      * @return The final value of businessId on the object
	 **/
	public String getBusinessId() {
		return this.businessId;
	}
	
	/**
	 * Reason to why the order is declined
      * @return The final value of declinedReason on the object
	 **/
	public String getDeclinedReason() {
		return this.declinedReason;
	}
	

	public static class Builder {
		private String orderId;
		private String businessId;
		private String declinedReason;
		
		public Builder() {
			this.orderId = "";
			this.businessId = "";
			this.declinedReason = "";
			
		}
		
		/**
		  * Adds a value to the builder for orderId
		  * @param orderId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setOrderId(String orderId) {
			this.orderId = orderId;
			return this;
		}
		
		/**
		  * Adds a value to the builder for businessId
		  * @param businessId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setBusinessId(String businessId) {
			this.businessId = businessId;
			return this;
		}
		
		/**
		  * Adds a value to the builder for declinedReason
		  * @param declinedReason Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setDeclinedReason(String declinedReason) {
			this.declinedReason = declinedReason;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the DeclineSalesOrderRequest class
		  * @return The instantiated final DeclineSalesOrderRequest
		 **/
		public DeclineSalesOrderRequest build() {
			return new DeclineSalesOrderRequest(
				this.orderId,
				this.businessId,
				this.declinedReason);
		}
	}

	/**
	 * Returns a Builder for DeclineSalesOrderRequest, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable DeclineSalesOrderRequest object using the
	 * build function.
	 * @return A fresh Builder instance with no values set
	 **/
	public static Builder newBuilder() {
		return new Builder();
	}

	/**
	 * Provides a human-readable representation of this object.  Useful for debugging.
	 * @return A string representation of the DeclineSalesOrderRequest instance
	 **/
	 public String toString() {
		 String result = "DeclineSalesOrderRequest\n";
		 result += "-> orderId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.orderId).split("\n"))) + "\n"; 
		 result += "-> businessId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.businessId).split("\n"))) + "\n"; 
		 result += "-> declinedReason: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.declinedReason).split("\n"))) + "\n"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* DeclineSalesOrderRequest, which is much more usable.
	* @return An instance of DeclineSalesOrderRequest representing the input proto object
	**/
	public static DeclineSalesOrderRequest fromProto(ApiProto.DeclineSalesOrderRequest proto) {
		DeclineSalesOrderRequest out = null;
		if (proto != null) {
			DeclineSalesOrderRequest.Builder outBuilder = DeclineSalesOrderRequest.newBuilder()
			.setOrderId(proto.getOrderId())
			.setBusinessId(proto.getBusinessId())
			.setDeclinedReason(proto.getDeclinedReason());
			out = outBuilder.build();
		}
		return out;
	}

	/**
	* Convenience method for handling lists of proto objects.  It calls .fromProto on each one
	* and returns a list of the converted results.
	* @return A list of DeclineSalesOrderRequest instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.DeclineSalesOrderRequest proto : protos) {
			out.add(DeclineSalesOrderRequest.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.DeclineSalesOrderRequest which is a proto object ready for wire transmission
	 **/
	 public ApiProto.DeclineSalesOrderRequest toProto() {
		 DeclineSalesOrderRequest obj = this;
		 ApiProto.DeclineSalesOrderRequest.Builder outBuilder = ApiProto.DeclineSalesOrderRequest.newBuilder();
		 outBuilder.setOrderId(obj.getOrderId());
		 outBuilder.setBusinessId(obj.getBusinessId());
		 outBuilder.setDeclinedReason(obj.getDeclinedReason());
		 return outBuilder.build();
	 }

	 /**
	  * Convenience method for handling lists of objects.  It calls .toProto on each one and
	  * returns a list of the converted results.
	  * @return A list of ApiProto.DeclineSalesOrderRequest instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (DeclineSalesOrderRequest obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy