Rev 231 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 231 | Rev 235 | ||
|---|---|---|---|
| Line 27... | Line 27... | ||
| 27 | import br.com.ec.core.interfaces.Alterar; |
27 | import br.com.ec.core.interfaces.Alterar; |
| 28 | import br.com.ec.core.interfaces.Cadastrar; |
28 | import br.com.ec.core.interfaces.Cadastrar; |
| 29 | import br.com.ec.core.util.DataUtils; |
29 | import br.com.ec.core.util.DataUtils; |
| 30 | import br.com.ec.core.util.VerificadorUtil; |
30 | import br.com.ec.core.util.VerificadorUtil; |
| 31 | import br.com.ec.domain.dto.TransferenciaProdutoDTO; |
31 | import br.com.ec.domain.dto.TransferenciaProdutoDTO; |
| - | 32 | import br.com.ec.domain.model.tipos.TipoProduto; |
|
| 32 | 33 | ||
| 33 | @Entity |
34 | @Entity |
| 34 | @Table(name="sec_transferencia", schema="sc_sec") |
35 | @Table(name="sec_transferencia", schema="sc_sec") |
| 35 | public class Transferencia implements Serializable, Identidade { |
36 | public class Transferencia implements Serializable, Identidade { |
| 36 | 37 | ||
| Line 266... | Line 267... | ||
| 266 | }
|
267 | }
|
| 267 | return false; |
268 | return false; |
| 268 | }
|
269 | }
|
| 269 | 270 | ||
| 270 | @Transient |
271 | @Transient |
| 271 | public Integer quantidadeProdutos() { |
- | |
| - | 272 | private Integer quantidadeProdutos(String tipoProduto) { |
|
| 272 | Integer quantidadeTotal = 0; |
273 | Integer quantidadeTotal = 0; |
| 273 | if (VerificadorUtil.naoEstaNuloOuVazio(getProdutosDTO())) { |
274 | if (VerificadorUtil.naoEstaNuloOuVazio(getProdutosDTO())) { |
| 274 | for (TransferenciaProdutoDTO transferenciaProduto : getProdutosDTO()) { |
275 | for (TransferenciaProdutoDTO transferenciaProduto : getProdutosDTO()) { |
| 275 | if (transferenciaProduto.ehTipoProdutoCapa()) { |
- | |
| - | 276 | if (transferenciaProduto.ehTipoProduto(tipoProduto)) { |
|
| - | 277 | quantidadeTotal = quantidadeTotal + transferenciaProduto.getQuantidade(); |
|
| - | 278 | }
|
|
| - | 279 | }
|
|
| - | 280 | }
|
|
| - | 281 | return quantidadeTotal; |
|
| - | 282 | }
|
|
| - | 283 | ||
| - | 284 | @Transient |
|
| - | 285 | public Integer quantidadeProdutosTipoCapa() { |
|
| - | 286 | return quantidadeProdutos(TipoProduto.CAPA.getValor()); |
|
| - | 287 | }
|
|
| - | 288 | ||
| - | 289 | @Transient |
|
| - | 290 | public Integer quantidadeProdutosTipoPelicula() { |
|
| - | 291 | return quantidadeProdutos(TipoProduto.PELICULA.getValor()); |
|
| - | 292 | }
|
|
| - | 293 | ||
| - | 294 | @Transient |
|
| - | 295 | public Integer quantidadeProdutosTipoOutrosExcetoCapaEePelicula() { |
|
| - | 296 | Integer quantidadeTotal = 0; |
|
| - | 297 | if (VerificadorUtil.naoEstaNuloOuVazio(getProdutosDTO())) { |
|
| - | 298 | for (TransferenciaProdutoDTO transferenciaProduto : getProdutosDTO()) { |
|
| - | 299 | if (!transferenciaProduto.ehTipoProduto(TipoProduto.CAPA.getValor()) && |
|
| - | 300 | !transferenciaProduto.ehTipoProduto(TipoProduto.PELICULA.getValor())) { |
|
| 276 | quantidadeTotal = quantidadeTotal + transferenciaProduto.getQuantidade(); |
301 | quantidadeTotal = quantidadeTotal + transferenciaProduto.getQuantidade(); |
| 277 | }
|
302 | }
|
| 278 | }
|
303 | }
|
| 279 | }
|
304 | }
|
| 280 | return quantidadeTotal; |
305 | return quantidadeTotal; |