Biblioteca Java - Rev 9
Subversion Repositories:
(root)/Spring/SpringWebMVC/InventoryHibernate/src/main/java/com/linkscreens/inventory/entity/InventoryItem.java @ 14
package com.linkscreens.inventory.entity;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* Entity for inventory item with JPA annotations.
*/
@Entity
@Table(name="inventar")
public class InventoryItem implements Comparable<InventoryItem> {
public InventoryItem(){}
public InventoryItem(String total, String cont) {
this.valoare = BigDecimal.ZERO;
this.amortizarePrecedenta = BigDecimal.ZERO;
this.amortizareCurenta = BigDecimal.ZERO;
this.amortizareTotala = BigDecimal.ZERO;
this.valoareRamasa = BigDecimal.ZERO;
this.setMijlocFix(total);
this.setSimbolClasaMijlocFix(total);
this.setCont(cont);
this.setAnLunaAdaugare(total);
this.setAnLunaPrimaRata(total);
}
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private Long nrCrt;
private String simbolClasaMijlocFix;
private String mijlocFix;
private String nrInventar;
private String cont;
private Integer cantitate;
private String UM;
private BigDecimal pret;
private BigDecimal valoare;
private BigDecimal amortizarePrecedenta;
private BigDecimal amortizareCurenta;
private BigDecimal amortizareTotala;
private BigDecimal valoareRamasa;
private Integer durataNormala;
private Integer durataRamasa;
private String anLunaPrimaRata;
@NotNull
private String anLunaAdaugare;
private Boolean deleted;
@Transient
private String lunaPrimaRata;
@Transient
private String anPrimaRata;
@Transient
private String lunaAdaugare;
@Transient
private String anAdaugare;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getNrCrt() {
return nrCrt;
}
public void setNrCrt(Long nrCrt) {
this.nrCrt = nrCrt;
}
public String getSimbolClasaMijlocFix() {
return simbolClasaMijlocFix;
}
public void setSimbolClasaMijlocFix(String simbolClasaMijlocFix) {
this.simbolClasaMijlocFix = simbolClasaMijlocFix;
}
public String getMijlocFix() {
return mijlocFix;
}
public void setMijlocFix(String mijlocFix) {
this.mijlocFix = mijlocFix;
}
public String getNrInventar() {
return nrInventar;
}
public void setNrInventar(String nrInventar) {
this.nrInventar = nrInventar;
}
public String getCont() {
return cont;
}
public void setCont(String cont) {
this.cont = cont;
}
public Integer getCantitate() {
return cantitate;
}
public void setCantitate(Integer cantitate) {
this.cantitate = cantitate;
}
public String getUM() {
return UM;
}
public void setUM(String UM) {
this.UM = UM;
}
public BigDecimal getPret() {
return pret;
}
public void setPret(BigDecimal pret) {
this.pret = pret;
}
public BigDecimal getValoare() {
return valoare;
}
public void setValoare(BigDecimal valoare) {
this.valoare = valoare;
}
public BigDecimal getAmortizarePrecedenta() {
return amortizarePrecedenta;
}
public void setAmortizarePrecedenta(BigDecimal amortizarePrecedenta) {
this.amortizarePrecedenta = amortizarePrecedenta;
}
public BigDecimal getAmortizareCurenta() {
return amortizareCurenta;
}
public void setAmortizareCurenta(BigDecimal amortizareCurenta) {
this.amortizareCurenta = amortizareCurenta;
}
public BigDecimal getAmortizareTotala() {
return amortizareTotala;
}
public void setAmortizareTotala(BigDecimal amortizareTotala) {
this.amortizareTotala = amortizareTotala;
}
public BigDecimal getValoareRamasa() {
return valoareRamasa;
}
public void setValoareRamasa(BigDecimal valoareRamasa) {
this.valoareRamasa = valoareRamasa;
}
public Integer getDurataNormala() {
return durataNormala;
}
public void setDurataNormala(Integer durataNormala) {
this.durataNormala = durataNormala;
}
public Integer getDurataRamasa() {
return durataRamasa;
}
public void setDurataRamasa(Integer durataRamasa) {
this.durataRamasa = durataRamasa;
}
public String getAnLunaPrimaRata() {
return anLunaPrimaRata;
}
public void setAnLunaPrimaRata(String anLunaPrimaRata) {
this.anLunaPrimaRata = anLunaPrimaRata;
}
public String getAnLunaAdaugare() {
return anLunaAdaugare;
}
public void setAnLunaAdaugare(String anLunaAdaugare) {
this.anLunaAdaugare = anLunaAdaugare;
}
public Boolean getDeleted() {
return deleted;
}
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
@Transient
public String getLunaPrimaRata() {
return lunaPrimaRata;
}
public void setLunaPrimaRata(String lunaPrimaRata) {
this.lunaPrimaRata = lunaPrimaRata;
}
@Transient
public String getAnPrimaRata() {
return anPrimaRata;
}
public void setAnPrimaRata(String anPrimaRata) {
this.anPrimaRata = anPrimaRata;
}
@Transient
public String getLunaAdaugare() {
return lunaAdaugare;
}
public void setLunaAdaugare(String lunaAdaugare) {
this.lunaAdaugare = lunaAdaugare;
}
@Transient
public String getAnAdaugare() {
return anAdaugare;
}
public void setAnAdaugare(String anAdaugare) {
this.anAdaugare = anAdaugare;
}
@Override
public String toString(){
return "id="+id+", nrCrt="+nrCrt+", symbol="+simbolClasaMijlocFix;
}
@Override
public int compareTo(InventoryItem other) {
if (!this.anLunaAdaugare.equals(other.anLunaAdaugare)) {
return this.anLunaAdaugare.compareTo(other.anLunaAdaugare);
} else if (!this.getCont().equals(other.getCont())) {
return this.getCont().compareTo(other.getCont());
} else if (!this.getValoare().equals(other.getValoare())) {
return this.getValoare().compareTo(other.getValoare());
}
return 0;
}
}
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* Entity for inventory item with JPA annotations.
*/
@Entity
@Table(name="inventar")
public class InventoryItem implements Comparable<InventoryItem> {
public InventoryItem(){}
public InventoryItem(String total, String cont) {
this.valoare = BigDecimal.ZERO;
this.amortizarePrecedenta = BigDecimal.ZERO;
this.amortizareCurenta = BigDecimal.ZERO;
this.amortizareTotala = BigDecimal.ZERO;
this.valoareRamasa = BigDecimal.ZERO;
this.setMijlocFix(total);
this.setSimbolClasaMijlocFix(total);
this.setCont(cont);
this.setAnLunaAdaugare(total);
this.setAnLunaPrimaRata(total);
}
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private Long nrCrt;
private String simbolClasaMijlocFix;
private String mijlocFix;
private String nrInventar;
private String cont;
private Integer cantitate;
private String UM;
private BigDecimal pret;
private BigDecimal valoare;
private BigDecimal amortizarePrecedenta;
private BigDecimal amortizareCurenta;
private BigDecimal amortizareTotala;
private BigDecimal valoareRamasa;
private Integer durataNormala;
private Integer durataRamasa;
private String anLunaPrimaRata;
@NotNull
private String anLunaAdaugare;
private Boolean deleted;
@Transient
private String lunaPrimaRata;
@Transient
private String anPrimaRata;
@Transient
private String lunaAdaugare;
@Transient
private String anAdaugare;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getNrCrt() {
return nrCrt;
}
public void setNrCrt(Long nrCrt) {
this.nrCrt = nrCrt;
}
public String getSimbolClasaMijlocFix() {
return simbolClasaMijlocFix;
}
public void setSimbolClasaMijlocFix(String simbolClasaMijlocFix) {
this.simbolClasaMijlocFix = simbolClasaMijlocFix;
}
public String getMijlocFix() {
return mijlocFix;
}
public void setMijlocFix(String mijlocFix) {
this.mijlocFix = mijlocFix;
}
public String getNrInventar() {
return nrInventar;
}
public void setNrInventar(String nrInventar) {
this.nrInventar = nrInventar;
}
public String getCont() {
return cont;
}
public void setCont(String cont) {
this.cont = cont;
}
public Integer getCantitate() {
return cantitate;
}
public void setCantitate(Integer cantitate) {
this.cantitate = cantitate;
}
public String getUM() {
return UM;
}
public void setUM(String UM) {
this.UM = UM;
}
public BigDecimal getPret() {
return pret;
}
public void setPret(BigDecimal pret) {
this.pret = pret;
}
public BigDecimal getValoare() {
return valoare;
}
public void setValoare(BigDecimal valoare) {
this.valoare = valoare;
}
public BigDecimal getAmortizarePrecedenta() {
return amortizarePrecedenta;
}
public void setAmortizarePrecedenta(BigDecimal amortizarePrecedenta) {
this.amortizarePrecedenta = amortizarePrecedenta;
}
public BigDecimal getAmortizareCurenta() {
return amortizareCurenta;
}
public void setAmortizareCurenta(BigDecimal amortizareCurenta) {
this.amortizareCurenta = amortizareCurenta;
}
public BigDecimal getAmortizareTotala() {
return amortizareTotala;
}
public void setAmortizareTotala(BigDecimal amortizareTotala) {
this.amortizareTotala = amortizareTotala;
}
public BigDecimal getValoareRamasa() {
return valoareRamasa;
}
public void setValoareRamasa(BigDecimal valoareRamasa) {
this.valoareRamasa = valoareRamasa;
}
public Integer getDurataNormala() {
return durataNormala;
}
public void setDurataNormala(Integer durataNormala) {
this.durataNormala = durataNormala;
}
public Integer getDurataRamasa() {
return durataRamasa;
}
public void setDurataRamasa(Integer durataRamasa) {
this.durataRamasa = durataRamasa;
}
public String getAnLunaPrimaRata() {
return anLunaPrimaRata;
}
public void setAnLunaPrimaRata(String anLunaPrimaRata) {
this.anLunaPrimaRata = anLunaPrimaRata;
}
public String getAnLunaAdaugare() {
return anLunaAdaugare;
}
public void setAnLunaAdaugare(String anLunaAdaugare) {
this.anLunaAdaugare = anLunaAdaugare;
}
public Boolean getDeleted() {
return deleted;
}
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
@Transient
public String getLunaPrimaRata() {
return lunaPrimaRata;
}
public void setLunaPrimaRata(String lunaPrimaRata) {
this.lunaPrimaRata = lunaPrimaRata;
}
@Transient
public String getAnPrimaRata() {
return anPrimaRata;
}
public void setAnPrimaRata(String anPrimaRata) {
this.anPrimaRata = anPrimaRata;
}
@Transient
public String getLunaAdaugare() {
return lunaAdaugare;
}
public void setLunaAdaugare(String lunaAdaugare) {
this.lunaAdaugare = lunaAdaugare;
}
@Transient
public String getAnAdaugare() {
return anAdaugare;
}
public void setAnAdaugare(String anAdaugare) {
this.anAdaugare = anAdaugare;
}
@Override
public String toString(){
return "id="+id+", nrCrt="+nrCrt+", symbol="+simbolClasaMijlocFix;
}
@Override
public int compareTo(InventoryItem other) {
if (!this.anLunaAdaugare.equals(other.anLunaAdaugare)) {
return this.anLunaAdaugare.compareTo(other.anLunaAdaugare);
} else if (!this.getCont().equals(other.getCont())) {
return this.getCont().compareTo(other.getCont());
} else if (!this.getValoare().equals(other.getValoare())) {
return this.getValoare().compareTo(other.getValoare());
}
return 0;
}
}