protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        String database = req.getParameter("DATABASE");
        int fouten = 0;
        Connection con = ConnectionFactory.getConnection();
        ConnectDBBusinessRule cdbbr = new ConnectDBBusinessRule(con);
        ArrayList<BusinessRule> ongeGenereerdeBusinessRule = cdbbr.getOngegenereerdeBusinessRules();
        System.out.println("Size: " + ongeGenereerdeBusinessRule.size());
        String returnMessage;
        if(ongeGenereerdeBusinessRule.size() == 0){
            returnMessage = "Er zijn geen businessrules te genereren.";
        } else {

            for(BusinessRule businessRule : ongeGenereerdeBusinessRule) {
                String gegenereerdeBusinessRule = "";
                try{
                    gegenereerdeBusinessRule = generator.generate(businessRule);
                    System.out.println(businessRule.getRuleNaam() + "\n");
                    System.out.println(gegenereerdeBusinessRule);
                    cdbbr.saveBusinessRule(businessRule.getRuleNaam(), businessRule.getLanguage(), gegenereerdeBusinessRule);
                    cdbbr.changeBusinessRuleStatus(businessRule.getRuleID(),"GENERATED");
                    System.out.println(database);
                    if(database.equals("target")){
                        cdbbr.runCode(gegenereerdeBusinessRule);
                    }
                } catch (NullPointerException ex){
                    cdbbr.changeBusinessRuleStatus(businessRule.getRuleID(),"ERROR");
                    StringWriter errors = new StringWriter();
                    ex.printStackTrace(new PrintWriter(errors));
                    cdbbr.saveToErrorLog(errors.toString(),"" + businessRule.getRuleID());
                    ex.printStackTrace();
                    fouten++;
                }
            }
            if((ongeGenereerdeBusinessRule.size() - fouten) == 1){
                returnMessage = "Er is " + (ongeGenereerdeBusinessRule.size()- fouten) + " businessrule gegenereerd.";
            } else {
                returnMessage = "Er zijn " + (ongeGenereerdeBusinessRule.size()- fouten) + " businessrules gegenereerd.";
            }
            if(fouten > 0){
                if(fouten == 1) {
                    returnMessage += "\nEn bij 1 businessrule is er een fout opgetreden";
                } else {
                    returnMessage += "\nEn bij " + fouten + " businessrules zijn er fouten opgetreden";
                }
            }
        }
        String session = req.getParameter("SESSION");
        String saveTo = req.getParameter("ITEM");
        String page = req.getParameter("PAGE");
        String url = req.getParameter("URL");
        resp.sendRedirect(url + ":" + page + ":" + session + "::::" + saveTo + ":" + returnMessage);
    }