Package br.jus.tjrn.arq.exception

Examples of br.jus.tjrn.arq.exception.ServiceBusinessException


                foto = IOUtils.toByteArray(new FileInputStream(file));
               
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                throw new ServiceBusinessException("Ocorreu um erro ao recuperar o arquivo do servidor", e);
            }
        }
       
        return foto;
    }
View Full Code Here


        try {
            FileUtils.writeByteArrayToFile(getFile(relativePath), fileContent);
        
        } catch (IOException e) {
            e.printStackTrace();
            throw new ServiceBusinessException("Ocorreu um erro ao salvar o arquivo", e);
        }
    }
View Full Code Here

       
        try {
            validateDomainConstraints(entityToSave);
           
        } catch (DomainConstraintException e) {
            throw new ServiceBusinessException(e);
        }
    }
View Full Code Here

        if (StringUtils.isNotBlank(pessoaJuridica.getCnpj())) {
       
            AbstractCPRFValidator cnpjValidator = AbstractCPRFValidator.create(pessoaJuridica.getCnpj());
           
            if (!cnpjValidator.isValido()) {
                throw new ServiceBusinessException(String.format("O CNPJ informado (%s) não é válido", pessoaJuridica.getCnpjFormatado()));
            }
           
            ServiceUniqueEntityValidator<T, D> uniqueEntityValidator = ServiceUniqueEntityValidator.create(dao);
            uniqueEntityValidator.validate(pessoaJuridica, String.format("O CNPJ informado (%s) já está cadastrado", pessoaJuridica.getCnpjFormatado()));
        }
View Full Code Here

    }
   
    public void update(Insumo insumo, Integer valor, int operacao) throws ServiceBusinessException{
      Integer novaQuantidade = insumo.getQuantidade() + (operacao * valor);
      if(novaQuantidade < 0)
        throw new ServiceBusinessException("A operação não pode ser concluída, pois a quantidade do insumo "+insumo.getDescricao()+" ("+novaQuantidade+") é insuficiente.");
   
      if(valor != 0)
        movimentacaoService.insert(insumo, new BigDecimal(valor), operacao);
      insumo.setQuantidade(novaQuantidade);
      super.update(insumo);
View Full Code Here

        if (StringUtils.isNotBlank(pessoaFisica.getCpf())) {
       
            AbstractCPRFValidator cpfValidator = AbstractCPRFValidator.create(pessoaFisica.getCpf());
           
            if (!cpfValidator.isValido()) {
                throw new ServiceBusinessException(String.format("O CPF informado (%s) não é válido", pessoaFisica.getCpfFormatado()));
            }
           
            ServiceUniqueEntityValidator<T, D> uniqueEntityValidator = ServiceUniqueEntityValidator.create(dao);
            uniqueEntityValidator.validate(pessoaFisica, String.format("O CPF informado (%s) já está cadastrado", pessoaFisica.getCpfFormatado()));
        }
View Full Code Here

   
    @Override
    public void validate(Galpao entity) throws ServiceBusinessException {
       
      if(entity.getCapacidade() == null || new BigDecimal(entity.getCapacidade()).equals(BigDecimal.ZERO))
          throw new ServiceBusinessException("O campo capacidade não pode ser vazio");
     
        Galpao entityToValidate = new Galpao();
        entityToValidate.setDescricao(entity.getDescricao());
        entityToValidate.setAtivo(true);
        entityToValidate.setId(entity.getId());
View Full Code Here

        entityToValidate.setAtivo(true);
        entityToValidate.setId(entity.getId());
       
       
        if(entity.getItens() == null || entity.getItens().size() == 0)
          throw new ServiceBusinessException("Nenhum item foi adicionado.");
        else{
          validaItens(entity);
        }
       
        if(entity.getValor() == null || entity.getValor().equals(BigDecimal.ZERO))
             throw new ServiceBusinessException("O campo valor não pode ser vazio.");
    }
View Full Code Here

    }
   
    public void validaItem(ItensCompras item,Compras compra) throws ServiceBusinessException{
      if(item != null){
        if(item.getTipoItem() == null)
          throw new ServiceBusinessException("O tipo do item de compra não pode ser vazio.");
        else{
          if(item.isTipoInsumo()){
            if(item.getInsumo() == null)
              throw new ServiceBusinessException("O insumo não pode ser vazio.");
          }else if(item.isTipoRacao()){
            if(item.getRacao() == null)
              throw new ServiceBusinessException("A ração não pode ser vazio.");
          }else if(item.isTipoProduto()){
            if(item.getProduto() == null)
              throw new ServiceBusinessException("O produto não pode ser vazio.");
            else{
              if(item.getProduto().getOvos() == true && item.getTipobandeja() == null)
                throw new ServiceBusinessException("O tipo de bandeja não pode ser vazio.");
            }
          }
        }

        if(item.getQuantidade() == null || item.getQuantidade().equals(BigDecimal.ZERO))
          throw new ServiceBusinessException("O campo quantidade não pode ser vazio.");
        if(item.getValor() == null || item.getValor().equals(BigDecimal.ZERO))
          throw new ServiceBusinessException("O campo valor não pode ser vazio.");
       
        if(containsItem(item,compra))
          throw new ServiceBusinessException("Item já inserido.")
      }
    }
View Full Code Here

        ServiceUniqueEntityValidator<Tiporacao, TiporacaoDao> uniqueEntityValidator = ServiceUniqueEntityValidator.create(dao);
        uniqueEntityValidator.validate(entityToValidate, String.format("O tipo de ração com a descrição informada (%s) já está cadastrado", entityToValidate.getDescricao()));
       
        // valida itens
        if(entity.getItens() == null || entity.getItens().size() == 0)
          throw new ServiceBusinessException("Nenhum item foi adicionado.");
        else{
          validaItens(entity.getItens());
        }
       
       
View Full Code Here

TOP

Related Classes of br.jus.tjrn.arq.exception.ServiceBusinessException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.