Libro.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. package org.django.acquabooks.pojos;
  2. import io.searchbox.annotations.JestId;
  3. import java.util.Date;
  4. public class Libro{
  5. @JestId
  6. private String barcode;
  7. private String titolo;
  8. private String autore;
  9. private String editore;
  10. private String tag;
  11. private Double prezzo;
  12. private Double sconto;
  13. private Double percentuale;
  14. private Integer qa;
  15. private Integer qv;
  16. private Long ultimoAggiornamento;
  17. /**
  18. * @return the editore
  19. */
  20. public String getEditore() {
  21. return editore;
  22. }
  23. /**
  24. * @param editore the editore to set
  25. */
  26. public void setEditore(String editore) {
  27. this.editore = editore;
  28. }
  29. public String getTag() {
  30. return tag;
  31. }
  32. public void setTag(String tag) {
  33. this.tag = tag;
  34. }
  35. @Override
  36. public String toString() {
  37. return "Libro [barcode=" + barcode + ", editore=" + editore + ", titolo=" + titolo + ", autore="
  38. + autore + ", tag=" + tag + ", prezzo=" + prezzo + ", sconto=" + prezzo
  39. + ", percentuale=" + percentuale + ", qa=" + qa + ", qv=" + qv
  40. + "]";
  41. }
  42. /**
  43. * @return the barcode
  44. */
  45. public String getBarcode() {
  46. return barcode;
  47. }
  48. /**
  49. * @param barcode the barcode to set
  50. */
  51. public void setBarcode(String barcode) {
  52. this.barcode = barcode;
  53. }
  54. /**
  55. * @return the titolo
  56. */
  57. public String getTitolo() {
  58. return titolo;
  59. }
  60. /**
  61. * @param titolo the titolo to set
  62. */
  63. public void setTitolo(String titolo) {
  64. this.titolo = titolo;
  65. }
  66. /**
  67. * @return the autore
  68. */
  69. public String getAutore() {
  70. return autore;
  71. }
  72. /**
  73. * @param autore the autore to set
  74. */
  75. public void setAutore(String autore) {
  76. this.autore = autore;
  77. }
  78. /**
  79. * @return the prezzo
  80. */
  81. public Double getPrezzo() {
  82. return prezzo!=null?prezzo:-9999;
  83. }
  84. /**
  85. * @param prezzo the prezzo to set
  86. */
  87. public void setPrezzo(Double prezzo) {
  88. this.prezzo = prezzo;
  89. }
  90. /**
  91. * @return the percentuale
  92. */
  93. public Double getPercentuale() {
  94. return percentuale;
  95. }
  96. /**
  97. * @param percentuale the percentuale to set
  98. */
  99. public void setPercentuale(Double percentuale) {
  100. this.percentuale = percentuale;
  101. }
  102. /**
  103. * @return the qa
  104. */
  105. public Integer getQa() {
  106. return qa;
  107. }
  108. /**
  109. * @param qa the qa to set
  110. */
  111. public void setQa(Integer qa) {
  112. this.qa = qa;
  113. }
  114. /**
  115. * @return the qv
  116. */
  117. public Integer getQv() {
  118. return qv;
  119. }
  120. /**
  121. * @param qv the qv to set
  122. */
  123. public void setQv(Integer qv) {
  124. this.qv = qv;
  125. }
  126. public void incrementaVenduto(int amount){
  127. this.setQv(this.getQv()+ amount);
  128. }
  129. public Double getSconto() {
  130. if(sconto == null){
  131. sconto = 0D;
  132. }
  133. return sconto;
  134. }
  135. public void setSconto(Double sconto) {
  136. this.sconto = sconto;
  137. }
  138. public Double getPrezzoScontato(){
  139. return getPrezzo() - (getPrezzo() * getSconto());
  140. }
  141. public Long getUltimoAggiornamento() {
  142. return ultimoAggiornamento;
  143. }
  144. public void setUltimoAggiornamento(Long ultimoAggiornamento) {
  145. this.ultimoAggiornamento = ultimoAggiornamento;
  146. }
  147. }