/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test;

import dao.DaoMesto;
import dao.DaoPoslovniPartner;
import dao.impl.DaoMestoImpl;
import dao.impl.DaoPoslovniPartnerImpl;
import domen.Mesto;
import domen.PravnoLice;
import java.util.logging.Level;
import java.util.logging.Logger;
import servis.ServisPoslovniPartner;
import servis.impl.ServisPoslovniPartnerImpl;

/**
 *
 * @author student
 */
public class Test {
    
    public static void main(String[] args) {
        //sacuvajMesto();
        sacuvajPoslovnogPartnera();
    }

    private static void sacuvajMesto() {
        Mesto mesto = new Mesto();
        mesto.setPtt(11000);
        mesto.setNaziv("Novi Beograd");
        
        DaoMesto daoMesto = new DaoMestoImpl();
        daoMesto.sacuvajIliAzuriraj(mesto);
    }

    private static void sacuvajPoslovnogPartnera() {
        sacuvajPravnoLice();
    }

    private static void sacuvajPravnoLice() {
        PravnoLice pl = new PravnoLice();
        pl.setPib("123456789");
        pl.setMaticniBroj("13456789");
        pl.setNaziv("Fiat");
        
        DaoPoslovniPartner daoPP = new DaoPoslovniPartnerImpl();
        //daoPP.sacuvaj(pl);
        ServisPoslovniPartner servisPP = new ServisPoslovniPartnerImpl(daoPP);
        try {
            servisPP.sacuvaj(pl);
            System.out.println("Pravno lice je sacuvano.");
        } catch (Exception ex) {
            System.out.println("Greska: " + ex.getMessage());
        }
        
        
    }
    
}
