HipoteseLegalController.java 1.78 KB
package br.com.centralit.controller;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import br.com.centralit.api.framework.json.ViewsEcm;
import br.com.centralit.api.model.HipoteseLegal;
import br.com.centralit.api.service.HipoteseLegalService;
import br.com.centralit.framework.controller.GenericController;
import br.com.centralit.framework.json.ResponseBodyWrapper;

@Controller
@RequestMapping("/rest/hipoteseLegal")
public class HipoteseLegalController extends GenericController<HipoteseLegal> {

	/** Atributo hipoteseLegalService. */
	private HipoteseLegalService hipoteseLegalService;

	@Autowired
	public HipoteseLegalController( HipoteseLegalService hipoteseLegalService ) {

		super(hipoteseLegalService);

		this.hipoteseLegalService = hipoteseLegalService;
	}

	@RequestMapping(value = "/findPorNivelAcesso", method = RequestMethod.GET, produces = "application/json")
	@ResponseBody
	public ResponseBodyWrapper findPorNivelAcesso(@RequestParam(value = "idNivelAcesso") Long idNivelAcesso) {

		final Collection<HipoteseLegal> hipoteses = this.hipoteseLegalService.findPorNivelAcesso(idNivelAcesso);

		ResponseBodyWrapper responseBody = new ResponseBodyWrapper(hipoteses, ViewsEcm.HipoteseLegalList.class);

		return responseBody;
	}

	@Override
	public Class<ViewsEcm.HipoteseLegalEdit> getEditView() {

		return ViewsEcm.HipoteseLegalEdit.class;
	}

	@Override
	public Class<ViewsEcm.HipoteseLegalList> getListView() {

		return ViewsEcm.HipoteseLegalList.class;
	}
}