2 * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.portalapp.portal.controller;
18 import com.alibaba.fastjson.JSONObject;
19 import org.onap.portalapp.portal.domain.Language;
20 import org.onap.portalapp.portal.service.LanguageService;
21 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.web.bind.annotation.*;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26 import java.util.List;
29 @RequestMapping("/auxapi")
30 public class LanguageController {
33 private LanguageService languageService;
35 @RequestMapping(value = "/language",method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
36 public JSONObject getLanguageList() {
37 return languageService.getLanguages();
40 @RequestMapping(value = "/languageSetting/user/{loginId}",method = RequestMethod.POST)
41 public void setUpUserLanguage(@RequestBody JSONObject jsonLanguageId,
42 @PathVariable("loginId") String loginId) throws Exception {
43 Integer languageId = jsonLanguageId.getInteger("languageId");
44 languageService.setUpUserLanguage(languageId,loginId);
47 @RequestMapping(value = "/languageSetting/user/{loginId}",method = RequestMethod.GET)
48 public JSONObject getUserLanguage(HttpServletRequest request, HttpServletResponse response,
49 @PathVariable("loginId") String loginId) {
50 return languageService.getUserLanguage(loginId);