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

com.xero.api.XeroBadRequestException Maven / Gradle / Ivy

package com.xero.api;

import com.xero.models.payrollau.Timesheets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import com.xero.models.accounting.Element;
import com.xero.models.assets.FieldValidationErrorsElement;
import com.xero.models.bankfeeds.FeedConnection;
import com.xero.models.bankfeeds.FeedConnections;
import com.xero.models.bankfeeds.Statement;
import com.xero.models.bankfeeds.Statements;

import io.swagger.annotations.ApiModelProperty;

/** handle bad request exception  */
public class XeroBadRequestException extends XeroException {

    private static final long serialVersionUID = 1L;
    private Integer statusCode;
    private String type;
    private String message;
    private List elements = new ArrayList();
    private List statementItems = new ArrayList();
    private List feedConnectionItems = new ArrayList();
    private List fieldValidationErrorsElements = new ArrayList();
    private com.xero.models.payrolluk.Problem payrollUkProblem = new com.xero.models.payrolluk.Problem();
    private com.xero.models.payrollnz.Problem payrollNzProblem = new com.xero.models.payrollnz.Problem();
    private List employeeItems = new ArrayList();
    
    private List leaveApplicationItems = new ArrayList();
    private List payItemItems = new ArrayList();
    private List payrollCalendarItems = new ArrayList();
    private List superFundItems = new ArrayList();
    private List timesheetItems = new ArrayList();
    private List payRunItems = new ArrayList();
    
    /** XeroBadRequestException
    * @param objectType String object type being interacted with when the error was returned.
    * @param error Error object with details specific to accounting API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.accounting.Error error, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type(objectType);
        this.elements(error.getElements());
    }
    
    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param error Error object with details specific to Assets API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.assets.Error error, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.fieldValidationErrorsElements = error.getFieldValidationErrors();
    }
    
    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param error Statements object with details specific to Bank Feeds API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, Statements error, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.statementItems = error.getItems();
    }
    
    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param error FeedConnections object with details specific to Bank Feeds API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, FeedConnections error, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.feedConnectionItems = error.getItems();
    }
    
    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param problem Problem object with details specific to UK Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrolluk.Problem problem, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.payrollUkProblem = problem;
    }
    
    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param problem Problem object with details specific to NZ Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollnz.Problem problem, Exception e)  {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.payrollNzProblem = problem;
    }

    /** XeroBadRequestException   
    * @param objectType String object type being interacted with when the error was returned.
    * @param employees Employees object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.Employees employees, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.employeeItems = employees.getEmployees();
    }
    
    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param leaveApplications LeaveApplications object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.LeaveApplications leaveApplications, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.leaveApplicationItems = leaveApplications.getLeaveApplications();
    }

    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param payItems PayItems object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.PayItems payItems, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
    }
    
    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param payrollCalendars PayrollCalendars object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.PayrollCalendars payrollCalendars, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.payrollCalendarItems = payrollCalendars.getPayrollCalendars();
    }
    
    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param superFunds SuperFunds object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.SuperFunds superFunds, Exception e) {
        this.statusCode = 400;
        this.type = objectType;
        this.superFundItems = superFunds.getSuperFunds();
    }
    
    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param timesheets Timesheets object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.Timesheets timesheets, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.timesheetItems = timesheets.getTimesheets();
    }
    
    /** XeroBadRequestException 
    * @param objectType String object type being interacted with when the error was returned.
    * @param payRuns PayRuns object with details specific to AU Payroll API
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(String objectType, com.xero.models.payrollau.PayRuns payRuns, Exception e) {
        super(e);
        this.statusCode = 400;
        this.type = objectType;
        this.payRunItems = payRuns.getPayRuns();
    }

    /** XeroBadRequestException 
    * @param statusCode Integer the server status code returned.
    * @param message String with details about the exception
    */
    public XeroBadRequestException(Integer statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }

    /** XeroBadRequestException 
    * @param statusCode Integer the server status code returned.
    * @param message String with details about the exception
    * @param e Exception object with details about the original exception
    */
    public XeroBadRequestException(Integer statusCode, String message, Exception e) {
        super(message, e);
        this.statusCode = statusCode;
        this.message = message;
    }

    /** Init StatusCode
    * @param statusCode Integer the server status code returned
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException statusCode(Integer statusCode) {
      this.statusCode = statusCode;
      return this;
    }
 
     /**
     * Exception number
     * @return statusCode
    **/
    @ApiModelProperty(value = "Status Code")
    public Integer getStatusCode() {
      return statusCode;
    }

