Subversion Repositories bacoAlunos

Rev

Rev 1935 | Rev 1974 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.web.controllers.courses;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONObject;
import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by jorgemachado on 06/01/17.
 */

public class CoursesServicesController extends AbstractWidgetAjaxController
{


    /**
     * See also CoursesServicesWidgetController for WS-API services
     */


    /**
     *
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Throwable
     */


    public JSONObject generateGlobalLearningResultsChartImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable {

        1.5.0/docs/api/java/lang/String.html">String courseReportDocument = request.getParameter("courseReportDocument");


        IServiceManager sm = ServiceManager.getInstance();
        1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response),
                "CourseReportGenerateGlobalLearningResultsChartImg",
                new 5+0%2Fdocs%2Fapi+Object">Object[]{courseReportDocument});
        return new JSONObject(json);
    }

    public JSONObject generateGlobalLearningResultsChartYearImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable {
        1.5.0/docs/api/java/lang/String.html">String courseReportDocument = request.getParameter("courseReportDocument");

        IServiceManager sm = ServiceManager.getInstance();
        1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response),
                "CourseReportGenerateGlobalLearningResultsChartYearImg",
                new 5+0%2Fdocs%2Fapi+Object">Object[]{courseReportDocument});
        return new JSONObject(json);
    }

    public JSONObject saveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable {
        1.5.0/docs/api/java/lang/String.html">String courseReportDocument = request.getParameter("courseReportDocument");

        IServiceManager sm = ServiceManager.getInstance();
        1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response),
                "SaveCourseReportDocument",
                new 5+0%2Fdocs%2Fapi+Object">Object[]{courseReportDocument});
        return new JSONObject(json);
    }


    /* AA 7/12/2017 */

    /*public JSONObject SaveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {

        String courseReportDocument = request.getParameter("courseReportDocument");

        IServiceManager sm = ServiceManager.getInstance();
        String json = (String) sm.execute(RequestUtils.getRequester(request, response),
                "SaveCourseReportDocument",
                new Object[]{courseReportDocument});
        return new JSONObject(json);
    }*/


    public JSONObject loadCourseReportDoc(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable {
    1.5.0/docs/api/java/lang/String.html">String courseReportDocument = request.getParameter("courseReportDocument");

    IServiceManager sm = ServiceManager.getInstance();
    1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response),
            "LoadCourseReportDocument",
            new 5+0%2Fdocs%2Fapi+Object">Object[]{courseReportDocument});
    return new JSONObject(json);
    }

    public ActionForward startEdit(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException
    {
        return mapping.findForward("page");
    }
}