MarksheetRESTfullWS.java

package com.sunilos.proj0.rest;

import java.util.List;

import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.PathVariable;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.ResponseBody;

import com.sunilos.proj0.ctl.BaseCtl;

import com.sunilos.proj0.ctl.CollegeCtl;

import com.sunilos.proj0.dto.MarksheetDTO;

import com.sunilos.proj0.form.MarksheetForm;

import com.sunilos.proj0.service.MarksheetServiceInt;

/**

* Marksheet RESTfull Web service

*

* @author SunilOS

* @version 1.0

* @Copyright (c) SunilOS

*/

@Controller

@RequestMapping(value = "/rest/Marksheet")

public class MarksheetRESTfullWS extends BaseCtl {

/**

* Logger object

*/

private static Logger log = Logger.getLogger(CollegeCtl.class);

@Autowired

MarksheetServiceInt service;

/**

* Delete a Marksheet

*

* @param id

* @return

* @throws Exception

*/

@RequestMapping(value = "/delete/{id}")

@ResponseBody

public MarksheetDTO delete(@PathVariable long id) throws Exception {

MarksheetDTO dto = service.findByPK(id);

service.delete(id);

return dto;

}

/**

* Gets Marksheet information

*

* @param id

* @return

*/

@RequestMapping(value = "/{id}", method = RequestMethod.GET)

@ResponseBody

public MarksheetDTO get(@PathVariable long id) {

log.debug("MarksheetCtl doDisplay() Start");

MarksheetDTO dto = service.findByPK(id);

return dto;

}

/**

* Gets Marksheet list

*

* @param form

* @return

*/

@RequestMapping(value = "/search", method = RequestMethod.GET)

@ResponseBody

public List getList(MarksheetForm form) {

MarksheetDTO dto = (MarksheetDTO) form.getDto();

return service.search(dto, form.getPageNo(), form.getPageSize());

}

}