Package fr.ippon.tatami.web.bot

Source Code of fr.ippon.tatami.web.bot.TatamibotController

package fr.ippon.tatami.web.bot;

import fr.ippon.tatami.bot.config.TatamibotConfiguration;
import fr.ippon.tatami.domain.User;
import fr.ippon.tatami.repository.TatamibotConfigurationRepository;
import fr.ippon.tatami.security.AuthenticationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.inject.Inject;
import java.util.Collection;

/**
* @author Julien Dubois
*/
@Controller
public class TatamibotController {

    private final Logger log = LoggerFactory.getLogger(TatamibotController.class);

    @Inject
    private TatamibotConfigurationRepository tatamibotConfigurationRepository;

    @Inject
    private AuthenticationService authenticationService;

    @RequestMapping(value = "/rest/tatamibot/configurations",
            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    public Collection<TatamibotConfiguration> getConfigurations() {
        User currentUser = authenticationService.getCurrentUser();
        return tatamibotConfigurationRepository.findTatamibotConfigurationsByDomain(currentUser.getDomain());
    }
}
TOP

Related Classes of fr.ippon.tatami.web.bot.TatamibotController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.