    /** Set StatusCode 
    * @param statusCode Integer the server status code returned
    */
    public void setStatusCode(Integer statusCode) {
      this.statusCode = statusCode;
    }

    /** Init Type 
    * @param type String the server status code returned
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException type(String type) {
      this.type = type;
      return this;
    }

     /**
     * Exception type
     * @return type
    **/
    @ApiModelProperty(value = "API set type")
    public String getType() {
      return type;
    }

    /** Set Type
    * @param type String the server status code returned
    */
    public void setType(String type) {
      this.type = type;
    }

    /** Init Message
    * @param message String with the details about the exception
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException message(String message) {
      this.message = message;
      return this;
    }

     /**
     * Exception message
     * @return message
    **/
    @ApiModelProperty(value = "Exception message")
    public String getMessage() {
      return message;
    }

    /** Set Message
    * @param message String with the details about the exception
    */
    public void setMessage(String message) {
      this.message = message;
    }

    /** Init Elements
    * @param elements List<Element> with the details about the exception
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException elements(List elements) {
      this.elements = elements;
      return this;
    }

    /** Add Elements 
    * @param elementsItem Element object with the details about the exception
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addElementsItem(Element elementsItem) {
      if (this.elements == null) {
        this.elements = new ArrayList();
      }
      this.elements.add(elementsItem);
      return this;
    }

     /**
     * Array of Elements of validation Errors
     * @return elements
    **/
    @ApiModelProperty(value = "Array of Elements of validation Errors")
    public List getElements() {
      return elements;
    }

    /** Set Elements 
    * @param elements List<Element> with the details about the exception
    */
    public void setElements(List elements) {
      this.elements = elements;
    }
    
    /** Init Statement Items 
    * @param statementItems List <Statement> a list of bank statements
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException statementItems(List statementItems) {
      this.statementItems = statementItems;
      return this;
    }
    
    /** Add Statement Items
    * @param item Statement object containing bank statement details
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addStatementItem(Statement item) {
      if (this.statementItems == null) {
        this.statementItems = new ArrayList();
      }
      this.statementItems.add(item);
      return this;
    }
    
    /**
    * Array of Statements Items of Errors Array
    * @return statementItems
    **/
    @ApiModelProperty(value = "Array of Statement Items with Errors Array")
    public List getStatementItems() {
      return statementItems;
    }
    
    /** Set Statement Items
    * @param statementItems List <Statement> a list of bank statements
    */
    public void setStatementItems(List statementItems) {
      this.statementItems = statementItems;
    }
    
    /** Init Feed Connection Items 
    * @param feedConnectionItems List <FeedConnection> a list of feed connections
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException feedConnectionItems(List feedConnectionItems) {
      this.feedConnectionItems = feedConnectionItems;
      return this;
    }
    
    /** Add Feed Connection Items 
    * @param item FeedConnection a list of feed connections
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addFeedConnectionItems(FeedConnection item) {
      if (this.feedConnectionItems == null) {
        this.feedConnectionItems = new ArrayList();
      }
      this.feedConnectionItems.add(item);
      return this;
    }
    
    /**
    * Array of FeedConnection of Errors Array
    * @return statementItems
    **/
    @ApiModelProperty(value = "Array of FeedConnection Items with Errors Array")
    public List getFeedConnectionItems() {
      return feedConnectionItems;
    }
    
    /** Set Feed Connection Items
    * @param feedConnectionItems List <FeedConnection> a list of feed connections
    */
    public void setFeedConnectionItems(List feedConnectionItems) {
      this.feedConnectionItems = feedConnectionItems;
    }
    
    /** Init Assets Field Validation Errors 
    * @param fieldValidationErrorsElements List <FieldValidationErrorsElement> a list of field validation errors
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException fieldValidationErrorsElements(List fieldValidationErrorsElements) {
      this.fieldValidationErrorsElements = fieldValidationErrorsElements;
      return this;
    }
    
    /** Add Assets Field Validation Errors 
    * @param element FieldValidationErrorsElement a list of field validation errors
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addFieldValidationErrorsElement(FieldValidationErrorsElement element) {
      if (this.fieldValidationErrorsElements == null) {
        this.fieldValidationErrorsElements = new ArrayList();
      }
      this.fieldValidationErrorsElements.add(element);
      return this;
    }
    
    /**
    * Array of Assets Errors Array
    * @return List<FieldValidationErrorsElement>
    **/
    @ApiModelProperty(value = "Array of FieldValidationErrorElement")
    public List getFieldValidationErrorsElements() {
      return fieldValidationErrorsElements;
    }
    
