Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1.  
  2. import java.io.Serializable;
  3. import java.math.BigDecimal;
  4.  
  5. import javax.persistence.Column;
  6. import javax.persistence.Entity;
  7. import javax.persistence.GeneratedValue;
  8. import javax.persistence.GenerationType;
  9. import javax.persistence.Id;
  10. import javax.persistence.Table;
  11.  
  12. import br.com.virilcorp.frentelite.balanca.BalancaEletronica;
  13. import br.com.virilcorp.frentelite.balanca.exception.PesoInstavelException;
  14. import br.com.virilcorp.frentelite.balanca.exception.PesoNegativoException;
  15. import br.com.virilcorp.frentelite.balanca.exception.SobreCargaPesoException;
  16. import br.com.virilcorp.frentelite.model.BaseModel;
  17. import br.com.virilcorp.frentelite.serialport.SerialPortConfig;
  18.  
  19. @Entity
  20. @Table(schema="configuracao")
  21. public class Balanca implements Serializable, SerialPortConfig, BaseModel, BalancaEletronica{
  22. private static final long serialVersionUID = -5116483091463066285L;
  23.  
  24. @Id
  25. @GeneratedValue(strategy=GenerationType.IDENTITY)
  26. private Integer id;
  27.  
  28. @Column
  29. private String serialPort;
  30.  
  31. @Column
  32. private Integer baudRate;
  33.  
  34. @Column
  35. private Integer dataBits;
  36.  
  37. @Column
  38. private Integer stopBits;
  39.  
  40. @Column
  41. private Integer parity;
  42.  
  43. @Column
  44. private Integer bytes;
  45.  
  46. @Column
  47. private Integer asciCode;
  48.  
  49. public Integer getId() {
  50. return id;
  51. }
  52. public void setId(Integer id) {
  53. this.id = id;
  54. }
  55. public String getSerialPort() {
  56. return serialPort;
  57. }
  58. public void setSerialPort(String serialPort) {
  59. this.serialPort = serialPort;
  60. }
  61. public Integer getBaudRate() {
  62. return baudRate;
  63. }
  64. public void setBaudRate(Integer baudRate) {
  65. this.baudRate = baudRate;
  66. }
  67. public Integer getDataBits() {
  68. return dataBits;
  69. }
  70. public void setDataBits(Integer dataBits) {
  71. this.dataBits = dataBits;
  72. }
  73. public Integer getStopBits() {
  74. return stopBits;
  75. }
  76. public void setStopBits(Integer stopBits) {
  77. this.stopBits = stopBits;
  78. }
  79. public Integer getParity() {
  80. return parity;
  81. }
  82. public void setParity(Integer parity) {
  83. this.parity = parity;
  84. }
  85. public Integer getBytes() {
  86. return bytes;
  87. }
  88. public void setBytes(Integer bytes) {
  89. this.bytes = bytes;
  90. }
  91. public Integer getAsciCode() {
  92. return asciCode;
  93. }
  94. public void setAsciCode(Integer asciCode) {
  95. this.asciCode = asciCode;
  96. }
  97. @Override
  98. public int hashCode() {
  99. final int prime = 31;
  100. int result = 1;
  101. result = prime * result + ((baudRate == null) ? 0 : baudRate.hashCode());
  102. result = prime * result + ((dataBits == null) ? 0 : dataBits.hashCode());
  103. result = prime * result + ((id == null) ? 0 : id.hashCode());
  104. result = prime * result + ((parity == null) ? 0 : parity.hashCode());
  105. result = prime * result + ((serialPort == null) ? 0 : serialPort.hashCode());
  106. result = prime * result + ((stopBits == null) ? 0 : stopBits.hashCode());
  107. return result;
  108. }
  109. @Override
  110. public boolean equals(Object obj) {
  111. if (this == obj)
  112. return true;
  113. if (obj == null)
  114. return false;
  115. if (getClass() != obj.getClass())
  116. return false;
  117. Balanca other = (Balanca) obj;
  118. if (baudRate == null) {
  119. if (other.baudRate != null)
  120. return false;
  121. } else if (!baudRate.equals(other.baudRate))
  122. return false;
  123. if (dataBits == null) {
  124. if (other.dataBits != null)
  125. return false;
  126. } else if (!dataBits.equals(other.dataBits))
  127. return false;
  128. if (id == null) {
  129. if (other.id != null)
  130. return false;
  131. } else if (!id.equals(other.id))
  132. return false;
  133. if (parity == null) {
  134. if (other.parity != null)
  135. return false;
  136. } else if (!parity.equals(other.parity))
  137. return false;
  138. if (serialPort == null) {
  139. if (other.serialPort != null)
  140. return false;
  141. } else if (!serialPort.equals(other.serialPort))
  142. return false;
  143. if (stopBits == null) {
  144. if (other.stopBits != null)
  145. return false;
  146. } else if (!stopBits.equals(other.stopBits))
  147. return false;
  148. return true;
  149. }
  150. @Override
  151. public void setBuffer(byte[] buffer) {
  152. // TODO Auto-generated method stub
  153.  
  154. }
  155. @Override
  156. public BigDecimal extrairPeso() throws PesoInstavelException, PesoNegativoException, SobreCargaPesoException {
  157. // TODO Auto-generated method stub
  158. return null;
  159. }
  160. @Override
  161. public void validar() throws PesoInstavelException, PesoNegativoException, SobreCargaPesoException {
  162. // TODO Auto-generated method stub
  163.  
  164. }
  165. @Override
  166. public byte[] getASCIIRequestHex() {
  167. // TODO Auto-generated method stub
  168. return null;
  169. }
  170. @Override
  171. public int getBytesSizeToRead() {
  172. // TODO Auto-generated method stub
  173. return 0;
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement