Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1894 → Rev 1898

/branches/grupo2/impl/conf/berserk/sd.xml
4044,4 → 4044,22
</filterChains>
</service>
 
<service>
<name>CourseReportGenerateGlobalLearningResultsChartYearImg</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
<description>
@reportCourseDocument documento course report em json
Serviço de suporte para gerar um grafico
Coloca o grafico no report documento
e salva o documento no curso
Devolve uma classe RepositoryFile4JsonView serializada em JSON
</description>
<isTransactional>true</isTransactional>
<defaultMethod>generateGenerateGlobalLearningResultsChartYearImg</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
</serviceDefinitions>
/branches/grupo2/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java
448,11 → 448,41
return view.toJson();
}
 
public String generateGenerateGlobalLearningResultsChartYearImg(String reportDocumentJson,UserSession session) throws IOException {
 
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
 
UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
 
 
FileUploaded fileUploaded = chartImg.generateChart2tmp(table,reportDocument);
 
RepositoryService repositoryService = new RepositoryService();
 
boolean imageInitialized = chartImg.getImage() != null
&&
chartImg.getImage().getIdentifier() != null;
 
RepositoryFile4JsonView view;
if(imageInitialized)
{
String identifier = chartImg.getImage().getIdentifier();
view = repositoryService.replaceRepositoryFileFromFileUpload(identifier, fileUploaded, ResourceAccessControlEnum.privateDomain, session);
}
else
{
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.privateDomain,session);
}
chartImg.setImage(view);
//TODO FALTA GUARDAR O JSON NO CURSO
return view.toJson();
}
 
 
 
/****************************************************************************/
/*
 
/branches/grupo2/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
42,5 → 42,14
return new JSONObject(json);
}
 
public JSONObject generateGlobalLearningResultsChartYearImg(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),
"CourseReportGenerateGlobalLearningResultsChartYearImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
}
/branches/grupo2/impl/src/web/user/courses/coursereport/templates.jsp
701,7 → 701,7
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
"generateGlobalLearningResultsChartYearImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},