<commit_before>package edu.oregonstate.mist.osuevents.db

import edu.oregonstate.mist.osuevents.core.Event
import groovy.transform.InheritConstructors

import static java.util.UUID.randomUUID

class EventsDAOWrapper {

    private final EventsDAO eventsDAO

    EventsDAOWrapper(EventsDAO eventsDAO) {
        this.eventsDAO = eventsDAO
    }

    /**
     * Get all events.
     * @return
     */
    List<Event> getEvents(Integer changedInPastHours = null) {
	   if (!changedInPastHours) {
		   changedInPastHours = 0
	   }
        List<Event> events = eventsDAO.getEvents(null, changedInPastHours)

        events.each {
            it.instances = eventsDAO.getInstances(it.eventID)
        }
    }

    /**
     * Get single event by ID.
     * @param eventID
     * @return
     */
    Event getEventByID(String eventID) {
        if (!eventID) {
            throw new EventsDAOWrapperException("Cannot get an event with a null eventID.")
        }

        def event = eventsDAO.getEvents(eventID, 0)

        if (event) {
            Event singleEvent = event?.get(0)
            singleEvent.instances = eventsDAO.getInstances(eventID)

            singleEvent
        } else {
            null
        }
    }

    /**
     * Create event, assigns a random UUID.
     * @param event
     * @return
     */
    Event createEvent(Event event) {
        event.eventID = randomUUID() as String
<commit_msg>Default null instead of 0<commit_after>package edu.oregonstate.mist.osuevents.db

import edu.oregonstate.mist.osuevents.core.Event
import groovy.transform.InheritConstructors

import static java.util.UUID.randomUUID

class EventsDAOWrapper {

    private final EventsDAO eventsDAO

    EventsDAOWrapper(EventsDAO eventsDAO) {
        this.eventsDAO = eventsDAO
    }

    /**
     * Get all events.
     * @return
     */
    List<Event> getEvents(Integer changedInPastHours = null) {
        List<Event> events = eventsDAO.getEvents(null, changedInPastHours)

        events.each {
            it.instances = eventsDAO.getInstances(it.eventID)
        }
    }

    /**
     * Get single event by ID.
     * @param eventID
     * @return
     */
    Event getEventByID(String eventID) {
        if (!eventID) {
            throw new EventsDAOWrapperException("Cannot get an event with a null eventID.")
        }

        def event = eventsDAO.getEvents(eventID, null)

        if (event) {
            Event singleEvent = event?.get(0)
            singleEvent.instances = eventsDAO.getInstances(eventID)

            singleEvent
        } else {
            null
        }
    }

    /**
     * Create event, assigns a random UUID.
     * @param event
     * @return
     */
    Event createEvent(Event event) {
        event.eventID = randomUUID() as String

{'fraction_non_alphanumeric': 0.08953068592057761, 'fraction_numerical': 0.0018050541516245488, 'mean_word_length': 2.124013528748591, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '5014145', 'n_tokens_mistral': 873, 'n_tokens_neox': 835, 'n_words': 182}