    /** Set Assets Field Validation Errors 
    * @param fieldValidationErrorsElements List <FieldValidationErrorsElement> a list of field validation errors
    */
    public void setFieldValidationErrorsElements(List fieldValidationErrorsElements) {
      this.fieldValidationErrorsElements = fieldValidationErrorsElements;
    }
    
    /** Init Payroll UK Problem 
    * @param problem the validation errors in UK Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException payrollUkProblem(com.xero.models.payrolluk.Problem problem) {
      this.payrollUkProblem = problem;
      return this;
    }
    
     /**
     * Exception type
     * @return com.xero.models.payrolluk.Problem
    **/
    @ApiModelProperty(value = "UK Payroll problem")
    public com.xero.models.payrolluk.Problem getPayrollUkProblem() {
      return payrollUkProblem;
    }
    
    /** Set Payroll UK Problem 
    * @param problem the validation errors in UK Payroll
    */
    public void setPayrollUkProblem(com.xero.models.payrolluk.Problem problem) {
      this.payrollUkProblem = problem;
    }
      
    /** Init Payroll NZ Problem 
    * @param problem the validation errors in NZ Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException payrollNzProblem(com.xero.models.payrollnz.Problem problem) {
      this.payrollNzProblem = problem;
      return this;
    }

    /**
     * Exception type
     * @return com.xero.models.payrollnz.Problem
    **/
    @ApiModelProperty(value = "NZ Payroll problem")
    public com.xero.models.payrollnz.Problem getPayrollNzProblem() {
      return payrollNzProblem;
    }

    /** Set Payroll NZ Problem 
    * @param problem the validation errors in NZ Payroll
    */
    public void setPayrollNzProblem(com.xero.models.payrollnz.Problem problem) {
      this.payrollNzProblem = problem;
    }

    /** Init Payroll AU Employee items 
    * @param employeeItems List <com.xero.models.payrollau.Employee> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException employeeItemsItems(List employeeItems) {
      this.employeeItems = employeeItems;
      return this;
    }
    
    /** Add Payroll AU Employee items 
    * @param item Employee with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addEmployeeItems(com.xero.models.payrollau.Employee item) {
      if (this.employeeItems == null) {
        this.employeeItems = new ArrayList();
      }
      this.employeeItems.add(item);
      return this;
    }
    
    /**
    * Array of FeedConnection of Errors Array
    * @return statementItems
    **/
    @ApiModelProperty(value = "Array of FeedConnection Items with Errors Array")
    public List getEmployeeItems() {
      return employeeItems;
    }

    /** Set Payroll AU Employee items 
    * @param employeeItems List <com.xero.models.payrollau.Employee> with validation errors in AU Payroll
    */
    public void setEmployeeItems(List employeeItems) {
      this.employeeItems = employeeItems;
    }
    
    /** Init Payroll AU PayItem items
    * @param payItemItems List <com.xero.models.payrollau.PayItem> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException payItemItems(List payItemItems) {
      this.payItemItems = payItemItems;
      return this;
    }
    
    /** Add Payroll AU PayItem items 
    * @param item com.xero.models.payrollau.PayItem with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addPayItemItems(com.xero.models.payrollau.PayItem item) {
      if (this.payItemItems == null) {
        this.payItemItems = new ArrayList();
      }
      this.payItemItems.add(item);
      return this;
    }
    
    /**
    * Array of PayItems with Validation Error Array
    * @return payItems
    **/
    @ApiModelProperty(value = "Array of PayItems with Validation Array")
    public List getPayItemItems() {
      return payItemItems;
    }
    
    /** Set Payroll AU PayItem items 
    * @param payItems List <com.xero.models.payrollau.PayItem> with validation errors in AU Payroll
    */
    public void setPayItemItems(List payItems) {
      this.payItemItems = payItems;
    }
    
    /** Init Payroll AU PayRun items 
    * @param payRunItems List <com.xero.models.payrollau.PayRun> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException payRunItems(List payRunItems) {
      this.payRunItems = payRunItems;
      return this;
    }
    
    /** Add Payroll AU PayRun items 
    * @param item com.xero.models.payrollau.PayRun with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addPayRunItems(com.xero.models.payrollau.PayRun item) {
      if (this.payRunItems == null) {
        this.payRunItems = new ArrayList();
      }
      this.payRunItems.add(item);
      return this;
    }
    
    /**
    * Array of PayRun with Validation Error Array
    * @return payRunItems
    **/
    @ApiModelProperty(value = "Array of PayRun with Validation Array")
    public List getPayRunItems() {
      return payRunItems;
    }
    
