/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java |
---|
1,15 → 1,37 |
package pt.estgp.estgweb.services.courses; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.StreamsUtils; |
import org.apache.log4j.Logger; |
import org.json.JSONArray; |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.Teacher; |
import pt.estgp.estgweb.domain.CourseUnitImpl; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseUnitSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.ReportTeacher; |
import pt.estgp.estgweb.services.courses.coursereport.CourseReportUtils; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.*; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.CourseUnitSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultsTable; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.CourseUnitDtpStat; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitDtpSemester; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitsDtpTable; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.surveys.SurveysResultsSection; |
import pt.estgp.estgweb.services.questionarios.QuestionariosReportsService; |
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.DataTable; |
import pt.estgp.estgweb.utils.Globals; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.QuestionariosDataTableComponent; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import java.util.ArrayList; |
import java.util.List; |
import java.io.IOException; |
import java.io.InputStream; |
import java.net.URL; |
import java.util.*; |
/** |
* Created by jorgemachado on 14/10/17. |
18,39 → 40,459 |
{ |
private static final Logger logger = Logger.getLogger(CourseReportServices.class); |
public void loadCourseReports(String importYear,long courseId) |
/****************************************************************************/ |
/* SERVICOS CORE DOS REPORTS |
/****************************************************************************/ |
/** |
* Gera uma tabela de estatisticas dos DTP recorrendo ao servico WS de |
* load de tabelas DTP, caso o serviço nao devolva unidades são criadas novas |
* com os valores a falso. |
* |
* @param courseCode |
* @param year |
* @return UnitsDtpTable |
* @throws IOException |
* @throws JSONException |
*/ |
public UnitsDtpTable updateDtpStatsTable4Course(ReportCourseDocument reportCourseDocument, String courseCode, String year) throws IOException, JSONException |
{ |
List<CourseUnitSection> sections = new ArrayList<CourseUnitSection>(); |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadByCourse(courseId,importYear); |
for(CourseUnit cu: units) |
ReportsUcSummarySection reportsUcSummarySection = (ReportsUcSummarySection) reportCourseDocument.findDocumentSection(ReportsUcSummarySection.class); |
UnitsDtpTable unitsDtpTable = (UnitsDtpTable) reportsUcSummarySection.findDocComponent(UnitsDtpTable.class); |
UnitDtpSemester semester1 = new UnitDtpSemester(); |
UnitDtpSemester semester2 = new UnitDtpSemester(); |
unitsDtpTable.setSemester1(semester1); |
unitsDtpTable.setSemester1(semester2); |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadByCourseSiges(courseCode, year); |
String json = loadCourseUnitDtpStats(courseCode,year); |
JSONObject response = new JSONObject(json); |
JSONArray stats = (JSONArray) ((JSONObject)response.get("response")).get("dtpstats"); |
CourseUnitDtpStat[] statsLoaded = CourseUnitDtpStat.fromJson(stats); |
for(CourseUnit cu :units) |
{ |
CourseUnitSection courseUnitSection = new CourseUnitSection(); |
sections.add(courseUnitSection); |
courseUnitSection.setTitle(cu.getName()); |
courseUnitSection.setCourseUnitName(cu.getName()); |
courseUnitSection.setCourseUnitId(cu.getId()); |
courseUnitSection.setSigesCode(cu.getCode()); |
ReportTeacher reportTeacher = new ReportTeacher(); |
if(cu.getResponsableTeacher() != null) |
CourseUnitDtpStat statFound = CourseReportUtils.findCourseUnitDtpStat(statsLoaded, (CourseUnitImpl) cu); |
if(statFound == null) |
{ |
reportTeacher.setSigesCode("" + cu.getResponsableTeacher().getSigesCode()); |
reportTeacher.setName(cu.getResponsableTeacher().getName()); |
statFound = CourseReportUtils.createCourseUnitDtpStat(cu); |
} |
//Todo faltam os profs |
courseUnitSection.setTeachers(new ArrayList<ReportTeacher>()); |
for(Teacher t : cu.getTeachers()) |
if(((CourseUnitImpl) cu).getSemestreAbsolutoS1S2().equals("S1")) |
semester1.getCourseUnitDtpStats().add(statFound); |
else |
semester2.getCourseUnitDtpStats().add(statFound); |
} |
return unitsDtpTable; |
} |
/** |
* |
* @param courseCode |
* @param year |
* @return |
* @throws IOException |
* @throws JSONException |
*/ |
public ReportCourseDocument createNewCourseReportDocument(String courseCode,String year) throws IOException, JSONException |
{ |
ReportCourseDocument reportCourseDocument = new ReportCourseDocument(); |
reportCourseDocument.init(); |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadByCourseSiges(courseCode, year); |
//FIRST SERVICE TO CALL TO OBTAIN UNITS AND EVALUATIONS |
//THIS IS THE BASE FOR THE REMAIN SERVICE CALLS |
List<DocumentSection> courseUnitSections = updateCleanCourseUnitSections(courseCode, year, reportCourseDocument, units); |
//A tabela de resultados globais não vai ser utilizada |
UnitsLearningResultsTable unitsLearningResultsTable = updateCleanLearningResultsFromCourseUnitsSections(reportCourseDocument); |
//Atualiza no DOC a tabela de analise DTP |
UnitsDtpTable unitsDtpTable = updateDtpStatsTable4Course(reportCourseDocument, courseCode, year); |
//Atualiza as tabelas dos Quesitonários pedagogicos |
SurveysResultsSection surveysResultsSection = updateSurveysDataTables(courseCode, year, reportCourseDocument); |
return reportCourseDocument; |
} |
public SurveysResultsSection updateSurveysDataTables(String courseCode, String year, ReportCourseDocument reportCourseDocument) throws IOException, JSONException { |
SurveysSection surveysSection = (SurveysSection) reportCourseDocument.findDocumentSection(SurveysSection.class); |
SurveysResultsSection surveysResultsSection = (SurveysResultsSection) surveysSection.findSubSection(SurveysResultsSection.class); |
QuestionariosDataTableComponent dataTableComponentS1 = (QuestionariosDataTableComponent) surveysResultsSection.getComponents().get(0); |
QuestionariosDataTableComponent dataTableComponentS2 = (QuestionariosDataTableComponent) surveysResultsSection.getComponents().get(1); |
QuestionariosReportsService questionariosReportsService = new QuestionariosReportsService(); |
String jsonDataTableS1 = questionariosReportsService.loadReportUnidadesSalasJson(courseCode,year,"S1"); |
String jsonDataTableS2 = questionariosReportsService.loadReportUnidadesSalasJson(courseCode,year,"S2"); |
DataTable dataTableS1 = DataTable.fromJson(jsonDataTableS1); |
DataTable dataTableS2 = DataTable.fromJson(jsonDataTableS2); |
dataTableComponentS1.setDataTable(dataTableS1); |
dataTableComponentS2.setDataTable(dataTableS2); |
return surveysResultsSection; |
} |
/** |
* Este serviço atualiza a tabela de resultados de aprendizagem com base nas courseunitssections |
* @param reportCourseDocument |
* @return UnitsLearningResultsTable |
*/ |
public UnitsLearningResultsTable updateCleanLearningResultsFromCourseUnitsSections(ReportCourseDocument reportCourseDocument) { |
CourseUnitsReportsSection unitReportsSection = (CourseUnitsReportsSection) reportCourseDocument.findDocumentSection(CourseUnitsReportsSection.class); |
LearningResultsSection learningResultsSection = (LearningResultsSection) reportCourseDocument.findDocumentSection(LearningResultsSection.class); |
UnitsLearningResultsTable learningResultsTable = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class); |
Map<Integer,UnitsLearningResultYear> anosPlano = new HashMap<Integer, UnitsLearningResultYear>(); |
Map<String,UnitsLearningResultSemester> anoSemestre = new HashMap<String, UnitsLearningResultSemester>(); |
for(DocumentSection subSection : unitReportsSection.getSubSections()) |
{ |
CourseUnitSection unitSection = (CourseUnitSection) subSection; |
int anoPlano = unitSection.getAnoPlano(); |
UnitsLearningResultYear anoFound = anosPlano.get(anoPlano); |
if(anoFound == null) |
{ |
ReportTeacher reportTeacherU = new ReportTeacher(); |
reportTeacherU.setSigesCode("" + t.getSigesCode()); |
reportTeacherU.setName(reportTeacherU.getName()); |
courseUnitSection.getTeachers().add(reportTeacher); |
anoFound = new UnitsLearningResultYear(anoPlano); |
anosPlano.put(anoPlano,anoFound); |
learningResultsTable.getYears().add(anoFound); |
} |
if(cu.getCourseUnitEvaluation() != null) |
String semestreCode = ((CourseUnitSection) subSection).getPeriod(); |
UnitsLearningResultSemester semestreFound = anoSemestre.get(anoPlano + "$" + semestreCode); |
if(semestreFound == null) |
{ |
courseUnitSection.setCourseUnitEvaluation(cu.getCourseUnitEvaluation()); |
semestreFound = new UnitsLearningResultSemester(semestreCode); |
anoSemestre.put(anoPlano + "$" + semestreCode,semestreFound); |
anoFound.getSemesters().add(semestreFound); |
} |
UnitsLearningResultUc uc = new UnitsLearningResultUc(); |
uc.setPeriod(semestreCode); |
uc.setName(unitSection.getName()); |
uc.setSigesCode(unitSection.getSigesCode()); |
if(unitSection.getCourseUnitEvaluation() != null) |
{ |
uc.setAlunosInscritos(Integer.parseInt(unitSection.getCourseUnitEvaluation().getNumAlunosInscritos())); |
uc.setAprovados1013(unitSection.getCourseUnitEvaluation().getNumAlunosAprov1013()); |
uc.setAprovados1416(unitSection.getCourseUnitEvaluation().getNumAlunosAprov1416()); |
uc.setAprovados1720(unitSection.getCourseUnitEvaluation().getNumAlunosAprov1720()); |
uc.setSemElementos(unitSection.getCourseUnitEvaluation().getNumAlunosSemElementosAvaliacao()); |
uc.setAprovados(unitSection.getCourseUnitEvaluation().getNumAlunosAprovTotal()); |
uc.setReprovados(unitSection.getCourseUnitEvaluation().getNumAlunosReprovados()); |
if(uc.getAlunosInscritos() > 0) |
{ |
uc.setAprovadosPercent((float) (uc.getAprovados() * 100.0 / uc.getAlunosInscritos())); |
uc.setReprovadosPercent((float) (uc.getReprovados() * 100.0 / uc.getAlunosInscritos())); |
uc.setSemElementosPercent((float) (uc.getSemElementos() * 100.0 / uc.getAlunosInscritos())); |
} |
if(uc.getAprovados() > 0) |
{ |
uc.setAprovados1013Percent((float) (uc.getAprovados1013() * 100.0 / uc.getAprovados())); |
uc.setAprovados1416Percent((float) (uc.getAprovados1416() * 100.0 / uc.getAprovados())); |
uc.setAprovados1720Percent((float) (uc.getAprovados1720() * 100.0 / uc.getAprovados())); |
} |
} |
semestreFound.getUcs().add(uc); |
} |
Collections.sort(learningResultsTable.getYears(), new Comparator<UnitsLearningResultYear>() { |
@Override |
public int compare(UnitsLearningResultYear o1, UnitsLearningResultYear o2) { |
return o1.getAno() - o2.getAno(); |
} |
}); |
for(UnitsLearningResultYear learningYearLine: learningResultsTable.getYears()) |
{ |
Collections.sort(learningYearLine.getSemesters(),new Comparator<UnitsLearningResultSemester>() { |
@Override |
public int compare(UnitsLearningResultSemester o1, UnitsLearningResultSemester o2) { |
return o1.getSemestre().compareTo(o2.getSemestre()); |
} |
}); |
} |
float totalCumProgPercentGlobal = 0; |
int totalInscritosGlobal = 0; |
float totalReprovadosPercentGlobal = 0; |
float totalAprovadosPercentGlobal = 0; |
float totalSemElementosPercentGlobal = 0; |
int totalAprovados1013PercentGlobal = 0; |
float totalAprovados1416PercentGlobal = 0; |
float totalAprovados1720PercentGlobal = 0; |
for(UnitsLearningResultYear learningYearLine: learningResultsTable.getYears()) |
{ |
float totalCumProgPercentAno = 0; |
int totalInscritosAno = 0; |
float totalReprovadosPercentAno = 0; |
float totalAprovadosPercentAno = 0; |
float totalSemElementosPercentAno = 0; |
int totalAprovados1013PercentAno = 0; |
float totalAprovados1416PercentAno = 0; |
float totalAprovados1720PercentAno = 0; |
for(UnitsLearningResultSemester semester: learningYearLine.getSemesters()) |
{ |
float totalCumProgPercent = 0; |
int totalInscritos = 0; |
float totalReprovadosPercent = 0; |
float totalAprovadosPercent = 0; |
float totalSemElementosPercent = 0; |
int totalAprovados1013Percent = 0; |
float totalAprovados1416Percent = 0; |
float totalAprovados1720Percent = 0; |
for(UnitsLearningResultUc uc: semester.getUcs()) |
{ |
totalCumProgPercent += uc.getCumprimentoProgramaPercent(); |
totalInscritos += uc.getAlunosInscritos(); |
totalAprovadosPercent += uc.getAprovadosPercent(); |
totalReprovadosPercent += uc.getReprovadosPercent(); |
totalSemElementosPercent += uc.getSemElementosPercent(); |
totalAprovados1013Percent += uc.getAprovados1013(); |
totalAprovados1416Percent += uc.getAprovados1416(); |
totalAprovados1720Percent += uc.getAprovados1720(); |
} |
//media de inscritos |
if(semester.getUcs().size() > 0) |
{ |
semester.setCumprimentoProgramaPercent( totalCumProgPercent / ((float)semester.getUcs().size())); |
semester.setAlunosInscritos( totalInscritos / (semester.getUcs().size())); |
semester.setAprovadosPercent( totalAprovadosPercent / ((float)semester.getUcs().size())); |
semester.setReprovadosPercent( totalReprovadosPercent / ((float)semester.getUcs().size())); |
semester.setSemElementosPercent( totalSemElementosPercent / ((float)semester.getUcs().size())); |
semester.setAprovados1013Percent( totalAprovados1013Percent / ((float)semester.getUcs().size())); |
semester.setAprovados1416Percent( totalAprovados1416Percent / ((float)semester.getUcs().size())); |
semester.setAprovados1720Percent( totalAprovados1720Percent / ((float)semester.getUcs().size())); |
} |
totalCumProgPercentAno += semester.getCumprimentoProgramaPercent(); |
totalInscritosAno += semester.getAlunosInscritos(); |
totalAprovadosPercentAno += semester.getAprovadosPercent(); |
totalReprovadosPercentAno += semester.getReprovadosPercent(); |
totalSemElementosPercentAno += semester.getSemElementosPercent(); |
totalAprovados1013PercentAno += semester.getAprovados1013(); |
totalAprovados1416PercentAno += semester.getAprovados1416(); |
totalAprovados1720PercentAno += semester.getAprovados1720(); |
} |
//media de inscritos |
if(learningYearLine.getSemesters().size() > 0) |
{ |
learningYearLine.setCumprimentoProgramaPercent( totalCumProgPercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setAlunosInscritos( totalInscritosAno / (learningYearLine.getSemesters().size())); |
learningYearLine.setAprovadosPercent( totalAprovadosPercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setReprovadosPercent( totalReprovadosPercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setSemElementosPercent( totalSemElementosPercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setAprovados1013Percent( totalAprovados1013PercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setAprovados1416Percent( totalAprovados1416PercentAno / ((float)learningYearLine.getSemesters().size())); |
learningYearLine.setAprovados1720Percent( totalAprovados1720PercentAno / ((float)learningYearLine.getSemesters().size())); |
} |
totalCumProgPercentGlobal += learningYearLine.getCumprimentoProgramaPercent(); |
totalInscritosGlobal += learningYearLine.getAlunosInscritos(); |
totalAprovadosPercentGlobal += learningYearLine.getAprovadosPercent(); |
totalReprovadosPercentGlobal += learningYearLine.getReprovadosPercent(); |
totalSemElementosPercentGlobal += learningYearLine.getSemElementosPercent(); |
totalAprovados1013PercentGlobal += learningYearLine.getAprovados1013(); |
totalAprovados1416PercentGlobal += learningYearLine.getAprovados1416(); |
totalAprovados1720PercentGlobal += learningYearLine.getAprovados1720(); |
} |
if(learningResultsTable.getYears().size() > 0) |
{ |
learningResultsTable.setCumprimentoProgramaPercent( totalCumProgPercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setAlunosInscritos( totalInscritosGlobal / (learningResultsTable.getYears().size())); |
learningResultsTable.setAprovadosPercent( totalAprovadosPercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setReprovadosPercent( totalReprovadosPercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setSemElementosPercent( totalSemElementosPercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setAprovados1013Percent( totalAprovados1013PercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setAprovados1416Percent( totalAprovados1416PercentGlobal / ((float)learningResultsTable.getYears().size())); |
learningResultsTable.setAprovados1720Percent( totalAprovados1720PercentGlobal / ((float)learningResultsTable.getYears().size())); |
} |
return learningResultsTable; |
//CRIAR A TABELA DE RESUTLADOS GLOBAIS GERAIS COMO UM RESUMO DA ANTERIOR |
/*for(UnitsLearningResultYear learningYearLine: learningResultsTable.getYears()) |
{ |
}*/ |
} |
/** |
* Update course unit sections with reports, this method dows not change learning results table |
* values from learning results stays in unit but does not change learning results Table |
* @param courseCode |
* @param year |
* @param reportCourseDocument |
* @param units |
* @throws JSONException |
* @throws IOException |
* @return a list of CourseUnitSection |
*/ |
public List<DocumentSection> updateCleanCourseUnitSections(String courseCode, String year, ReportCourseDocument reportCourseDocument, List<CourseUnit> units) throws JSONException, IOException { |
String courseUnitSectionsJson = loadCourseEvaluationSections(courseCode,year); |
JSONObject object = new JSONObject(courseUnitSectionsJson); |
JSONArray evaluations = object.getJSONArray("evaluations"); |
CourseUnitSection[] courseUnitSections = CourseUnitSection.fromJsonArray(evaluations.toString()); |
CourseUnitsReportsSection unitReportsSection = (CourseUnitsReportsSection) reportCourseDocument.findDocumentSection(CourseUnitsReportsSection.class); |
List<DocumentSection> subSections = new ArrayList<DocumentSection>(); |
unitReportsSection.setSubSections(subSections); |
for(CourseUnit cu :units) |
{ |
CourseUnitSection sectionFound = CourseReportUtils.findCourseUnitSection(courseUnitSections, (CourseUnitImpl) cu); |
if(sectionFound == null) |
{ |
sectionFound = CourseReportUtils.createCourseUnitEvaluationSection((CourseUnitImpl) cu); |
} |
unitReportsSection.getSubSections().add(sectionFound); |
} |
return subSections; |
} |
public static void main(String[] args) throws IOException, JSONException { |
AbstractDao.getCurrentSession().beginTransaction(); |
ReportCourseDocument reportCourseDocument = new CourseReportServices().createNewCourseReportDocument("9119","201516"); |
System.out.println(reportCourseDocument.toJson()); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
/* |
public String loadUnitsAndCreateLearningResultsTables4Course(String courseCode, String year) throws IOException, JSONException |
{ |
} |
*/ |
//TODO loadUnitsAndCreateLearningResultsTables4Course |
//HIPOTESE DEVOLVER DOIS OBJECTOS |
//SERVICO DE ARRANQUE |
//DEVOLVE UM REPORT DOCUMENT E O CHAMADOR USA O QUE QUISER |
//A GERACAO DE GRAFICOS FAZ-SE APENAS A PEDIDO |
// SE ELE PEDIR PARA ATUALIZAR TUDO CARREGA-SE UNIDADES E TABELAS NU DOC NOVO |
// E NO BROWSER SUBSTITUI-SE ESSES ELEMENTOS NOS ANTIGOS a seccao das unidades |
// e as as tabelas |
/****************************************************************************/ |
/* SERVICOS WS-API |
/****************************************************************************/ |
/** |
* This service loads a list of course units given course code and year |
* with dtp stats codes pre-filled |
* @param courseCode |
* @param year |
* @return |
* @throws JSONException |
* @throws IOException |
*/ |
public String loadCourseUnitDtpStats(String courseCode,String year) throws JSONException, IOException { |
if(Globals.SYSTEM_WSJSON_SERVICE_COURSE_UNITS_DTP_STATS.indexOf("localhost")>=0) |
{ |
JSONArray array = new JSONArray(); |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadByCourseSiges(courseCode, year); |
for(CourseUnit cu: units) |
{ |
CourseUnitDtpStat stat = CourseReportUtils.createCourseUnitDtpStat(cu); |
//sections.add(courseUnitSection); |
array.put(stat.toJsonObject()); |
} |
JSONObject obj = new JSONObject(); |
obj.put("dtpstats",array); |
return obj.toString(); |
} |
else |
{ |
URL url = new URL(Globals.SYSTEM_WSJSON_SERVICE_COURSE_UNITS_DTP_STATS + "?code=" + courseCode + "&year=" + year); |
InputStream is = url.openStream(); |
String json = StreamsUtils.readString(is); |
is.close(); |
//TODO temos de extrair o resultado do RESPONSE |
JSONObject jsonObject = new JSONObject(json); |
return jsonObject.getString("response").toString(); |
} |
} |
/** |
* |
* Para um determinado curso e ano o serviço faz uma listagem de todas as suas unidades curriculares |
* e lista a sua informação básica juntamente com o relatório de avaliação disponivel |
* O serviço adiciona ainda o Ano de cada unidade por inspeção do Plano de Estudos |
* caso a unidade não seja encontrada no Plano de estudos o ano irá ser preenchido com -1 |
* |
* @param courseCode codigo Siges na base de dados |
* @param year 201617, 201718 |
* @return String JSONObject with a JSON ARRAY of List<CourseUnitSection> |
*/ |
public String loadCourseEvaluationSections(String courseCode,String year) throws JSONException, IOException { |
if(Globals.SYSTEM_WSJSON_SERVICE_COURSE_UNITS_EVALUATION.indexOf("localhost")>=0) |
{ |
JSONArray array = new JSONArray(); |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadByCourseSiges(courseCode, year); |
for(CourseUnit cu: units) |
{ |
CourseUnitSection courseUnitSection = CourseReportUtils.createCourseUnitEvaluationSection((CourseUnitImpl) cu); |
array.put(courseUnitSection.toJsonObject()); |
} |
JSONObject obj = new JSONObject(); |
obj.put("evaluations",array); |
return obj.toString(); |
} |
else |
{ |
URL url = new URL(Globals.SYSTEM_WSJSON_SERVICE_COURSE_UNITS_EVALUATION + "?code=" + courseCode + "&year=" + year); |
InputStream is = url.openStream(); |
String json = StreamsUtils.readString(is); |
is.close(); |
JSONObject jsonObject = new JSONObject(json); |
return jsonObject.getString("response").toString(); |
} |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitDtpSemester.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/GlobalLearningResultYear.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitsLearningResultYear.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/DocumentSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/CourseUnitDtpStat.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/ImageComponent.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/GenericTextSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/TextComponent.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/ReportTeacher.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitsLearningResultUc.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/SurveysAnalysisSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/LearningGlobalAnalysisSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitsLearningResultsTable.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/CustomPane.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitsDtpTable.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/CourseUnitSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/GlobalLearningResultTable.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/GlobalLearningResultSemester.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/SurveysResultsSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/LearningAnalysisSection.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/DocComponent.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/UnitsLearningResultSemester.java |
---|
File deleted |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/IntroSection.java |
---|
1,9 → 1,20 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.utils.documentBuilder.GenericTextSection; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class IntroSection extends GenericTextSection |
{ |
public IntroSection() |
{ |
} |
public void init() |
{ |
setTitle("Introdução"); |
super.init(); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/surveys/SurveysResultsSection.java |
---|
New file |
0,0 → 1,22 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.surveys; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.QuestionariosDataTableComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class SurveysResultsSection extends DocumentSection |
{ |
public SurveysResultsSection() { |
} |
public SurveysResultsSection(String title) { |
super(title); |
getComponents().add(new QuestionariosDataTableComponent("Resultados do 1º Semestre")); |
getComponents().add(new QuestionariosDataTableComponent("Resultados do 2º Semestre")); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/surveys/SurveysAnalysisSection.java |
---|
New file |
0,0 → 1,25 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.surveys; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.GenericTextSection; |
import pt.estgp.estgweb.utils.documentBuilder.TextComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class SurveysAnalysisSection extends DocumentSection |
{ |
public SurveysAnalysisSection() { |
} |
public SurveysAnalysisSection(String title) { |
super(title); |
getComponents().add(new TextComponent()); |
//4.2.1 |
getSubSections().add(new GenericTextSection("Análise das UC's")); |
//4.2.2 |
getSubSections().add(new GenericTextSection("Análise das Salas")); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultYear.java |
---|
New file |
0,0 → 1,48 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class GlobalLearningResultYear |
{ |
int semElementosPercent; |
int reprovadosPercent; |
int aprovadosPercent; |
public int getSemElementosPercent() { |
return semElementosPercent; |
} |
public void setSemElementosPercent(int semElementosPercent) { |
this.semElementosPercent = semElementosPercent; |
} |
public int getReprovadosPercent() { |
return reprovadosPercent; |
} |
public void setReprovadosPercent(int reprovadosPercent) { |
this.reprovadosPercent = reprovadosPercent; |
} |
public int getAprovadosPercent() { |
return aprovadosPercent; |
} |
public void setAprovadosPercent(int aprovadosPercent) { |
this.aprovadosPercent = aprovadosPercent; |
} |
List<GlobalLearningResultSemester> globalLearningResultSemesters = new ArrayList<GlobalLearningResultSemester>(); |
public List<GlobalLearningResultSemester> getGlobalLearningResultSemesters() { |
return globalLearningResultSemesters; |
} |
public void setGlobalLearningResultSemesters(List<GlobalLearningResultSemester> globalLearningResultSemesters) { |
this.globalLearningResultSemesters = globalLearningResultSemesters; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultsChartImg.java |
---|
New file |
0,0 → 1,11 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import pt.estgp.estgweb.utils.documentBuilder.AutoImageWraperComponent; |
/** |
* Created by jorgemachado on 31/10/17. |
*/ |
public class GlobalLearningResultsChartImg extends AutoImageWraperComponent |
{ |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/UnitsLearningResult.java |
---|
New file |
0,0 → 1,135 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
/** |
* Created by jorgemachado on 03/11/17. |
*/ |
public class UnitsLearningResult |
{ |
float cumprimentoProgramaPercent; |
int alunosInscritos; |
int semElementos; |
float semElementosPercent; |
int aprovados; |
float aprovadosPercent; |
int reprovados; |
float reprovadosPercent; |
int aprovados1013; |
float aprovados1013Percent; |
int aprovados1416; |
float aprovados1416Percent; |
int aprovados1720; |
float aprovados1720Percent; |
public float getCumprimentoProgramaPercent() { |
return cumprimentoProgramaPercent; |
} |
public void setCumprimentoProgramaPercent(float cumprimentoProgramaPercent) { |
this.cumprimentoProgramaPercent = cumprimentoProgramaPercent; |
} |
public int getAlunosInscritos() { |
return alunosInscritos; |
} |
public void setAlunosInscritos(int alunosInscritos) { |
this.alunosInscritos = alunosInscritos; |
} |
public int getSemElementos() { |
return semElementos; |
} |
public void setSemElementos(int semElementos) { |
this.semElementos = semElementos; |
} |
public float getSemElementosPercent() { |
return semElementosPercent; |
} |
public void setSemElementosPercent(float semElementosPercent) { |
this.semElementosPercent = semElementosPercent; |
} |
public int getAprovados() { |
return aprovados; |
} |
public void setAprovados(int aprovados) { |
this.aprovados = aprovados; |
} |
public float getAprovadosPercent() { |
return aprovadosPercent; |
} |
public void setAprovadosPercent(float aprovadosPercent) { |
this.aprovadosPercent = aprovadosPercent; |
} |
public int getReprovados() { |
return reprovados; |
} |
public void setReprovados(int reprovados) { |
this.reprovados = reprovados; |
} |
public float getReprovadosPercent() { |
return reprovadosPercent; |
} |
public void setReprovadosPercent(float reprovadosPercent) { |
this.reprovadosPercent = reprovadosPercent; |
} |
public int getAprovados1013() { |
return aprovados1013; |
} |
public void setAprovados1013(int aprovados1013) { |
this.aprovados1013 = aprovados1013; |
} |
public float getAprovados1013Percent() { |
return aprovados1013Percent; |
} |
public void setAprovados1013Percent(float aprovados1013Percent) { |
this.aprovados1013Percent = aprovados1013Percent; |
} |
public int getAprovados1416() { |
return aprovados1416; |
} |
public void setAprovados1416(int aprovados1416) { |
this.aprovados1416 = aprovados1416; |
} |
public float getAprovados1416Percent() { |
return aprovados1416Percent; |
} |
public void setAprovados1416Percent(float aprovados1416Percent) { |
this.aprovados1416Percent = aprovados1416Percent; |
} |
public int getAprovados1720() { |
return aprovados1720; |
} |
public void setAprovados1720(int aprovados1720) { |
this.aprovados1720 = aprovados1720; |
} |
public float getAprovados1720Percent() { |
return aprovados1720Percent; |
} |
public void setAprovados1720Percent(float aprovados1720Percent) { |
this.aprovados1720Percent = aprovados1720Percent; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultsChartYearImg.java |
---|
New file |
0,0 → 1,10 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import pt.estgp.estgweb.utils.documentBuilder.AutoImageWraperComponent; |
/** |
* Created by jorgemachado on 31/10/17. |
*/ |
public class GlobalLearningResultsChartYearImg extends AutoImageWraperComponent |
{ |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/UnitsLearningResultYear.java |
---|
New file |
0,0 → 1,39 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitsLearningResultYear extends UnitsLearningResult |
{ |
int ano; |
List<UnitsLearningResultSemester> semesters = new ArrayList<UnitsLearningResultSemester>(); |
public UnitsLearningResultYear() { |
} |
public UnitsLearningResultYear(int ano) { |
this.ano = ano; |
} |
public int getAno() { |
return ano; |
} |
public void setAno(int ano) { |
this.ano = ano; |
} |
public List<UnitsLearningResultSemester> getSemesters() { |
return semesters; |
} |
public void setSemesters(List<UnitsLearningResultSemester> semesters) { |
this.semesters = semesters; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultSemester.java |
---|
New file |
0,0 → 1,35 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class GlobalLearningResultSemester |
{ |
int semElementosPercent; |
int reprovadosPercent; |
int aprovadosPercent; |
public int getSemElementosPercent() { |
return semElementosPercent; |
} |
public void setSemElementosPercent(int semElementosPercent) { |
this.semElementosPercent = semElementosPercent; |
} |
public int getReprovadosPercent() { |
return reprovadosPercent; |
} |
public void setReprovadosPercent(int reprovadosPercent) { |
this.reprovadosPercent = reprovadosPercent; |
} |
public int getAprovadosPercent() { |
return aprovadosPercent; |
} |
public void setAprovadosPercent(int aprovadosPercent) { |
this.aprovadosPercent = aprovadosPercent; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultTable.java |
---|
New file |
0,0 → 1,52 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import pt.estgp.estgweb.utils.documentBuilder.AbstractTableComponent; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class GlobalLearningResultTable extends AbstractTableComponent |
{ |
List<GlobalLearningResultYear> globalLearningResultYear = new ArrayList<GlobalLearningResultYear>(); |
int semElementosPercent; |
int reprovadosPercent; |
int aprovadosPercent; |
public int getSemElementosPercent() { |
return semElementosPercent; |
} |
public void setSemElementosPercent(int semElementosPercent) { |
this.semElementosPercent = semElementosPercent; |
} |
public int getReprovadosPercent() { |
return reprovadosPercent; |
} |
public void setReprovadosPercent(int reprovadosPercent) { |
this.reprovadosPercent = reprovadosPercent; |
} |
public int getAprovadosPercent() { |
return aprovadosPercent; |
} |
public void setAprovadosPercent(int aprovadosPercent) { |
this.aprovadosPercent = aprovadosPercent; |
} |
public List<GlobalLearningResultYear> getGlobalLearningResultYear() { |
return globalLearningResultYear; |
} |
public void setGlobalLearningResultYear(List<GlobalLearningResultYear> globalLearningResultYear) { |
this.globalLearningResultYear = globalLearningResultYear; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/LearningResultsChartSem.java |
---|
New file |
0,0 → 1,27 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import pt.estgp.estgweb.utils.documentBuilder.AutoImageWraperComponent; |
/** |
* Created by jorgemachado on 31/10/17. |
*/ |
public class LearningResultsChartSem extends AutoImageWraperComponent |
{ |
String semesterCode; |
public LearningResultsChartSem() { |
} |
public LearningResultsChartSem(String semesterCode) { |
this.semesterCode = semesterCode; |
} |
public String getSemesterCode() { |
return semesterCode; |
} |
public void setSemesterCode(String semesterCode) { |
this.semesterCode = semesterCode; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/UnitsLearningResultSemester.java |
---|
New file |
0,0 → 1,40 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitsLearningResultSemester extends UnitsLearningResult |
{ |
String semestre; |
List<UnitsLearningResultUc> ucs = new ArrayList<UnitsLearningResultUc>(); |
public UnitsLearningResultSemester() { |
} |
public UnitsLearningResultSemester(String semestre) { |
this.semestre = semestre; |
} |
public String getSemestre() { |
return semestre; |
} |
public void setSemestre(String semestre) { |
this.semestre = semestre; |
} |
public List<UnitsLearningResultUc> getUcs() { |
return ucs; |
} |
public void setUcs(List<UnitsLearningResultUc> ucs) { |
this.ucs = ucs; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/UnitsLearningResultUc.java |
---|
New file |
0,0 → 1,39 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitsLearningResultUc extends UnitsLearningResult |
{ |
private String name; |
private String sigesCode; |
private String period; |
public String getName() { |
return name; |
} |
public void setName(String name) { |
this.name = name; |
} |
public String getSigesCode() { |
return sigesCode; |
} |
public void setSigesCode(String sigesCode) { |
this.sigesCode = sigesCode; |
} |
public String getPeriod() { |
return period; |
} |
public void setPeriod(String period) { |
this.period = period; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/UnitsLearningResultsTable.java |
---|
New file |
0,0 → 1,151 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
import pt.estgp.estgweb.utils.documentBuilder.AbstractTableComponent; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitsLearningResultsTable extends AbstractTableComponent |
{ |
float cumprimentoProgramaPercent; |
int alunosInscritos; |
int semElementos; |
float semElementosPercent; |
int aprovados; |
float aprovadosPercent; |
int reprovados; |
float reprovadosPercent; |
int aprovados1013; |
float aprovados1013Percent; |
int aprovados1416; |
float aprovados1416Percent; |
int aprovados1720; |
float aprovados1720Percent; |
List<UnitsLearningResultYear> years = new ArrayList<UnitsLearningResultYear>(); |
public List<UnitsLearningResultYear> getYears() { |
return years; |
} |
public void setYears(List<UnitsLearningResultYear> years) { |
this.years = years; |
} |
public float getCumprimentoProgramaPercent() { |
return cumprimentoProgramaPercent; |
} |
public void setCumprimentoProgramaPercent(float cumprimentoProgramaPercent) { |
this.cumprimentoProgramaPercent = cumprimentoProgramaPercent; |
} |
public int getAlunosInscritos() { |
return alunosInscritos; |
} |
public void setAlunosInscritos(int alunosInscritos) { |
this.alunosInscritos = alunosInscritos; |
} |
public int getSemElementos() { |
return semElementos; |
} |
public void setSemElementos(int semElementos) { |
this.semElementos = semElementos; |
} |
public float getSemElementosPercent() { |
return semElementosPercent; |
} |
public void setSemElementosPercent(float semElementosPercent) { |
this.semElementosPercent = semElementosPercent; |
} |
public int getAprovados() { |
return aprovados; |
} |
public void setAprovados(int aprovados) { |
this.aprovados = aprovados; |
} |
public float getAprovadosPercent() { |
return aprovadosPercent; |
} |
public void setAprovadosPercent(float aprovadosPercent) { |
this.aprovadosPercent = aprovadosPercent; |
} |
public int getReprovados() { |
return reprovados; |
} |
public void setReprovados(int reprovados) { |
this.reprovados = reprovados; |
} |
public float getReprovadosPercent() { |
return reprovadosPercent; |
} |
public void setReprovadosPercent(float reprovadosPercent) { |
this.reprovadosPercent = reprovadosPercent; |
} |
public int getAprovados1013() { |
return aprovados1013; |
} |
public void setAprovados1013(int aprovados1013) { |
this.aprovados1013 = aprovados1013; |
} |
public float getAprovados1013Percent() { |
return aprovados1013Percent; |
} |
public void setAprovados1013Percent(float aprovados1013Percent) { |
this.aprovados1013Percent = aprovados1013Percent; |
} |
public int getAprovados1416() { |
return aprovados1416; |
} |
public void setAprovados1416(int aprovados1416) { |
this.aprovados1416 = aprovados1416; |
} |
public float getAprovados1416Percent() { |
return aprovados1416Percent; |
} |
public void setAprovados1416Percent(float aprovados1416Percent) { |
this.aprovados1416Percent = aprovados1416Percent; |
} |
public int getAprovados1720() { |
return aprovados1720; |
} |
public void setAprovados1720(int aprovados1720) { |
this.aprovados1720 = aprovados1720; |
} |
public float getAprovados1720Percent() { |
return aprovados1720Percent; |
} |
public void setAprovados1720Percent(float aprovados1720Percent) { |
this.aprovados1720Percent = aprovados1720Percent; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/LearningAnalysisSection.java |
---|
New file |
0,0 → 1,24 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.LearningResultsChartSem; |
import pt.estgp.estgweb.utils.documentBuilder.CustomPane; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.TextComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class LearningAnalysisSection extends DocumentSection |
{ |
public LearningAnalysisSection() { |
} |
public LearningAnalysisSection(String title) |
{ |
super(title); |
super.getComponents().add(new TextComponent()); |
super.getComponents().add(new LearningResultsChartSem("S1")); |
super.getComponents().add(new LearningResultsChartSem("S2")); |
super.getComponents().add(new CustomPane()); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/LearningGlobalAnalysisSection.java |
---|
New file |
0,0 → 1,28 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.GlobalLearningResultTable; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.GlobalLearningResultsChartImg; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.GlobalLearningResultsChartYearImg; |
import pt.estgp.estgweb.utils.documentBuilder.CustomPane; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.TextComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class LearningGlobalAnalysisSection extends DocumentSection |
{ |
public LearningGlobalAnalysisSection() |
{ |
} |
public LearningGlobalAnalysisSection(String title) { |
super(title); |
super.getComponents().add(new TextComponent()); |
super.getComponents().add(new GlobalLearningResultTable()); |
super.getComponents().add(new GlobalLearningResultsChartImg()); |
super.getComponents().add(new TextComponent()); |
super.getComponents().add(new GlobalLearningResultsChartYearImg()); |
super.getComponents().add(new CustomPane()); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/reportucsummary/UnitDtpSemester.java |
---|
New file |
0,0 → 1,20 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitDtpSemester |
{ |
List<CourseUnitDtpStat> courseUnitDtpStats = new ArrayList<CourseUnitDtpStat>(); |
public List<CourseUnitDtpStat> getCourseUnitDtpStats() { |
return courseUnitDtpStats; |
} |
public void setCourseUnitDtpStats(List<CourseUnitDtpStat> courseUnitDtpStats) { |
this.courseUnitDtpStats = courseUnitDtpStats; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/reportucsummary/UnitsDtpTable.java |
---|
New file |
0,0 → 1,81 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary; |
import com.owlike.genson.Genson; |
import com.owlike.genson.GensonBuilder; |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.utils.documentBuilder.AbstractTableComponent; |
import java.util.Date; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class UnitsDtpTable extends AbstractTableComponent |
{ |
UnitDtpSemester semester1 = new UnitDtpSemester(); |
UnitDtpSemester semester2 = new UnitDtpSemester(); |
public UnitDtpSemester getSemester1() { |
return semester1; |
} |
public void setSemester1(UnitDtpSemester semester1) { |
this.semester1 = semester1; |
} |
public UnitDtpSemester getSemester2() { |
return semester2; |
} |
public void setSemester2(UnitDtpSemester semester2) { |
this.semester2 = semester2; |
} |
private static Genson gensonGenericLoad; |
static{ |
gensonGenericLoad = new GensonBuilder() |
.useMethods(true) |
.useFields(true) |
.useRuntimeType(true) |
.useClassMetadata(true) |
.useDateAsTimestamp(true) |
.exclude(Class.class) |
.exclude(Date.class) |
.exclude(java.sql.Timestamp.class) |
.exclude(java.sql.Date.class) |
.create(); |
} |
public static UnitsDtpTable fromJson(String json) |
{ |
return gensonGenericLoad.deserialize(json,UnitsDtpTable.class); |
} |
/** |
* Generic Json Object only for local class methods |
* @return |
* @throws org.json.JSONException |
*/ |
public JSONObject toJsonObject() throws JSONException |
{ |
return new JSONObject(toJson()); |
} |
/** |
* * Generic Json Object only for local class methods |
* @return |
* @throws java.io.IOException |
*/ |
public String toJson() |
{ |
return gensonGenericLoad.serialize(this); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/reportucsummary/CourseUnitDtpStat.java |
---|
New file |
0,0 → 1,176 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary; |
import org.json.JSONArray; |
import com.owlike.genson.Genson; |
import com.owlike.genson.GensonBuilder; |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.utils.JsonView; |
import java.util.Date; |
import java.util.List; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class CourseUnitDtpStat implements JsonView |
{ |
String sigesCode; |
String period; |
String name; |
boolean planeamentoConteudos; |
boolean planeamentoCalendarizacao; |
boolean ficha; |
boolean sumarios; |
boolean avaliacaoEnunciados; |
boolean avaliacaoPautas; |
boolean relatorio; |
boolean inquerito; |
public String getSigesCode() { |
return sigesCode; |
} |
public void setSigesCode(String sigesCode) { |
this.sigesCode = sigesCode; |
} |
public String getPeriod() { |
return period; |
} |
public void setPeriod(String period) { |
this.period = period; |
} |
public String getName() { |
return name; |
} |
public void setName(String name) { |
this.name = name; |
} |
public boolean isPlaneamentoConteudos() { |
return planeamentoConteudos; |
} |
public void setPlaneamentoConteudos(boolean planeamentoConteudos) { |
this.planeamentoConteudos = planeamentoConteudos; |
} |
public boolean isPlaneamentoCalendarizacao() { |
return planeamentoCalendarizacao; |
} |
public void setPlaneamentoCalendarizacao(boolean planeamentoCalendarizacao) { |
this.planeamentoCalendarizacao = planeamentoCalendarizacao; |
} |
public boolean isFicha() { |
return ficha; |
} |
public void setFicha(boolean ficha) { |
this.ficha = ficha; |
} |
public boolean isSumarios() { |
return sumarios; |
} |
public void setSumarios(boolean sumarios) { |
this.sumarios = sumarios; |
} |
public boolean isAvaliacaoEnunciados() { |
return avaliacaoEnunciados; |
} |
public void setAvaliacaoEnunciados(boolean avaliacaoEnunciados) { |
this.avaliacaoEnunciados = avaliacaoEnunciados; |
} |
public boolean isAvaliacaoPautas() { |
return avaliacaoPautas; |
} |
public void setAvaliacaoPautas(boolean avaliacaoPautas) { |
this.avaliacaoPautas = avaliacaoPautas; |
} |
public boolean isRelatorio() { |
return relatorio; |
} |
public void setRelatorio(boolean relatorio) { |
this.relatorio = relatorio; |
} |
public boolean isInquerito() { |
return inquerito; |
} |
public void setInquerito(boolean inquerito) { |
this.inquerito = inquerito; |
} |
private static Genson gensonGenericLoad; |
static{ |
gensonGenericLoad = new GensonBuilder() |
.useMethods(true) |
.useFields(true) |
.useRuntimeType(true) |
.useClassMetadata(true) |
.useDateAsTimestamp(true) |
.exclude(Class.class) |
.exclude(Date.class) |
.exclude(java.sql.Timestamp.class) |
.exclude(java.sql.Date.class) |
.create(); |
} |
public static CourseUnitDtpStat fromJson(String json) |
{ |
return gensonGenericLoad.deserialize(json,CourseUnitDtpStat.class); |
} |
public static CourseUnitDtpStat[] fromJson(JSONArray stats) |
{ |
return gensonGenericLoad.deserialize(stats.toString(),CourseUnitDtpStat[].class); |
} |
public List<String> getJsonExcludedProperties() { |
return null; |
} |
/** |
* Generic Json Object only for local class methods |
* @return |
* @throws org.json.JSONException |
*/ |
public JSONObject toJsonObject() throws JSONException |
{ |
return new JSONObject(toJson()); |
} |
/** |
* * Generic Json Object only for local class methods |
* @return |
* @throws java.io.IOException |
*/ |
public String toJson() |
{ |
return gensonGenericLoad.serialize(this); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/ConclusionsSection.java |
---|
1,27 → 1,22 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.GenericTextSection; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class ConclusionsSection extends DocumentSection |
{ |
GenericTextSection problemsIdentificationSection = new GenericTextSection(); |
GenericTextSection improvementsSection = new GenericTextSection(); |
public GenericTextSection getProblemsIdentificationSection() { |
return problemsIdentificationSection; |
public ConclusionsSection() |
{ |
} |
public void setProblemsIdentificationSection(GenericTextSection problemsIdentificationSection) { |
this.problemsIdentificationSection = problemsIdentificationSection; |
public void init() |
{ |
super.setTitle("Conclusões"); |
super.getSubSections().add(new GenericTextSection("Identificação de Problemas")); |
super.getSubSections().add(new GenericTextSection("Melhorias")); |
} |
public GenericTextSection getImprovementsSection() { |
return improvementsSection; |
} |
public void setImprovementsSection(GenericTextSection improvementsSection) { |
this.improvementsSection = improvementsSection; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/SurveysSection.java |
---|
1,5 → 1,9 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.surveys.SurveysAnalysisSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.surveys.SurveysResultsSection; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
7,25 → 11,16 |
{ |
SurveysResultsSection surveysResultsSection = new SurveysResultsSection(); |
public SurveysSection() |
{ |
SurveysAnalysisSection surveysAnalysisSection = new SurveysAnalysisSection(); |
public SurveysResultsSection getSurveysResultsSection() { |
return surveysResultsSection; |
} |
public void setSurveysResultsSection(SurveysResultsSection surveysResultsSection) { |
this.surveysResultsSection = surveysResultsSection; |
public void init() { |
super.setTitle("Inquéritos Pedagógicos"); |
//4.1 |
super.getSubSections().add(new SurveysResultsSection("Resultados dos Inquéritos Pedagógicos")); |
//4.2 |
super.getSubSections().add(new SurveysAnalysisSection("Análise dos Inquéritos Pedagógicos")); |
} |
public SurveysAnalysisSection getSurveysAnalysisSection() { |
return surveysAnalysisSection; |
} |
public void setSurveysAnalysisSection(SurveysAnalysisSection surveysAnalysisSection) { |
this.surveysAnalysisSection = surveysAnalysisSection; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/LearningResultsSection.java |
---|
1,81 → 1,39 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.LearningAnalysisSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.LearningGlobalAnalysisSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultsTable; |
import pt.estgp.estgweb.utils.documentBuilder.CustomPane; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.GenericTextSection; |
import pt.estgp.estgweb.utils.documentBuilder.TextComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class LearningResultsSection extends DocumentSection |
{ |
TextComponent text = new TextComponent(); |
UnitsLearningResultsTable unitsLearningResultsTable; |
CustomPane customPane = new CustomPane(); |
//3.1 Analise Aproveitamento |
LearningAnalysisSection learningAnalisysSection = new LearningAnalysisSection(); |
//3.2 Analise Global Aproveitamento |
LearningGlobalAnalysisSection learningGlobalAnalisysSection = new LearningGlobalAnalysisSection(); |
//3.3 Analise Funcionamento UCs |
GenericTextSection ucsWorkingAnalisysSection = new GenericTextSection(); |
//3.4 Cumprimento de Programas |
GenericTextSection ucsProgramExecutedAnalisysSection = new GenericTextSection(); |
public TextComponent getText() { |
return text; |
public LearningResultsSection() |
{ |
super(); |
} |
public void setText(TextComponent text) { |
this.text = text; |
} |
public void init() |
{ |
super.setTitle("Resultados da Aprendizagem"); |
super.getComponents().add(new TextComponent()); |
super.getComponents().add(new UnitsLearningResultsTable()); |
super.getComponents().add(new CustomPane()); |
public UnitsLearningResultsTable getUnitsLearningResultsTable() { |
return unitsLearningResultsTable; |
//3.1 Analise Aproveitamento |
super.getSubSections().add(new LearningAnalysisSection("Analise Aproveitamento")); |
//3.2 Analise Global Aproveitamento |
super.getSubSections().add(new LearningGlobalAnalysisSection("Analise Global Aproveitamento")); |
//3.3 Analise Funcionamento UCs |
super.getSubSections().add(new GenericTextSection("Analise Funcionamento UCs")); |
//3.4 Cumprimento de Programas |
super.getSubSections().add(new GenericTextSection("Cumprimento de Programas")); |
} |
public void setUnitsLearningResultsTable(UnitsLearningResultsTable unitsLearningResultsTable) { |
this.unitsLearningResultsTable = unitsLearningResultsTable; |
} |
public CustomPane getCustomPane() { |
return customPane; |
} |
public void setCustomPane(CustomPane customPane) { |
this.customPane = customPane; |
} |
public LearningAnalysisSection getLearningAnalisysSection() { |
return learningAnalisysSection; |
} |
public void setLearningAnalisysSection(LearningAnalysisSection learningAnalisysSection) { |
this.learningAnalisysSection = learningAnalisysSection; |
} |
public LearningGlobalAnalysisSection getLearningGlobalAnalisysSection() { |
return learningGlobalAnalisysSection; |
} |
public void setLearningGlobalAnalisysSection(LearningGlobalAnalysisSection learningGlobalAnalisysSection) { |
this.learningGlobalAnalisysSection = learningGlobalAnalisysSection; |
} |
public GenericTextSection getUcsWorkingAnalisysSection() { |
return ucsWorkingAnalisysSection; |
} |
public void setUcsWorkingAnalisysSection(GenericTextSection ucsWorkingAnalisysSection) { |
this.ucsWorkingAnalisysSection = ucsWorkingAnalisysSection; |
} |
public GenericTextSection getUcsProgramExecutedAnalisysSection() { |
return ucsProgramExecutedAnalisysSection; |
} |
public void setUcsProgramExecutedAnalisysSection(GenericTextSection ucsProgramExecutedAnalisysSection) { |
this.ucsProgramExecutedAnalisysSection = ucsProgramExecutedAnalisysSection; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/CourseUnitsReportsSection.java |
---|
New file |
0,0 → 1,24 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import java.util.ArrayList; |
/** |
* Created by jorgemachado on 31/10/17. |
*/ |
public class CourseUnitsReportsSection extends DocumentSection |
{ |
public CourseUnitsReportsSection() |
{ |
} |
public void init() { |
setTitle("Relatórios das Unidades Curriculares"); |
setSubSections(new ArrayList<DocumentSection>()); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/ReportsUcSummarySection.java |
---|
1,37 → 1,24 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitsDtpTable; |
import pt.estgp.estgweb.utils.documentBuilder.CustomPane; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import pt.estgp.estgweb.utils.documentBuilder.TextComponent; |
/** |
* Created by jorgemachado on 11/10/17. |
*/ |
public class ReportsUcSummarySection extends DocumentSection |
{ |
TextComponent text = new TextComponent(); |
UnitsDtpTable unitsDtpTable = new UnitsDtpTable(); |
public ReportsUcSummarySection() |
{ |
CustomPane customPane = new CustomPane(); |
public TextComponent getText() { |
return text; |
} |
public void setText(TextComponent text) { |
this.text = text; |
public void init(){ |
super.setTitle("Mapa Sintese dos Relatórios dos Reeponsáveis das UC's"); |
super.getComponents().add(new TextComponent()); |
super.getComponents().add(new UnitsDtpTable()); |
super.getComponents().add(new CustomPane()); |
} |
public UnitsDtpTable getUnitsDtpTable() { |
return unitsDtpTable; |
} |
public void setUnitsDtpTable(UnitsDtpTable unitsDtpTable) { |
this.unitsDtpTable = unitsDtpTable; |
} |
public CustomPane getCustomPane() { |
return customPane; |
} |
public void setCustomPane(CustomPane customPane) { |
this.customPane = customPane; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/ReportCourseDocument.java |
---|
6,41 → 6,87 |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.utils.JsonView; |
import pt.estgp.estgweb.utils.documentBuilder.Document; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.List; |
/** |
* Created by jorgemachado on 14/10/17. |
*/ |
public class ReportCourseDocument implements JsonView |
public class ReportCourseDocument extends Document implements JsonView |
{ |
private static final Logger logger = Logger.getLogger(ReportCourseDocument.class); |
List<CourseUnitSection> courseUnitSections = new ArrayList<CourseUnitSection>(); |
public ReportCourseDocument() |
{ |
public List<CourseUnitSection> getCourseUnitSections() { |
return courseUnitSections; |
} |
public void setCourseUnitSections(List<CourseUnitSection> courseUnitSections) { |
this.courseUnitSections = courseUnitSections; |
public void init() |
{ |
//1 - Introducao |
IntroSection introSection = new IntroSection(); |
introSection.init(); |
getSections().add(introSection); |
//2 - Mapa Sintese dos Relatórios dos Responsáveis das UC's |
ReportsUcSummarySection reportsUcSummarySection = new ReportsUcSummarySection(); |
reportsUcSummarySection.init(); |
getSections().add(reportsUcSummarySection); |
//3 - Resultados da Aprendizagem |
LearningResultsSection learningResultsSection = new LearningResultsSection(); |
learningResultsSection.init(); |
getSections().add(learningResultsSection); |
//4 - Inquéritos |
SurveysSection surveysSection = new SurveysSection(); |
surveysSection.init(); |
getSections().add(surveysSection); |
//5 - Conclusões |
ConclusionsSection conclusionsSection = new ConclusionsSection(); |
conclusionsSection.init(); |
getSections().add(conclusionsSection); |
//5 - Unidades Curriculares |
CourseUnitsReportsSection courseUnitsReportsSection = new CourseUnitsReportsSection(); |
courseUnitsReportsSection.init(); |
getSections().add(courseUnitsReportsSection); |
} |
public DocumentSection findDocumentSection(Class sectionClass) |
{ |
if(getSections() != null) |
for(DocumentSection section: getSections()) |
{ |
if(section.getClass().equals(sectionClass)) |
{ |
return section; |
} |
} |
return null; |
} |
private static Genson gensonGenericLoad; |
static{ |
gensonGenericLoad = new GensonBuilder() |
//Usa ClassMetadata nos objectos contidos se houver |
// porque no principal já foi buscar antes fazendo parse ao JSON no metodo fromJson e fazendo get("@class") |
//porque no genson o @class tem de vir em primeiro e pode não |
// se nos outros não vier info da class ele falha |
.useMethods(true) //only bean proerties |
.useFields(true) //pode existir uma var com campos publicos esses ele serializa |
.useRuntimeType(true) |
.useMethods(true) |
.useFields(true) |
.useRuntimeType(true) //para ignorar a CGLIB do courseUnitEvaluation |
.useClassMetadata(true) |
.useDateAsTimestamp(true) |
.exclude(Class.class) |
.exclude(Date.class) |
.exclude(java.sql.Timestamp.class) |
.exclude(java.sql.Date.class) |
61,7 → 107,7 |
/** |
* Generic Json Object only for local class methods |
* @return |
* @throws JSONException |
* @throws org.json.JSONException |
*/ |
public JSONObject toJsonObject() throws JSONException |
{ |
78,4 → 124,6 |
return gensonGenericLoad.serialize(this); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/courseunitreport/CourseUnitSection.java |
---|
New file |
0,0 → 1,164 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport; |
import com.owlike.genson.Genson; |
import com.owlike.genson.GensonBuilder; |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.CourseUnitEvaluation; |
import pt.estgp.estgweb.domain.CourseUnitEvaluationImpl; |
import pt.estgp.estgweb.domain.utils.JsonView; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.components.ReportTeacher; |
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
import java.util.Date; |
import java.util.List; |
/** |
* Created by jorgemachado on 14/10/17. |
*/ |
public class CourseUnitSection extends DocumentSection implements JsonView |
{ |
private long courseUnitId; |
private String name; |
private String sigesCode; |
private String period; |
private ReportTeacher responsableTeacher; |
private int anoPlano; |
private List<ReportTeacher> teachers; |
private CourseUnitEvaluationImpl courseUnitEvaluation; |
public CourseUnitSection() |
{ |
} |
public CourseUnitSection(long courseUnitId, |
String courseUnitName, |
String sigesCode, |
int anoPlano, |
String period, |
ReportTeacher responsableTeacher, |
List<ReportTeacher> teachers, |
CourseUnitEvaluationImpl courseUnitEvaluation) { |
this.courseUnitId = courseUnitId; |
this.name = courseUnitName; |
this.sigesCode = sigesCode; |
this.anoPlano = anoPlano; |
this.period = period; |
this.responsableTeacher = responsableTeacher; |
this.teachers = teachers; |
this.courseUnitEvaluation = courseUnitEvaluation; |
super.setTitle(courseUnitName); |
} |
public long getCourseUnitId() { |
return courseUnitId; |
} |
public void setCourseUnitId(long courseUnitId) { |
this.courseUnitId = courseUnitId; |
} |
public String getPeriod() { return period; } |
public void setPeriod(String period) { this.period = period; } |
public String getName() { |
return name; |
} |
public void setName(String name) { |
this.name = name; |
} |
public String getSigesCode() { |
return sigesCode; |
} |
public void setSigesCode(String sigesCode) { |
this.sigesCode = sigesCode; |
} |
public ReportTeacher getResponsableTeacher() { |
return responsableTeacher; |
} |
public void setResponsableTeacher(ReportTeacher responsableTeacher) { |
this.responsableTeacher = responsableTeacher; |
} |
public List<ReportTeacher> getTeachers() { |
return teachers; |
} |
public void setTeachers(List<ReportTeacher> teachers) { |
this.teachers = teachers; |
} |
public CourseUnitEvaluation getCourseUnitEvaluation() { |
return courseUnitEvaluation; |
} |
public void setCourseUnitEvaluation(CourseUnitEvaluationImpl courseUnitEvaluation) { |
this.courseUnitEvaluation = courseUnitEvaluation; |
} |
public int getAnoPlano() { |
return anoPlano; |
} |
public void setAnoPlano(int anoPlano) { |
this.anoPlano = anoPlano; |
} |
private static Genson gensonGenericLoad; |
static{ |
gensonGenericLoad = new GensonBuilder() |
.useMethods(true) |
.useFields(true) |
.useRuntimeType(true) |
.useClassMetadata(true) |
.useDateAsTimestamp(true) |
.exclude(Class.class) |
.exclude(Date.class) |
.exclude(java.sql.Timestamp.class) |
.exclude(java.sql.Date.class) |
.create(); |
} |
public static CourseUnitSection fromJson(String json) |
{ |
return gensonGenericLoad.deserialize(json,CourseUnitSection.class); |
} |
public static CourseUnitSection[] fromJsonArray(String jsonArray) |
{ |
return gensonGenericLoad.deserialize(jsonArray,CourseUnitSection[].class); |
} |
public List<String> getJsonExcludedProperties() { |
return null; |
} |
/** |
* Generic Json Object only for local class methods |
* @return |
* @throws org.json.JSONException |
*/ |
public JSONObject toJsonObject() throws JSONException |
{ |
return new JSONObject(toJson()); |
} |
/** |
* * Generic Json Object only for local class methods |
* @return |
* @throws java.io.IOException |
*/ |
public String toJson() |
{ |
return gensonGenericLoad.serialize(this); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/courseunitreport/components/ReportTeacher.java |
---|
New file |
0,0 → 1,28 |
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.components; |
import pt.estgp.estgweb.utils.documentBuilder.DocComponent; |
/** |
* Created by jorgemachado on 14/10/17. |
*/ |
public class ReportTeacher extends DocComponent |
{ |
private String name; |
private String sigesCode; |
public String getName() { |
return name; |
} |
public void setName(String name) { |
this.name = name; |
} |
public String getSigesCode() { |
return sigesCode; |
} |
public void setSigesCode(String sigesCode) { |
this.sigesCode = sigesCode; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/CourseReportUtils.java |
---|
New file |
0,0 → 1,103 |
package pt.estgp.estgweb.services.courses.coursereport; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.CourseUnitEvaluationImpl; |
import pt.estgp.estgweb.domain.CourseUnitImpl; |
import pt.estgp.estgweb.domain.Teacher; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.CourseUnitSection; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.components.ReportTeacher; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.CourseUnitDtpStat; |
import java.util.ArrayList; |
/** |
* Created by jorgemachado on 03/11/17. |
*/ |
public class CourseReportUtils |
{ |
public static CourseUnitDtpStat createCourseUnitDtpStat(CourseUnit cu) |
{ |
CourseUnitDtpStat stat = new CourseUnitDtpStat() ; |
stat.setSigesCode(cu.getCode()); |
stat.setName(cu.getName()); |
stat.setPeriod(((CourseUnitImpl)cu).getSemestreAbsolutoS1S2()); |
stat.setPlaneamentoConteudos(cu.getStatdtpPlaneamentoFiles() > 0); |
stat.setPlaneamentoCalendarizacao(cu.getStatdtpPlaneamentoFiles() > 0); |
stat.setAvaliacaoPautas(cu.getStatdtpAvaliacaoPautasFiles() > 0); |
stat.setAvaliacaoEnunciados(cu.getStatdtpAvaliacaoEnunciadosFiles() > 0); |
stat.setRelatorio(cu.getCourseUnitEvaluation() != null && cu.getCourseUnitEvaluation().isClosed()); |
stat.setFicha(cu.isStatdtpFichaCurricularValid()); |
stat.setSumarios(cu.getStatdtpSumaries() > 0); |
stat.setInquerito(cu.getStatdtpInqueritoPedagogicoFiles() > 0); |
return stat; |
} |
public static CourseUnitSection createCourseUnitEvaluationSection(CourseUnitImpl cu) { |
CourseUnitSection courseUnitSection = new CourseUnitSection(); |
courseUnitSection.setTitle("Relatório de Avaliação de " + cu.getName() + " (" + cu.getCode() + ")"); |
courseUnitSection.setName(cu.getName()); |
courseUnitSection.setCourseUnitId(cu.getId()); |
courseUnitSection.setSigesCode(cu.getCode()); |
courseUnitSection.setPeriod(cu.getSemestreAbsolutoS1S2()); |
if(cu.getResponsableTeacher() != null) |
{ |
ReportTeacher reportTeacher = new ReportTeacher(); |
reportTeacher.setSigesCode("" + cu.getResponsableTeacher().getSigesCode()); |
reportTeacher.setName(cu.getResponsableTeacher().getName()); |
courseUnitSection.setResponsableTeacher(reportTeacher); |
} |
courseUnitSection.setTeachers(new ArrayList<ReportTeacher>()); |
for(Teacher t : cu.getTeachers()) |
{ |
ReportTeacher reportTeacher = new ReportTeacher(); |
reportTeacher.setSigesCode("" + t.getSigesCode()); |
reportTeacher.setName(t.getName()); |
courseUnitSection.getTeachers().add(reportTeacher); |
} |
if(cu.getCourseUnitEvaluation() != null) |
{ |
courseUnitSection.setCourseUnitEvaluation((CourseUnitEvaluationImpl) DaoFactory.getCourseUnitEvaluationDaoImpl().narrow(cu.getCourseUnitEvaluation())); |
} |
CourseUnitImpl cuImpl = (CourseUnitImpl) cu; |
int ano = cuImpl.getAnoPlanoFromStudiesPlan(); |
//o ano podera ser -1 caso nao encontre plano para ele |
courseUnitSection.setAnoPlano(ano); |
return courseUnitSection; |
} |
public static CourseUnitDtpStat findCourseUnitDtpStat(CourseUnitDtpStat[] statsLoaded, CourseUnitImpl courseUnit) |
{ |
for(CourseUnitDtpStat stat: statsLoaded) |
{ |
if(stat.getSigesCode().equals(courseUnit.getCode()) && |
stat.getPeriod().equals(courseUnit.getSemestreAbsolutoS1S2())) |
{ |
return stat; |
} |
} |
return null; |
} |
public static CourseUnitSection findCourseUnitSection(CourseUnitSection[] sectionLoaded, CourseUnitImpl courseUnit) |
{ |
for(CourseUnitSection section: sectionLoaded) |
{ |
if(section.getSigesCode().equals(courseUnit.getCode()) && |
section.getPeriod().equals(courseUnit.getSemestreAbsolutoS1S2())) |
{ |
return section; |
} |
} |
return null; |
} |
} |