Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1788 → Rev 1789

/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java
3,7 → 3,6
import com.owlike.genson.Genson;
import com.owlike.genson.GensonBuilder;
import com.owlike.genson.reflect.VisibilityFilter;
import jomm.dao.impl.AbstractDao;
import jomm.utils.BytesUtils;
import jomm.utils.FilesUtils;
import jomm.utils.StreamsUtils;
18,13 → 17,12
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.filters.exceptions.AccessDeniedException;
import pt.estgp.estgweb.services.courses.xsd.Curso;
import pt.estgp.estgweb.services.courses.xsd.SemestreImpl;
import pt.estgp.estgweb.services.courses.xsd.UnidadeType;
import pt.estgp.estgweb.services.courses.xsd.*;
import pt.estgp.estgweb.services.data.IRepositoryFile;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.services.users.ReplaceRoleResult;
import pt.estgp.estgweb.services.users.UserRoleConfigService;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Dom4jUtil;
60,6 → 58,7
RepositoryService repositoryService = new RepositoryService();
 
 
 
/**
* Servico e subservico para termos acesso as variaveis de controlo
* @param id
356,7 → 355,7
courseStudiesPlan.setXml(sw.toString());
 
 
String json = getGensonPlanoEstudos().serialize(curso);
String json = CursoImpl.getGensonPlanoEstudosParaApiJsonWS().serialize(curso);
//SETTING JSON in COURSE STUDIES PLAN
courseStudiesPlan.setJson(json);
 
417,24 → 416,6
}
 
 
private static Genson getGensonPlanoEstudos(){
Genson genson = new GensonBuilder()
.exclude("class")
.exclude("siges", Curso.class)
.exclude("nome",Curso.class)
.exclude("codigoPlanoSiges",Curso.class)
.exclude("anoPlanoSiges",Curso.class)
.exclude("descPlanoSiges",Curso.class)
.exclude("dep")
.exclude("removed",UnidadeType.class)
.exclude("perfilId",Curso.Semestre.Perfil.class)
.exclude("semestreId",Curso.Semestre.class)
.create();
return genson;
}
 
 
 
private static Genson getGensonCourse(){
Genson genson = new GensonBuilder()
.exclude(Object.class)
475,6 → 456,7
.include("schoolForJsonApi", CourseImpl.class)
.include("statusForJsonApi", CourseImpl.class)
 
 
.include("name", Course.class)
.include("nameEn", Course.class)
.include("nameEs", Course.class)
624,6 → 606,7
* Nota: O plano de Estudos é uma classe persistente que tem apenas versão e descrição
* deverá ter como campo o XML e o JSON já gerados do plano de estudos que comporta
*
* //TODO REVER
* @param code
* @return
* @throws JSONException
665,7 → 648,9
JSONObject studiesPlanObj;
if(studiesPlan.getJson() != null)
{
studiesPlanObj = new JSONObject(studiesPlan.getJson());
CursoImpl c = CursoImpl.loadFromJson(studiesPlan.getJson());
autoFillTotalHorasContacto(c);
studiesPlanObj = c.toJsonObjectJsonApiWS();
studiesPlanObj.put("version",studiesPlan.getVersion());
coursesResponse.put("courseStudiesPlan",studiesPlanObj);
}
982,7 → 967,7
* Updates studiesPlanVersion
* Updates studiesPlanVersionDescription
* Updates PlanoEstudos XML and JSON
*
* TODO REVER
* @param courseId
* @param coursePlanId
* @param planoEditado
1026,6 → 1011,12
planoEditado.setSiges(course.getCode());//GARANTIR QUE O CODIGO SIGEST ESTA CORRECTO
planoEditado.setNome(course.getName());
planoEditado.setDep(course.getArea());
 
/**
* Calcula automaticamente as horas de contacto totais
*/
autoFillTotalHorasContacto(planoEditado);
 
//planoEditado.setDepDesc("");
//planoEditado.setDepDescEn("");
//planoEditado.setDepDescEs("");
1037,7 → 1028,7
marshaller.marshal(planoEditado,xml);
 
courseStudiesPlanPersistente.setXml(xml.toString());
String json = getGensonPlanoEstudos().serialize(planoEditado);
String json = CursoImpl.getGensonPlanoEstudosParaApiJsonWS().serialize(planoEditado);
//SETTING JSON in COURSE STUDIES PLAN
courseStudiesPlanPersistente.setJson(json);
break;
1050,6 → 1041,35
}
}
 
private void autoFillTotalHorasContacto(Curso planoEditado) {
if(planoEditado.getSemestre() != null)
{
for(Curso.Semestre s : planoEditado.getSemestre())
{
if(s.getUnidade() != null)
{
for(UnidadeType u : s.getUnidade())
{
u.setTotalHorasContacto(UnidadeImpl.calculateTotalHorasContacto(u.getHorasContacto()));
}
}
if(s.getPerfil() != null)
{
for(Curso.Semestre.Perfil p : s.getPerfil())
{
if(p.getUnidade() != null)
{
for(UnidadeType u : p.getUnidade())
{
u.setTotalHorasContacto(UnidadeImpl.calculateTotalHorasContacto(u.getHorasContacto()));
}
}
}
}
}
}
}
 
public void generateFreshJsonPlanosEstudosFromXml(UserSession session)
{
List<CourseStudiesPlan> coursePlans = DaoFactory.getCourseStudiesPlanDaoImpl().findAll();
1072,7 → 1092,7
StringWriter xml = new StringWriter();
marshaller.marshal(cursoPlano,xml);
courseStudiesPlanPersistente.setXml(xml.toString());
String json = getGensonPlanoEstudos().serialize(cursoPlano);
String json = CursoImpl.getGensonPlanoEstudosParaApiJsonWS().serialize(cursoPlano);
//SETTING JSON in COURSE STUDIES PLAN
courseStudiesPlanPersistente.setJson(json);
}
1124,12 → 1144,13
return t;
}
 
/*
public static void main(String[] args)
{
AbstractDao.getCurrentSession().beginTransaction();
new CoursesService().generateFreshJsonPlanosEstudosFromXml(null);
AbstractDao.getCurrentSession().getTransaction().commit();
}
}*/
 
public StudiesPlanImporter importStudiesPlanVersionFromFile(InputStream stream, Long studiesPlanId, UserSession session) throws IOException
{
1150,7 → 1171,7
return importer;
}
 
public UserRoleConfigService.ReplaceRoleResult createRoleCourseComission(long courseId,UserSession userSession) throws AccessDeniedException
public ReplaceRoleResult createRoleCourseComission(long courseId,UserSession userSession) throws AccessDeniedException
{
Course c = DaoFactory.getCourseDaoImpl().load(courseId);
String normalizedName = StringsUtils.getNormalizedNameSafeforCode(c.getName());
1168,7 → 1189,7
 
try {
 
UserRoleConfigService.ReplaceRoleResult result;
ReplaceRoleResult result;
if(c.getValidationRole() == null || c.getValidationRole().trim().length() == 0)
{
result = new UserRoleConfigService().addUpdateRole(newUserRoleConfig,userSession);
1301,5 → 1322,18
 
}
 
public static void main(String[] args) throws JAXBException, IOException {
 
String json = "{\"anoPlanoSiges\":null,\"codigoPlanoSiges\":null,\"dep\":null,\"descPlanoSiges\":null,\"nome\":null,\"semestre\":[{\"id\":\"S1\",\"notas\":null,\"perfil\":[],\"semestreDesc\":\"Semestre 1\",\"semestreDescEn\":\"Semester 1\",\"semestreDescEs\":\"Semestre 1\",\"semestreDescFr\":\"Semestre 1\",\"semestreId\":null,\"unidade\":[{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Português — Língua e Literatura\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:12\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"},\"eCTS\":\"6\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Geografia\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"125\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:16\",\"horasContacto\":{\"tP\":\"45\",\"oT\":\"15\"},\"eCTS\":\"5\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"História\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"125\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:20\",\"horasContacto\":{\"tP\":\"45\",\"oT\":\"15\"},\"eCTS\":\"5\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Linguística e Análise do Discurso\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:24\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"},\"eCTS\":\"6\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Matemática no 1.o Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"125\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:28\",\"horasContacto\":{\"tP\":\"45\",\"oT\":\"15\"},\"eCTS\":\"5\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Educação para a Saúde\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:32\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"},\"eCTS\":\"3\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Música, Emoção e Criatividade\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:36\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"},\"eCTS\":\"3\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Educação para a Cidadania\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:40\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"},\"eCTS\":\"3\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Descobrir a Matemática\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:44\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"},\"eCTS\":\"3\"}],\"type\":\"semestre\",\"$$hashKey\":\"object:6\"},{\"id\":\"S2\",\"notas\":null,\"perfil\":[],\"semestreDesc\":\"Semestre 1\",\"semestreDescEn\":\"Semester 1\",\"semestreDescEs\":\"Semestre 1\",\"semestreDescFr\":\"Semestre 1\",\"semestreId\":null,\"unidade\":[{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática do Português no 1º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:54\",\"eCTS\":\"6\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática do Estudo do Meio no 1º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:58\",\"eCTS\":\"6\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática da Matemática no 1º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:62\",\"eCTS\":\"6\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática das Expressões no 1º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"150\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:66\",\"eCTS\":\"6\",\"horasContacto\":{\"tP\":\"60\",\"oT\":\"15\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Psicologia da Educação\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:70\",\"eCTS\":\"3\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Investigação em Educação\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"75\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:74\",\"eCTS\":\"3\",\"horasContacto\":{\"tP\":\"30\",\"oT\":\"7\"}}],\"type\":\"semestre\",\"$$hashKey\":\"object:48\"},{\"id\":\"S3\",\"notas\":null,\"perfil\":[],\"semestreDesc\":\"Semestre 1\",\"semestreDescEn\":\"Semester 1\",\"semestreDescEs\":\"Semestre 1\",\"semestreDescFr\":\"Semestre 1\",\"semestreId\":null,\"unidade\":[{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Prática de Ensino Supervisionada no 1º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"500\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:90\",\"eCTS\":\"20\",\"horasContacto\":{\"s\":\"30\",\"e\":\"270\",\"oT\":\"45\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Seminário de Investigação I\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"50\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:98\",\"eCTS\":\"2\",\"horasContacto\":{\"s\":\"20\",\"oT\":\"10\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática da História e Geografia de Portugal no 2º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"100\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:94\",\"eCTS\":\"4\",\"horasContacto\":{\"tP\":\"35\",\"oT\":\"15\"}},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"Didática do Português no 2º Ciclo do Ensino Básico\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":\"100\",\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:102\",\"eCTS\":\"4\",\"horasContacto\":{\"oT\":\"15\",\"tP\":\"35\"}}],\"type\":\"semestre\",\"$$hashKey\":\"object:78\"},{\"id\":\"S4\",\"notas\":null,\"perfil\":[],\"semestreDesc\":\"Semestre 1\",\"semestreDescEn\":\"Semester 1\",\"semestreDescEs\":\"Semestre 1\",\"semestreDescFr\":\"Semestre 1\",\"semestreId\":null,\"unidade\":[{\"dep\":\"\",\"ects\":\"\",\"nome\":\"\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":0,\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:106\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":0,\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:110\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":0,\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:114\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":0,\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:118\"},{\"dep\":\"\",\"ects\":\"\",\"nome\":\"\",\"nomeEn\":null,\"nomeEs\":null,\"nomeFr\":null,\"obs\":\"\",\"removed\":null,\"siges\":null,\"totalHoras\":0,\"urlFichaCurricular\":\"\",\"urlUnidadeCurricular\":\"\",\"type\":\"unidade\",\"$$hashKey\":\"object:122\"}],\"type\":\"semestre\",\"$$hashKey\":\"object:84\"}],\"siges\":null}";
CursoImpl c = CursoImpl.loadFromJson(json);
 
JAXBContext jc = JAXBContext.newInstance(Curso.class);
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter xml = new StringWriter();
marshaller.marshal(c,xml);
System.out.println(xml);
}
 
 
}
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/xsd/UnidadeImpl.java
3,8 → 3,10
/**
* Created by jorgemachado on 15/09/16.
*/
public class UnidadeImpl extends UnidadeType {
public UnidadeType.HorasContacto getHorasContacto() {
public class UnidadeImpl extends UnidadeType
{
public UnidadeType.HorasContacto getHorasContacto()
{
 
if(horasContacto == null)
horasContacto = new HorasContacto();
186,5 → 188,53
return null;
}
 
/**
* GenField
* **/
public static String calculateTotalHorasContacto(HorasContacto h)
{
if(h == null)
return "0";
double total = 0;
total += convertHoras(h.getE());
total += convertHoras(h.getO());
total += convertHoras(h.getOT());
total += convertHoras(h.getP());
total += convertHoras(h.getPD());
total += convertHoras(h.getPL());
total += convertHoras(h.getS());
total += convertHoras(h.getT());
total += convertHoras(h.getTC());
total += convertHoras(h.getTP());
 
String totalStr = String.format( "%.1f", total ).replace(",", ".");
if(totalStr.endsWith(".0"))
{
return ((int)total) + "";
}
return totalStr;
}
 
private static double convertHoras(String horas)
{
if(horas == null || horas.trim().length() == 0)
return 0;
try
{
if(horas.indexOf(",")>=0)
{
horas = horas.replace(",",".");
}
Double d = Double.parseDouble(horas);
return d.doubleValue();
}
catch(Throwable e)
{
return 0;
}
}
 
 
 
 
}
/branches/v3/impl/src/java/pt/estgp/estgweb/services/courses/xsd/CursoImpl.java
14,6 → 14,23
*/
public class CursoImpl extends Curso
{
public static Genson getGensonPlanoEstudosParaApiJsonWS(){
Genson genson = new GensonBuilder()
.useRuntimeType(true)
.exclude("class")
.exclude("siges", Curso.class)
.exclude("nome",Curso.class)
.exclude("codigoPlanoSiges",Curso.class)
.exclude("anoPlanoSiges",Curso.class)
.exclude("descPlanoSiges",Curso.class)
.exclude("dep")
.exclude("removed",UnidadeType.class)
.exclude("perfilId",Semestre.Perfil.class)
.exclude("semestreId",Semestre.class)
.create();
return genson;
}
 
public List<Semestre> getSemestre()
{
if (semestre == null) {
23,13 → 40,13
}
 
//ESTE GENSON e apenas para propositos de interface. O JSON gerado para envio pelas API's e feito no servico
//CourseService.savePlanoEstudosEditado que usa o Genson obtido em CourseService.getGensonPlanoEstudos
//CourseService.savePlanoEstudosEditado que usa o Genson obtido em CourseService.getGensonPlanoEstudosParaApiJsonWS
 
static Genson genson;
 
static {
GensonBuilder gensonBuilder = new GensonBuilder()
.exclude(Object.class)
//.exclude(Object.class)
 
.include(Boolean.class)
.include(Integer.class)
68,5 → 85,9
return new JSONObject(toJson());
}
 
public JSONObject toJsonObjectJsonApiWS() throws IOException, JSONException {
return new JSONObject(getGensonPlanoEstudosParaApiJsonWS().serialize(this));
}
 
 
}
/branches/v3/impl/src/doc/estgweb.eap
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3/impl/src/web/user/courses/studiesPlansAdministrationEdit.jsp
387,6 → 387,31
"FICHA_URL" : true
}
 
$scope.isInteger = function(n) { return Number(n) === n && n % 1 === 0; }
$scope.isFloat = function(n) { return Number(n) === n && n % 1 !== 0; }
 
 
$scope.getTotalHorasContacto = function(totalHoras)
{
var total = 0;
 
for (var key in totalHoras )
{
if(key != "tc" && key != "ot" && key != "pd"
&& key != "pd"
&& key != "pl"
&& key != "tp")
{
var valor = totalHoras[key];
if(!isNaN(Number(valor)))
{
total+= Number(valor);
}
}
}
return total;
}
 
$scope.submeterForm = function()
{
$("#planoEstudosJsonInterface").val(
512,7 → 537,7
<th>SIGES</th>
<th>Nome</th>
<th>ECTS</th>
<th>Total</th>
<th>Total Horas de Trabalho</th>
<th>T</th>
<th>TP</th>
<th>P</th>
675,7 → 700,8
<th ng-show="confView.SIGES">SIGES</th>
<th ng-show="confView.Nome">Nome</th>
<th ng-show="confView.ECTS">ECTS</th>
<th ng-show="confView.Total">Total</th>
<th ng-show="confView.Total">Total Horas Trabalho</th>
<th>Total Contacto</th>
<th ng-show="confView.T">T</th>
<th ng-show="confView.TP">TP</th>
<th ng-show="confView.P">P</th>
735,7 → 761,8
<th ng-show="confView.SIGES">SIGES</th>
<th ng-show="confView.Nome">Nome</th>
<th ng-show="confView.ECTS">ECTS</th>
<th ng-show="confView.Total">Total</th>
<th ng-show="confView.Total">Total Horas de Trabalho</th>
<th>Total Contacto</th>
<th ng-show="confView.T">T</th>
<th ng-show="confView.TP">TP</th>
<th ng-show="confView.P">P</th>
795,7 → 822,7
</td>
<td ng-show="confView.ECTS"><input type="text" style="width: 40px" ng-model="u.eCTS"/></td>
<td ng-show="confView.Total"><input type="text" style="width: 40px" ng-model="u.totalHoras"></td>
 
<td>{{getTotalHorasContacto(u.horasContacto)}}</td>
<td ng-show="confView.T"><input type="text" style="width: 40px" ng-model="u.horasContacto.t"/></td>
<td ng-show="confView.TP"><input type="text" style="width: 40px" ng-model="u.horasContacto.tP"/></td>
<td ng-show="confView.P"><input type="text" style="width: 40px" ng-model="u.horasContacto.p"/></td>
/branches/v3/impl/src/xsd/planoestudos.xsd
75,19 → 75,20
<xsd:element name="nomeFr" type="xsd:string"/>
<xsd:element name="dep" type="xsd:string"/>
<xsd:element name="totalHoras" type="xsd:int"/>
<xsd:element name="totalHorasContacto" type="xsd:string"/>
<xsd:element name="horasContacto">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="T" type="xsd:int" minOccurs="0"/>
<xsd:element name="TP" type="xsd:int" minOccurs="0"/>
<xsd:element name="P" type="xsd:int" minOccurs="0"/>
<xsd:element name="PL" type="xsd:int" minOccurs="0"/>
<xsd:element name="PD" type="xsd:int" minOccurs="0"/>
<xsd:element name="OT" type="xsd:int" minOccurs="0"/>
<xsd:element name="E" type="xsd:int" minOccurs="0"/>
<xsd:element name="S" type="xsd:int" minOccurs="0"/>
<xsd:element name="TC" type="xsd:int" minOccurs="0"/>
<xsd:element name="O" type="xsd:int" minOccurs="0"/>
<xsd:element name="T" type="xsd:string" minOccurs="0"/>
<xsd:element name="TP" type="xsd:string" minOccurs="0"/>
<xsd:element name="P" type="xsd:string" minOccurs="0"/>
<xsd:element name="PL" type="xsd:string" minOccurs="0"/>
<xsd:element name="PD" type="xsd:string" minOccurs="0"/>
<xsd:element name="OT" type="xsd:string" minOccurs="0"/>
<xsd:element name="E" type="xsd:string" minOccurs="0"/>
<xsd:element name="S" type="xsd:string" minOccurs="0"/>
<xsd:element name="TC" type="xsd:string" minOccurs="0"/>
<xsd:element name="O" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
/branches/v3/impl/gen/java/pt/estgp/estgweb/services/courses/xsd/package-info.java
2,7 → 2,7
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.07.07 at 12:21:09 PM WEST
// Generated on: 2017.07.07 at 02:58:14 PM WEST
//
 
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.estgp.pt/xsd/planoestudos/1.0/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
/branches/v3/impl/gen/java/pt/estgp/estgweb/services/courses/xsd/Curso.java
2,20 → 2,15
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.07.07 at 12:21:09 PM WEST
// Generated on: 2017.07.07 at 02:58:14 PM WEST
//
 
 
package pt.estgp.estgweb.services.courses.xsd;
 
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
 
 
/**
283,7 → 278,12
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* Objects of the following type(s) are allowed in t
public void setSemestre(List<Semestre> semestre) {
this.semestre = semestre;
}
 
t
* {@link Curso.Semestre }
*
*
297,7 → 297,7
 
 
/**
* <p>Java class for anonymous complex type.
* <p>Java class for anonymous comp}lex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
/branches/v3/impl/gen/java/pt/estgp/estgweb/services/courses/xsd/UnidadeType.java
2,7 → 2,7
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.07.07 at 12:21:09 PM WEST
// Generated on: 2017.07.07 at 02:58:14 PM WEST
//
 
 
33,6 → 33,7
* &lt;element name="nomeFr" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="dep" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="totalHoras" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="totalHorasContacto" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="horasContacto">
* &lt;complexType>
* &lt;complexContent>
75,6 → 76,7
"nomeFr",
"dep",
"totalHoras",
"totalHorasContacto",
"horasContacto",
"ects",
"obs"
95,6 → 97,8
protected String dep;
protected int totalHoras;
@XmlElement(required = true)
protected String totalHorasContacto;
@XmlElement(required = true)
protected UnidadeType.HorasContacto horasContacto;
@XmlElement(name = "ECTS", required = true)
protected String ects;
290,6 → 294,30
}
 
/**
* Gets the value of the totalHorasContacto property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTotalHorasContacto() {
return totalHorasContacto;
}
 
/**
* Sets the value of the totalHorasContacto property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTotalHorasContacto(String value) {
this.totalHorasContacto = value;
}
 
/**
* Gets the value of the horasContacto property.
*
* @return
/branches/v3/impl/gen/java/pt/estgp/estgweb/services/courses/xsd/ObjectFactory.java
2,7 → 2,7
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.07.07 at 12:21:09 PM WEST
// Generated on: 2017.07.07 at 02:58:14 PM WEST
//
 
 
45,6 → 45,14
}
 
/**
* Create an instance of {@link Curso.Semestre.Perfil }
*
*/
public Curso.Semestre.Perfil createCursoSemestrePerfil() {
return new Curso.Semestre.Perfil();
}
 
/**
* Create an instance of {@link UnidadeType }
*
*/
68,12 → 76,4
return new Curso.Semestre();
}
 
/**
* Create an instance of {@link Curso.Semestre.Perfil }
*
*/
public Curso.Semestre.Perfil createCursoSemestrePerfil() {
return new Curso.Semestre.Perfil();
}
 
}