<commit_before>package uk.ac.ebi.spot.goci.curation.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.spot.goci.model.Event;
import uk.ac.ebi.spot.goci.model.EventType;
import uk.ac.ebi.spot.goci.model.SecureUser;
import uk.ac.ebi.spot.goci.repository.EventRepository;

import java.util.Date;

/**
 * Created by emma on 06/05/2016.
 *
 * @author emma
 *         <p>
 *         Service class to handle common operations regarding events
 */
@Service
public class EventOperationsService {

    private EventRepository eventRepository;

    @Autowired
    public EventOperationsService(EventRepository eventRepository) {
        this.eventRepository = eventRepository;
    }

    /**
     * Create an event
     *
     * @param eventType Event type to create
     * @return Event object
     */
    public synchronized Event createEvent(EventType eventType, SecureUser user) {
        // Create and save event
        Event event = new Event();
        event.setEventDate(new Date());
        event.setEventType(eventType);
        event.setUser(user);
        eventRepository.save(event);
        return event;
    }

    /**
     * Create an event with a description
     *
     * @param eventType Event type to create
     * @return Event object
     */
    public synchronized Event createEvent(EventType eventType, SecureUser user, String eventDescription) {
        // todo add description
        // Create and save event
        Event event = new Event();
        event.setEventDate(new Date());
        event.setEventType(eventType);
        event.setUser(user);
        eventRepository.save(event);
        return event;
    }


}<commit_msg>Update comments<commit_after>package uk.ac.ebi.spot.goci.curation.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.spot.goci.model.Event;
import uk.ac.ebi.spot.goci.model.EventType;
import uk.ac.ebi.spot.goci.model.SecureUser;
import uk.ac.ebi.spot.goci.repository.EventRepository;

import java.util.Date;

/**
 * Created by emma on 06/05/2016.
 *
 * @author emma
 *         <p>
 *         Service class to handle common operations regarding events
 */
@Service
public class EventOperationsService {

    private EventRepository eventRepository;

    @Autowired
    public EventOperationsService(EventRepository eventRepository) {
        this.eventRepository = eventRepository;
    }

    /**
     * Create an event
     *
     * @param eventType Event type to create
     * @param user      User Initiating event
     * @return Event object
     */
    public synchronized Event createEvent(EventType eventType, SecureUser user) {
        // Create and save event
        Event event = new Event();
        event.setEventDate(new Date());
        event.setEventType(eventType);
        event.setUser(user);
        eventRepository.save(event);
        return event;
    }

    /**
     * Create an event with a description
     *
     * @param eventType        Event type to create
     * @param user             User Initiating event
     * @param eventDescription Description of update event
     * @return Event object
     */
    public synchronized Event createEvent(EventType eventType, SecureUser user, String eventDescription) {
        // Create and save event
        Event event = new Event();
        event.setEventDate(new Date());
        event.setEventType(eventType);
        event.setUser(user);
        event.setEventDescription(eventDescription);
        eventRepository.save(event);
        return event;
    }
}
{'fraction_non_alphanumeric': 0.09185347184253691, 'fraction_numerical': 0.004373974849644614, 'mean_word_length': 2.710953346855984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2021879', 'n_tokens_mistral': 1013, 'n_tokens_neox': 996, 'n_words': 257}