    /** Set Payroll AU PayRun items 
    * @param payRunItems List <com.xero.models.payrollau.PayRun> with validation errors in AU Payroll
    */
    public void setPayRunItems(List payRunItems) {
      this.payRunItems = payRunItems;
    }
    
    /** Init Payroll AU Calendar items 
    * @param payrollCalendarItems List <com.xero.models.payrollau.PayrollCalendar> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException payrollCalendarItems(List payrollCalendarItems) {
      this.payrollCalendarItems = payrollCalendarItems;
      return this;
    }
    
    /** Add Payroll AU Calendar items 
    * @param item com.xero.models.payrollau.PayrollCalendar with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addPayrollCalendarItems(com.xero.models.payrollau.PayrollCalendar item) {
      if (this.payrollCalendarItems == null) {
        this.payrollCalendarItems = new ArrayList();
      }
      this.payrollCalendarItems.add(item);
      return this;
    }
    
    /**
    * Array of PayrollCalendar with Validation Error Array
    * @return payrollCalendarItems
    **/
    @ApiModelProperty(value = "Array of PayrollCalendar with Validation Array")
    public List getPayrollCalendarItems() {
      return payrollCalendarItems;
    }
    
    /** Set Payroll AU Calendar items
    * @param payrollCalendarItems List <com.xero.models.payrollau.PayrollCalendar> with validation errors in AU Payroll
    */
    public void setPayrollCalendarItems(List payrollCalendarItems) {
      this.payrollCalendarItems = payrollCalendarItems;
    }
    
    
    /** Init Payroll AU SuperFund items 
    * @param superFundItems List <com.xero.models.payrollau.SuperFund> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException superFundItems(List superFundItems) {
      this.superFundItems = superFundItems;
      return this;
    }
    
    /** Add Payroll AU SuperFund items 
    * @param item com.xero.models.payrollau.SuperFund with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addSuperFundItems(com.xero.models.payrollau.SuperFund item) {
      if (this.superFundItems == null) {
        this.superFundItems = new ArrayList();
      }
      this.superFundItems.add(item);
      return this;
    }
    
    /**
    * Array of SuperFund with Validation Error Array
    * @return superFundItems
    **/
    @ApiModelProperty(value = "Array of SuperFund with Validation Array")
    public List getSuperFundItems() {
      return superFundItems;
    }
    
    /** Set Payroll AU SuperFund items 
    * @param superFundItems List <com.xero.models.payrollau.SuperFund> with validation errors in AU Payroll
    */
    public void setSuperFundItems(List superFundItems) {
      this.superFundItems = superFundItems;
    }
    
    /** Initilize Payroll AU Timesheet items 
    * @param timesheetItems List <com.xero.models.payrollau.Timesheet> with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException timesheetItems(List timesheetItems) {
      this.timesheetItems = timesheetItems;
      return this;
    }

    /** Add Payroll AU Timesheet items 
    * @param item com.xero.models.payrollau.Timesheet with validation errors in AU Payroll
    * @return XeroBadRequestException an instance the bad request exception  
    */
    public XeroBadRequestException addTimesheetItems(com.xero.models.payrollau.Timesheet item) {
      if (this.timesheetItems == null) {
        this.timesheetItems = new ArrayList();
      }
      this.timesheetItems.add(item);
      return this;
    }
    
    /**
    * Array of Timesheet with Validation Error Array
    * @return timesheetItems
    **/
    @ApiModelProperty(value = "Array of Timesheet with Validation Array")
    public List getTimesheetItems() {
      return timesheetItems;
    }
    
    /** Set Payroll AU Timesheet items 
    * @param timesheetItems List <com.xero.models.payrollau.Timesheet> with validation errors in AU Payroll
    **/
    public void setTimesheetItems(List timesheetItems) {
      this.timesheetItems = timesheetItems;
    }
      
    @Override
    public boolean equals(java.lang.Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      XeroBadRequestException error = (XeroBadRequestException) o;
      return Objects.equals(this.statusCode, error.statusCode) &&
          Objects.equals(this.type, error.type) &&
          Objects.equals(this.message, error.message) &&
          Objects.equals(this.elements, error.elements);
    }

    @Override
    public int hashCode() {
      return Objects.hash(statusCode, type, message);  //, elements
    }


    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class Error {\n");
      sb.append("    statusCode: ").append(toIndentedString(statusCode)).append("\n");
      sb.append("    type: ").append(toIndentedString(type)).append("\n");
      sb.append("    message: ").append(toIndentedString(message)).append("\n");
      sb.append("    elements: ").append(toIndentedString(elements)).append("\n");
      sb.append("}");
      return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
      if (o == null) {
        return "null";
      }
      return o.toString().replace("\n", "\n    ");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy