<commit_before><%-- 
    Document   : incident_detail
    Created on : 17-mrt-2015, 10:51:02
    Author     : Eric
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="api.TwitterFeed"%>
<%@page import="api.WeatherFeed"%>
<%@page import="java.util.List"%>
<%@page import="incident.Incident"%>
<%@page import="javax.persistence.criteria.CriteriaBuilder.In"%>
<%@page import="cims.DatabaseManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%!
    public int incidentId;
    public Incident currentIncident;
    public List<String> advice;
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Crisis Informatie Management Systeem</title>
        <link href="/CIMS/css/bootstrap.min.css" rel="stylesheet">
        <link href="/CIMS/css/Site.css" rel="stylesheet">
    </head>
    <body>
        <%@include file="/navigationBar.jsp" %>
        <div class="container">

            <%
                if (request.getParameter("incident") != null)
                {
                    String id = request.getParameter("incident");
                    Incident incident = DatabaseManager.getIncientById(Integer.parseInt(id));
                    if (incident != null)
                    {
                        this.incidentId = Integer.parseInt(id);
                        this.currentIncident = incident;
                        advice = DatabaseManager.getAdviceById(Integer.parseInt(id));
                    }
                    else
                    {
                        response.sendRedirect("all.jsp");
                    }

                }
            %>

            <div class="jumbotron">
                <h2><%out.println(this.currentIncident.toString()); %></h2>
                <p><%out.println("Locatie: " + this.currentIncident.getLocation()); %></p>
                <p><% out.println("Gemeld op: " + this.currentIncident.getDate());%></p>

                <%
                    if (advice.size() > 0)
                    {%>
                <p><%out.println("Advies: "); %></p>
                <% for (String singleAdvice : advice)
                            { %>
                <p><% out.println(singleAdvice); %></p>
                <% }
                }
                else
                { %>
                <p><% out.println("Nog geen advies beschikbaar. Blijf deze pagina in de gaten houden voor advies."); %></p>
                <% }
                %>
                <p><%
		    String location = this.currentIncident.getLocation().replace(", Nederland", "");
                    WeatherFeed wf = new WeatherFeed(location, WeatherFeed.Query.TEMPERATURE);
                    out.println("Weer: " + wf.getData() + " en ");
                    wf.setQuery(WeatherFeed.Query.DESCRIPTION);
                    out.println(wf.getData());%></p>
		<div style="height:400px;overflow:scroll;">
		    <h3>Laatste updates over dit incident op Twitter:</h3>		    
		    <ul>
			<%
			    // Veel kun je niet meer aan de query toevoegen; de tweets moeten wel bestaan en recent zijn.
			    ArrayList<String> tweets = new TwitterFeed().getTweets(location /*+ "incident"*/, 25);
			    for(String tweet : tweets){
				    out.println("<li><a href='http://twitter.com/search?q=" + tweet + "'>" + tweet + "</a></li>" + "<br>");
			    }
			%>
		    </ul>
		</div>
            </div>

            <footer>
                <p>&copy; <b>CIMS</b> 2015</p>
            </footer>
        </div> <!-- /container -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script src="/CIMS/js/bootstrap.min.js"></script>
    </body>

</html><commit_msg>Sorry, ik verveelde me. Nu ga ik slapen.<commit_after><%-- 
    Document   : incident_detail
    Created on : 17-mrt-2015, 10:51:02
    Author     : Eric
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="api.TwitterFeed"%>
<%@page import="api.WeatherFeed"%>
<%@page import="java.util.List"%>
<%@page import="incident.Incident"%>
<%@page import="javax.persistence.criteria.CriteriaBuilder.In"%>
<%@page import="cims.DatabaseManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%!
    public int incidentId;
    public Incident currentIncident;
    public List<String> advice;
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Crisis Informatie Management Systeem</title>
        <link href="/CIMS/css/bootstrap.min.css" rel="stylesheet">
        <link href="/CIMS/css/Site.css" rel="stylesheet">
    </head>
    <body>
        <%@include file="/navigationBar.jsp" %>
        <div class="container">

            <%
                if (request.getParameter("incident") != null)
                {
                    String id = request.getParameter("incident");
                    Incident incident = DatabaseManager.getIncientById(Integer.parseInt(id));
                    if (incident != null)
                    {
                        this.incidentId = Integer.parseInt(id);
                        this.currentIncident = incident;
                        advice = DatabaseManager.getAdviceById(Integer.parseInt(id));
                    }
                    else
                    {
                        response.sendRedirect("all.jsp");
                    }

                }
            %>

            <div class="jumbotron">
                <h2><%out.println(this.currentIncident.toString()); %></h2>
                <p><%out.println("Locatie: " + this.currentIncident.getLocation()); %></p>
                <p><% out.println("Gemeld op: " + this.currentIncident.getDate());%></p>

                <%
                    if (advice.size() > 0)
                    {%>
                <p><%out.println("Advies: "); %></p>
                <% for (String singleAdvice : advice)
                            { %>
                <p><% out.println(singleAdvice); %></p>
                <% }
                }
                else
                { %>
                <p><% out.println("Nog geen advies beschikbaar. Blijf deze pagina in de gaten houden voor advies."); %></p>
                <% }
                %>
                <p><%
		    String location = this.currentIncident.getLocation().replace(", Nederland", "");
                    WeatherFeed wf = new WeatherFeed(location, WeatherFeed.Query.TEMPERATURE);
                    out.println("Weer: " + wf.getData() + " en ");
                    wf.setQuery(WeatherFeed.Query.DESCRIPTION);
                    out.println(wf.getData());%></p>
		<div style="height:400px;overflow:scroll;">
		    <h3>Laatste updates over dit incident op Twitter:</h3>		    
		    <ul>
			<%
			    // Veel kun je niet meer aan de query toevoegen; de tweets moeten wel bestaan en recent zijn.
			    double latitude = this.currentIncident.getLatitude();
			    double longitude = this.currentIncident.getLongitude();
			    ArrayList<String> tweets = new TwitterFeed().getByLocation(latitude, longitude, 5, "", 25);
			    for (String tweet : tweets) {
				    out.println("<li><a href='http://twitter.com/search?q=" + tweet + "'>" + tweet + "</a></li>" + "<br>");
			    }
			%>
		    </ul>
		</div>
            </div>

            <footer>
                <p>&copy; <b>CIMS</b> 2015</p>
            </footer>
        </div> <!-- /container -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script src="/CIMS/js/bootstrap.min.js"></script>
    </body>

</html>
{'fraction_non_alphanumeric': 0.16114180478821363, 'fraction_numerical': 0.008550381478558274, 'mean_word_length': 1.743774810537712, 'pattern_counts': {'":': 0, '<': 159, '<?xml version=': 0, '>': 161, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3382449', 'n_tokens_mistral': 2444, 'n_tokens_neox': 2195, 'n_words': 396}