Package maissocial.controle

Source Code of maissocial.controle.ProfPisControle

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package maissocial.controle;

import maissocial.exception.ProfPisJaCadastradaException;
import java.util.List;
import maissocial.entidade.ProfPis;
import maissocial.repositorio.ProfPisRepositorio;

/**
*
* @author luciano
*/
public class ProfPisControle {

    private ProfPisRepositorio ppRep;

    public ProfPisControle(){
        this.ppRep = new ProfPisRepositorio();
    }

    public void salvarProfPis(ProfPis pp) throws Exception, ProfPisJaCadastradaException{
        if( pp == null || pp.getNome() == null || pp.getNome().equals("") || pp.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        ProfPis pp2 = this.ppRep.pesquisarProfPisPorNome(pp.getNome());
        if(pp2 == null){
            this.ppRep.salvarProfPis(pp);
        }else{
            throw new ProfPisJaCadastradaException("Profifional do Pis já cadastrado!");
        }

    }

    public void deletarProfPisPorObj(ProfPis pp){
        this.ppRep.deletarProfPisPorObj(pp);
    }

    public void deletarProfPis(int cod){
        this.ppRep.deletarProfPis(cod);
    }

    public void alterarProfPis(ProfPis pp) throws Exception, ProfPisJaCadastradaException{
        if( pp == null || pp.getNome() == null || pp.getNome().equals("") || pp.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        ProfPis pp2 = this.ppRep.pesquisarProfPisPorNome(pp.getNome());
        if(pp2 == null){
            this.ppRep.alterarProfPis(pp);
        }else{
            throw new ProfPisJaCadastradaException("Profissional do Pis já cadastrado!");
        }
    }

    public ProfPis pesquisarProfPisPorCodigo(int cod){
        ProfPis pp = this.ppRep.pesquisarProfPisPorCodigo(cod);
        return pp;
    }

     public ProfPis pesquisarProfPisPorCpf(String cpf){
        ProfPis pp = this.ppRep.pesquisarProfPisPorCpf(cpf);
        return pp;
    }

    public ProfPis pesquisarProfPisPorNome(String nome){
        ProfPis pp = this.ppRep.pesquisarProfPisPorNome(nome);
        return pp;
    }

    public List pesquisarProfPisTodos(){
        List pp = this.ppRep.pesquisarProfPisTodos();
        return pp;
    }

}
TOP

Related Classes of maissocial.controle.ProfPisControle

TOP
Copyright © 2018 www.massapi.com. 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.