/*
 * Copyright 2012-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * GENERATED CODE - DO NOT EDIT
 */
package com.example;

import java.util.LinkedHashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.teiid.spring.openapi.TeiidRSProvider;
import org.teiid.spring.autoconfigure.TeiidServer;
import org.teiid.adminapi.VDB;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/portfolio")
public class portfolio extends TeiidRSProvider {
    
    @Autowired
    private TeiidServer server;
    
    @Autowired
    private VDB vdb;
    
    @RequestMapping(value = "g1/{p1}", method = RequestMethod.GET, produces = {"application/xml"} )
    @ResponseBody
    @ApiOperation(value="")
    public ResponseEntity<InputStreamResource> g1Table(@PathVariable(name="p1") java.lang.Integer p1, @RequestParam(name="p2") java.lang.String p2) {
        setServer(this.server);
        setVdb(this.vdb);
        LinkedHashMap<String, Object> parameters = new LinkedHashMap<String, Object>();
        parameters.put("p1",p1);
    parameters.put("p2",p2);
    
        return execute("portfolio.g1Table", parameters, "UTF-8", false);
    }

    @RequestMapping(value = "g2", method = RequestMethod.GET, produces = {"text/plain"} )
    @ResponseBody
    @ApiOperation(value="")
    public ResponseEntity<InputStreamResource> g2Table() {
        setServer(this.server);
        setVdb(this.vdb);
        LinkedHashMap<String, Object> parameters = new LinkedHashMap<String, Object>();
        
        return execute("portfolio.g2Table", parameters, "UTF-8", false);
    }

    @RequestMapping(value = "g3", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"} , consumes = "multipart/form-data" )
    @ResponseBody
    @ApiOperation(value="")
    public ResponseEntity<InputStreamResource> g3Table(@RequestParam(name="p1") java.lang.Integer p1, @RequestParam(name="p2") MultipartFile p2) {
        setServer(this.server);
        setVdb(this.vdb);
        LinkedHashMap<String, Object> parameters = new LinkedHashMap<String, Object>();
        parameters.put("p1",p1);
    parameters.put("p2",p2);
    
        return execute("portfolio.g3Table", parameters, "UTF-8", false);
    }

}
