Rev 296 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 296 | espaco | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import javax.persistence.Transient; |
||
| 4 | |||
| 5 | import br.com.ec.core.util.VerificadorUtil; |
||
| 319 | espaco | 6 | import br.com.ec.domain.model.IndicadorDRE; |
| 296 | espaco | 7 | import br.com.ec.domain.shared.ConstantesSEC; |
| 8 | |||
| 9 | public class IndicadorDreDTO implements Cloneable { |
||
| 10 | |||
| 11 | private Long codigo; |
||
| 12 | private String descricao; |
||
| 13 | private Integer numeroOrdem; |
||
| 14 | private Boolean ativo; |
||
| 15 | |||
| 16 | private Double valorTotal; |
||
| 17 | private Double margem; |
||
| 18 | private String observacao; |
||
| 19 | |||
| 20 | public IndicadorDreDTO() {} |
||
| 21 | |||
| 22 | public IndicadorDreDTO(Long codigo, String descricao) { |
||
| 23 | super(); |
||
| 24 | this.codigo = codigo; |
||
| 25 | this.descricao = descricao; |
||
| 26 | } |
||
| 27 | |||
| 28 | public IndicadorDreDTO(Long codigo, String descricao, Integer numeroOrdem, Boolean ativo, Double valorTotal, |
||
| 29 | Double margem, String observacao) { |
||
| 30 | super(); |
||
| 31 | this.codigo = codigo; |
||
| 32 | this.descricao = descricao; |
||
| 33 | this.numeroOrdem = numeroOrdem; |
||
| 34 | this.ativo = ativo; |
||
| 35 | this.valorTotal = valorTotal; |
||
| 36 | this.margem = margem; |
||
| 37 | this.observacao = observacao; |
||
| 38 | } |
||
| 39 | |||
| 40 | public Long getCodigo() { |
||
| 41 | return codigo; |
||
| 42 | } |
||
| 43 | public void setCodigo(Long codigo) { |
||
| 44 | this.codigo = codigo; |
||
| 45 | } |
||
| 46 | |||
| 47 | public String getDescricao() { |
||
| 48 | return descricao; |
||
| 49 | } |
||
| 50 | public void setDescricao(String descricao) { |
||
| 51 | this.descricao = descricao; |
||
| 52 | } |
||
| 53 | |||
| 54 | public Integer getNumeroOrdem() { |
||
| 55 | return numeroOrdem; |
||
| 56 | } |
||
| 57 | public void setNumeroOrdem(Integer numeroOrdem) { |
||
| 58 | this.numeroOrdem = numeroOrdem; |
||
| 59 | } |
||
| 60 | |||
| 61 | public Boolean getAtivo() { |
||
| 62 | return ativo; |
||
| 63 | } |
||
| 64 | public void setAtivo(Boolean ativo) { |
||
| 65 | this.ativo = ativo; |
||
| 66 | } |
||
| 67 | |||
| 68 | public Double getValorTotal() { |
||
| 69 | return valorTotal; |
||
| 70 | } |
||
| 71 | public void setValorTotal(Double valorTotal) { |
||
| 72 | this.valorTotal = valorTotal; |
||
| 73 | } |
||
| 74 | |||
| 75 | public Double getMargem() { |
||
| 76 | return margem; |
||
| 77 | } |
||
| 78 | public void setMargem(Double margem) { |
||
| 79 | this.margem = margem; |
||
| 80 | } |
||
| 81 | |||
| 82 | public String getObservacao() { |
||
| 83 | return observacao; |
||
| 84 | } |
||
| 85 | public void setObservacao(String observacao) { |
||
| 86 | this.observacao = observacao; |
||
| 87 | } |
||
| 88 | |||
| 89 | @Transient |
||
| 90 | public String corIndicador() { |
||
| 91 | if (VerificadorUtil.naoEstaNulo(getCodigo())) { |
||
| 92 | if (getCodigo().equals(ConstantesSEC.DRE.RECEITA_OPERACIONAL_BRUTA_1)) { |
||
| 93 | return "green"; |
||
| 94 | } else { |
||
| 95 | if (getValorTotal() >= 0.0) { |
||
| 96 | return "red"; |
||
| 97 | } else { |
||
| 98 | return "green"; |
||
| 99 | } |
||
| 100 | } |
||
| 101 | } else { |
||
| 102 | if (getValorTotal() >= 0.0) { |
||
| 103 | return "green"; |
||
| 104 | } else { |
||
| 105 | return "red"; |
||
| 106 | } |
||
| 107 | } |
||
| 108 | } |
||
| 109 | |||
| 110 | @Override |
||
| 111 | public IndicadorDreDTO clone() throws CloneNotSupportedException { |
||
| 112 | return (IndicadorDreDTO) super.clone(); |
||
| 113 | } |
||
| 114 | |||
| 115 | @Override |
||
| 116 | public int hashCode() { |
||
| 117 | final int prime = 31; |
||
| 118 | int result = 1; |
||
| 119 | result = prime * result |
||
| 120 | + ((codigo == null) ? 0 : codigo.hashCode()); |
||
| 121 | return result; |
||
| 122 | } |
||
| 123 | |||
| 124 | @Override |
||
| 125 | public boolean equals(Object obj) { |
||
| 126 | if (this == obj) |
||
| 127 | return true; |
||
| 128 | if (obj == null) |
||
| 129 | return false; |
||
| 130 | if (getClass() != obj.getClass()) |
||
| 131 | return false; |
||
| 132 | IndicadorDreDTO other = (IndicadorDreDTO) obj; |
||
| 133 | if (codigo == null) { |
||
| 134 | if (other.codigo != null) |
||
| 135 | return false; |
||
| 136 | } else if (!codigo.equals(other.codigo)) |
||
| 137 | return false; |
||
| 138 | return true; |
||
| 139 | } |
||
| 140 | |||
| 141 | } |