<commit_before>package org.xcolab.service.balloons.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.xcolab.model.tables.pojos.BalloonLink;
import org.xcolab.model.tables.pojos.BalloonText;
import org.xcolab.model.tables.pojos.BalloonUserTracking;
import org.xcolab.service.balloons.domain.balloonlink.BalloonLinkDao;
import org.xcolab.service.balloons.domain.balloontext.BalloonTextDao;
import org.xcolab.service.balloons.domain.balloonusertracking.BalloonUserTrackingDao;
import org.xcolab.service.balloons.exceptions.NotFoundException;

import java.util.List;

@RestController
public class BalloonsController {

    @Autowired
    private BalloonUserTrackingDao balloonUserTrackingDao;

    @Autowired
    private BalloonLinkDao balloonLinkDao;

    @Autowired
    private BalloonTextDao balloonTextDao;

    @RequestMapping(value = "/balloonLinks/", method = RequestMethod.POST)
    public BalloonLink createBalloonLink(@RequestBody BalloonLink balloonLink) {

        return this.balloonLinkDao.create(balloonLink);
    }


    @RequestMapping(value = "/balloonLinks/{uuid}", method = RequestMethod.PUT)
    public boolean updateBalloonLink(@RequestBody BalloonLink balloonLink,
                                     @PathVariable("uuid") String uuid) throws NotFoundException {

        if (balloonLinkDao.getBalloonLink(uuid) == null) {
            throw new NotFoundException();
        } else {
            return balloonLinkDao.update(balloonLink);
        }
    }

    @RequestMapping(value = "/balloonLinks/{uuid}", method = RequestMethod.GET)
    public BalloonLink getBallonLink(@PathVariable("uuid") String uuid) throws NotFoundException {
        if (uuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonLinkDao.getBalloonLink(uuid);
        }
    }

    @RequestMapping(value = "/balloonLinks/", method = RequestMethod.GET)
    public BalloonLink getBallonLinkByMemberUuid(@RequestParam(required = false) String memberUuid) throws NotFoundException {
        if (memberUuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonLinkDao.getBalloonLinkByUserUuid(memberUuid);
        }
    }


    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.GET)
    public List<BalloonUserTracking> getAllBalloonUserTracking() {

        return this.balloonUserTrackingDao.getAllBalloonUserTracking();
    }

    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.POST)
    public BalloonUserTracking createBalloonUserTracking(@RequestBody BalloonUserTracking balloonUserTracking) {

        return this.balloonUserTrackingDao.create(balloonUserTracking);
    }

    @RequestMapping(value = "/balloonUserTracking/{uuid}", method = RequestMethod.GET)
    public BalloonUserTracking getBallonUserTracking(@PathVariable("uuid") String uuid) throws NotFoundException {
        if (uuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonUserTrackingDao.getBallonUserTrackingByUuid(uuid);
        }
    }

    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.GET)
    public List<BalloonUserTracking> getBallonUserTrackingByEmail(@RequestParam(required = false) String email) throws NotFoundException {
        if (email == null) {
            throw new NotFoundException();
        } else {
            return this.balloonUserTrackingDao.getBallonUserTrackingByEmail(email);
        }
    }
<commit_msg>bug fix for red ballon<commit_after>package org.xcolab.service.balloons.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.xcolab.model.tables.pojos.BalloonLink;
import org.xcolab.model.tables.pojos.BalloonText;
import org.xcolab.model.tables.pojos.BalloonUserTracking;
import org.xcolab.service.balloons.domain.balloonlink.BalloonLinkDao;
import org.xcolab.service.balloons.domain.balloontext.BalloonTextDao;
import org.xcolab.service.balloons.domain.balloonusertracking.BalloonUserTrackingDao;
import org.xcolab.service.balloons.exceptions.NotFoundException;

import java.util.List;

@RestController
public class BalloonsController {

    @Autowired
    private BalloonUserTrackingDao balloonUserTrackingDao;

    @Autowired
    private BalloonLinkDao balloonLinkDao;

    @Autowired
    private BalloonTextDao balloonTextDao;

    @RequestMapping(value = "/balloonLinks/", method = RequestMethod.POST)
    public BalloonLink createBalloonLink(@RequestBody BalloonLink balloonLink) {

        return this.balloonLinkDao.create(balloonLink);
    }


    @RequestMapping(value = "/balloonLinks/{uuid}", method = RequestMethod.PUT)
    public boolean updateBalloonLink(@RequestBody BalloonLink balloonLink,
                                     @PathVariable("uuid") String uuid) throws NotFoundException {

        if (balloonLinkDao.getBalloonLink(uuid) == null) {
            throw new NotFoundException();
        } else {
            return balloonLinkDao.update(balloonLink);
        }
    }

    @RequestMapping(value = "/balloonLinks/{uuid}", method = RequestMethod.GET)
    public BalloonLink getBallonLink(@PathVariable("uuid") String uuid) throws NotFoundException {
        if (uuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonLinkDao.getBalloonLink(uuid);
        }
    }

    @RequestMapping(value = "/balloonLinks/", method = RequestMethod.GET)
    public BalloonLink getBallonLinkByMemberUuid(@RequestParam(required = false) String memberUuid) throws NotFoundException {
        if (memberUuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonLinkDao.getBalloonLinkByUserUuid(memberUuid);
        }
    }


    /*
    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.GET)
    public List<BalloonUserTracking> getAllBalloonUserTracking() {

        return this.balloonUserTrackingDao.getAllBalloonUserTracking();
    }*/

    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.POST)
    public BalloonUserTracking createBalloonUserTracking(@RequestBody BalloonUserTracking balloonUserTracking) {

        return this.balloonUserTrackingDao.create(balloonUserTracking);
    }

    @RequestMapping(value = "/balloonUserTracking/{uuid}", method = RequestMethod.GET)
    public BalloonUserTracking getBallonUserTracking(@PathVariable("uuid") String uuid) throws NotFoundException {
        if (uuid == null) {
            throw new NotFoundException();
        } else {
            return this.balloonUserTrackingDao.getBallonUserTrackingByUuid(uuid);
        }
    }

    @RequestMapping(value = "/balloonUserTracking/", method = RequestMethod.GET)
    public List<BalloonUserTracking> getBallonUserTrackingByEmail(@RequestParam(required = false) String email) throws NotFoundException {
        if (email == null) {
            throw new NotFoundException();
        } else {
            return this.balloonUserTrackingDao.getBallonUserTrackingByEmail(email);
        }
    }

{'fraction_non_alphanumeric': 0.09206510681586978, 'fraction_numerical': 0.0, 'mean_word_length': 3.8549382716049383, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7493555', 'n_tokens_mistral': 2244, 'n_tokens_neox': 2209, 'n_words': 372}