Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1017 → Rev 1235

/impl/importRoutines.xml
28,8 → 28,8
<target name="teachers">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportTeachersService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<!--<arg value="201314"/>-->
<!--<arg value="201415"/>-->
<arg value="201516"/>
<arg value="201415"/>
<!--<arg value="201516"/>-->
</java>
</target>
<target name="students">
60,8 → 60,32
 
 
<!-- PONTUAIS -->
 
<target name="agendarImportacoes">
<java classname="pt.estgp.estgweb.services.jobs.JobScheduleService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
 
</java>
</target>
<target name="grades">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<!--<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="200809"/>
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="200910"/>
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201011"/>
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201112"/>
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201213"/>
</java>-->
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
</java>
 
</target>
 
<target name="setAreas">
84,9 → 108,13
<java classname="pt.estgp.estgweb.services.courseunits.SaveCourseUnitProgram" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
 
<target name="storeAllEvaluationsFtp">
<java classname="pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
 
 
 
 
<target name="loadSummariesAtsi">
<java classname="pt.estgp.estgweb.services.sigesimports.LoadSumariesToPDF" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
/impl/conf/language/MessageResourcesCourse.properties
3,6 → 3,7
# COURSE UNITS MESSAGE RESOURCES
#
################################################################################
course.label=Curso
module.Courses=Cursos
course.new=Criar Curso
course.submit.edit=Editar Curso {0}
39,8 → 40,14
course.C=Acções de Formação de Curta Duração
course.A=Formações Avançadas
course.O=Outras Formações
course.T=TeSP
course.T=CTeSP
course.D=Diploma de Estudos Superiores Especializados
course.H=Doutoramento
course.Z=Desconhecido
 
 
 
 
course.Bs=Bacharelatos
course.Ls=Licenciaturas
course.Ms=Mestrados
54,6 → 61,7
course.valid.program=Programa Validado
course.directed.coordinated=Cursos que coordena e/ou dirige (Apenas os Presidentes dos Departamentos tem permissão para alterar o estado de um programa)
courseunit.programs=Programas Curriculares
courseunit.indexes=Índice de Unidades e Cursos (Gestão de Fichas)
course.directed.courses=Cursos que dirige
course.coordinated.courses=Cursos que coordena
course.unit.directed=Unidades Curriculares
91,3 → 99,13
course.menu.publicacoes=Publicações
 
status=Curso Activo
 
courses.fill.course=Por favor escolha pelo menos um curso nos filtros.
 
course.pedagogic.contents.admin=Administração de Inquéritos Pedagógicos
 
course.comissions=Comissões de Curso
 
course.list=Listagem de Cursos
course.course.units=Listagem de Unidades Curriculares
 
/impl/conf/language/MessageResourcesImportSiges.properties
6,12 → 6,25
import.semestre.separated=Importando as disciplinas por Semestre
import.semestre.repeated.S1=Unidade Repetida no 1º semestre
import.semestre.repeated.S2=Unidade Repetida no 2º Semestre
import.semestre.repeated.T1=Unidade Repetida no 1º Trimestre
import.semestre.repeated.T2=Unidade Repetida no 2º Trimestre
import.semestre.repeated.T3=Unidade Repetida no 3º Trimestre
import.semestre.repeated.T4=Unidade Repetida no 4º Trimestre
import.semestre.repeated.A=Unidade Repetida Anual
 
import.semestre.course.units.T1=Importando Unidades Curriculares do 1º Trimestre
import.semestre.course.units.T2=Importando Unidades Curriculares do 2º Trimestre
import.semestre.course.units.T3=Importando Unidades Curriculares do 3º Trimestre
import.semestre.course.units.T4=Importando Unidades Curriculares do 4º Trimestre
import.semestre.course.units.S1=Importando Unidades Curriculares do 1º Semestre
import.semestre.course.units.S2=Importando Unidades Curriculares do 2º Semestre
import.semestre.course.units.A=Importando Unidades Curriculares Anuais
import.semestre.updating.course.units.S1=Actualizando Unidades Curriculares do 1º Semestre
import.semestre.updating.course.units.S2=Actualizando Unidades Curriculares do 2º Semestre
import.semestre.updating.course.units.T1=Actualizando Unidades Curriculares do 1º Trimestre
import.semestre.updating.course.units.T2=Actualizando Unidades Curriculares do 2º Trimestre
import.semestre.updating.course.units.T3=Actualizando Unidades Curriculares do 3º Trimestre
import.semestre.updating.course.units.T4=Actualizando Unidades Curriculares do 4º Trimestre
import.semestre.updating.course.units.A=Actualizando Unidades Curriculares Anuais
import.semestre.updating.courses=Actualizando os Cursos
import.error=Erro na importação
/impl/conf/language/MessageResources.properties
160,6 → 160,7
fail.authenticate=O nome de utilizador ou a palavra passe estão errados. Por favor tente de novo.
dontexist.authenticate=O utilizador já existe na rede interna mas ainda não está disponivel no sistema BACO, por favor dirija-se ao Centro Informático.
 
top.separators=Separadores Públicos
#palavras comuns
courseunit=Unidade Curricular
grade=Nota
362,6 → 363,7
delete=Apagar
confirm=Confirmar
save=Salvar
deliverEvaluation=Entregar Avaliação
add=Adicionar
put=Colocar
remove=Remover
473,23 → 475,105
user.role.courseValidateProgramTGI=Comissão de Curso de TGI
user.role.courseValidateProgramRU=Comissão de Curso de RU
 
user.role.courseValidateProgramCF=Comissão de Curso de Contabilidade e Finanças
user.role.courseValidateProgramTPB=Comissão de Curso de Tecnologias de Produção de Biocombustíveis
 
configuration.grades=Configuração Pautas
configuration=Configurações
configuration.directories=Configuração de Directórios
configuration.directory=Directório
directories.leaf.not.found=Nó não encontrado com o id {0}
 
directories.removed.leaf=Nó {0} removido com sucesso. Necessita de gravar as alterações para tornar a operação definitiva.
directories.add.leaf=Nó {0} adicionado com sucesso. Necessita de gravar as alterações para tornar a operação definitiva.
 
directories.remove.ask=Têm a certeza que pretende eliminar este nó -> {0}?
directories.add.right=Direito adicionado com sucesso, por favor atribua as permissões desejadas
directories.remove.right=Direito removido com sucesso ({0},{1},{2})
 
directories.add.group=Grupo Adicionado cm sucesso, atribua um descritivo
directories.remove.group=Grupo removido cm sucesso
directories.refresh=Refrescar Página
 
 
directories.confirm.save=Tem a certeza que deseja SALVAR as alterações?
directories.confirm.cancel=Tem a certeza que deseja CANCELAR as alterações?
 
directories.save=Salvar as Alterações
directories.cancel=Cancelar e reverter
directories.canceled=Operação cancelada
directories.saved=Operação salva com sucesso
 
 
##TAREFAS AGENDADAS
 
configuration.jobtask=Tarefa Executada
configuration.jobtasks=Tarefas Executadas
configuration.tasks=Tarefas Agendadas
configuration.task=Tarefa Agendada
configuration.taskLog=Log de Tarefa
configuration.task.weekly=Semanalmente
configuration.task.monthly=Mensalmente
configuration.task.dally=Diariamente
configuration.task.hour=Hora
configuration.task.minute=Minuto
configuration.task.second=Segundo
configuration.task.weekday=Dia da semana
configuration.task.monthday=Dia do Mês
configuration.task.now=Agendar para correr agora
configuration.tasks.canceled=Calcelado
configuration.tasks.saved=Tarefa agendada com sucesso
configuration.task.records=Registos de Tarefas Agendadas
configuration.task.log=Ficheiro de Registo
configuration.task.progress=Progresso
 
configuration.task.PENDING=Hora
configuration.task.STARTED=Iniciada
configuration.task.FINISHED=Terminada
configuration.task.FAILED=Falhada
configuration.task.UNKNOWN_ERROR=Terminada com erro desconhecido
configuration.task.unknown=Desconhecido
 
targetService.pt.estgp.estgweb.services.sigesimports.ImportTeachersService=Importação de Professores
targetService.pt.estgp.estgweb.services.sigesimports.ImportStudentsService=Importação de Alunos
targetService.pt.estgp.estgweb.services.sigesimports.ImportSumariesJson=Importação de Sumários
targetService.pt.estgp.estgweb.services.sigesimports.ImportGradesService=Importação de Notas
targetService.pt.estgp.estgweb.services.sigesimports.ImportCourseService=Importação de Cursos
targetService.pt.estgp.estgweb.services.sigesimports.SincronizeLastYearCourseUnitProgramsService=Clonagem de Fichas Curriculares
 
weekday.Mon=Segundas
weekday.Tue=Terças
weekday.Wed=Quartas
weekday.Thu=Quintas
weekday.Fri=Sextas
weekday.Sat=Sabados
weekday.Sun=Domingos
 
weekday.2=Segundas
weekday.3=Terças
weekday.4=Quartas
weekday.5=Quintas
weekday.6=Sextas
weekday.7=Sabados
weekday.1=Domingos
 
monthday.day=ao dia
weekday.day=às
day.time=às
 
job.schedule.inactive=Tarefa está inativa
job.schedule.active=Tarefa reativada
job.schedule.deleted=Tarefa apagada das agendadas
job.schedule.for.now=Agendada para correr assim que for possivel
job.status.PENDING=Pendente
job.status.STARTED=Iniciado
job.status.FINISHED=Terminado
job.status.FINISHED_ERRORS=Terminado com Erros
job.status.FINISHED_WARNINGS=Terminado com Avisos
job.status.FAILED=Falhado
job.status.UNKNOWN_ERROR=Erro Desconhecido
 
close=Fechar
 
 
 
508,3 → 592,25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/impl/conf/language/MessageResourcesCourseUnits.properties
6,10 → 6,12
module.CourseUnits=Unidades Curriculares
course={0} &gt
courseunit={0}
course.unit=Unidade Curricular
 
course.nav.without.arrow={0}
courseunit.security.not.implemented=N\u00e3o implementado por raz\u00f5es de seguran\u00e7a
courseunit.removed=Unidade Removida com sucesso
courseunit.cant.be.removed=N\u00e3o pode remover esta unidade
courseunit.menu.unit.old.units=Anos anteriores
courseunit.menu.unit.other.units=Outros Anos
courseunit.menu.unit=Unidade
45,6 → 47,8
courseunit.name=Nome
courseunit.code=C\u00f3digo
courseunit.semestre=Semestre
courseunit.trimestre=Trimestre
courseunit.anuais=Anuais
courseunit.importYear=Ano de Importa\u00e7\u00e3o
courseunit.course=Curso
 
61,7 → 65,12
courseunit.teacher.situation.all=Todos
courseunit.S1=1\u00ba Semestre
courseunit.S2=2\u00aa Semestre
courseunit.A=Anual
courseunit.ALL=Todos os Semestres
courseunit.T1=1\u00ba Trimestre
courseunit.T2=2\u00ba Trimestre
courseunit.T3=3\u00ba Trimestre
courseunit.T4=4\u00ba Trimestre
courseunit.assignement.delivered.date=Data de Entrega
courseunit.assignement.delivered.date.first.version=Data de Entrega da Primeira Vers\u00e3o
courseunit.assignement.delivered.versions=Total de Vers\u00f5es Entregues
86,7 → 95,7
courseunit.students=Estudantes
courseunit.students.count=Total de estudantes inscritos
courseunit.program=Ficha Curricular
courseunit.edit.program=Editar Programa
courseunit.edit.program=Editar Ficha Curricular
 
courseunit.assignement.deliver.time=Entregue
courseunit.assignement.deliver.time.ok=Entregue a Horas
134,10 → 143,10
 
 
 
courseunits.contentsGrants=Permiss\u00f5es de Consulta dos Ficheiros de Conte\u00fados
courseunits.contentsGrants.PUBLIC=PUBLICAS
courseunits.contentsGrants.PRIVATE=PRIVADOS A ESTUDANTES E DOCENTES DA UNIDADE
courseunits.contentsGrants.INTERNAL=COMUNIDADE ACAD\u00c9MICA
courseunits.contentsGrants=Anuncios e Blog
courseunits.contentsGrants.PUBLIC=PUBLICO
courseunits.contentsGrants.PRIVATE=privado unidade
courseunits.contentsGrants.INTERNAL=interno ESTG
 
 
courseunit.program.objectivos=Objetivos da aprendizagem (conhecimentos, aptid\u00f5es e compet\u00eancias) a desenvolver pelos estudantes, operacionaliza\u00e7\u00e3o dos objetivos e medi\u00e7\u00e3o do seu grau de cumprimento)
175,16 → 184,21
courseunit.evaluation.mapa1.desc=Dados relativos ao processo de avalia\u00e7\u00e3o
courseunit.menu.evaluation=Relat\u00f3rio de Avalia\u00e7\u00e3o
courseunit.evaluation.success=Ficha de Avalia\u00e7\u00e3o alterada com sucesso
courseunit.evaluation.tryagain=Ocorreu um problema a gravar o seu relat\u00f3rio. Por favor tente novamente
 
courseunit.turma=Turma
 
 
 
 
 
 
 
courseunit.consultaroutros=Consultar outros programas
courseunit.confirmaclonagem=Tem a certeza que deseja clonar o programa do ano na caixa de selecção para este programa actualmente aberto para edição? Vai gerar uma nova versão de programa e a anterior será arquivada em PDF.
 
courseunit.dossier.tecnico.pedagogico=Dossier T\u00E9cnico Pedag\u00F3gico
 
 
courseunit.delete.administration=Apagar Unidades Curriculares Administra\u00e7\u00e3o
 
courseunit.canDelete.true=Permitido
courseunit.canDelete.false=Não Permitido
/impl/conf/WEB-INF/struts/struts-courses.xml
86,8 → 86,18
 
 
 
<!--
Administração Conselho Pedagógico
 
Atividade de entrada de inqueritos pedagogicos
-->
 
<action path="/user/coursePedagogicContents" forward="page.courses.pedagogic.contents"/>
<action path="/user/courseComissions" forward="page.courses.comissions"/>
<action path="/user/courseCourseUnits" forward="page.courses.courseunits"/>
 
 
 
</action-mappings>
 
</struts-config>
/impl/conf/WEB-INF/struts/struts-courseunits.xml
144,6 → 144,41
<forward name="edit" path="page.edit.courseunit.admin.from.service.zone"/>
</action>
 
 
<action path="/admin/courseUnitsDeleteAdmin" forward="page.courseunit.delete.admin"/>
 
 
<action path="/user/startDeleteCourseUnitAdminFromUnitsDeleteAdministration"
type="pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsAdminController"
name="CourseUnitsForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.courseunit.delete.admin">
<forward name="delete" path="page.courseunit.delete.admin"/>
</action>
 
<action path="/user/startEditCourseUnitAdminFromUnitsDeleteAdministration" forward="/user/courseUnitControllerAdminFromUnitsDeleteAdministration.do?dispatch=edit&amp;from=UnitsDeleteAdministration"/>
<action path="/user/courseUnitControllerAdminFromUnitsDeleteAdministration"
type="pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsAdminController"
name="CourseUnitsForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.courseunit.delete.admin">
<forward name="edit" path="page.edit.courseunit.admin.from.course.unit.delete"/>
</action>
<action path="/user/startEditCourseUnitAdminFromCourseCourseUnits" forward="/user/courseUnitControllerAdminFromCourseCourseUnits.do?dispatch=edit&amp;from=CourseCourseUnits"/>
<action path="/user/courseUnitControllerAdminFromCourseCourseUnits"
type="pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsAdminController"
name="CourseUnitsForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.courses.courseunits">
<forward name="edit" path="page.edit.courseunit.admin.from.course.course.units"/>
</action>
</action-mappings>
 
</struts-config>
/impl/conf/WEB-INF/struts/tiles-courseunits.xml
177,7 → 177,28
<put name="left" value="/user/courseunits/menu.jsp"/>
<put name="body" value="/user/courseunits/dossierTecnicoPedagogico.jsp"/>
</definition>
 
<!--Remocao de unidades curriculares-->
<definition name="page.courseunit.delete.admin" extends="page.separators.home">
<put name="title" value="Apagar Unidades Curriculares Administração"/>
<put name="topnav" value="/admin/courseunits/topnavCourseUnitDeleteAdministration.jsp"/>
<put name="body" value="/admin/courseunits/courseUnitDeleteAdministration.jsp"/>
</definition>
 
<definition name="page.edit.courseunit.admin.from.course.unit.delete" extends="page.separators.home">
<put name="title" value="Unidade Curricular"/>
<put name="topnav" value="/admin/courseunits/topnavEditCourseUnitFromDelete.jsp"/>
<put name="body" value="/admin/courseunits/courseunit.jsp"/>
</definition>
<definition name="page.edit.courseunit.admin.from.course.course.units" extends="page.separators.home">
<put name="title" value="Unidade Curricular"/>
<put name="topnav" value="/admin/courseunits/topnavEditCourseUnitFromCourseCourseUnits.jsp"/>
<put name="body" value="/admin/courseunits/courseunit.jsp"/>
</definition>
 
 
 
</tiles-definitions>
/impl/conf/WEB-INF/struts/tiles-courses.xml
75,18 → 75,37
</definition>
 
 
<definition name="page.directed.coordinated.courses.from.home" extends="page.separators.home">
<definition name="page.directed.coordinated.courses.from.home" extends="base.separators">
<put name="title" value="Ver Cursos e Unidades"/>
<put name="topnav" value="/user/courses/topnavDirectedCoordinatedCourses.jsp"/>
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/>
</definition>
<definition name="page.courses.programs.from.home" extends="page.separators.home">
<definition name="page.courses.programs.from.home" extends="base.separators">
<put name="title" value="Ver Cursos e Unidades"/>
<put name="topnav" value="/user/courses/topnavDirectedCoordinatedCourses.jsp"/>
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/>
</definition>
<definition name="page.courses.pedagogic.contents" extends="page.separators.serviceZone">
<put name="title" value="Conselho Pedagógico Inquéritos"/>
<put name="topnav" value="/user/serviceZone/topnavCoursePedagogicContents.jsp"/>
<put name="body" value="/admin/courses/coursePedagogicContents.jsp"/>
</definition>
<definition name="page.courses.comissions" extends="page.separators.home">
<put name="title" value="Comissões de Curso"/>
<put name="topnav" value="/admin/courses/topnavCourseComissions.jsp"/>
<put name="body" value="/admin/courses/courseComissions.jsp"/>
</definition>
 
 
<definition name="page.courses.courseunits" extends="page.separators.home">
<put name="title" value="Listagem de Unidades"/>
<put name="topnav" value="/admin/courses/topnavCourseCourseUnits.jsp"/>
<put name="body" value="/admin/courses/courseCourseUnits.jsp"/>
</definition>
 
 
 
/impl/conf/WEB-INF/struts/tiles-intranet.xml
8,6 → 8,7
<tiles-definitions>
 
<definition name="base.separators" extends="base.definition" path="/layout/layoutintranet.jsp">
<put name="separator" value="1" type="string"/>
<put name="header" value="/layout/headerIntranet.jsp"/>
<put name="navigationTop" value="/layout/topnavempty.jsp"/>
<put name="left" value="/layout/topnavempty.jsp"/>
/impl/conf/WEB-INF/struts/struts-configuration.xml
New file
0,0 → 1,77
<?xml version="1.0" encoding="UTF-8"?>
 
<!--<!DOCTYPE struts-config PUBLIC-->
<!--"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"-->
<!--"http://struts.apache.org/dtds/struts-config_1_3.dtd">-->
 
<struts-config>
<form-beans>
<form-bean type="pt.estgp.estgweb.web.form.configuration.ConfigurationGradesForm" name="ConfigurationGradesForm"/>
<form-bean type="pt.estgp.estgweb.web.form.configuration.DirectoriesForm" name="DirectoriesForm"/>
<form-bean type="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" name="SchedulleTasksForm"/>
</form-beans>
 
<global-exceptions>
 
</global-exceptions>
 
<global-forwards>
 
</global-forwards>
<action-mappings>
 
 
 
<action path="/user/configurationGrades" forward="page.configuration.grades"/>
 
<action path="/user/grades"
type="pt.estgp.estgweb.web.controllers.configuration.GradesController"
name="ConfigurationGradesForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.separators.serviceZone">
 
<forward name="save" path="page.separators.serviceZone"/>
<forward name="grades" path="page.configuration.grades"/>
</action>
 
 
<action path="/user/configurationDirectories" forward="page.configuration.directories"/>
<action path="/user/configurationDirectory" forward="page.configuration.directory"/>
 
<action path="/user/configurationDir"
type="pt.estgp.estgweb.web.controllers.configuration.DirectoriesController"
name="DirectoriesForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.separators.serviceZone">
 
<forward name="save" path="page.separators.serviceZone"/>
<forward name="directory" path="page.configuration.directory"/>
<forward name="directories" path="page.configuration.directories"/>
</action>
 
 
<action path="/user/configurationSchedulleTasks" forward="page.configuration.tasks"/>
<action path="/user/configurationJobTasks" forward="page.configuration.jobtasks"/>
 
<action path="/user/configurationTasks"
type="pt.estgp.estgweb.web.controllers.configuration.SchedulerTasksController"
name="SchedulleTasksForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.separators.serviceZone">
 
<forward name="save" path="page.separators.serviceZone"/>
<forward name="jobtasks" path="page.configuration.jobtasks"/>
<forward name="tasks" path="page.configuration.tasks"/>
<forward name="task" path="page.configuration.task"/>
<forward name="taskLog" path="page.configuration.taskLog"/>
<forward name="taskLogfromjobtasks" path="page.configuration.taskLog.from.jobtasks"/>
</action>
 
</action-mappings>
</struts-config>
Property changes:
Added: svn:executable
+ *
/impl/conf/WEB-INF/struts/tiles-configuration.xml
New file
0,0 → 1,59
<?xml version="1.0" encoding="UTF-8" ?>
 
<!--<!DOCTYPE tiles-definitions PUBLIC-->
<!--"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"-->
<!--"http://struts.apache.org/dtds/tiles-config_1_1.dtd">-->
 
<tiles-definitions>
 
<definition name="page.configuration.grades" extends="page.separators.serviceZone">
<put name="title" value="Configuração Notas"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationGrades.jsp"/>
<put name="body" value="/admin/configuration/grades.jsp"/>
</definition>
 
 
<definition name="page.configuration.directories" extends="page.separators.serviceZone">
<put name="title" value="Configuração Directorios"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationDirectories.jsp"/>
<put name="body" value="/admin/configuration/directories.jsp"/>
</definition>
 
<definition name="page.configuration.directory" extends="page.separators.serviceZone">
<put name="title" value="Directório"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationDirectory.jsp"/>
<put name="body" value="/admin/configuration/directory.jsp"/>
</definition>
 
<definition name="page.configuration.tasks" extends="page.separators.serviceZone">
<put name="title" value="Tarefas Agendadas"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationTasks.jsp"/>
<put name="body" value="/admin/configuration/tasks.jsp"/>
</definition>
 
<definition name="page.configuration.jobtasks" extends="page.separators.serviceZone">
<put name="title" value="Registo de Tarefas Executadas"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationJobTasks.jsp"/>
<put name="body" value="/admin/configuration/jobTasks.jsp"/>
</definition>
 
<definition name="page.configuration.task" extends="page.separators.serviceZone">
<put name="title" value="Tarefa Agendada"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationTask.jsp"/>
<put name="body" value="/admin/configuration/task.jsp"/>
</definition>
 
<definition name="page.configuration.taskLog" extends="page.separators.serviceZone">
<put name="title" value="Tarefa Agendada"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationTaskLog.jsp"/>
<put name="body" value="/admin/configuration/taskLog.jsp"/>
</definition>
 
<definition name="page.configuration.taskLog.from.jobtasks" extends="page.separators.serviceZone">
<put name="title" value="Tarefa Agendada"/>
<put name="topnav" value="/user/serviceZone/topnavConfigurationTaskLogFromJobTasks.jsp"/>
<put name="body" value="/admin/configuration/taskLog.jsp"/>
</definition>
 
</tiles-definitions>
Property changes:
Added: svn:executable
+ *
/impl/conf/WEB-INF/struts/struts-default.xml
27,6 → 27,7
<forward name="error401" path="/error401.do"/>
<forward name="error408" path="/error408.do"/>
<forward name="errorNoCookies" path="page.no.cookies"/>
<forward name="jsonOk" path="page.service.json.ok"/>
 
<!--Announcements-->
 
210,7 → 211,8
/WEB-INF/struts/tiles-srusource.xml,
/WEB-INF/struts/tiles-survey.xml,
/WEB-INF/struts/tiles-processes.xml,
/WEB-INF/struts/tiles-comunicationfolder.xml"/> <!-- Duarte Santos -->
/WEB-INF/struts/tiles-comunicationfolder.xml,
/WEB-INF/struts/tiles-configuration.xml"/> <!-- Duarte Santos -->
</plug-in>
 
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
/impl/conf/WEB-INF/struts/tiles-default.xml
433,4 → 433,11
<put name="body" value="/errors/noCookies.jsp" />
</definition>
 
<definition name="base.empty.json" path="/layout/emptyLayoutJson.jsp">
</definition>
 
<definition name="page.service.json.ok" extends="base.empty.json">
<put name="body" value="/layout/jsonAutoSaveOk.jsp"/>
</definition>
 
</tiles-definitions>
/impl/conf/WEB-INF/web.xml
165,7 → 165,8
/WEB-INF/struts/struts-srusource.xml,
/WEB-INF/struts/struts-survey.xml, <!-- Duarte Santos -->
/WEB-INF/struts/struts-comunicationfolder.xml,
/WEB-INF/struts/struts-processes.xml
/WEB-INF/struts/struts-processes.xml,
/WEB-INF/struts/struts-configuration.xml
</param-value>
</init-param>
<init-param>
243,8 → 244,20
<servlet-class>pt.estgp.estgweb.web.ajaxapis.ServicosImpressao</servlet-class>
</servlet>
 
<servlet>
<servlet-name>logServiceStream</servlet-name>
<servlet-class>pt.estgp.estgweb.web.LogsServiceStream</servlet-class>
</servlet>
 
<servlet>
<servlet-name>schedullerTasksJson</servlet-name>
<servlet-class>pt.estgp.estgweb.web.controllers.configuration.SchedullerTasksJson</servlet-class>
</servlet>
 
 
 
 
 
<!--MAPPINGS-->
 
<!--SOAP Tutorial-->
312,6 → 325,10
<url-pattern>/repositoryStreamVersion/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>logServiceStream</servlet-name>
<url-pattern>/logServiceStream/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ftpProxyStream</servlet-name>
<url-pattern>/ftpProxyStream/*</url-pattern>
</servlet-mapping>
332,7 → 349,12
<url-pattern>/user/ajaxapis/ServicosImpressao</url-pattern>
</servlet-mapping>
 
<servlet-mapping>
<servlet-name>schedullerTasksJson</servlet-name>
<url-pattern>/admin/schedullerTasksJson</url-pattern>
</servlet-mapping>
 
 
<!--START FILES-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
/impl/conf/app.properties
10,6 → 10,7
user.session.timeout.minutes=60
site.url=@site.url@
 
#USAR APENAS ESTES DOIS EMAILS NAO DA PARA MAIS
admin.email=ci@estgp.pt
admin.email.2=jmachado@estgp.pt
 
55,17 → 56,19
email.courseunit.blogpost.subject.pt={0}: {1} (ESTG)
email.courseunit.blogpost.subject.en={0}: {1} (ESTG)
 
email.new.grades=true
email.new.grades=false
email.courseunit.announcements=true
email.courseunit.blogs=true
 
email.summaries=false
 
email.summary.subject.pt=Sumário lançado em {0}
email.summary.subject.en=Sumário lançado em {0}
email.summary.subject.pt=Sumario lançado em {0}
email.summary.subject.en=Sumario lançado em {0}
 
 
email.unidade.edicao.subject.pt=Ficha em edição {0}
email.relatorio.aval.unidade.editado.subject.pt=Relatorio Avaliacao Editado {0}
email.relatorio.aval.unidade.editado.subject.en=Unit Report Evaluation Edited {0}
email.unidade.edicao.subject.pt=Ficha em edicao {0}
email.unidade.edicao.subject.en=Unit in edition {0}
email.unidade.editada.subject.pt=Ficha editada {0}
email.unidade.editada.subject.en=Unit edited {0}
124,6 → 127,10
server.ionline.start.path=
ionline.pass=baco
ionline.user=Baco_web
ionline.use.default.credentials.to.updates.and.deletes=false
ionline.use.default.credentials.to.read=false
ionline.use.default.credentials.to.read.if.user.fail.when.authenticated=true
ionline.use.default.credentials.to.read.if.user.fail.when.not.authenticated=true
##ESTA CONFIGURACAO ESTA FUNCIONAL
## Ver nos Ficheiros FtpService metodo run
## Ver LayoutController
135,14 → 142,18
## Todos o sistema de ficheiros tem codigo espalhado das classes FTPServer e FTPClient
## Para se conseguir isolar o sistema deste código tem de se fazer um nivel de abstracao
## e remover todos o código de FTPServer e FTPClient
ionline.use.default.credentials.to.updates.and.deletes=false
 
server.grupos=ftp://ftppublic:ftppublic@w2.estgp.pt
 
server.grupos=ftp://w2.estgp.pt
server.grupos.start.path=/grupos
grupos.pass=ftppublic
grupos.user=ftppublic
grupos.use.default.credentials.to.read=true
#Irrelevantes vai usar sempre as defaults
grupos.use.default.credentials.to.read.if.user.fail.when.authenticated=true
grupos.use.default.credentials.to.read.if.user.fail.when.not.authenticated=true
grupos.use.default.credentials.to.updates.and.deletes=false
 
 
server.estgp.start.path=
server.estgp=http://localhost:9090/static
estgp.encoding=UTF-8
246,6 → 257,8
user.role.78=courseValidateProgramRPS
user.role.79=courseValidateProgramTGI
user.role.80=courseValidateProgramRU
user.role.85=courseValidateProgramCF
user.role.86=courseValidateProgramTPB
 
 
user.role.81=courseValidatePrograms
447,7 → 460,7
#########################################################################
# Common Services
#
search.max.results=8
search.max.results=30
search.best.fragments.max.fragment.size=80
search.best.fragments.max.fragments=3
 
456,10 → 469,29
# Imports SIGoES
#
 
#Disciplinas extracurriculares tem 6 no CdTipoDisci nas inscrições
siges.codigo.tipo.disciplina.extra.curricular=6
 
siges.degree.1=L
siges.degree.2=B
siges.degree.3=D
siges.degree.4=M
siges.degree.8=C
siges.degree.5=H
siges.degree.6=P
siges.degree.7=Z
siges.degree.8=Z
siges.degree.9=A
siges.degree.10=T
siges.degree.11=E
siges.degree.12=Z
siges.degree.13=Z
siges.degree.14=Z
siges.degree.15=Z
siges.degree.16=C
siges.degree.17=O
 
siges.degree.unknown=Z
 
# DONT USE ANY MORE NOW IS IN CONFIGURATION DAO national.institution.code=3122
# DONT USE ANY MORE NOW IS IN CONFIGURATION DAO siges.institution.code=1
# DONT USE ANY MORE NOW IS IN CONFIGURATION DAO ws.siges.wsdl=@ws.siges.wsdl@
483,6 → 515,11
intranet.semestre.S2=Semestre2
intranet.semestre.A=Anual
 
intranet.semestre.T1=Trimestre1
intranet.semestre.T2=Trimestre2
intranet.semestre.T3=Trimestre3
intranet.semestre.T4=Trimestre4
 
intranet.setup.file=@intranet.setup.folders.file@
intranet.setup.users.filename=cursos.txt
intranet.setup.filename=@intranet.setup.folders.filename@
504,6 → 541,8
intranet.dtp.course.coordinator.write=true
intranet.dtp.course.director.write=true
intranet.dtp.course.unit.responsible.write=true
intranet.dtp.course.unit.fullcontrol.roles=
intranet.dtp.course.unit.inquerito_pedagogico.role=pedagogicCouncil
 
##COLOCAR AQUI AS DEFINICOES DO DTP
 
654,8 → 693,8
 
 
#################
# SIGES CODES
#
# SIGES CODES
#################
netpa.tipo.aula.1=Teorica
netpa.tipo.aula.2=Teorico-pratica
netpa.tipo.aula.3=Pratica Laboratorial
664,3 → 703,11
netpa.tipo.aula.6=OT-Orientacao Tutorial
netpa.tipo.aula.7=Ensino Clinico
netpa.tipo.aula.8=Estagio HO
 
 
#################
#ORACLE IPP
#################
oracle.siges.url=@oracle.siges.url@
oracle.siges.username=@oracle.siges.username@
oracle.siges.password=@oracle.siges.password@
/impl/conf/template/email/unidadeRelatorioAvaliacaoEditado_en.txt
New file
0,0 → 1,13
#Email unidade ficha em edicao
Caro membro da comissão de curso de {0}
 
O BACO informa-o de que o relatorio de avaliação da unidade curricular de {1}
foi alterado
 
Estado: {2}
 
Com os melhores cumprimentos
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
Property changes:
Added: svn:executable
+ *
/impl/conf/template/email/GradeUnit.txt
3,4 → 3,4
# 0: Unidade
# 1: Nota
##################################################
{0}:{1};
{0} {1} {2} {3}
/impl/conf/template/email/unidadeRelatorioAvaliacaoEditado_pt.txt
New file
0,0 → 1,13
#Email unidade ficha em edicao
Caro membro da comissão de curso de {0}
 
O BACO informa-o de que o relatorio de avaliação da unidade curricular de {1}
foi editado
 
Estado: {2}
 
Cumprimentos
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
/impl/conf/directories/topMenus.xsl
New file
0,0 → 1,142
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:param name="contextPath">/baco</xsl:param>
<xsl:template match="/">
<table id="menuTop" cellpadding="0" cellspacing="0">
<tr>
<td>
<ul id="menu_dropdown" class="menubar">
<xsl:apply-templates select="/d:directory/d:leaf" mode="root"/>
</ul>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:leaf" mode="root">
<li class="submenu">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@url and @absolute='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@url and @absolute='false'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>#</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="@label"/>
</a>
<xsl:if test="./d:leaf">
<div class="shadow">
<ul class="menu">
<xsl:for-each select="./d:leaf">
<li>
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@url and @absolute='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@url and @absolute='false'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>#</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="@label"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</li>
</xsl:template>
 
 
 
<xsl:template match="/" mode="new" >
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
 
</div>
<ul class="nav navbar-nav">
<xsl:apply-templates select="/d:directory/d:leaf" mode="root"/>
</ul>
 
 
</div>
 
</nav>
</xsl:template>
 
 
<xsl:template match="d:leaf" mode="new">
<xsl:choose>
<xsl:when test="./d:leaf">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" >
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@url and @absolute='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@url and @absolute='false'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>#</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="@label"/>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<xsl:for-each select="./d:leaf">
<li>
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@url and @absolute='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@url and @absolute='false'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>#</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="@label"/>
</a>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@url and @absolute='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@url and @absolute='false'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>#</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="@label"/>
</a>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
 
</xsl:stylesheet>
/impl/conf/directories/futureStudent.xml
1,82 → 1,87
<?xml version="1.0" encoding="UTF-8"?>
<directory label="Futuros Alunos" place="home" layout="layout0" layoutRoot="layoutPortal" targetRole="futureStudent" id="futureStudent" menuKey="menu.futuroAlunos" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/directory.xsd">
 
<directory label="Futuros Alunos" place="home" layout="layout0" layoutRoot="layoutPortal" targetRole="futureStudent" id="futureStudent" menuKey="menu.futuroAlunos" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<groupsDeclaration>
<group>1</group>
<group>2</group>
<group>
<name>1</name>
<description>1</description>
</group>
<group>
<name>2</name>
<description>2</description>
</group>
</groupsDeclaration>
<node label="A ESTG" id="ESTG" group="1">
<leaf absolute="false" url="/pagina.php?nome_id=MensagemDirector" proxy="conteudos" id="estgDirector" label="Mensagem do Director"></leaf>
<leaf absolute="false" url="/public/portal/estgComoChegarEstg.html" proxy="estgp" id="estgChegar" label="Como Chegar à ESTG"></leaf>
<leaf absolute="false" url="/public/portal/estgPassado.html" proxy="estgp" id="estgPassado" label="O nosso Passado"></leaf>
<leaf absolute="false" url="/public/portal/estgPresente.html" proxy="estgp" id="estgPresente" label="O Presente"></leaf>
<leaf absolute="false" url="/public/portal/estgEdificio.html" proxy="estgp" id="estgCidade" label="O Edifício"></leaf>
<leaf absolute="false" url="/public/portal/estgMissao.html" proxy="estgp" id="estgMissao" label="Missao"></leaf>
<leaf absolute="false" url="/public/portal/estgFotos.html" proxy="estgp" id="estgFotos" label="Fotografias"></leaf>
</node>
<node label="Serviços on-line" id="servicosOnLine" group="1">
<leaf absolute="true" url="http://mail.estgp.pt/exchange/" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf absolute="false" url="/public/portal/servicosRegie.html" proxy="estgp" id="servRegie" label="Régie"></leaf>
<leaf absolute="false" url="/public/portal/servicosCentroInformatico.html" proxy="estgp" id="servCentroInformatico" label="Centro Informático"></leaf>
</node>
<node label="Contactos" id="contactos" group="2">
<leaf absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</node>
<node label="Biblioteca" id="biblioteca" group="1">
<leaf absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Colecções"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contactos e Horários"></leaf>
</node>
<node label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf absolute="false" url="/public/portal/PALVErasmusAlunosEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusAlunosEstrangeiros" label="Os Alunos Estrangeiros na ESTG"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusAlunosESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroAlunos" label="Os Alunos da ESTG no Estrangeiro"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Sectorial - Erasmus"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Actividades Elegiveis"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusFormularioEstudantes.html" proxy="estgp" id="PALVErasmusFomularioEstudantes" label="Formulários Estudantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</node>
<node label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Director"></leaf>
<leaf node="true" label="A ESTG" id="ESTG" group="1">
<leaf node="false" absolute="false" url="/pagina.php?nome_id=MensagemDirector" proxy="conteudos" id="estgDirector" label="Mensagem do Director"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgComoChegarEstg.html" proxy="estgp" id="estgChegar" label="Como Chegar à ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgPassado.html" proxy="estgp" id="estgPassado" label="O nosso Passado"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgPresente.html" proxy="estgp" id="estgPresente" label="O Presente"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgEdificio.html" proxy="estgp" id="estgCidade" label="O Edifício"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgMissao.html" proxy="estgp" id="estgMissao" label="Missao"></leaf>
<leaf node="false" absolute="false" url="/public/portal/estgFotos.html" proxy="estgp" id="estgFotos" label="Fotografias"></leaf>
</leaf>
<leaf node="true" label="Serviços on-line" id="servicosOnLine" group="1">
<leaf node="false" absolute="true" url="http://mail.estgp.pt/exchange/" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosRegie.html" proxy="estgp" id="servRegie" label="Régie"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosCentroInformatico.html" proxy="estgp" id="servCentroInformatico" label="Centro Informático"></leaf>
</leaf>
<leaf node="true" label="Contactos" id="contactos" group="2">
<leaf node="false" absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</leaf>
<leaf node="true" label="Biblioteca" id="biblioteca" group="1">
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Colecções"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contactos e Horários"></leaf>
</leaf>
<leaf node="true" label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusAlunosEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusAlunosEstrangeiros" label="Os Alunos Estrangeiros na ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusAlunosESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroAlunos" label="Os Alunos da ESTG no Estrangeiro"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Sectorial - Erasmus"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Actividades Elegiveis"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusFormularioEstudantes.html" proxy="estgp" id="PALVErasmusFomularioEstudantes" label="Formulários Estudantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</leaf>
<leaf node="true" label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf node="false" absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Director"></leaf>
 
<leaf absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
 
 
<leaf absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoDepartamental" label="Conselho Departamental"></leaf>
</node>
<node label="Informação Académica" id="infoAcademica" group="2">
<leaf absolute="true" url="http://baco.estgp.pt/dir/student/infoAcademica/infoAcadCalendarioEscolar/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
</node>
<node label="O IPP" id="IPP" group="2">
<leaf absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Acção Social"></leaf>
</node>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoDepartamental" label="Conselho Departamental"></leaf>
</leaf>
<leaf node="true" label="Informação Académica" id="infoAcademica" group="2">
<leaf node="false" absolute="true" url="http://baco.estgp.pt/dir/student/infoAcademica/infoAcadCalendarioEscolar/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
</leaf>
<leaf node="true" label="O IPP" id="IPP" group="2">
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf node="false" absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf node="false" absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf node="false" absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Acção Social"></leaf>
</leaf>
</directory>
/impl/conf/directories/directory.xsd
1,6 → 1,8
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Jorge Machado (Escola Superior de tecnologia e Gestao, Portalegre) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.estgp.pt/baco/directory/" targetNamespace="http://www.estgp.pt/baco/directory/" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.estgp.pt/baco/directory/"
xmlns:xsl="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.estgp.pt/baco/directory/"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="directory">
<xs:annotation>
<xs:documentation>This schema is to define information structured directories</xs:documentation>
8,14 → 10,13
<xs:complexType>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="leaf" type="leafT" maxOccurs="unbounded"/>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="place" use="required"/>
<xs:attribute name="style" use="required"/>
<xs:attribute name="layout" use="required"/>
30,13 → 31,12
</xs:annotation>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="leaf" type="leafT" maxOccurs="unbounded"/>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="group" use="optional">
<xs:annotation>
<xs:documentation>Grouping purposes in styling</xs:documentation>
65,18 → 65,19
<xs:documentation>A leaf is an URL for an external or internal WEB site</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>A leaf can be a root of some diferent system like FTP server Directory</xs:documentation>
</xs:annotation>
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:annotation>
<xs:documentation>A leaf can be a root of some diferent system like FTP server Directory</xs:documentation>
</xs:annotation>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:element name="leaf" type="leafT" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="url" type="xs:string" use="required"/>
<xs:attribute name="node" type="xs:boolean" use="optional"/>
<xs:attribute name="url" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="xml" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>False by default</xs:documentation>
93,7 → 94,7
When style=false and layout=false external file will be directly writed in TopWindow</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="absolute" type="xs:boolean" use="required">
<xs:attribute name="absolute" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>follow parameter will be evaluated only If this parameter is set to false</xs:documentation>
</xs:annotation>
139,11 → 140,36
</xs:restriction>
</xs:simpleType>
</xs:attribute>
 
<!-- NODE ATTRIBUTES -->
<xs:attribute name="showNav" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>Show link to this node in navigation menus, true by default</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" use="optional">
<xs:annotation>
<xs:documentation>Type of node, by default HTTP link</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="ftp"/>
<xs:enumeration value="http"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="groupDeclarationT">
<xs:sequence>
<xs:element name="group" maxOccurs="unbounded"/>
<xs:element name="group" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightsT">
151,24 → 177,34
<xs:documentation>Rights define who is authorized to enter in a node</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="role" type="rightT1"/>
<xs:element name="user" type="rightT1"/>
</xs:choice>
 
<xs:element name="right" maxOccurs="unbounded">
<xs:complexType >
<xs:annotation>
<xs:documentation>A right T1 can be to permit or restrict</xs:documentation>
</xs:annotation>
<xs:attribute name="target" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="user"/>
<xs:enumeration value="role"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="permit"/>
<xs:enumeration value="restrict"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
 
<xs:element name="internal" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightT1" mixed="true">
<xs:annotation>
<xs:documentation>A right T1 can be to permit or restrict</xs:documentation>
</xs:annotation>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="permit"/>
<xs:enumeration value="restrict"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
 
</xs:schema>
/impl/conf/directories/styleMapaDir.xsl
13,11 → 13,11
<td>ULR</td>
<td width="20%">NOTAS</td>
</tr>
<xsl:for-each select="//d:node">
<xsl:for-each select="//d:leaf[@node='true']">
<tr>
<td colspan="4" style="background-color:#aaaaaa"><xsl:value-of select="@label"/></td>
</tr>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<tr>
<td><xsl:text>-&gt;</xsl:text><xsl:value-of select="@label"/></td>
<td>
/impl/conf/directories/utilsIntranet.xml
1,22 → 1,23
<?xml version="1.0" encoding="UTF-8"?>
<directory place="intranetUtils" label="Utilitários" layout="layoutIntranetUtils" layoutRoot="layoutIntranetUtils" targetRole="student" id="utilsIntranet" menuKey="intranet.separator.utils" style="styleIntranet.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<leaf absolute="false" label="Home Utilitários" layout="true" proxy="estgp" id="utils" url="/intranet/escola/utils.html"/>
<leaf absolute="false" label="Secretaria" layout="true" proxy="estgp" id="secretaria" url="/intranet/escola/secretaria.html">
<leaf absolute="false" label="Documentos de Apoio" layout="true" proxy="estgp" id="documentosApoio" url="/intranet/escola/secretaria/documentosApoio.html"/>
<leaf absolute="false" label="Formulários [alunos]" layout="true" proxy="estgp" id="Forms.Alunos" url="/intranet/escola/secretaria/formulariosAlunos.html"/>
<leaf absolute="false" label="Legislação" layout="true" proxy="estgp" id="legislacao" url="/intranet/escola/secretaria/legislacao.html"/>
<leaf label="Folhas de Presenças" id="Folhas.Presencas" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Intranet/Escola/Secretaria/Folhas.Presencas"/>
<leaf label="Projetos-AA,CA,GE,MKT" id="Projectos.Finais" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Intranet/Escola/Secretaria/Projectos.Finais"/>
<leaf label="Atas" id="Actas" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Actas"/>
<leaf node="false" absolute="false" label="Home Utilitários" layout="true" proxy="estgp" id="utils" url="/intranet/escola/utils.html"/>
<leaf node="false" absolute="false" label="Secretaria" layout="true" proxy="estgp" id="secretaria" url="/intranet/escola/secretaria.html">
<leaf node="false" absolute="false" label="Documentos de Apoio" layout="true" proxy="estgp" id="documentosApoio" url="/intranet/escola/secretaria/documentosApoio.html"/>
<leaf node="false" absolute="false" label="Formulários [alunos]" layout="true" proxy="estgp" id="Forms.Alunos" url="/intranet/escola/secretaria/formulariosAlunos.html"/>
<leaf node="false" absolute="false" label="Legislação" layout="true" proxy="estgp" id="legislacao" url="/intranet/escola/secretaria/legislacao.html"/>
<leaf node="false" label="Folhas de Presenças" id="Folhas.Presencas" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Intranet/Escola/Secretaria/Folhas.Presencas"/>
<leaf node="false" label="Projetos-AA,CA,GE,MKT" id="Projectos.Finais" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Intranet/Escola/Secretaria/Projectos.Finais"/>
<leaf node="false" label="Atas" id="Actas" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Actas"/>
</leaf>
<leaf absolute="false" label="Horários" layout="true" proxy="estgp" id="horarios" url="/intranet/escola/horarios.html">
<leaf absolute="false" label="Horários de CET" layout="true" proxy="estgp" id="horariosCet" url="/intranet/escola/horarios_cets.html"/>
<leaf absolute="false" label="Horários de Licenciaturas" layout="true" proxy="estgp" id="horariosLicenciaturas" url="/intranet/escola/horarios_licenciaturas.html"/>
<leaf absolute="false" label="Horários de Mestrados" layout="true" proxy="estgp" id="horariosMestrados" url="/intranet/escola/horarios_mestrados.html"/>
<leaf absolute="false" label="Horários de Docentes" layout="true" proxy="estgp" id="horariosDocentes" url="/intranet/escola/horarios_Docentes.html"/>
<leaf absolute="false" label="Horários de Salas" layout="true" proxy="estgp" id="horariosSalas" url="/intranet/escola/horarios_salas.html"/>
<leaf node="false" absolute="false" label="Horários" layout="true" proxy="estgp" id="horarios" url="/intranet/escola/horarios.html">
<leaf node="false" absolute="false" label="Horários de CTeSP" layout="true" proxy="estgp" id="horariosCTeSP" url="/intranet/escola/horarios_ctesp.html"/>
<leaf node="false" absolute="false" label="Horários de CET" layout="true" proxy="estgp" id="horariosCet" url="/intranet/escola/horarios_cets.html"/>
<leaf node="false" absolute="false" label="Horários de Licenciaturas" layout="true" proxy="estgp" id="horariosLicenciaturas" url="/intranet/escola/horarios_licenciaturas.html"/>
<leaf node="false" absolute="false" label="Horários de Mestrados" layout="true" proxy="estgp" id="horariosMestrados" url="/intranet/escola/horarios_mestrados.html"/>
<leaf node="false" absolute="false" label="Horários de Docentes" layout="true" proxy="estgp" id="horariosDocentes" url="/intranet/escola/horarios_Docentes.html"/>
<leaf node="false" absolute="false" label="Horários de Salas" layout="true" proxy="estgp" id="horariosSalas" url="/intranet/escola/horarios_salas.html"/>
</leaf>
<leaf label="Calendário Escolar" id="calEscolar" absolute="false" url="/public/portal/CL20102011.pdf" layout="false" proxy="estgp"/>
<leaf absolute="false" label="Calendário de Exames" layout="true" proxy="estgp" id="exames" url="/intranet/escola/Exames.html"/>
<leaf absolute="false" label="Centro Informático" layout="true" proxy="estgp" id="ci" url="/intranet/escola/ci.html"/>
<leaf node="false" label="Calendário Escolar" id="calEscolar" absolute="false" url="/public/portal/CL20102011.pdf" layout="false" proxy="estgp"/>
<leaf node="false" absolute="false" label="Calendário de Exames" layout="true" proxy="estgp" id="exames" url="/intranet/escola/Exames.html"/>
<leaf node="false" absolute="false" label="Centro Informático" layout="true" proxy="estgp" id="ci" url="/intranet/escola/ci.html"/>
</directory>
/impl/conf/directories/student.xml
1,77 → 1,93
<?xml version="1.0" encoding="UTF-8"?>
<directory label="Alunos" place="home" layout="layout0" layoutRoot="layoutPortal" targetRole="student" id="student" menuKey="menu.alunos" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<groupsDeclaration>
<group>1</group>
<group>2</group>
</groupsDeclaration>
<node label="Serviços on-line" id="servicosOnLine" group="1">
<leaf absolute="true" url="http://baco.estgp.pt/layout/webmailRedirect.jsp" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf absolute="false" url="/public/portal/servicosRegie.html" proxy="estgp" id="servRegie" label="Régie"></leaf>
<leaf absolute="false" url="/public/portal/servicosCentroInformatico.html" proxy="estgp" id="servCentroInformatico" label="Centro informático"></leaf>
</node>
<node label="Contactos" id="contactos" group="2">
<leaf absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</node>
<node label="Biblioteca" id="biblioteca" group="1">
<leaf absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Coleções"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contatos e Horários"></leaf>
</node>
<node label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf absolute="false" url="/public/portal/PALVErasmusAlunosEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusAlunosEstrangeiros" label="Os Alunos Estrangeiros na ESTG"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusAlunosESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroAlunos" label="Os Alunos da ESTG no Estrangeiro"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Setorial - Erasmus"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Atividades Elegiveis"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusFormularioEstudantes.html" proxy="estgp" id="PALVErasmusFomularioEstudantes" label="Formulários Estudantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</node>
<node label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Diretor"></leaf>
<groupsDeclaration>
<group>
<name>1</name>
<description>1</description>
</group>
<group>
<name>2</name>
<description>2</description>
</group>
</groupsDeclaration>
<leaf node="true" label="Serviços on-line" id="servicosOnLine" group="1">
<leaf node="false" absolute="true" url="http://baco.estgp.pt/layout/webmailRedirect.jsp" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosRegie.html" proxy="estgp" id="servRegie" label="Régie"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosCentroInformatico.html" proxy="estgp" id="servCentroInformatico" label="Centro informático"></leaf>
</leaf>
<leaf node="true" label="Contactos" id="contactos" group="2">
<leaf node="false" absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</leaf>
<leaf node="true" label="Biblioteca" id="biblioteca" group="1">
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Coleções"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contatos e Horários"></leaf>
</leaf>
<leaf node="true" label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusAlunosEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusAlunosEstrangeiros" label="Os Alunos Estrangeiros na ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusAlunosESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroAlunos" label="Os Alunos da ESTG no Estrangeiro"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Setorial - Erasmus"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Atividades Elegiveis"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusFormularioEstudantes.html" proxy="estgp" id="PALVErasmusFomularioEstudantes" label="Formulários Estudantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</leaf>
<leaf node="true" label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf node="false" absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Diretor"></leaf>
 
<leaf absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
 
<leaf absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoDepartamental" label="Conselho Interdepartamental"></leaf>
</node>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoDepartamental" label="Conselho Interdepartamental"></leaf>
<rights>
<right target="role" type="restrict" name="student"/>
<internal>true</internal>
</rights>
</leaf>
<node label="Informação Académica" id="infoAcademica" group="2">
<leaf absolute="false" url="/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
</node>
<node label="O IPP" id="IPP" group="1">
<leaf absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Acção Social"></leaf>
</node>
<node label="Departamentos" id="departamentos" group="2">
<leaf absolute="false" url="/public/departamentos/depTD.html" proxy="estgp" id="depTD" label="Departamento de TD"></leaf>
<leaf absolute="false" url="/public/departamentos/depCESH.html" proxy="estgp" id="depCESH" label="Departamento de CESH"></leaf>
</node>
<leaf node="true" label="Informação Académica" id="infoAcademica" group="2">
<leaf node="false" absolute="false" url="/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
<rights>
<right target="user" type="restrict" name="jmachado"/>
</rights>
</leaf>
<leaf node="true" label="O IPP" id="IPP" group="1">
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf node="false" absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf node="false" absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf node="false" absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Acção Social"></leaf>
</leaf>
<leaf node="true" label="Departamentos" id="departamentos" group="2">
<leaf node="false" absolute="false" url="/public/departamentos/depTD.html" proxy="estgp" id="depTD" label="Departamento de TD"></leaf>
<leaf node="false" absolute="false" url="/public/departamentos/depCESH.html" proxy="estgp" id="depCESH" label="Departamento de CESH"></leaf>
</leaf>
<rights>
<right target="role" type="permit" name="admin"/>
<right target="role" type="restrict" name="student"/>
</rights>
</directory>
/impl/conf/directories/utils.xsl
11,7 → 11,7
</a>
</xsl:template>
<xsl:template match="d:node" mode="link">
<xsl:template match="d:leaf[@node='true']" mode="link">
<a>
<xsl:attribute name="href">
<xsl:choose>
26,14 → 26,17
<xsl:apply-templates select="." mode="label"/>
</a>
</xsl:template>
<xsl:template match="d:leaf" mode="link">
<xsl:template match="d:leaf[@node='false']" mode="link">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="string(@absolute)='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@idPrefixSize"><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/></xsl:when>
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@proxy='local'">
<xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
</xsl:when>
<xsl:when test="@idPrefixSize"><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/></xsl:when>
<xsl:when test="@remoteExtensionRoot='true'"><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/><xsl:value-of select="@url"/></xsl:otherwise>
</xsl:choose>
41,12 → 44,24
<xsl:apply-templates select="." mode="label"/>
</a>
</xsl:template>
 
<!--
- A variavel de ambiente dirStartPath é o contextPath + /dir
- Os templates linkparent tem por objectivo escrever toda a hierarquia de ID's até ao elemento directory
- Todos os nós que trazem o atributo idPrefixSize significa que foram extendidos a partir de um FTP
não são orginais do XML do directório
- por exemplo para o id gerado FTP_4_DTP será
um elemento representativo de uma pasta DTP, o id é unico porque 4 é a profundidade onde ele
está logo o par 4 + DTP é único supostamente a menos que alguém vá criar uma pasta com este nome
o que é quase impossivel
substring(@id,@idPrefixSize+1) este código com o id de exemplo vai originar DTP no link
 
-->
<xsl:template match="d:directory" mode="linkParent">/<xsl:value-of select="@id"/></xsl:template>
<xsl:template match="d:node" mode="linkParent">
<xsl:template match="d:leaf[@node='true']" mode="linkParent">
<xsl:choose>
<xsl:when test="@idPrefixSize"><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/></xsl:when>
<xsl:otherwise><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/></xsl:otherwise>
55,11 → 70,11
 
 
<xsl:template match="d:leaf" mode="linkParent">
<xsl:template match="d:leaf[@node='false']" mode="linkParent">
<xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/>
</xsl:template>
<xsl:template match="d:leaf" mode="bodyContent">
<xsl:template match="d:leaf[@node='false']" mode="bodyContent">
<xsl:choose>
<xsl:when test="string(@xml) = 'true'">
<xsl:variable name="bodyDoc" select="document($includeXML)"/>
74,10 → 89,10
<xsl:template match="d:directory" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
<xsl:template match="d:node" mode="label">
<xsl:template match="d:leaf[@node='true']" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
<xsl:template match="d:leaf" mode="label">
<xsl:template match="d:leaf[@node='false']" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
/impl/conf/directories/style1.xsl
247,7 → 247,7
<xsl:apply-templates select="." mode="childs"/>
</xsl:template>
 
<xsl:template match="d:node" mode="root">
<xsl:template match="d:leaf[@node='true']" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
267,11 → 267,11
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<xsl:if test="d:leaf[@node='false']">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<xsl:for-each select="d:leaf[@node='false']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
280,13 → 280,13
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:if test="d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<xsl:when test="d:groupsDeclaration/d:group/d:name">
<xsl:for-each select="d:groupsDeclaration/d:group/d:name">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<xsl:for-each select="../../../d:leaf[@node='true' and @group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
295,7 → 295,7
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<xsl:for-each select="d:leaf[@node='true']">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
307,15 → 307,15
</table>
</xsl:template>
<xsl:template match="d:node" mode="childs">
<xsl:template match="d:leaf[@node='true']" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<xsl:if test="d:leaf[@node='false']">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<xsl:for-each select="d:leaf[@node='false']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
324,13 → 324,13
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:if test="d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<xsl:when test="d:groupsDeclaration/d:group/d:name">
<xsl:for-each select="d:groupsDeclaration/d:group/d:name">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<xsl:for-each select="../../../d:leaf[@node='true' and @group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
339,7 → 339,7
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<xsl:for-each select="d:leaf[@node='true']">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
351,16 → 351,16
</table>
</xsl:template>
<xsl:template match="d:node" mode="block">
<xsl:template match="d:leaf[@node='true']" mode="block">
<div class="block">
<p><xsl:apply-templates select="." mode="link"/></p>
<ul>
<xsl:for-each select="d:leaf">
<xsl:for-each select="d:leaf[@node='false']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
<xsl:for-each select="d:node">
<xsl:for-each select="d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
373,7 → 373,7
| Página de Apresentação de uma Folha no Corpo da Página
===========================================================
-->
<xsl:template match="d:leaf" mode="root">
<xsl:template match="d:leaf[@node='false']" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table id="bigTable" cellspacing="0" cellpadding="0">
<tr>
417,12 → 417,12
Tamanho
</th>
</tr>
<xsl:apply-templates select="./d:leaf[@ftpDirectory='true']" mode="ftpLine"/>
<xsl:apply-templates select="./d:leaf[@ftpDirectory='false']" mode="ftpLine"/>
<xsl:apply-templates select="./d:leaf[@node='false' and @ftpDirectory='true']" mode="ftpLine"/>
<xsl:apply-templates select="./d:leaf[@node='false' and @ftpDirectory='false']" mode="ftpLine"/>
</table>
</div>
</xsl:template>
<xsl:template match="d:leaf" mode="ftpLine">
<xsl:template match="d:leaf[@node='false']" mode="ftpLine">
<xsl:choose>
<xsl:when test="./@ftpDirectory='true'">
<tr class="dir">
451,7 → 451,7
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="d:leaf" mode="mime">
<xsl:template match="d:leaf[@node='false']" mode="mime">
<img>
<xsl:attribute name="alt"><xsl:value-of select="."/></xsl:attribute>
<xsl:attribute name="src">
490,7 → 490,7
-->
 
<xsl:template match="d:leaf" mode="topNav">
<xsl:template match="d:leaf[@node='false']" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
502,7 → 502,7
</div>
</xsl:template>
 
<xsl:template match="d:node" mode="topNav">
<xsl:template match="d:leaf[@node='true']" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
529,7 → 529,7
</div>-->
</xsl:template>
<xsl:template match="d:leaf" mode="topNavRemote">
<xsl:template match="d:leaf[@node='false']" mode="topNavRemote">
<div id="topnav">
<ul>
<li class="navPlace">
538,7 → 538,7
</div>
</xsl:template>
<xsl:template match="d:node" mode="topNavRemote">
<xsl:template match="d:leaf[@node='true']" mode="topNavRemote">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBackRemote"/>
561,7 → 561,7
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBack">
<xsl:template match="d:leaf[@node='true']" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
570,7 → 570,7
</li>
</xsl:template>
<xsl:template match="d:leaf" mode="navBack">
<xsl:template match="d:leaf[@node='false']" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
579,12 → 579,12
</li>
</xsl:template>
<xsl:template match="d:leaf" mode="navBackRemote">
<xsl:template match="d:leaf[@node='false']" mode="navBackRemote">
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBackRemote">
<xsl:template match="d:leaf[@node='true']" mode="navBackRemote">
<xsl:apply-templates select=".." mode="navBackRemote"/>
<li class="navPlace">
&gt;
597,15 → 597,15
| Barra de Navegação Lateral Esquerda
===========================================================
-->
<xsl:template match="d:node" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<xsl:template match="d:leaf[@node='true']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
619,24 → 619,24
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
<!--</xsl:if>-->
</xsl:template>
<xsl:template match="d:leaf" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<xsl:template match="d:leaf[@node='false']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
650,24 → 650,24
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
<!--</xsl:if>-->
</xsl:template>
<xsl:template match="d:directory" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
681,14 → 681,14
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace"><xsl:call-template name="linkPrefix"/><xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
<!--</xsl:if>-->
</xsl:template>
<xsl:template name="linkPrefix">
701,9 → 701,9
-->
<xsl:template name="treeRoot">
<xsl:if test="/d:directory/d:node">
<xsl:if test="/d:directory/d:leaf[@node='true']">
<ul>
<xsl:for-each select="/d:directory/d:node">
<xsl:for-each select="/d:directory/d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
712,20 → 712,20
</xsl:if>
</xsl:template>
<xsl:template match="d:node" mode="treeLoop">
<xsl:template match="d:leaf[@node='true']" mode="treeLoop">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p><xsl:value-of select="@label"/></p>
<xsl:if test="./d:leaf">
<xsl:for-each select="./d:leaf">
<xsl:if test="./d:leaf[@node='false']">
<xsl:for-each select="./d:leaf[@node='false']">
<xsl:apply-templates select="." mode="tree"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="./d:node">
<xsl:if test="./d:leaf[@node='true']">
<ul>
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
735,7 → 735,7
</div>
</xsl:template>
<xsl:template match="d:leaf" mode="tree">
<xsl:template match="d:leaf[@node='false']" mode="tree">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
/impl/conf/directories/topMenus.xml
New file
0,0 → 1,50
<?xml version="1.0" encoding="UTF-8"?>
<directory id="topMenus" label="Menus de Top" place="home" layout="" layoutRoot="" targetRole="" menuKey="" style="topMenus.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<leaf node="true" label="Apresentação" id="app">
<leaf node="false" id="msgDir" label="Mensagem do Director" absolute="false" url="/dir/futureStudent/ESTG/estgDirector/public/portal/estgMensagemDirector.html" proxy="local"/>
<leaf node="false" id="missao" label="A ESTG e a sua missão" absolute="false" url="/dir/futureStudent/ESTG/estgMissao/public/portal/estgMissao.html" proxy="local"/>
<leaf node="false" id="historia" label="História" absolute="false" url="/dir/futureStudent/ESTG/estgPassado/public/portal/estgPassado.html" proxy="local"/>
<leaf node="false" id="localizacao" label="Localização" absolute="false" url="/dir/futureStudent/ESTG/estgChegar/public/portal/estgComoChegarEstg.html" proxy="local"/>
<leaf node="false" id="fotos" label="A ESTG em Fotografias" absolute="false" url="/dir/futureStudent/ESTG/estgFotos/public/portal/estgFotos.html" proxy="local"/>
</leaf>
 
<leaf node="true" label="Organização" id="org">
<leaf node="false" id="director" label="Director" absolute="false" url="/dir/student/OrgaosGestao/orgaosDirector/public/portal/orgaoDirector.html" proxy="local"/>
<leaf node="false" id="ctc" label="Conselho Tecnico Cientifico" absolute="false" url="/dir/student/OrgaosGestao/orgaosConselhoTecnicoCientifico/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="local"/>
<leaf node="false" id="cr" label="Conselho de Representantes" absolute="false" url="/dir/student/OrgaosGestao/orgaosConselhoRepresentantes/public/portal/orgaosConselhoRepresentantes.html" proxy="local"/>
<leaf node="false" id="cp" label="Conselho Pedagógico" absolute="false" url="/dir/student/OrgaosGestao/orgaosConselhoPedagogico/public/portal/orgaosConselhoPedagogico.html" proxy="local"/>
<leaf node="false" id="cg" label="Conselho de Gestão" absolute="false" url="/dir/student/OrgaosGestao/orgaosConselhogestao/public/portal/orgaosConselhoGestao.html" proxy="local"/>
<leaf node="false" id="cint" label="Conselho Interdepartamental" absolute="false" url="/dir/teacher/OrgaosGestao/orgaosConselhoInterdepartamental/public/portal/orgaosConselhoInterdepartamental.html" proxy="local"/>
</leaf>
 
<leaf node="true" label="Departamentos" id="departamentos">
<leaf node="false" id="dtd" label="Tecnologia e Design" absolute="false" url="/dir/student/departamentos/depTD/public/departamentos/depTD.html" proxy="local"/>
<leaf node="false" id="cesh" label="Ciencias Empresariais Sociais e Humanas" absolute="false" url="/dir/student/departamentos/depTD/public/departamentos/depCESH.html" proxy="local"/>
</leaf>
 
<leaf node="true" label="Ensino" id="ensino">
<leaf node="false" id="lecenciaturas" label="Licenciaturas" absolute="false" url="/courses.do?type=L" proxy="local"/>
<leaf node="false" id="mestrados" label="Mestrados" absolute="false" url="/courses.do?type=M" proxy="local"/>
<leaf node="false" id="accurtadur" label="Acções de Formação de Curta Duração" absolute="false" url="/courses.do?type=C" proxy="local"/>
<leaf node="false" id="cet" label="CET" absolute="false" url="/courses.do?type=E" proxy="local"/>
<leaf node="false" id="favanc" label="Formações Avançadas" absolute="false" url="/courses.do?type=A" proxy="local"/>
<leaf node="false" id="pgrad" label="Pós Graduação" absolute="false" url="/courses.do?type=P" proxy="local"/>
<leaf node="false" id="tesp" label="TeSP" absolute="false" url="/courses.do?type=T" proxy="local"/>
</leaf>
 
<leaf node="true" label="I&amp;D" id="ied">
<leaf node="false" id="poliempreende" label="Poliempreende" absolute="true" url="http://www.ipportalegre.pt/poliempreende/" proxy="local"/>
<leaf node="false" id="alimentsaud" label="Alimentação Saudável" absolute="true" url="http://alimentacaosaudavel.ipportalegre.pt" proxy="local"/>
<leaf node="false" id="c3i" label="C3i" absolute="true" url="http://www.c3i.ipportalegre.pt/" proxy="local"/>
</leaf>
 
<leaf node="false" id="contactos" label="Contactos" absolute="false" url="/dir/student/contactos/contGerais/public/portal/contactosGeraisEstg.html" proxy="local"/>
 
<leaf node="true" label="O Politécnico" id="politecnico">
<leaf node="false" id="ipp" label="Instituto Politécnico de Portalegre" absolute="true" url="http://www.ipportalegre.pt/" proxy="local"/>
<leaf node="false" id="esep" label="E. S. Educação" absolute="true" url="http://www.esep.pt/" proxy="local"/>
<leaf node="false" id="esae" label="E. S. Agrária de Elvas" absolute="true" url="http://www.esaelvas.pt/" proxy="local"/>
<leaf node="false" id="essp" label="E. S. Saúde" absolute="true" url="http://www.essp.pt/" proxy="local"/>
<leaf node="false" id="sas" label="SAS" absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="local"/>
</leaf>
</directory>
/impl/conf/directories/styleIntranet.xsl
12,7 → 12,7
</xsl:template>
 
 
<xsl:template match="d:leaf" mode="topNav">
<xsl:template match="d:leaf[@node='false']" mode="topNav">
<xsl:if test="not(local-name(..) = 'directory')">
<div id="topnav">
<ul>
26,7 → 26,7
</xsl:if>
</xsl:template>
 
<xsl:template match="d:node" mode="topNav">
<xsl:template match="d:leaf[@node='true']" mode="topNav">
<xsl:if test="not(local-name(..) = 'directory')">
<div id="topnav">
<ul>
48,7 → 48,7
</xsl:template>
<xsl:template match="d:leaf" mode="topNavRemote">
<xsl:template match="d:leaf[@node='false']" mode="topNavRemote">
<div id="topnav">
<ul>
<li class="navPlace">
57,7 → 57,7
</div>
</xsl:template>
<xsl:template match="d:node" mode="topNavRemote">
<xsl:template match="d:leaf[@node='true']" mode="topNavRemote">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBackRemote"/>
80,7 → 80,7
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBack">
<xsl:template match="d:leaf[@node='true']" mode="navBack">
<xsl:if test="not(local-name(..) = 'directory')">
<xsl:apply-templates select=".." mode="navBack"/>
</xsl:if>
94,7 → 94,7
</li>
</xsl:template>
<xsl:template match="d:leaf" mode="navBack">
<xsl:template match="d:leaf[@node='false']" mode="navBack">
<xsl:if test="not(local-name(..) = 'directory')">
<xsl:apply-templates select=".." mode="navBack"/>
</xsl:if>
107,12 → 107,12
</li>
</xsl:template>
<xsl:template match="d:leaf" mode="navBackRemote">
<xsl:template match="d:leaf[@node='false']" mode="navBackRemote">
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBackRemote">
<xsl:template match="d:leaf[@node='true']" mode="navBackRemote">
<xsl:apply-templates select=".." mode="navBackRemote"/>
<li class="navPlace">
&gt;
125,15 → 125,15
| Barra de Navegação Lateral Esquerda
===========================================================
-->
<xsl:template match="d:node" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<xsl:template match="d:leaf[@node='true']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
147,24 → 147,24
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
<!--</xsl:if>-->
</xsl:template>
<xsl:template match="d:leaf" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<xsl:template match="d:leaf[@node='false']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
178,14 → 178,14
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace"><xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
<!--</xsl:if>-->
</xsl:template>
 
 
/impl/conf/directories/teacher.xml
1,74 → 1,80
<?xml version="1.0" encoding="UTF-8"?>
<directory label="Docentes" place="home" layout="layout0" layoutRoot="layoutPortal" targetRole="teacher" id="teacher" menuKey="menu.docentes" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<groupsDeclaration>
<group>1</group>
<group>2</group>
</groupsDeclaration>
<node label="Serviços on-line" id="servicosOnLine" group="1">
<leaf absolute="true" url="http://baco.estgp.pt/layout/webmailRedirect.jsp" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf absolute="true" url="http://assiduidade.ipportalegre.pt/mymillenium/" proxy="estgp" id="servPortalAssiduidade" label="Portal de Assiduidade"></leaf>
<leaf absolute="true" url="http://sisgor.ipportalegre.pt/" proxy="estgp" id="servSisgom" label="Sisgor Ocorrências"></leaf>
<leaf absolute="true" url="https://www.siadap.gov.pt/" proxy="estgp" id="siadap" label="Siadap"></leaf>
</node>
<node label="Contactos" id="contactos" group="2">
<leaf absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</node>
<node label="Biblioteca" id="biblioteca" group="1">
<leaf absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Coleções"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contactos e Horários"></leaf>
</node>
<node label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf absolute="false" url="/public/portal/PALVErasmusDocentesEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusDocentesEstrangeiros" label="Os Docentes Estrangeiros na ESTG"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusDocentesESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroDocentes" label="Os Docentes da ESTG no Estrangeiro"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Setorial - Erasmus"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Atividades Elegiveis"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusFormularioDocentes.html" proxy="estgp" id="PALVErasmusFomularioDocentes" label="Formulários Docentes"></leaf>
<leaf absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</node>
<node label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Director"></leaf>
<leaf absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
<leaf absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoInterdepartamental" label="Conselho Interdepartamental"></leaf>
</node>
<node label="Informação Académica" id="infoAcademica" group="2">
<leaf absolute="true" url="http://baco.estgp.pt/dir/student/infoAcademica/infoAcadCalendarioEscolar/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
</node>
<node label="O IPP" id="IPP" group="1">
<leaf absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Ação Social"></leaf>
</node>
<node label="Departamentos" id="departamentos" group="2">
<leaf absolute="false" url="/public/departamentos/depTD.html" proxy="estgp" id="depTD" label="Departamento de TD"></leaf>
<leaf absolute="false" url="/public/departamentos/depCESH.html" proxy="estgp" id="depCESH" label="Departamento de CESH"></leaf>
</node>
<groupsDeclaration>
<group>
<name>1</name>
<description>1</description>
</group>
<group>
<name>2</name>
<description>2</description>
</group>
</groupsDeclaration>
<leaf node="true" label="Serviços on-line" id="servicosOnLine" group="1">
<leaf node="false" absolute="true" url="http://baco.estgp.pt/layout/webmailRedirect.jsp" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="true" url="http://netpa.ipportalegre.pt/" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf node="false" absolute="true" url="http://assiduidade.ipportalegre.pt/mymillenium/" proxy="estgp" id="servPortalAssiduidade" label="Portal de Assiduidade"></leaf>
<leaf node="false" absolute="true" url="http://sisgor.ipportalegre.pt/" proxy="estgp" id="servSisgom" label="Sisgor Ocorrências"></leaf>
<leaf node="false" absolute="true" url="https://www.siadap.gov.pt/" proxy="estgp" id="siadap" label="Siadap"></leaf>
</leaf>
<leaf node="true" label="Contactos" id="contactos" group="2">
<leaf node="false" absolute="false" url="/public/portal/contactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Gerais ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosDepartamentos.html" proxy="estgp" id="contDep" label="Departamentos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosSecretaria.html" proxy="estgp" id="contSecretaria" label="Secretaria"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosCentroInformatico.html" proxy="estgp" id="contCentroInformatico" label="Centro Informático"></leaf>
<leaf node="false" absolute="false" url="/public/portal/contactosGabineteComunicacao.html" proxy="estgp" id="contGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
</leaf>
<leaf node="true" label="Biblioteca" id="biblioteca" group="1">
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaApresentacao.html" proxy="estgp" id="servBiblioteca" label="Apresentação"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaServicos.html" proxy="estgp" id="servBibliotecaServ" label="Serviços"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaColeccoes.html" proxy="estgp" id="servBibliotecaColeccoes" label="Coleções"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaPublico.html" proxy="estgp" id="servBibliotecaPublico" label="Público"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaCatalogos.html" proxy="estgp" id="servBibliotecaCatalogos" label="Catálogos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaRegulamento.html" proxy="estgp" id="servBiblioteRegulamento" label="Regulamento"></leaf>
<leaf node="false" absolute="false" url="/public/portal/servicosBibliotecaContactos.html" proxy="estgp" id="servBibliotecaContactos" label="Contactos e Horários"></leaf>
</leaf>
<leaf node="true" label="PALV Erasmus" id="PALVErasmus" group="2">
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusDocentesEstrangeirosESTG.html" proxy="estgp" id="PALVErasmusDocentesEstrangeiros" label="Os Docentes Estrangeiros na ESTG"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusDocentesESTGEstrangeiro.html" proxy="estgp" id="PALVErasmusEstrangeiroDocentes" label="Os Docentes da ESTG no Estrangeiro"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusObjectivos.html" proxy="estgp" id="PALVErasmusObjectivos" label="Objectivos"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusPaises.html" proxy="estgp" id="PALVErasmusPaises" label="Países Participantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusProgramaErasmus.html" proxy="estgp" id="PALVErasmusProgramaErasmus" label="Programa Setorial - Erasmus"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusActividadesElegiveis.html" proxy="estgp" id="PALVErasmusActividadesElegiveis" label="Atividades Elegiveis"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusMobilidadeEstudantes.html" proxy="estgp" id="PALVErasmusMobilidadeEstudantes" label="Mobilidade Estudantes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusParceirosESTG.html" proxy="estgp" id="PALVErasmusParceiros" label="Parceiros"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusFormularioDocentes.html" proxy="estgp" id="PALVErasmusFomularioDocentes" label="Formulários Docentes"></leaf>
<leaf node="false" absolute="false" url="/public/portal/PALVErasmusContactos.html" proxy="estgp" id="PALVErasmusContactos" label="Contactos"></leaf>
</leaf>
<leaf node="true" label="Orgãos de Gestão" id="OrgaosGestao" group="1">
<leaf node="false" absolute="false" url="/public/portal/orgaoDirector.html" proxy="estgp" id="orgaosDirector" label="Director"></leaf>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoTecnicoCientifico.html" proxy="estgp" id="orgaosConselhoTecnicoCientifico" label="Conselho Técnico Científico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Tecnico.Cientifico.Externo" proxy="grupos" id="pastaConselhoTecnicoCientificoExterna" label=" -----> Documentação CTC" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoPedagogico.html" proxy="estgp" id="orgaosConselhoPedagogico" label="Conselho Pedagógico"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Pedagogico.Externo" proxy="grupos" id="pastaConselhoPegagogicoExterna" label=" -----> Documentação CP" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoRepresentantes.html" proxy="estgp" id="orgaosConselhoRepresentantes" label="Conselho Representantes"></leaf>
<leaf node="false" absolute="false" url="/Conselho.Representantes.Externo" proxy="grupos" id="pastaConselhoRepresentantesExterna" label=" -----> Documentação CR" remoteExtensionRoot="true" style="true" layout="true" />
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoGestao.html" proxy="estgp" id="orgaosConselhogestao" label="Conselho de Gestão"></leaf>
<leaf node="false" absolute="false" url="/public/portal/orgaosConselhoInterdepartamental.html" proxy="estgp" id="orgaosConselhoInterdepartamental" label="Conselho Interdepartamental"></leaf>
</leaf>
<leaf node="true" label="Informação Académica" id="infoAcademica" group="2">
<leaf node="false" absolute="true" url="http://baco.estgp.pt/dir/student/infoAcademica/infoAcadCalendarioEscolar/public/portal/CL20102011.pdf" proxy="estgp" id="infoAcadCalendarioEscolar" label="Calendário Escolar"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=L" proxy="estgp" id="infoAcadLicenciaturas" label="Licenciaturas"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=M" proxy="estgp" id="infoAcadMestrados" label="Mestrados"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=P" proxy="estgp" id="infoAcadPgraduacoes" label="Pós-Graduações"></leaf>
<leaf node="false" absolute="true" url="http://baco.estgp.pt/courses.do?type=E" proxy="estgp" id="infoAcadCET" label="CET"></leaf>
</leaf>
<leaf node="true" label="O IPP" id="IPP" group="1">
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/" proxy="estgp" id="ippIPP" label="IPP Serviços Centrais"></leaf>
<leaf node="false" absolute="true" url="http://www.esep.pt/" proxy="estgp" id="ippESEP" label="Esc. Sup. de Educação"></leaf>
<leaf node="false" absolute="true" url="http://www.esaelvas.pt/" proxy="estgp" id="ippESAE" label="Esc. Sup. Agrária"></leaf>
<leaf node="false" absolute="true" url="http://www.essp.pt/" proxy="estgp" id="ippESSP" label="Esc. Sup. de Saúde"></leaf>
<leaf node="false" absolute="true" url="http://www.ipportalegre.pt/sas/" proxy="estgp" id="ippSAS" label="Serviços de Ação Social"></leaf>
</leaf>
<leaf node="true" label="Departamentos" id="departamentos" group="2">
<leaf node="false" absolute="false" url="/public/departamentos/depTD.html" proxy="estgp" id="depTD" label="Departamento de TD"></leaf>
<leaf node="false" absolute="false" url="/public/departamentos/depCESH.html" proxy="estgp" id="depCESH" label="Departamento de CESH"></leaf>
</leaf>
</directory>
/impl/conf/directories/directoryBeforeConfiguration.xsd
New file
0,0 → 1,180
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Jorge Machado (Escola Superior de tecnologia e Gestao, Portalegre) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.estgp.pt/baco/directory/" targetNamespace="http://www.estgp.pt/baco/directory/" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="directory">
<xs:annotation>
<xs:documentation>This schema is to define information structured directories</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="place" use="required"/>
<xs:attribute name="style" use="required"/>
<xs:attribute name="layout" use="required"/>
<xs:attribute name="layoutRoot" use="required"/>
<xs:attribute name="targetRole" use="required"/>
<xs:attribute name="menuKey" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="nodeT">
<xs:annotation>
<xs:documentation>A node is a directory internal object, it has a label and an identifier and can have children nodes and/or leafs</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="group" use="optional">
<xs:annotation>
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="showNav" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>Show link to this node in navigation menus, true by default</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" use="optional">
<xs:annotation>
<xs:documentation>Type of node, by default HTTP link</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="ftp"/>
<xs:enumeration value="http"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
<xs:complexType name="leafT">
<xs:annotation>
<xs:documentation>A leaf is an URL for an external or internal WEB site</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>A leaf can be a root of some diferent system like FTP server Directory</xs:documentation>
</xs:annotation>
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="url" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="label_en" use="optional"/>
<xs:attribute name="label_es" use="optional"/>
<xs:attribute name="xml" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>False by default</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="xs:boolean">
<xs:annotation>
<xs:documentation>True by default, define if a source is to be included in layout or opened in all window</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="style" type="xs:boolean">
<xs:annotation>
<xs:documentation>True by default, define if a source is to be styled by the XSLT.
When style=false and layout=false external file will be directly writed in TopWindow</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="absolute" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>follow parameter will be evaluated only If this parameter is set to false</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="proxy" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Only consider a proxy if it is here defined</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="group" use="optional">
<xs:annotation>
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="remoteExtensionRoot" type="xs:boolean" use="optional"/>
<!--
The next attributes are filled by system BACO when remoteExtensionPoint is reached
-->
<xs:attribute name="ftpDirectory" type="xs:boolean"/>
<xs:attribute name="size" use="optional">
<xs:annotation>
<xs:documentation>Size of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="mimeType" use="optional">
<xs:annotation>
<xs:documentation>Mime Type of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lastModification" use="optional">
<xs:annotation>
<xs:documentation>Last Modification of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="visualization" use="optional">
<xs:annotation>
<xs:documentation>Type of node, by default HTTP link</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="filesystem"/>
<xs:enumeration value="normal"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="groupDeclarationT">
<xs:sequence>
<xs:element name="group" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightsT">
<xs:annotation>
<xs:documentation>Rights define who is authorized to enter in a node</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="role" type="rightT1"/>
<xs:element name="user" type="rightT1"/>
</xs:choice>
<xs:element name="internal" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightT1" mixed="true">
<xs:annotation>
<xs:documentation>A right T1 can be to permit or restrict</xs:documentation>
</xs:annotation>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="permit"/>
<xs:enumeration value="restrict"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:schema>
Property changes:
Added: svn:executable
+ *
/impl/conf/directories/editados/teacher.xml
1,4 → 1,4
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<directory label="Docentes" place="home" layout="layout0" layoutRoot="layoutPortal" targetRole="teacher" id="teacher" menuKey="menu.docentes" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<groupsDeclaration>
<group>1</group>
/impl/conf/berserk/sd.xml
266,7 → 266,20
</filterChains>
</service>
 
<service>
<name>LoadOwnerAnnouncementsMax</name>
<implementationClass>pt.estgp.estgweb.services.announcements.LoadOwnerAnnouncements</implementationClass>
<description>Load owner Blogs</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadMax</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
 
 
<!--Teste-->
<service>
<name>TesteSaver</name>
421,7 → 434,20
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
 
<service>
<name>LoadEditableBlogsMax</name>
<implementationClass>pt.estgp.estgweb.services.blogs.LoadEditableBlogs</implementationClass>
<description>Load editable Blogs</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadMax</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadOwnerBlogs</name>
<implementationClass>pt.estgp.estgweb.services.blogs.LoadOwnerBlogs</implementationClass>
<description>Load owner Blogs</description>
433,6 → 459,18
</filterChains>
</service>
<service>
<name>LoadOwnerBlogsMax</name>
<implementationClass>pt.estgp.estgweb.services.blogs.LoadOwnerBlogs</implementationClass>
<description>Load owner Blogs</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadMax</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadOwnerBlogPosts</name>
<implementationClass>pt.estgp.estgweb.services.blogs.LoadOwnerBlogPosts</implementationClass>
<description>Load owner Blog Posts</description>
443,6 → 481,18
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadOwnerBlogPostsMax</name>
<implementationClass>pt.estgp.estgweb.services.blogs.LoadOwnerBlogPosts</implementationClass>
<description>Load owner Blog Posts</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadMax</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
 
 
 
763,7 → 813,7
</filterChains>
</service>
 
<service>
<!--<service>
<name>DeleteCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.UpdateCourseUnitService</implementationClass>
<description>Update course unit objectives and program file</description>
774,7 → 824,7
<chain name="Session"/>
<chain name="Supers"/>
</filterChains>
</service>
</service>-->
<service>
<name>LoadCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitService</implementationClass>
845,6 → 895,18
</service>
 
<service>
<name>LoadCourseUnitInEvaluationBySigesCodes</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitsBySigesCodesService</implementationClass>
<description>Load course old units</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadUnitInEvaluation</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
<service>
<name>LoadCourseUnitsBySigesCodesSemestreLastYear</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitsBySigesCodesService</implementationClass>
<description>Load a unique unit by sigescode, semestre and course code</description>
1062,6 → 1124,15
</filterChains>
</service>
<service>
<name>LoadSubscribedUnitsGivenYear</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadSubscribedUnitsCurrentYearService</implementationClass>
<description>Load student units in current Year</description>
<isTransactional>true</isTransactional>
<defaultMethod>givenYear</defaultMethod>
<filterChains>
</filterChains>
</service>
<service>
<name>LoadSubscribedUnitsOldYears</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadSubscribedUnitsOldYearsService</implementationClass>
<description>Load student units in current Year</description>
2026,5 → 2097,180
</service>
 
 
<!--DIRECTORIES-->
 
<service>
<name>LoadDirectoryService</name>
<implementationClass>pt.estgp.estgweb.services.directories.DirectoryService</implementationClass>
<description>Loads a Directory</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadDirectory</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="ServicesOrAdmin"/>
</filterChains>
</service>
 
<service>
<name>LoadDirectoryServiceXml</name>
<implementationClass>pt.estgp.estgweb.services.directories.DirectoryService</implementationClass>
<description>Loads a Directory</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadDirectoryXml</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
<service>
<name>LoadDirectoryServiceHtml</name>
<implementationClass>pt.estgp.estgweb.services.directories.DirectoryService</implementationClass>
<description>Loads a Directory and style it with XSL</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadDirectoryHtml</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
<service>
<name>SaveDirectoryService</name>
<implementationClass>pt.estgp.estgweb.services.directories.DirectoryService</implementationClass>
<description>Save a Directory Object</description>
<isTransactional>true</isTransactional>
<defaultMethod>saveDirectory</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>LoadJobServiceTaskSchedullers</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobServiceInterfaces</implementationClass>
<description>Save a Directory Object</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadJobServiceTaskSchedullers</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>LoadJobServiceTask</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobServiceInterfaces</implementationClass>
<description>Save a Directory Object</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadJobServiceTask</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>LoadJobServiceTaskScheduler</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobServiceInterfaces</implementationClass>
<description>Save a Directory Object</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadJobServiceTaskScheduler</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>RunNowJobServiceTaskScheduller</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobScheduleService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>runNow</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>ToggleActiveJobServiceTaskScheduller</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobScheduleService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>toggleActive</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>DeleteJobServiceTaskScheduller</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobScheduleService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>delete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>SaveJobServiceTaskScheduler</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobScheduleService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>save</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
 
 
<service>
<name>TryDeleteCourseUnitService</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.DeleteCourseUnitService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>tryDelete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
<service>
<name>LoadCandidatesDeleteCourseUnitService</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.DeleteCourseUnitService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>loadDeleteCandidates</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
 
 
 
 
 
 
 
</serviceDefinitions>
/impl/conf/berserk/fcd.xml
49,6 → 49,13
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass>
</filterChain>
<filterChain>
<name>ServicesOrAdmin</name>
<expression>AuthenticatedUsers &amp;&amp; (RoleUsers("admin") || RoleUsers("services"))</expression>
<description>Validate if a user is coordinator or director</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass>
</filterChain>
<filterChain>
<name>IdentifiersManager</name>
<expression>AuthenticatedUsers &amp;&amp; RoleUsers("identifiersManager")</expression>
<description>Admins Control Chain</description>
/impl/src/java/jomm/utils/AutoFillArrayList.java
20,7 → 20,7
{
super();
// this.c = c;
for(int i=0;i<600;i++)
for(int i=0;i<50;i++)
{
try
{
/impl/src/java/jomm/dao/impl/AbstractDao.java
13,9 → 13,7
import pt.estgp.estgweb.domain.DomainSerializableObject;
 
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
 
import static org.hibernate.criterion.Restrictions.eq;
 
258,6 → 256,8
}
}
 
 
 
/**
* Returns results as a page.
* <p/>
903,4 → 903,40
 
return criteria;
}
 
/**
* return deleted objects
* @param incompleteList
* @param persistentList
* @param comparator
* @return
*/
public List<CLAZZ> deleteMissing(Collection<CLAZZ> incompleteList, Collection<CLAZZ> persistentList,Comparator<CLAZZ> comparator)
{
List<CLAZZ> deletedObjects = new ArrayList<CLAZZ>();
//Remover apagados
Iterator<CLAZZ> iterPersistentObjects = persistentList.iterator();
while(iterPersistentObjects.hasNext())
{
CLAZZ persisitentObj = iterPersistentObjects.next();
boolean found = false;
for(CLAZZ incompleteListObj: incompleteList)
{
if(comparator.compare(incompleteListObj,persisitentObj)==0)
{
found = true;
break;
}
}
if(!found)
{
iterPersistentObjects.remove();
deletedObjects.add(persisitentObj);
delete(persisitentObj);
}
}
return deletedObjects;
}
 
 
}
/impl/src/java/jomm/web/ftp/impl/FtpFile.java
189,7 → 189,8
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
else
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFiles.add(iFile);
}
return iFiles;
/impl/src/java/pt/estgp/estgweb/utils/StringsUtils.java
25,6 → 25,21
return roles;
}
 
public static String getSerialLongs(List<Long> longs, String separator)
{
if (longs == null)
return null;
String roles = null;
for (Long role : longs)
{
if (roles == null)
roles = "" + role;
else
roles += separator + role;
}
return roles;
}
 
public static List<String> getStringsFromSerial(String stringsSerial, String separator)
{
if (stringsSerial == null)
33,11 → 48,25
List<String> l = new ArrayList<String>();
for (String role : roles)
{
l.add(role);
if(role != null && role.trim().length() > 0)
l.add(role);
}
return l;
}
 
public static List<Long> getLongsFromSerial(String stringsSerial, String separator)
{
if (stringsSerial == null)
return null;
String[] roles = stringsSerial.split(separator);
List<Long> l = new ArrayList<Long>();
for (String role : roles)
{
l.add(Long.parseLong(role));
}
return l;
}
 
//TODO ARRANJAR ISTO
public static String getNormalizedName(String nome)
{
/impl/src/java/pt/estgp/estgweb/utils/Dom4jUtil.java
256,7 → 256,7
 
private static Transformer getTransformerFromSystem(String xsltFile) throws TransformerConfigurationException, IOException
{
Templates tpl= templates.get(xsltFile);
Templates tpl = templates.get(xsltFile);
if (tpl==null)
{
String path = Globals.CLASSES_ABSOLUTE_PATH + xsltFile;
/impl/src/java/pt/estgp/estgweb/utils/DynamicArrayList.java
New file
0,0 → 1,70
package pt.estgp.estgweb.utils;
 
import java.util.ArrayList;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class DynamicArrayList<E> extends ArrayList<E>
{
Class referenceClass;
public DynamicArrayList(Class clazz)
{
this.referenceClass = clazz;
}
 
 
@Override
public E get(int i) {
if(i >= size())
{
while(i >= size())
{
try {
super.add((E)referenceClass.newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return super.get(i);
}
 
@Override
public void add(int i, E obj) {
if(i >= size())
{
while(i >= size())
{
try {
super.add((E)referenceClass.newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
super.add(i,obj);
}
 
@Override
public E set(int i, E obj) {
if(i >= size())
{
while(i >= size())
{
try {
super.add((E)referenceClass.newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return super.set(i,obj);
}
}
/impl/src/java/pt/estgp/estgweb/Globals.java
1,14 → 1,9
package pt.estgp.estgweb;
 
import pt.estgp.estgweb.domain.DirectoryImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.directories.DirectoryService;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.StringsUtils;
 
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
* @author Jorge Machado
30,6 → 25,7
CLASSES_ABSOLUTE_PATH = CLASSES_ABSOLUTE_PATH.substring(0,CLASSES_ABSOLUTE_PATH.length()-1);
}
 
/*
//place, List
public static Map<String,List<DirectoryImpl>> DIRECTORIES = new HashMap<String,List<DirectoryImpl>>();
 
49,9 → 45,9
return directories;
}
}
*/
 
 
 
public static final String ROLE_PROCESSES_ADMIN = "processes.admin";
public static final String INTRANET_IMPRESSAO_SERVICO_API = ConfigProperties.getProperty("impressao.servicos.api");
public static final boolean INTRANET_IMPRESSAO_SERVICO_AUTH = ConfigProperties.getBooleanProperty("impressao.servicos.auth");
102,6 → 98,9
public static final boolean INTRANET_DTP_CourseCoordinatorWrite = ConfigProperties.getBooleanProperty("intranet.dtp.course.coordinator.write");
public static final boolean INTRANET_DTP_CourseDirectorWrite = ConfigProperties.getBooleanProperty("intranet.dtp.course.director.write");
public static final boolean INTRANET_DTP_CourseUnitResponsibleWrite = ConfigProperties.getBooleanProperty("intranet.dtp.course.unit.responsible.write");
//use , as separator
public static final List<String> INTRANET_DTP_FULLCONTROL_ROLES = StringsUtils.getStringsFromSerial(ConfigProperties.getProperty("intranet.dtp.course.unit.fullcontrol.roles"),",");
public static final String INTRANET_DTP_INQUERITO_PEDAGOGICO_ROLE = ConfigProperties.getProperty("intranet.dtp.course.unit.inquerito_pedagogico.role");
 
 
 
164,7 → 163,7
 
/*SIGES WEB SERVICES*/
//NAO É URGENTE PARA ACTUALIZACOES VAMOS DEIXAR CARREGAR DA BD E NAS ACTUALIZAÇOES MUDA AQUI
public static BigDecimal NATIONAL_INSTITUTION_CODE = new BigDecimal(DaoFactory.getConfigurationDaoImpl().getNationalInstitutionCodeCreateTransaction());
//public static BigDecimal NATIONAL_INSTITUTION_CODE = new BigDecimal(DaoFactory.getConfigurationDaoImpl().getNationalInstitutionCodeCreateTransaction());
// DONT USE NOW IN CONFIGURATION DAO public static final BigDecimal SIGES_INSTITUTION_CODE = new BigDecimal(ConfigProperties.getIntProperty("siges.institution.code"));
// DONT USE ANY MORE NOW IS IN CONFIGURATION DAOpublic static final String SIGES_WEBSERVICE_WSDL = ConfigProperties.getProperty("ws.siges.wsdl");
public static final String SIGES_WEBSERVICE_TARGET_NAMESPACE = ConfigProperties.getProperty("ws.siges.target.namespace");
227,7 → 226,13
public static final String INTRANET_SEMESTRE_S2 = ConfigProperties.getProperty("intranet.semestre.S2");
public static final String INTRANET_SEMESTRE_A = ConfigProperties.getProperty("intranet.semestre.A");
 
public static final String INTRANET_SEMESTRE_T1 = ConfigProperties.getProperty("intranet.semestre.T1");
public static final String INTRANET_SEMESTRE_T2 = ConfigProperties.getProperty("intranet.semestre.T2");
public static final String INTRANET_SEMESTRE_T3 = ConfigProperties.getProperty("intranet.semestre.T3");
public static final String INTRANET_SEMESTRE_T4 = ConfigProperties.getProperty("intranet.semestre.T4");
 
 
 
public static final String INTRANET_SETUP_FILE = ConfigProperties.getProperty("intranet.setup.file");
public static final String INTRANET_USERS_SETUP_FILE_NAME = ConfigProperties.getProperty("intranet.setup.users.filename");
public static final String INTRANET_SETUP_FILE_NAME = ConfigProperties.getProperty("intranet.setup.filename");
241,8 → 246,10
public static final String PROFILE_SCHOLAR_DEGREE_SUPERIOR = "superior";
public static final String PROFILE_DEGREE_NOTSET = "notset";
 
public static final String COURSE_DEGREE_UNKNOWN = ConfigProperties.getProperty("siges.degree.unknown");
 
 
 
public static final boolean SMS_COURSEUNIT_ANNOUNCEMENT = ConfigProperties.getBooleanProperty("sms.courseunit.announcement");
public static final boolean SMS_NEW_GRADES = ConfigProperties.getBooleanProperty("sms.new.grades");
public static final boolean EMAIL_NEW_GRADES = ConfigProperties.getBooleanProperty("email.new.grades");
355,6 → 362,10
public static final String EMAIL_UNDADE_EDITADA_TEMPLATE_PT = "unidadeEditada_pt.txt";
public static final String EMAIL_UNDADE_EDITADA_TEMPLATE_EN = "unidadeEditada_en.txt";
 
public static final String EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_TEMPLATE_PT = "unidadeRelatorioAvaliacaoEditado_pt.txt";
public static final String EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_TEMPLATE_EN = "unidadeRelatorioAvaliacaoEditado_en.txt";
 
 
public static final String EMAIL_UNDADE_VALIDADA_TEMPLATE_PT = "unidadeValidada_pt.txt";
public static final String EMAIL_UNDADE_VALIDADA_TEMPLATE_EN = "unidadeValidada_en.txt";
 
362,9 → 373,13
public static final String EMAIL_UNDADE_EDICAO_SUBJECT_PT = "email.unidade.edicao.subject.pt";
public static final String EMAIL_UNDADE_EDICAO_SUBJECT_EN = "email.unidade.edicao.subject.en";
 
public static final String EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_SUBJECT_PT = "email.relatorio.aval.unidade.editado.subject.pt";
public static final String EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_SUBJECT_EN = "email.relatorio.aval.unidade.editado.subject.en";
 
public static final String EMAIL_UNDADE_EDITADA_SUBJECT_PT = "email.unidade.editada.subject.pt";
public static final String EMAIL_UNDADE_EDITADA_SUBJECT_EN = "email.unidade.editada.subject.en";
 
 
public static final String EMAIL_UNDADE_VALIDADA_SUBJECT_PT = "email.unidade.validade.subject.pt";
public static final String EMAIL_UNDADE_VALIDADA_SUBJECT_EN = "email.unidade.validada.subject.en";
 
386,4 → 401,6
public static final String FTP_IONLINE_USER = ConfigProperties.getProperty("ionline.user");
public static final String FTP_IONLINE_PASS = ConfigProperties.getProperty("ionline.pass");
public static final String FTP_IONLINE_START_PATH = ConfigProperties.getProperty("server.ionline.start.path");
 
public static final String ROLE_INVITED = "invited";
}
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesCommonServices.java
115,7 → 115,7
// }
// }
}
if(userSession.getUser().hasRole(Globals.COURSE_COMMISSION_PROGRAMS_ROLES))
/*if(userSession.getUser().hasRole(Globals.COURSE_COMMISSION_PROGRAMS_ROLES))
{
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
for(Course course: courses)
125,18 → 125,18
int missing = DaoFactory.getCourseUnitDaoImpl().countMissingProgramGivenCourse(course.getId());
if(missing > 0)
{
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do#" + course.getId());
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do?courseId=" + course.getId() + "#" + course.getId());
todos.add(defaultToDo);
}
int missingValidate = DaoFactory.getCourseUnitDaoImpl().countMissingProgramValidateCourse(course.getId());
if(missingValidate > 0)
{
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.validate.todo",""+missingValidate,"/user/startLoadCoursesProgramsFromHome.do#" + course.getId());
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.validate.todo",""+missingValidate,"/user/startLoadCoursesProgramsFromHome.do?courseId=" + course.getId() + "#" + course.getId());
todos.add(defaultToDo);
}
}
}
}
}*/
if(userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
{
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
145,7 → 145,7
int missing = DaoFactory.getCourseUnitDaoImpl().countMissingProgramGivenCourse(course.getId());
if(missing > 0)
{
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do#" + course.getId());
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do?courseId=" + course.getId() + "#" + course.getId());
todos.add(defaultToDo);
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedCourses.java
76,6 → 76,7
{
if(merge == null)
merge = new AutoFillArrayList<CourseView>(CourseView.class);
//merge = new ArrayList<CourseView>();
return merge;
}
 
/impl/src/java/pt/estgp/estgweb/services/courseunits/DeleteCourseUnitService.java
New file
0,0 → 1,208
package pt.estgp.estgweb.services.courseunits;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
 
/**
* Created by jorgemachado on 15/12/15.
*/
public class DeleteCourseUnitService implements IService
{
 
private static final Logger logger = Logger.getLogger(DeleteCourseUnitService.class);
 
public static class CourseUnitContentsInfo
{
public List<String> warnings = new ArrayList<String>();
public String messageResult = "";
boolean canDelete = false;
public CourseUnitView cuv;
 
public List<String> getWarnings() {
return warnings;
}
 
public String getMessageResult() {
return messageResult;
}
 
public boolean isCanDelete() {
return canDelete;
}
 
public CourseUnitView getCuv() {
return cuv;
}
}
/**
*
* @param courseUnitId
* @return a list of warnings
*
*/
public CourseUnitContentsInfo checkDelete(long courseUnitId,UserSession session)
{
CourseUnitContentsInfo result = new CourseUnitContentsInfo();
result.canDelete = true;
 
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(courseUnitId);
 
boolean alert = false;
if(cu.getStudents() != null && cu.getStudents().size() > 0)
{
result.warnings.add("ALERT - Tem Alunos (NAO PODE APAGAR, remova os alunos primeiro)");
result.canDelete = false;
}
if(cu.getTeachers() != null && cu.getTeachers().size() > 0)
{
result.warnings.add("ALERT - Tem Professores");
}
if(cu.getAnnouncements() != null && cu.getAnnouncements().size() > 0)
{
result.warnings.add("ALERT - Tem Anuncios");
}
if(cu.getAssignements() != null && cu.getAssignements().size() > 0)
{
result.warnings.add("ALERT - Tem Trabalhos (NAO PODE APAGAR, remova os trabalhos primeiro (tarefa do professor))");
}
if(cu.getBlogs() != null && cu.getBlogs().size() > 0)
{
result.warnings.add("ALERT - Tem BLOGS");
}
if(cu.getCourseUnitEvaluation() != null)
{
result.warnings.add("ALERT - Tem Relatorio de Avaliacao (NAO PODE APAGAR, contacte a equipa de desenvolvimento para encontrar solucao)");
result.canDelete = false;
}
if(cu.getCourseUnitProgram() != null)
{
result.warnings.add("ALERT - Tem ficha curricular, nao vai apagar a ficha fica em backup id ficha: (" + cu.getCourseUnitProgram().getId() + ") pdf: (http://SITE_URL/repositoryStream/" + cu.getProgramStreamId() + "), exporte a ficha para backup");
}
if(cu.getSummaries() != null && cu.getSummaries().size() > 0)
{
result.warnings.add("ALERT - Tem Sumarios, vai apagar os sumarios localmente");
}
if(result.canDelete)
{
result.messageResult ="Pode Apagar";
}
else
{
result.messageResult ="Não é permitido apagar esta unidade";
}
result.cuv = new CourseUnitView(cu,false,false,false,false);
return result;
}
 
/**
*
* @param courseUnitId
* @return a list of warnings
*
*/
public CourseUnitContentsInfo tryDelete(long courseUnitId,UserSession session)
{
CourseUnitContentsInfo result = checkDelete(courseUnitId,session);
 
if(result.canDelete)
{
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(courseUnitId);
logger.warn("Will Delete courseUnit: " + cu.getImportYear() + ";" + cu.getSemestre() + ";" + cu.getCode() + ";" + cu.getName() + ";" + cu.getCourseCode() + ";" + cu.getCourseName());
 
if(cu.getTeachers() != null && cu.getTeachers().size() > 0)
{
Iterator<TeacherImpl> teachers = cu.getTeachers().iterator();
while(teachers.hasNext())
{
Teacher t = teachers.next();
teachers.remove();
t.getTeachedUnits().remove(cu);
logger.warn("Removing Teacher: " + t.getSigesCode() + " - id:" + t.getId() + " name:" + t.getName());
}
}
if(cu.getAnnouncements() != null && cu.getAnnouncements().size() > 0)
{
Iterator<CourseUnitAnnouncement> annoucements = cu.getAnnouncements().iterator();
while(annoucements.hasNext())
{
CourseUnitAnnouncement a = annoucements.next();
annoucements.remove();
a.setCourseUnit(null);
logger.warn("Removing Annoucement: " + a.getId());
DaoFactory.getAnnouncementDaoImpl().delete(a);
}
}
if(cu.getBlogs() != null && cu.getBlogs().size() > 0)
{
Iterator<CourseUnitBlog> blogs = cu.getBlogs().iterator();
while(blogs.hasNext())
{
CourseUnitBlog a = blogs.next();
blogs.remove();
Set<BlogPost> posts = a.getPosts();
Iterator<BlogPost> postsIter = posts.iterator();
while(postsIter.hasNext())
{
BlogPost bp = postsIter.next();
a.getPosts().remove(bp);
bp.setBlog(null);
DaoFactory.getBlogPostDaoImpl().delete(bp);
}
a.setCourseUnit(null);
logger.warn("Removing Blog: " + a.getId());
DaoFactory.getCourseUnitBlogDaoImpl().delete(a);
}
}
 
if(cu.getCourseUnitProgram() != null)
{
result.warnings.add("ALERT - Tem ficha curricular, nao vai apagar a ficha fica em backup id ficha: (" + cu.getCourseUnitProgram().getId() + ") pdf: (http://SITE_URL/repositoryStream/" + cu.getProgramStreamId() + "), exporte a ficha para backup");
cu.setCourseUnitProgram(null);
}
if(cu.getSummaries() != null && cu.getSummaries().size() > 0)
{
result.warnings.add("ALERT - Tem Sumarios, vai apagar os sumarios localmente");
Iterator<CourseUnitSummary> summaries = cu.getSummaries().iterator();
while(summaries.hasNext())
{
CourseUnitSummary a = summaries.next();
summaries.remove();
a.setCourseUnit(null);
logger.warn("Removing Summary: " + a.getId());
DaoFactory.getCourseUnitSummaryDaoImpl().delete(a);
}
 
}
DaoFactory.getCourseUnitDaoImpl().delete(cu);
result.messageResult = "Unidade Apagada";
}
 
return result;
}
 
public List<CourseUnitContentsInfo> loadDeleteCandidates(String importYear,UserSession session)
{
List<CourseUnitContentsInfo> courseUnitContentsInfos = new ArrayList<CourseUnitContentsInfo>();
Query q = AbstractDao.getCurrentSession().createQuery("select c.id from c in class " + CourseUnit.class.getName() +
" where size(c.students) = 0 and c.importYear = ? order by c.importYear, c.semestre, c.code");
q.setString(0,importYear);
Iterator iter = q.iterate();
while(iter.hasNext())
{
Long id = (Long) iter.next();
CourseUnitContentsInfo cuInfo = checkDelete(id,session);
courseUnitContentsInfos.add(cuInfo);
}
return courseUnitContentsInfos;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/SaveCourseUnitEvaluation.java
1,5 → 1,6
package pt.estgp.estgweb.services.courseunits;
 
import jomm.dao.impl.AbstractDao;
import jomm.utils.PdfUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
9,8 → 10,10
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.dao.impl.CourseUnitDaoImpl;
import pt.estgp.estgweb.domain.views.CourseUnitEvaluationView;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.IRepositoryFile;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.Dom4jUtil;
19,10 → 22,7
 
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
 
61,7 → 61,6
evaluation = new CourseUnitEvaluationImpl();
DaoFactory.getCourseUnitEvaluationDaoImpl().save(evaluation);
c.setCourseUnitEvaluation(evaluation);
cupv.setCourseUnitEvaluation(evaluation);
}
//
 
71,43 → 70,55
(c.getResponsableTeacher()!=null && usession.getUser().getId() == c.getResponsableTeacher().getId())
))
{
//PROF OU RESPONSAVEL
cupv.persistViewInObjectTeacher(evaluation);
cupv.setCourseUnitEvaluation(evaluation);
}
if(usession.getUser() instanceof Teacher
else if(usession.getUser() instanceof Teacher
&& (((usession.getUser())).hasRole(c.getCourse().getValidationRole())
||
((usession.getUser()) == c.getCourse().getCoordinator()))
)
{
//COMISSAO DE CURSO
cupv.persistViewInObjectTeacher(evaluation);
cupv.setCourseUnitEvaluation(evaluation);
}
List<String> errors = new ArrayList<String>();
String estado = "POR ENTREGAR";
if(cupv.isFechar())
{
evaluation.setClosed(true);
evaluation.setTeacherComplete(true);
estado = "Aceite pela Comissão de Curso";
}
else if(cupv.isTeacherComplete())
{
estado = "Entregue à Comissão de Curso pelo docente";
evaluation.setTeacherComplete(true);
}
else
else if(!cupv.isAutosave())
{
estado = "Alterado pelo docente";
evaluation.setClosed(false);
//TODO TIRAR ISTO NO PROXIMO ANO
evaluation.setTeacherComplete(true);
//TODO novo
evaluation.setTeacherComplete(false);
}
 
createPdf(evaluation,c,usession,errors);
if(usession.getUser() instanceof Teacher)
DirectedCoordinatedUnitsService.sendNotificationsEditedInterestedPeople(c,usession);
else
 
 
if(!cupv.isAutosave())
{
logger.info("Nao vai informar docentes");
createPdf(evaluation,c,usession,errors);
if(usession != null && usession.getUser() != null && usession.getUser() instanceof Teacher)
DirectedCoordinatedUnitsService.sendNotificationsCourseUnitEvaluationEditedInterestedPeople(c, estado, usession);
else
{
logger.info("Nao vai informar docentes");
}
}
//passou para aqui para não afetar a persistencia
//estava em cima no create do new e depois o evaluation interno ficava a nulo
// e no persist ja nao havia nada para persistir
cupv.setCourseUnitEvaluation(evaluation);
return cupv;
}
 
126,12 → 137,16
))
{
evaluation.setClosed(false);
evaluation.setTeacherComplete(false);
}
CourseUnitEvaluationView cupv = new CourseUnitEvaluationView(evaluation);
if(usession != null && usession.getUser() != null && usession.getUser() instanceof Teacher)
DirectedCoordinatedUnitsService.sendNotificationsCourseUnitEvaluationEditedInterestedPeople(c, "Aberto pela Comissão de Curso", usession);
 
return cupv;
}
 
//TODO TEACHER COMPLETE OPEN
//TODO TEACHER COMPLETE OPEN not in use coordinatores open and close every fields
public CourseUnitEvaluationView setTeacherIncomplete(Long coursUnitId, UserSession usession) throws ServiceException {
 
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().get(coursUnitId);
190,13 → 205,13
 
//NOVO
 
/*
 
if(cuv.isClosed())
{
RepositoryFileImpl repoFile = repositoryService.loadView(cu.getEvaluationStreamId());
sendPdfFtpIonline(cu,errors,userSession,path,repoFile.getLastVersion().getSaveDate(),null);
sendPdfFtpIonline(cu,errors,userSession,new FileInputStream(path),repoFile.getLastVersion().getSaveDate(),null);
}
*/
 
}
 
public String generatePdf(CourseUnitEvaluation cuv, CourseUnit c) throws IOException, TransformerException, FOPException {
243,7 → 258,7
}*/
 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd.HH_mm_ss");
private void sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u,String pdfPath,Date versionDate,FTPClient client) throws IOException, TransformerException, FOPException {
private boolean sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u,InputStream input,Date versionDate,FTPClient client) throws IOException, TransformerException, FOPException {
 
FtpServer server = null;
if(client == null)
254,7 → 269,7
{
logger.warn("###################");
logger.warn("################### > CANT CONNECT FTP");
return;
return false;
}
}
client.setFileType(FTP.BINARY_FILE_TYPE);
263,18 → 278,70
if(!client.changeWorkingDirectory(pastaFichaCurricular))
{
logger.error("FTP CANT CHANGE TO PATH: " + pastaFichaCurricular);
return false;
}
else
{
client.storeFile(cu.getCode() + "_" + cu.getNormalizedName() + "_v" + sdf.format(versionDate) + ".pdf",new FileInputStream(pdfPath));
client.storeFile(cu.getCode() + "_" + cu.getNormalizedName() + "_v" + sdf.format(versionDate) + ".pdf",input);
 
if(server != null)
{
client.quit();
client.disconnect();
}
return true;
}
 
//
}
 
public void storeAllClosedEvaluationsInActivePeriod() throws IOException
{
CourseUnitDaoImpl dao = DaoFactory.getCourseUnitDaoImpl();
List<Long> unitsIds = dao.loadClosedCourseUnitsEvaluations();
 
List<String> errors = new ArrayList<String>();
for (Long unitId: unitsIds) {
CourseUnit next = DaoFactory.getCourseUnitDaoImpl().load(unitId);
 
try {
if(next.getEvaluationStreamId() == null)
{
System.out.print("Generating PDF for evaluation report for: " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName());
createPdf(next.getCourseUnitEvaluation(),next,null,errors);
}
 
System.out.print("Sending evaluation report for: " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName());
 
RepositoryFileImpl repoFile = repositoryService.loadView(next.getEvaluationStreamId());
IRepositoryFile iRepoFile = repositoryService.loadByIdentifier(next.getEvaluationStreamId());
 
 
if(sendPdfFtpIonline(next,errors,null,iRepoFile.getInput(),repoFile.getLastVersion().getSaveDate(),null))
System.out.print(" ... OK");
else
System.out.print(" ... FAIL probably no StreamID");
System.out.print("\n");
if(errors.size()>0)
for(String error:errors)
logger.warn(error);
} catch (IOException e) {
logger.error(e,e);
} catch (TransformerException e) {
logger.error(e, e);
} catch (FOPException e) {
e.printStackTrace();
}
 
AbstractDao.getCurrentSession().evict(next);
}
}
 
public static void main(String[] args) throws IOException {
 
AbstractDao.getCurrentSession().beginTransaction();
new SaveCourseUnitEvaluation().storeAllClosedEvaluationsInActivePeriod();
AbstractDao.getCurrentSession().flush();
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/courseunitsummaries.fo.xsl
88,7 → 88,7
<fo:table-row>
<fo:table-cell padding-top="3pt">
<fo:block >
Revisto a <xsl:value-of select="//updateDate"/> por <xsl:value-of select="$revisor"/> / Página <fo:page-number/>
Atualizado a <xsl:value-of select="//updateDate"/> / Página <fo:page-number/>
</fo:block>
<fo:block font-size="5pt">
ESTG.SA.xxxx.1
114,6 → 114,7
 
<xsl:template match="/courseUnit">
 
 
<fo:table table-layout="fixed" border="0px solid black" margin="0.5em" font-size="8.5pt">
<xsl:call-template name="gen_cols"/>
<fo:table-body text-align="left">
226,7 → 227,7
</fo:table-row>
 
 
<xsl:if test="//summary">
<xsl:if test="//summary[./numeroAula != '-1']">
<fo:table-row background-color="#FFF" color="#000" padding="0">
 
<fo:table-cell padding="0" number-columns-spanned="2" border-right="1px solid gray" border-bottom="1px solid gray" display-align="center" >
241,69 → 242,78
 
<fo:table-body>
 
<!--Confirmar isto do cEstado = 1
 
<xsl:for-each select="//summary">
Sumarios T_SUMARIOSAULAS.CD_ESTADO
1 Lançado
2 Faltou
3 Cancelado
4 Pré-lançado
-->
<xsl:for-each select="//summary[./numeroAula != '-1' and ./cEstado = '1']">
<xsl:sort select="dataAula" case-order="lower-first"/>
<fo:table-row>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./dataAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt" >
Aula <xsl:value-of select="./numeroAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt">
<xsl:value-of select="./tipoAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./numeroHoras"/> Horas
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt">
<xsl:value-of select="./alunosPresentes"/> Alunos
</fo:block>
</fo:table-cell>
 
</fo:table-row>
<fo:table-row>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./dataAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt" >
Aula <xsl:value-of select="./numeroAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt">
<xsl:value-of select="./tipoAula"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./numeroHoras"/> Horas
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="0.5px solid gray" >
<fo:block font-size="8pt">
<xsl:value-of select="./alunosPresentes"/> Alunos
</fo:block>
</fo:table-cell>
 
<fo:table-row>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
Titulo
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="4" border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./titulo"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-row>
 
<fo:table-row>
<fo:table-cell border-bottom="1px solid gray" >
<fo:block font-size="8pt">
Descrição
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1px solid gray" number-columns-spanned="4">
<fo:block font-size="8pt">
<xsl:value-of select="./descricao"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
Titulo
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="4" border-bottom="0.5px solid gray">
<fo:block font-size="8pt">
<xsl:value-of select="./titulo"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
 
<fo:table-row height='20px'>
<fo:table-cell number-columns-spanned="5" >
<fo:block ></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-bottom="1px solid gray" >
<fo:block font-size="8pt">
Descrição
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1px solid gray" number-columns-spanned="4">
<fo:block font-size="8pt">
<xsl:value-of select="./descricao"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
 
<fo:table-row height='20px'>
<fo:table-cell number-columns-spanned="5" >
<fo:block ></fo:block>
</fo:table-cell>
</fo:table-row>
 
</xsl:for-each>
</fo:table-body>
</fo:table>
/impl/src/java/pt/estgp/estgweb/services/courseunits/courseunitprogram.fo.xsl
608,7 → 608,7
</fo:block>
</fo:table-cell>
<fo:table-cell background-color="#FFF" color="#000" border-bottom="1px solid gray" padding-right="0.1em" display-align="center">
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve">
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve" wrap-option="wrap" white-space-collapse="false" white-space-treatment="preserve">
<xsl:value-of select="$value"/>
</fo:block>
</fo:table-cell>
646,13 → 646,13
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve" font-weight="bold">
1 - <xsl:value-of select="$field1"/>
</fo:block>
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve">
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve" wrap-option="wrap" white-space-collapse="false" white-space-treatment="preserve">
<xsl:value-of select="$value1"/>
</fo:block>
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve" font-weight="bold">
2 - <xsl:value-of select="$field2"/>
</fo:block>
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve">
<fo:block text-align="left" padding="3pt" linefeed-treatment="preserve" wrap-option="wrap" white-space-collapse="false" white-space-treatment="preserve">
<xsl:value-of select="$value2"/>
</fo:block>
</fo:table-cell>
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadCourseUnitService.java
90,4 → 90,6
}
return cV;
}
 
 
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitsCommonServices.java
1,17 → 1,16
package pt.estgp.estgweb.services.courseunits;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.common.*;
import pt.estgp.estgweb.services.common.impl.DefaultSearchResults;
import pt.estgp.estgweb.services.common.impl.DefaultResult;
import pt.estgp.estgweb.services.common.impl.DefaultSearchResults;
import pt.estgp.estgweb.services.common.impl.DefaultToDo;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
 
/*
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt
90,7 → 89,7
if(userSession.getUser() != null && userSession.getUser() instanceof Teacher)
{
// HashMap<Long,Long> doneProgramCodes = new HashMap<Long,Long>();
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingObjectivesOrPrograms(userSession.getUser().getId());
/*List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingObjectivesOrPrograms(userSession.getUser().getId());
for(CourseUnit c: courseUnits)
{
DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.objectives.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId());
120,8 → 119,8
DefaultToDo defaultToDo = new DefaultToDo(c.getQuestion(),null,c.getCourseUnit().getName(), "courseunit.question.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId());
todos.add(defaultToDo);
}
*/
 
 
}
if(userSession.getUser() != null && userSession.getUser() instanceof Student)
{
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedUnitsService.java
96,6 → 96,13
if(importYear == null)
importYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear();
 
DirectedCoordinatedCourses directedCoordinatedCourses;
if(courseId <= 0)
{
directedCoordinatedCourses = new DirectedCoordinatedCourses();
return directedCoordinatedCourses;
}
 
/**
* Area and Course Initialization
*/
142,7 → 149,7
courseViews.add(cV);
}
fill(courseViews, semestre, importYear, teachersSituationEnum);
DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
directedCoordinatedCourses = new DirectedCoordinatedCourses();
directedCoordinatedCourses.setMerge(courseViews);
directedCoordinatedCourses.setArea(area);
directedCoordinatedCourses.setCourseId(courseId);
161,20 → 168,55
cV.setCourseUnitsWithProgramNotCheckedS2(new ArrayList<CourseUnitView>());
for (CourseUnitView cUV : cV.getCourseUnits())
{
 
 
if (cUV.getProgramStreamId() == null)
if (cUV.getSemestre().equals("S1"))
{
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithNoProgram" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
}
/*if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithNoProgramS1().add(cUV);
else
cV.getCourseUnitsWithNoProgramS2().add(cUV);
cV.getCourseUnitsWithNoProgramS2().add(cUV);*/
else if (cUV.isValidProgram())
if (cUV.getSemestre().equals("S1"))
{
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithProgramChecked" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
}
/*if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);
else if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);*/
else
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithProgramNotChecked" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
 
/*if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramNotCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);*/
}
}
}
191,12 → 233,27
 
for (CourseView cV : courseViews)
{
cV.setCourseUnitsWithNoProgramA(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramT1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramT2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramT3(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramT4(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedA(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedT1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedT2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedT3(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedT4(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedA(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedT1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedT2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedT3(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedT4(new ArrayList<CourseUnitView>());
 
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadCourseUnits(cV.getId(),semestre,importYear,withTeacher,withNoTeacher);
204,19 → 261,48
{
CourseUnitView cUV = new CourseUnitView(cU,true,false,false,false);
if (cUV.getProgramStreamId() == null)
if (cUV.getSemestre().equals("S1"))
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithNoProgram" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
/*if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithNoProgramS1().add(cUV);
else
cV.getCourseUnitsWithNoProgramS2().add(cUV);
cV.getCourseUnitsWithNoProgramS2().add(cUV);*/
else if (cUV.isValidProgram())
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithProgramChecked" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
/*
if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);
else if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);*/
else
try {
((List<CourseUnitView>)
(cV.getClass()
.getMethod("getCourseUnitsWithProgramNotChecked" + cUV.getSemestre())
.invoke(cV)))
.add(cUV);
} catch (Throwable e) {
logger.error(e,e);
}
/*if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramNotCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);*/
}
}
}
234,10 → 320,20
 
if(userSession.getUser().isAdmin() || userSession.getUser().hasRole("courseValidatePrograms") || userSession.getUser().hasRole(c.getValidationRole())) //NOVO para validação por programas
{
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedA(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedS1(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedS2(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedT1(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedT2(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedT3(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedT4(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedA(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedS1(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedS2(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedT1(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedT2(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedT3(),userSession);
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedT4(),userSession);
}
}
}
323,8 → 419,27
}
}
 
public static void sendNotificationsCourseUnitEvaluationEditedInterestedPeople(CourseUnit courseUnit,String estado,UserSession u)
{
try{
SendEmailService sendEmailService = new SendEmailService();
List<String> emails = getEmailJobNotifications(courseUnit);
EMAILJob emailJob = new EMAILJob(sendEmailService.getRelatorioAvaliacaoUnidadeEditadaEmail(emails,courseUnit,LangEnum.PORTUGUESE,estado));
JobScheduleService.getInstance().scheduleNow(emailJob,"New Notification EMAIL unit state changed to courseComission and teachers " ,u);
}catch(Throwable t)
{
logger.error(t,t);
}
}
 
public static List<String> getEmailJobNotifications(CourseUnit courseUnit) {
List<String> emails = DaoFactory.getCourseUnitDaoImpl().getTeachersEmails(courseUnit.getId());
 
List<String> emails = new ArrayList<String>();
for(Teacher t: courseUnit.getTeachers())
{
if(t.getEmail() != null)
emails.add(t.getEmail());
}
if(emails == null)
emails = new ArrayList<String>();
if(courseUnit.getCourse().getCoordinator() != null && courseUnit.getCourse().getCoordinator().getEmail()!=null)
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitDirPackageServiceBat.java
5,10 → 5,7
import jomm.utils.StringsUtils;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.Course;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.Teacher;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.ConfigProperties;
49,6 → 46,23
new File(tmpDir).mkdirs();
//List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(importYear);
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll();
 
List<User> usersFullControlDtp = null;
if(Globals.INTRANET_DTP_FULLCONTROL_ROLES != null && Globals.INTRANET_DTP_FULLCONTROL_ROLES.size() > 0)
{
usersFullControlDtp = DaoFactory.getUserDaoImpl().loadRolesUsers(Globals.INTRANET_DTP_FULLCONTROL_ROLES);
}
 
List<User> usersInqueritoPedagogico = null;
if(Globals.INTRANET_DTP_INQUERITO_PEDAGOGICO_ROLE != null && Globals.INTRANET_DTP_INQUERITO_PEDAGOGICO_ROLE.trim().length() > 0)
{
usersInqueritoPedagogico = DaoFactory.getUserDaoImpl().loadRoleUsers(Globals.INTRANET_DTP_INQUERITO_PEDAGOGICO_ROLE.trim());
}
 
 
List<User> usersServicesPrograms = DaoFactory.getUserDaoImpl().loadRoleUsers("servicesPrograms");
 
 
try
{
FileWriter batRunner = new FileWriter(tmpDir + "/create.bat");
105,19 → 119,107
//FileWriter confWriterSemestre1 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
//FileWriter confWriterSemestre2 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
// FileWriter confWriterA = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
 
boolean at = false;
boolean s1t = false;
boolean s2t = false;
boolean t1t = false;
boolean t2t = false;
boolean t3t = false;
boolean t4t = false;
 
for(CourseUnit courseUnit: courseUnits)
{
if(courseUnit.getSemestre().equals("S1"))
s1t = true;
else if(courseUnit.getSemestre().equals("S2"))
s2t = true;
else if(courseUnit.getSemestre().equals("A"))
at = true;
else if(courseUnit.getSemestre().equals("T1"))
t1t = true;
else if(courseUnit.getSemestre().equals("T2"))
t2t = true;
else if(courseUnit.getSemestre().equals("T3"))
t3t = true;
else if(courseUnit.getSemestre().equals("T4"))
t4t = true;
}
 
batRunner.write("md " + courseNormalizedName + "\\\n");
batRunner.write("md " + relativeDirCourse + "\\\n");
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_S1 + "\\\n");
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_S2 + "\\\n");
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_A + "\\\n");
 
/**
* Relatorio de Curso Novo
*/
batRunner.write("md " + relativeDirCourse + "\\" + "Relatorio.Curso" + "\n");
batRunner.write("cd " + relativeDirCourse + "\\\n");
 
 
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /p \"Domain Users\":n\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /p \"Authenticated Users\":n\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /p \"Intranet\":n\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /p \"Alunos\":n\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /r \"Domain Users\"\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /r \"Authenticated Users\"\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /r \"Intranet\"\n");
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /r \"Alunos\"\n");
 
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"" + ConfigProperties.getProperty("ionline.user") + "\":f\n");
 
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"Docentes\":r\n");
 
 
if(c.getUserGroupStudents() != null)
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"" + c.getUserGroupStudents() + "\":r\n");
 
if(c.getDirector() != null)
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"" + c.getDirector().getUsername() + "\":f\n");
 
if(c.getCoordinator() != null)
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"" + c.getCoordinator().getUsername() + "\":f\n");
 
for(User serviceUser: usersServicesPrograms)
batRunner.write("cacls " + "Relatorio.Curso" + " /t /e /g \"" + serviceUser.getUsername() + "\":f\n");
 
batRunner.write("cd ..\\..\\\n");
/*Fim de Relatorio de Curso*/
 
 
if(s1t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_S1 + "\\\n");
if(s2t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_S2 + "\\\n");
if(at)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_A + "\\\n");
if(t1t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_T1 + "\\\n");
if(t2t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_T2 + "\\\n");
if(t3t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_T3 + "\\\n");
if(t4t)
batRunner.write("md " + relativeDirCourse + "\\" + Globals.INTRANET_SEMESTRE_T4 + "\\\n");
batRunner.write("cd " + relativeDirCourse + "\\\n");
 
//back = "..\\..\\";
//batRunner.write("\n");
 
 
// List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear);
for(CourseUnit courseUnit: courseUnits)
{
boolean turmasMultiplas = false;
for(CourseUnit cuCompare: courseUnits)
{
if(cuCompare.getId() == courseUnit.getId())
continue;
if(((CourseUnitImpl)cuCompare).equalsIgnoringTurma(courseUnit))
{
turmasMultiplas = true;
break;
}
}
//FileWriter nowWriter;
String semestre;
if(courseUnit.getSemestre().equals("S1"))
130,6 → 232,26
//nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_S2;
}
else if(courseUnit.getSemestre().equals("T1"))
{
//nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_T1;
}
else if(courseUnit.getSemestre().equals("T2"))
{
//nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_T2;
}
else if(courseUnit.getSemestre().equals("T3"))
{
//nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_T3;
}
else if(courseUnit.getSemestre().equals("T4"))
{
//nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_T4;
}
else
{
//nowWriter = confWriterA;
144,9 → 266,23
md Unidade\DTP\6.Inquerito.Pedagogico.Unidade.Curricular
md Unidade\DTP\7.Relatorio.Final*/
 
 
 
 
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
//Em caso de turmas multiplas necessitamos de colocar na path a turma
//todo mudar isto no futuro para meter sempre que houver turma
if(turmasMultiplas && courseUnit.getCdTurma() !=null && courseUnit.getCdTurma().trim().length() > 0)
{
normalizedName = normalizedName + "." + courseUnit.getCdTurma();
batRunner.write("REM Unidade de Turma Multipla " + courseImportYearPath + "/" + semestre + "/" + normalizedName + " \n");
}
 
courseUnit.setNormalizedName(normalizedName);
 
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
courseUnit.setNormalizedName(normalizedName);
 
 
courseUnit.setPathIntranet(unitPath.substring(tmpDir.length()));
 
String semestreUnitName = semestre + "\\" + normalizedName + "\\";
178,7 → 314,9
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + c.getUserGroupStudents() + "\":r\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + ConfigProperties.getProperty("ionline.user") + "\":f\n");
 
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + ConfigProperties.getProperty("ionline.user") + "\":f\n");
 
 
/*
echo CACLS Seminario.Ii /T /E /R [NOME DO GRUPO DE TODOS OS ALUNOS DA ESTG tira os parentisis rectos]
echo CACLS Seminario.Ii /T /E /G [NOME DO GRUPO DE TODOS OS DOCENTES]:R
230,7 → 368,7
batRunner.write("cd ..\\\n");
 
}
if(Globals.INTRANET_DTP_CourseDirectorWrite && c.getCoordinator() != null)
if(Globals.INTRANET_DTP_CourseDirectorWrite && c.getDirector() != null)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + c.getDirector().getUsername() + "\":c\n");
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
238,6 → 376,28
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaAvaliacao + " /t /e /r \"" + c.getDirector().getUsername() + "\"\n");
batRunner.write("cd ..\\\n");
}
 
if(usersInqueritoPedagogico != null && usersInqueritoPedagogico.size() > 0)
{
for(User u: usersInqueritoPedagogico)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + u.getUsername() + "\":r\n");
}
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
for(User u: usersInqueritoPedagogico)
{
batRunner.write("cacls " + Globals.INTRANET_DTP_InqueritoPedagogico + " /t /e /g \"" + u.getUsername() + "\":f\n");
}
batRunner.write("cd ..\\\n");
}
 
if(usersFullControlDtp != null && usersFullControlDtp.size() > 0)
{
for(User u: usersFullControlDtp)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + u.getUsername() + "\":f\n");
}
}
batRunner.write("cd ..\\..\\\n");
}
batRunner.write("cd ..\\..\\\n");
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadCourseUnitsBySigesCodesService.java
1,19 → 1,15
package pt.estgp.estgweb.services.courseunits;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitSummaryView;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.RepositoryFile;
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import org.apache.log4j.Logger;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
40,6 → 36,16
return courseUnitViews;
}
 
public CourseUnitView loadUnitInEvaluation(String code, String courseCode, UserSession userSession) throws ServiceException {
 
 
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().loadUnitInEvaluationBySigesCodes(code, courseCode);
if(c == null)
return null;
return new CourseUnitView(c);
 
}
 
public CourseUnitView loadLastYear(String code, String courseCode, String semestre, UserSession userSession) throws ServiceException {
 
if(semestre.equals("S3"))
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadSubscribedUnitsCurrentYearService.java
5,6 → 5,7
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
 
/**
18,6 → 19,7
{
Student t = DaoFactory.getStudentDaoImpl().load(studentId);
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(studentId, DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
units = new ArrayList<CourseUnit>(units);
for(CourseUnit c: units)
{
c.getName();
25,4 → 27,17
}
return units;
}
 
public List<CourseUnit> givenYear(long studentId,String year)
{
Student t = DaoFactory.getStudentDaoImpl().load(studentId);
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(studentId, year);
units = new ArrayList<CourseUnit>(units);
for(CourseUnit c: units)
{
c.getName();
c.getCourse().getName();
}
return units;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitDirPackageService.java
74,13 → 74,26
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T1).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T2).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T3).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T4).mkdirs();
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_SETUP_FILE_NAME);
 
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T1 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T2 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T3 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T4 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
 
String callPathS1 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S1 + "\\").substring(tmpDir.length() + 1);
String callPathS2 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S2 + "\\").substring(tmpDir.length() + 1);
String callPathA = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_A + "\\").substring(tmpDir.length() + 1);
String callPathT1 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_T1 + "\\").substring(tmpDir.length() + 1);
String callPathT2 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_T2 + "\\").substring(tmpDir.length() + 1);
String callPathT3 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_T3 + "\\").substring(tmpDir.length() + 1);
String callPathT4 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_T4 + "\\").substring(tmpDir.length() + 1);
batRunner.write("cd " + back + callPathS1);
back = "..\\..\\..\\";
batRunner.write("\n");
94,11 → 107,36
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
 
batRunner.write("cd " + back + callPathT1);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
 
batRunner.write("cd " + back + callPathT2);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
 
batRunner.write("cd " + back + callPathT3);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
 
batRunner.write("cd " + back + callPathT4);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
FileWriter confWriterSemestre1 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterSemestre2 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterA = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
 
FileWriter confWriterTrimestre1 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T1 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterTrimestre2 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T2 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterTrimestre3 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T3 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterTrimestre4 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_T4 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
 
 
// List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear);
for(CourseUnit courseUnit: courseUnits)
{
114,6 → 152,27
nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_S2;
}
else if(courseUnit.getSemestre().equals("T1"))
{
nowWriter = confWriterTrimestre1;
semestre = Globals.INTRANET_SEMESTRE_T1;
}
else if(courseUnit.getSemestre().equals("T2"))
{
nowWriter = confWriterTrimestre2;
semestre = Globals.INTRANET_SEMESTRE_T2;
}
else if(courseUnit.getSemestre().equals("T3"))
{
nowWriter = confWriterTrimestre3;
semestre = Globals.INTRANET_SEMESTRE_T3;
}
else if(courseUnit.getSemestre().equals("T4"))
{
nowWriter = confWriterTrimestre4;
semestre = Globals.INTRANET_SEMESTRE_T4;
}
 
else
{
nowWriter = confWriterA;
145,9 → 204,17
}
confWriterSemestre1.flush();
confWriterSemestre2.flush();
confWriterTrimestre1.flush();
confWriterTrimestre2.flush();
confWriterTrimestre3.flush();
confWriterTrimestre4.flush();
confWriterA.flush();
confWriterSemestre1.close();
confWriterSemestre2.close();
confWriterTrimestre1.close();
confWriterTrimestre2.close();
confWriterTrimestre3.close();
confWriterTrimestre4.close();
confWriterA.close();
}
catch (IOException e)
/impl/src/java/pt/estgp/estgweb/services/courseunits/courseunitevaluation.fo.xsl
304,20 → 304,20
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação dos resultados quantitativos obtidos pelos estudantes </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoQuantitivos"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação dos resultados quantitativos obtidos pelos estudantes </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block font-family="monospace" wrap-option="wrap" linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve"> <xsl:value-of select="//qualApreciacaoQuantitivos"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação do funcionamento da UC (Condições de funcionamento da UC; problemas detetados; identificação de práticas pedagógicas de mérito ou deficientes; etc.) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoUC"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block font-family="monospace" wrap-option="wrap" linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve" > <xsl:value-of select="//qualApreciacaoUC"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação do cumprimento do programa da UC (Adequação das metodologias de ensino/aprendizagem utilizadas; competências efetivamente adquiridas e cumprimento dos conteúdos planificados) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoCumprimentoPrograma"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block font-family="monospace" wrap-option="wrap" linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve" > <xsl:value-of select="//qualApreciacaoCumprimentoPrograma"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Conclusões (Pontos fortes e fracos; sugestões de melhoria e respetivo plano de ação para a sua concretização) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualConclusoes"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block font-family="monospace" wrap-option="wrap" linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve"> <xsl:value-of select="//qualConclusoes"/> </fo:block> </fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java
204,8 → 204,15
}
}
 
public Email getMessageEmail(String from, String subject,String text, LangEnum langEnum, String target, List<User> users, User user)
public static class SendTo
{
public String name;
public String email;
public String outEmail;
}
 
public Email getMessageEmail(String from, String subject,String text, LangEnum langEnum, String target, List<String> emails, User user)
{
// # 0 : From
// # 1 : Subject
// # 2 : Text
230,6 → 237,52
}
 
List<String> recipients = new ArrayList<String>();
for(String e: emails)
{
if(Email.validEmail(e))
recipients.add(e);
}
logger.info("subject: " + subject);
logger.info("user: " + user.getEmail());
logger.info("template: " + template);
logger.info("arguments:");
for(String arg: arguments)
logger.info(arg);
logger.info("recipients:");
for(String rec: recipients)
logger.info(rec);
logger.info("arguments end");
Email email = new Email(subject ,recipients,user.getEmail(),template,arguments,Message.RecipientType.BCC);
email.setFromName(from + " (ESTG)");
return email;
}
 
public Email getMessageEmailOld(String from, String subject,String text, LangEnum langEnum, String target, List<User> users, User user)
{
// # 0 : From
// # 1 : Subject
// # 2 : Text
// # 3 : person
// # 4 : target
List<String> arguments = new ArrayList<String>();
arguments.add(from);
arguments.add(subject);
arguments.add(text);
arguments.add(user.getName());
arguments.add(target);
 
String template;
 
if(langEnum == LangEnum.PORTUGUESE)
{
template = Globals.EMAIL_MESSAGE_TEMPLATE_PT;
}
else
{
template = Globals.EMAIL_MESSAGE_TEMPLATE_EN;
}
 
List<String> recipients = new ArrayList<String>();
for(User u: users)
{
if(Email.validEmail(u.getEmail()))
580,6 → 633,36
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
public Email getRelatorioAvaliacaoUnidadeEditadaEmail(List<String> emails, CourseUnit c, LangEnum langEnum,String estado)
{
List<String> arguments = new ArrayList<String>();
 
 
String subject;
String template;
 
if(langEnum == LangEnum.PORTUGUESE)
{
template = Globals.EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_TEMPLATE_PT;
subject = Globals.EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_SUBJECT_PT;
}
else
{
template = Globals.EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_TEMPLATE_EN;
subject = Globals.EMAIL_RELATORIO_AVALIACAO_UNDADE_EDITADA_SUBJECT_EN;
}
subject = MessageFormat.format(ConfigProperties.getProperty(subject),new String[]{c.getName()});
 
arguments.add(c.getCourseName());
arguments.add(c.getName());
arguments.add(estado);
 
List<String> recipients = new ArrayList<String>();
for(String email:emails)
recipients.add(email);
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
public boolean sendNewGrades(List<String[]> grades, LangEnum langEnum, String studentEmail, String studentName)
{
try
/impl/src/java/pt/estgp/estgweb/services/sigesimports/CleanCourseUnitsZeroStudents.java
New file
0,0 → 1,72
package pt.estgp.estgweb.services.sigesimports;
 
import jomm.dao.impl.AbstractDao;
import org.hibernate.Query;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.dao.DaoFactory;
 
import java.util.Iterator;
 
/**
* Created by jorgemachado on 01/12/15.
*/
public class CleanCourseUnitsZeroStudents
{
public static void main(String[] args)
{
AbstractDao.getCurrentSession().beginTransaction();
 
 
Query q = AbstractDao.getCurrentSession().createQuery("select c.id from c in class " + CourseUnit.class.getName() +
" where size(c.students) = 0 and (c.importYear = '201415' or c.importYear='201516') order by c.importYear, c.semestre, c.code");
Iterator iter = q.iterate();
System.out.println("ANO;SEMESTRE;CODIGO;NOME;CODIGOCURSO;NOMECURSO");
while(iter.hasNext())
{
 
Long id = (Long) iter.next();
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(id);
System.out.println(cu.getImportYear() + ";" + cu.getSemestre() + ";" + cu.getCode() + ";" + cu.getName() + ";" + cu.getCourseCode() + ";" +cu.getCourseName());
boolean alert = false;
if(cu.getAnnouncements() != null && cu.getAnnouncements().size() > 0)
{
System.out.println("ALERT - Tem Announcements");
}
if(cu.getAssignements() != null && cu.getAssignements().size() > 0)
{
System.out.println("ALERT - Tem Assignements");
}
if(cu.getBlogs() != null && cu.getBlogs().size() > 0)
{
System.out.println("ALERT - Tem BLOGS");
}
if(cu.getCourseUnitEvaluation() != null)
{
System.out.println("ALERT - Tem Evaluation");
alert = true;
}
if(cu.getCourseUnitProgram() != null)
{
System.out.println("ALERT - Tem program");
alert = true;
}
if(cu.getSummaries() != null && cu.getSummaries().size() > 0)
{
System.out.println("ALERT - Tem SUMMARIES");
}
if(alert)
{
System.out.println(">>>>>>>>>>>>>>NAO APAGA");
}
else
{
System.out.println("+++++++++++++++CANDIDATA A APAGAR");
}
 
}
 
 
 
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportGradesService.java
11,6 → 11,7
import pt.estgp.estgweb.services.email.SendEmailService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.services.jobs.JobScheduleService;
import pt.estgp.estgweb.services.jobs.ServiceJob;
import pt.estgp.estgweb.services.logresults.ILogMessages;
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessage;
33,23 → 34,59
* @time 12:51:32
* @see pt.estgp.estgweb
*/
public class ImportGradesService implements IService
public class ImportGradesService extends ServiceJob implements IService
{
 
private static final Logger logger = Logger.getLogger(ImportGradesService.class);
 
private static final int MAX_COMMIT = 100;
private static final int MAX_COMMIT = 20;
 
private HashMap<Long,List<Long>> newGrades = new HashMap<Long,List<Long>>();
 
public ILogMessages run(String year) throws ServiceException
{
DefaultLogMessages logMessages = new DefaultLogMessages();
logMessages.addMessage(new DefaultLogMessage("import.grades", LogMessageTypeEnum.INFO, "instituicao " + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()));
logger.info("starting grades import");
logMessages.addMessage(new DefaultLogMessage("import.grades", LogMessageTypeEnum.INFO, "instituicao " + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode() + " ano : " + year));
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
Map<Integer,Integer> alunos = new HashMap<Integer,Integer>();
Map<String,String> alunoCadeira = new HashMap<String,String>();
 
int foundTotal = 0;
 
try
{
AbstractDao.getCurrentSession().beginTransaction();
logger.info("Loading Epocas de avaliacao");
serviceLogInfo("Loading Epocas de avaliacao");
List<ConfigurationGradesEpocaAvaliacao> epocas = DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().findAll();
if(epocas == null || epocas.size() == 0)
{
logMessages.addMessage(new DefaultLogMessage("import.grades",LogMessageTypeEnum.WARNING,"Sem Epocas de Avaliacao, por favor adicione as epocas ao sistema"));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
return logMessages;
}
List<ConfigurationGradesStatusEpoca> statusEpocas = DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().findAll();
if(statusEpocas == null || statusEpocas.size() == 0)
{
logMessages.addMessage(new DefaultLogMessage("import.grades",LogMessageTypeEnum.WARNING,"Sem Status de epocas de avaliacao, por favor adicione as epocas ao sistema"));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
return logMessages;
}
HashMap<String,String> mapaEpocasAvaliacao = new HashMap<String, String>();
for(ConfigurationGradesEpocaAvaliacao epoca: epocas)
{
mapaEpocasAvaliacao.put(epoca.getCodigoEpoca() + "-" + epoca.getCodigoMomento(), epoca.getDescricao());
}
 
HashMap<String,String> mapaStatusEpocas = new HashMap<String, String>();
for(ConfigurationGradesStatusEpoca statusEpoca: statusEpocas)
{
mapaStatusEpocas.put(statusEpoca.getStatus(), statusEpoca.getDescricao());
}
 
//AbstractDao.getCurrentSession().beginTransaction();
String WSDL = DaoFactory.getConfigurationDaoImpl().getSigesWebServicesWsdl();
SiGesWEB service;
try
60,39 → 97,76
{
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(),"erro na configuracao do WEB Service", LogMessageTypeEnum.INFO));
logger.fatal(e, e);
serviceLogFatal(logMessages.getLastMessage());
return logMessages;
}
ArrayOfNota arrayOfNotas = service.getSiGesWEBSoap().getNotas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year);
List<Nota> notas = arrayOfNotas.getNota();
 
int i = 0;
for (Nota nota : notas)
{
foundTotal++;
if (i++ > MAX_COMMIT)
{
i = 0;
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
setProgress((int) (((float)foundTotal)/((float)notas.size())*100.0f));
commitPartially();
}
 
/**
* n.codigo_aluno = getDecimal("CD_ALUNO",aReader); ----- OK
n.codigo_curso = getDecimal("CD_CURSO", aReader); ----- OK
n.codigo_disciplina = getDecimal("CD_DISCIP", aReader);- OK
n.nota = getDecimal("NR_AVALIA", aReader); ---------- OK
n.data_avaliacao = getDateTime("DT_AVALIA", aReader); - OK
n.status_epoca = getDecimal("CD_STA_EPO", aReader); -- OK
n.cd_duracao = getString("CD_DURACAO",aReader); - ------ OK
*/
 
int codAluno = nota.getCodigoAluno().intValue();
alunos.put(codAluno,codAluno);
int codUnidade = nota.getCodigoDisciplina().intValue();
alunoCadeira.put(codAluno + "$" + codUnidade,codAluno + "$" + codUnidade);
int codCurso = nota.getCodigoCurso().intValue();
String cdDuracao = nota.getCdDuracao();
int valor = nota.getNota().intValue();
int statusEpoca = nota.getStatusEpoca().intValue();
Date data = nota.getDataAvaliacao().toGregorianCalendar().getTime();
int momento = nota.getMomentoAvaliacao().intValue();
int epoca = nota.getEpocaAvaliacao().intValue();
 
//boolean eFinal = nota.get
 
String descricaoEpoca = mapaEpocasAvaliacao.get(epoca + "-" + momento);
String descricaoStatusEpoca = mapaStatusEpocas.get(""+statusEpoca) == null ? ""+statusEpoca : mapaStatusEpocas.get(statusEpoca+"");
 
Student s = DaoFactory.getStudentDaoImpl().loadBySigesCode(codAluno);
 
if(s != null)
if(descricaoEpoca!= null && s != null)
{
CourseUnit courseUnit;
CourseUnit courseUnit = null;
try{
courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUniqueSubscribed("" + codUnidade, year, "" + codCurso,s.getId(),cdDuracao);
 
List<CourseUnit> cus = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode("" + codUnidade, "" + codCurso,cdDuracao,year);
//Uma cadeira atribuida a uma nota que pode nao ser de facto a turma dela
//A nota tem de passar a deixar de ter obrigatoriamente a cadeira
//ha que mudar isso na interface e colocar apenas o descritivo nesses casos e manter a cadeira
//a null para nao haver hipoteses de confusao
if(cus != null && cus.size() > 0)
courseUnit = cus.get(0);
if(cus.size() > 1)
{
CourseUnit c1 = cus.get(0);
CourseUnit c2 = cus.get(1);
logMessages.addMessage(new DefaultLogMessage("import.warning","",
"Mais que uma unidade para o código(unidade,curso): " + codUnidade + "," + codCurso + " -> " + courseUnit.getName() + " possiveis duas turmas: " + c1.getCdTurma() + " - " + c2.getCdTurma() , LogMessageTypeEnum.INFO));
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
}
if(courseUnit != null)
{
CourseUnitGrade grade = DaoFactory.getCourseUnitGradeDaoImpl().find(courseUnit.getId(),s.getId());
CourseUnitGrade grade = DaoFactory.getCourseUnitGradeDaoImpl().find(courseUnit.getId(),s.getId(),""+momento,""+epoca);
if(grade == null)
{
grade = DomainObjectFactory.createCourseUnitGradeImpl();
100,8 → 174,14
grade.setCourseUnit(courseUnit);
grade.setNormalizedCourseUnitName(courseUnit.getNormalizedName());
grade.setImportYear(year);
grade.setCodigoEpoca("" + epoca);
grade.setCodigoMomento("" + momento);
grade.setDescEpoca(descricaoEpoca);
grade.setStatusEpoca(statusEpoca);
grade.setDescStatusEpoca(descricaoStatusEpoca);
DaoFactory.getCourseUnitGradeDaoImpl().save(grade);
if(grade.getGrade() > 0)
 
if(grade.getGrade() >= 0)
addGrade(grade);
}
if(grade.getGrade() != valor || grade.getStatusEpoca() != statusEpoca || (grade.getPublishDate() != null && grade.getPublishDate().getTime() != data.getTime()))
109,43 → 189,79
grade.setPublishDate(data);
grade.setGrade(valor);
grade.setStatusEpoca(statusEpoca);
if(grade.getGrade() > 0)
grade.setDescStatusEpoca(descricaoStatusEpoca);
if(grade.getGrade() >= 0)
addGrade(grade);
}
 
}
else
{
logMessages.addMessage(new DefaultLogMessage("import.warning","","CourseUnit: " + codUnidade + ": course: " + codCurso + " does not exist or is not subscribed by student: " + codAluno + " with id:" + s.getId(), LogMessageTypeEnum.WARNING));
logger.warn("CourseUnit: " + codUnidade + ": course: " + codCurso + " does not exist");
logMessages.addMessage(new DefaultLogMessage("import.warning","","CourseUnit: " + codUnidade + " course: " + codCurso + " searching for student" + s.getSigesCode() + " semestre: " + cdDuracao + " year: " + year + " does not exist", LogMessageTypeEnum.WARNING));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
}catch(Exception e)
{
logger.warn("Error : unit:" + codUnidade + " course:" + codCurso + " student:" + s.getId(),e);
 
logMessages.addMessage(new DefaultLogMessage("import.warning","","Error : unit:" + codUnidade + " course:" + codCurso + " student:" + s.getId(), LogMessageTypeEnum.WARNING));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
 
}
else
{
logMessages.addMessage(new DefaultLogMessage("import.warning","","Student: " + codAluno + " does not exist", LogMessageTypeEnum.WARNING));
logger.warn("Student: " + codAluno + " does not exist");
if(descricaoEpoca == null)
{
logMessages.addMessage(new DefaultLogMessage("import.warning","",epoca + "-" + momento + " nao esta catalogada para atribuicao de nota", LogMessageTypeEnum.WARNING));
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
}else
{
logMessages.addMessage(new DefaultLogMessage("import.warning","","Student: " + codAluno + " does not exist", LogMessageTypeEnum.WARNING));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
 
}
 
}
sendSms(null);
sendEmail(null);
AbstractDao.getCurrentSession().getTransaction().commit();
 
 
//AbstractDao.getCurrentSession().getTransaction().commit();
}
catch (Throwable e)
{
logger.error(e, e);
 
AbstractDao.getCurrentSession().getTransaction().rollback();
 
//AbstractDao.getCurrentSession().getTransaction().rollback();
logMessages.addMessage(new DefaultLogMessage("import.error", e.toString(), "see log for details", LogMessageTypeEnum.ERROR));
serviceLogError(logMessages.getLastMessage());
throw new ServiceException(e.toString(), e);
}
setProgress(100);
logger.info("######################################");
serviceLogInfo("######################################");
logger.info("######################################");
serviceLogInfo("######################################");
logger.info("STATS " + year);
serviceLogInfo("STATS " + year);
logger.info("Total Notas: " + foundTotal);
serviceLogInfo("Total Notas: " + foundTotal);
logger.info("Alunos: " + alunos.size());
serviceLogInfo("Alunos: " + alunos.size());
logger.info("Notas de Alunos em cadeiras: " + alunoCadeira.size());
serviceLogInfo("Notas de Alunos em cadeiras: " + alunoCadeira.size());
 
 
 
logMessages.addMessage(new DefaultLogMessage("import.teachers.terminating", LogMessageTypeEnum.INFO));
logger.info("terminating grades import");
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
return logMessages;
}
 
189,6 → 305,7
 
private void sendEmail(UserSession userSession)
{
 
if(Globals.EMAIL_NEW_GRADES && newGrades.size() > 0)
{
Set<Map.Entry<Long,List<Long>>> set = newGrades.entrySet();
202,7 → 319,7
for(long gradeId: studentGrades)
{
CourseUnitGrade grade = DaoFactory.getCourseUnitGradeDaoImpl().get(gradeId);
String[] gradeArray = new String[] {grade.getNormalizedCourseUnitName(),""+grade.getGrade()};
String[] gradeArray = new String[] {grade.getNormalizedCourseUnitName(),""+grade.getGrade(),grade.getDescEpoca()};
gradesArray.add(gradeArray);
}
EMAILJob emailJob = new EMAILJob(sendEmailService.getNewGradesEmail(gradesArray, LangEnum.PORTUGUESE,s.getEmail(),s.getName()));
211,6 → 328,7
}
}
 
 
/**
* Testar por aqui poi requer Super Role e assim e' autmatico
*
222,8 → 340,15
String year = DaoFactory.getConfigurationDaoImpl().getImportsDefaultImportYearCreateTransaction();;
if(args != null && args.length > 0)
year = args[0];
AbstractDao.getCurrentSession().beginTransaction();
new ImportGradesService().run(year);
AbstractDao.getCurrentSession().getTransaction().commit();
}
 
 
@Override
protected ILogMessages runJobServiceTask() throws Throwable {
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
return run(importYear);
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumaries.java
89,7 → 89,7
//comentario de teste
try
{
arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),DatesUtils.getSemestre());
arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),DatesUtils.getSemestre(),null);
break;
}
catch(Throwable t)
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java
38,19 → 38,28
{
 
private static final Logger logger = Logger.getLogger(ImportStudentsService.class);
private static final int MAX_COMMIT = 100;
private static final int MAX_COMMIT = 20;
 
int studentsMerged = 0;
int studentsNew = 0;
int studentsZeroUnits = 0;
int unitsNotFound = 0;
int unitsNotFoundTurma = 0;
int unitsRemovedToStudents = 0;
int unitsLocalAddedNotRemoved = 0;
int unitsLocallyRemovedNotAdded = 0;
int alunosFound = 0;
int studentsChangeBI = 0;
int unitsAddedToStudents = 0;
int alunosErasmusCadeirasEcontradas = 0;
int turmaMoreThanOneRegularCourse = 0;
 
//Vasco da Gama
//Cadeiras a Vulso
//Erasmus
//disciplinas a vulso ESS
Integer[] cursosFicticios = {19,4,0,22};
 
public ILogMessages run(String year) throws ServiceException
{
 
58,14 → 67,21
studentsNew = 0;
studentsZeroUnits = 0;
unitsNotFound = 0;
unitsNotFoundTurma = 0;
unitsRemovedToStudents = 0;
unitsLocalAddedNotRemoved = 0;
unitsLocallyRemovedNotAdded = 0;
alunosFound = 0;
studentsChangeBI = 0;
unitsAddedToStudents = 0;
alunosErasmusCadeirasEcontradas = 0;
turmaMoreThanOneRegularCourse = 0;
 
String activeImportYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear();
 
String msgS = "STARTING STUDENTS IMPORT SERVICE FOR YEAR: " + year;
 
 
serviceLogInfo(msgS);
logger.info(msgS);
 
80,6 → 96,7
{
serviceLogInfo("STARTING WEB SERVICE AT " + WSDL);
service = new SiGesWEB(new URL(WSDL), new QName(Globals.SIGES_WEBSERVICE_TARGET_NAMESPACE, "SiGesWEB"));
 
}
catch (MalformedURLException e)
{
99,9 → 116,8
if (i++ > MAX_COMMIT)
{
i = 0;
setProgress((int) (((float)alunosFound)/((float)codigos.size())*100.0f));
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
setProgress((int) (((float) alunosFound) / ((float) codigos.size()) * 100.0f));
commitPartially();
}
 
Aluno alunoSiges = service.getSiGesWEBSoap().getAlunoInscrito(c, new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year);
148,7 → 164,7
DaoFactory.getStudentDaoImpl().save(s);
newUser = true;
}
persist(alunoSiges, s, newUser,year);
persist(alunoSiges, s, newUser,year,activeImportYear,logMessages,service);
//Advising CommonsServicesManager before change password
 
if (newUser)
187,8 → 203,7
logger.error(e,e);
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(), "see log for details", LogMessageTypeEnum.ERROR));
serviceLogError(e.toString(),e);
String cause = e.getCause() == null ? "" : e.getCause().toString();
sendNotificationAdmin("Erro de importacao de alunos",cause);
sendNotificationAdmin("Erro de importacao de alunos",e.toString());
}
 
 
199,21 → 214,49
serviceLogInfo("#Students Merged: " + studentsMerged);
serviceLogInfo("#Students Zero Units: " + studentsZeroUnits);
serviceLogInfo("#Units not found: " + unitsNotFound);
serviceLogInfo("#Units not found in real course (turma ok): " + unitsNotFoundTurma);
serviceLogInfo("#Units added to Students: " + unitsAddedToStudents);
serviceLogInfo("#Units removed to Students: " + unitsRemovedToStudents);
serviceLogInfo("#Units not Removed because localy added: " + unitsLocalAddedNotRemoved);
serviceLogInfo("#Units not Added because localy removed: " + unitsLocallyRemovedNotAdded);
serviceLogInfo("#ERASMUS Sum Subscriptions Replaced: " + alunosErasmusCadeirasEcontradas);
if(turmaMoreThanOneRegularCourse > 0)
serviceLogInfo("#########!!!!!!!PROBLEMA TURMAS COM MAIS DE UM CURSO: " + turmaMoreThanOneRegularCourse);
 
logger.info("############################");
logger.info("############################");
logger.info("#Students found: " + alunosFound);
logger.info("#Students New: " + studentsNew);
logger.info("#Students Merged: " + studentsMerged);
logger.info("#Students Zero Units: " + studentsZeroUnits);
logger.info("#Units not found: " + unitsNotFound);
logger.info("#Units not found in real course (turma ok): " + unitsNotFoundTurma);
logger.info("#Units added to Students: " + unitsAddedToStudents);
logger.info("#Units removed to Students: " + unitsRemovedToStudents);
logger.info("#Units not Removed because localy added: " + unitsLocalAddedNotRemoved);
logger.info("#Units not Added because localy removed: " + unitsLocallyRemovedNotAdded);
logger.info("#ERASMUS Sum Subscriptions Replaced: " + alunosErasmusCadeirasEcontradas);
if(turmaMoreThanOneRegularCourse > 0)
logger.warn("#########!!!!!!!PROBLEMA TURMAS COM MAIS DE UM CURSO: " + turmaMoreThanOneRegularCourse);
 
if(studentsChangeBI>0)
{
serviceLogInfo("#>>>>>AVISO AVISO<<<<<<<<<: ");
serviceLogInfo("#>>>>>AVISO AVISO<<<<<<<<<: ");
serviceLogInfo("#>>>>>NUMEROS DE ALUNOS MUDARAM DE BI<<<<<<<<<: CONSULTAR LOG");
serviceLogInfo("#CODIGO SIGES COM BIs DIFERENTES:" + studentsChangeBI);
logger.info("#>>>>>AVISO AVISO<<<<<<<<<: ");
logger.info("#>>>>>AVISO AVISO<<<<<<<<<: ");
logger.info("#>>>>>NUMEROS DE ALUNOS MUDARAM DE BI<<<<<<<<<: CONSULTAR LOG");
logger.info("#CODIGO SIGES COM BIs DIFERENTES:" + studentsChangeBI);
}
 
setProgress(100);
return logMessages;
}
 
 
 
/**
* Envio de Notificação aos operadores do CI
* @param subject
230,6 → 273,7
List<String> arguments = new ArrayList<String>();
arguments.add(cause.replace("\n","<br/>"));
Email email = new Email(subject,emails,Globals.SYSTEM_EMAIL_BOX,"messageToAdmin_pt.txt",arguments);
email.setHtml(true);
try {
new SendEmailService().sendEmail(email);
} catch (ServiceException e) {
237,7 → 281,116
}
}
 
public BigDecimal getRealCourse(String turma,String year, String semestre, SiGesWEB service, DefaultLogMessages messages)
{
HashMap<String,List<BigDecimal>> pairs = getCourseTurmaPairs(year,semestre,service,messages);
List<BigDecimal> cursos = pairs.get(turma);
if(cursos.size() > 1)
{
String msgAdmin = "";
String msg = "####Atenção existe um caso de dúvida nas inscrições : " + year + "-" + semestre + " turma " + turma;
msgAdmin += msg + "\n";
logger.warn(msg);
serviceLogWarn(msg);
msg = "####A turma " + turma + " tem " + cursos.size() + " cursos associados: ";
logger.warn(msg);
serviceLogWarn(msg);
msgAdmin += msg + "\n";
for(BigDecimal curso: cursos)
{
msg = "######->turma:" + turma + " -> curso siges: " + curso.longValue();
msgAdmin += msg + "\n";
logger.warn(msg);
serviceLogWarn(msg);
}
sendNotificationAdmin("Atenção existe um caso de dúvida nas inscrições",msgAdmin);
}
if(cursos.size() > 0)
return cursos.get(0);
else
{
String msg = "####Atenção existe um em que uma turma nao tem curso associado : " + year + "-" + semestre + " turma " + turma;
sendNotificationAdmin("Atenção existe um em que uma turma nao tem curso associado",msg);
logger.error(msg);
serviceLogError(msg);
return null;
}
}
 
boolean isCursoFicticio(int cursoCode)
{
for(Integer cursoFicticio: cursosFicticios)
{
if(cursoFicticio.intValue() == cursoCode)
{
return true;
}
}
return false;
}
 
HashMap<String,HashMap<String,List<BigDecimal>>> semestreTurmaCursosPairs = new HashMap<String, HashMap<String, List<BigDecimal>>>();
private HashMap<String,List<BigDecimal>> getCourseTurmaPairs(String year,String semestre, SiGesWEB service, DefaultLogMessages messages)
{
HashMap<String,List<BigDecimal>> turmaCourses = semestreTurmaCursosPairs.get(year + ";" + semestre);
if(turmaCourses == null)
{
String msg = "Starting structure pairs turma curso para : " + year + "-" + semestre;
logger.info(msg);
serviceLogInfo(msg);
ArrayOfTurmaCurso arrayOfTurmaCurso = service.getSiGesWEBSoap().loadParesTurmaCurso(
new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode())
, year,semestre);
turmaCourses = new HashMap<String, List<BigDecimal>>();
for(TurmaCurso turmaCursoPair: arrayOfTurmaCurso.getTurmaCurso())
{
List<BigDecimal> cursos = turmaCourses.get(turmaCursoPair.getCdTurma());
if(cursos == null)
{
cursos = new ArrayList<BigDecimal>();
turmaCourses.put(turmaCursoPair.getCdTurma(),cursos);
}
if(turmaCursoPair.getCodigoCurso().intValue() >= 0)
{
boolean cursoFicticio = isCursoFicticio(turmaCursoPair.getCodigoCurso().intValue());
if(!cursoFicticio)
{
cursos.add(turmaCursoPair.getCodigoCurso());
 
msg = "Adding:" + turmaCursoPair.getCdTurma() + "->" + turmaCursoPair.getCodigoCurso();
logger.info(msg);
serviceLogInfo(msg);
if(cursos.size()>1)
{
turmaMoreThanOneRegularCourse++;
msg = "Warning: turma " + turmaCursoPair.getCdTurma() + " has more than one regular course associated ";
logger.warn(msg);
serviceLogWarn(msg);
messages.addMessage(new DefaultLogMessage("", LogMessageTypeEnum.WARNING,msg));
}
}
else
{
msg = "Not adding:" + turmaCursoPair.getCdTurma() + "->" + turmaCursoPair.getCodigoCurso() + " -> Codigo de Curso Ficticio ->não vai ser considerado";
logger.info(msg);
serviceLogInfo(msg);
}
}
else
{
msg = "Excluding:" + turmaCursoPair.getCdTurma() + "->" + turmaCursoPair.getCodigoCurso();
logger.warn(msg);
serviceLogInfo(msg);
}
}
semestreTurmaCursosPairs.put(year + ";" + semestre,turmaCourses);
/***END INICIALIZACAO***/
}
/**Inicialização da Estrutura de Suporte aos Cursos/Turma*/
return turmaCourses;
}
 
 
/**
* Nao esta testado
* jm
245,7 → 398,7
* @param alunoSiges Aluno
* @param student Student
*/
private void persist(Aluno alunoSiges, Student student, boolean newUser, String year)
private void persist(Aluno alunoSiges, Student student, boolean newUser, String year, String activeImportYear, DefaultLogMessages logMessages, SiGesWEB service)
{
if(newUser)
{
262,19 → 415,20
 
builder.append("ATENCAO NUMERO DE ALUNO " + alunoSiges.getCodigo() + " MUDOU DE DONO VAI SER BLOQUEADO IMEDIATAMENTE\n");
builder.append("ALTERANDO DADOS DO ALUNO " + alunoSiges.getCodigo() + "\n");
builder.append("<<<<<<<ANTES: " + "\n");
builder.append("<<<<<<<BI: " + student.getBi() + "\n");
builder.append("<<<<<<<Nome: " + student.getName() + "\n");
builder.append("<<<<<<<Username: " + student.getUserNameNetpa() + "\n");
builder.append("<<<<<<<Address: " + student.getAddress() + "\n");
builder.append("<<<<<<<Zip: " + student.getZip() + "\n");
builder.append("<<<<<<<Email: " + student.getEmail() + "\n");
builder.append("<<<<<<<Phone: " + student.getPhonenumber() + "\n");
builder.append("-----ANTES: " + "\n");
builder.append("-----BI: " + student.getBi() + "\n");
builder.append("-----Nome: " + student.getName() + "\n");
builder.append("-----Username: " + student.getUserNameNetpa() + "\n");
builder.append("-----Address: " + student.getAddress() + "\n");
builder.append("-----Zip: " + student.getZip() + "\n");
builder.append("-----Email: " + student.getEmail() + "\n");
builder.append("-----Phone: " + student.getPhonenumber() + "\n");
 
cloneFields(alunoSiges, student);
 
student.setAutoBlockMode(false);
student.setManualBlock(true);
//todo verificar isto
//student.setAutoBlockMode(false);
//student.setManualBlock(true);
 
builder.append("DEPOIS: " + "\n");
builder.append("BI: " + student.getBi() + "\n");
292,6 → 446,35
 
}
 
if(alunoSiges.getHistoricos() == null || alunoSiges.getHistoricos().getAlunoHistorico() == null || alunoSiges.getHistoricos().getAlunoHistorico().size() == 0)
{
student.setPropinasEmDia(false);
serviceLogWarn("ATENTION Estudante sem historico de Matriculas para aferir propinas: codigo " + alunoSiges.getCodigo());
logger.warn("ATENTION Estudante sem historico de Matriculas para aferir propinas: codigo " + alunoSiges.getCodigo());
}
else
{
student.setPropinasEmDia(false);
student.setPropinasEmDiaYear(activeImportYear);
 
for(AlunoHistorico hist: alunoSiges.getHistoricos().getAlunoHistorico())
{
if(hist.getCodigoLectivo()!=null && hist.getCodigoLectivo().equals(activeImportYear))
{
if(hist.getPropinaEmDia().equalsIgnoreCase("s"))
{
student.setPropinasEmDia(true);
student.setPropinasEmDiaYear(activeImportYear);
}
break;
}
}
if(!student.isPropinasEmDia())
{
serviceLogWarn("ATENTION Estudante sem propina em dia: codigo " + alunoSiges.getCodigo());
logger.warn("ATENTION Estudante sem propina em dia: codigo " + alunoSiges.getCodigo());
}
}
/*Desta forma as relacoes antigas sao ignoradas cria-se uma lista nova e atribui-se ao Teacher, o Hibernate faz resto e apaga as chaves estrangeiras antigas */
if (alunoSiges.getDisciplinasInscrito() == null || alunoSiges.getDisciplinasInscrito().getDisciplina() == null || alunoSiges.getDisciplinasInscrito().getDisciplina().size() == 0)
{
307,32 → 490,73
//4 - Remover da lista do aluno as unidades que não vêm do SIGES e que não foram adicionadas localmente
 
 
//todo mudar isto
//todo mudar nos webservices quando vai buscar o mapa de turmas
final int ERASMUS_CODE = 0;
//FALTA AQUI O VASCO DA GAMA
//FALTA AQUI DISCIPLINAS A VULSO
 
//PASSO 1
Set<CourseUnit> units = new HashSet<CourseUnit>();
Set<CourseUnit> unitsFromSigesPersistentInBaco = new HashSet<CourseUnit>();
ArrayOfDisciplina disciplinas = alunoSiges.getDisciplinasInscrito();
for (Disciplina disciplina : disciplinas.getDisciplina())
{
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(),"" + disciplina.getCodigoCurso(),disciplina.getCdDuracao(),disciplina.getCdLectivo());
boolean cursoFicticio = isCursoFicticio(disciplina.getCodigoCurso().intValue());
BigDecimal codigoDoCurso = disciplina.getCodigoCurso();
if(disciplina.getCdTipoDisciplina() != null
&&
(disciplina.getCdTipoDisciplina().intValue() == ImportCourseService.SIGES_CODIGO_TIPO_DISCIPLINA_EXTRA_CURRICULAR
||
cursoFicticio))
{
if(cursoFicticio)
{
alunosErasmusCadeirasEcontradas++;
String msg = "Disciplina para Aluno " + student.getSigesCode() + " de Curso Ficticio " +disciplina.getCodigoCurso().intValue() + " encontrada vamos trocar para código de curso real";
serviceLogInfo(msg);
logger.info(msg);
}
else
{
String msg = "Disciplina para Aluno " + student.getSigesCode() + " ExtraCurricular " +disciplina.getCodigoCurso().intValue() + " encontrada vamos trocar para código de curso real";
serviceLogInfo(msg);
logger.info(msg);
}
codigoDoCurso = getRealCourse(disciplina.getCdTurma(),year,disciplina.getCdDuracao(),service,logMessages);
String msg = "Codigo de curso (" + disciplina.getCodigoCurso() + ") da disciplina " + disciplina.getCodigo() + " tipo: " + disciplina.getCdTipoDisciplina() + " nome:" + disciplina.getNome() + "turma: " + disciplina.getCdTurma() + " Modificado para o real: " + codigoDoCurso;
serviceLogInfo(msg);
logger.info(msg);
}
 
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(),"" + codigoDoCurso,disciplina.getCdDuracao(),disciplina.getCdLectivo()
,disciplina.getCdTurma());
//Special procedure for Aluno to check if turma not exist will find without turma code to keep old years compatibility
if(courseUnit == null)
{
unitsNotFoundTurma++;
courseUnit = tryFindCourseUnitWithOutTurma(logMessages,disciplina.getCdDuracao(),""+disciplina.getCodigo().intValue()
,"" + codigoDoCurso.intValue(),disciplina.getCdLectivo(),disciplina.getCdTurma());
}
if(courseUnit == null)
{
unitsNotFound++;
String msg = "Unit not found: semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + disciplina.getCodigoCurso() + " year:" + disciplina.getCdLectivo();
String msg = "Unit not found (student " + student.getSigesCode() + "): semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + codigoDoCurso + " year:" + disciplina.getCdLectivo() + " turma: " + disciplina.getCdTurma();
serviceLogWarn(msg);
logger.warn(msg);
}
else
units.add(courseUnit);
unitsFromSigesPersistentInBaco.add(courseUnit);
}
 
//PASSO 2
Iterator<CourseUnit> iter = units.iterator();
StudentImpl sImpl = (StudentImpl) DaoFactory.getStudentDaoImpl().narrow(student);
//PASSO 2 - Sao retiradas da lista unitsFromSigesPersistentInBaco as que o aluno tem mas que foram removidas localmente
Iterator<CourseUnit> iter = unitsFromSigesPersistentInBaco.iterator();
StudentImpl studentImpl = (StudentImpl) DaoFactory.getStudentDaoImpl().narrow(student);
while (iter.hasNext())
{
CourseUnit courseUnit = iter.next();
//In case of a comming proxy
 
if(sImpl.isLocalRemovedUnit(courseUnit))
if(studentImpl.isLocalRemovedUnit(courseUnit))
{
unitsLocallyRemovedNotAdded++;
String msg = "Removendo unidade: " + ((CourseUnitImpl)courseUnit).getSigesUniqueIdentifiers() + " - do aluno: " + student.getSigesCode() + " - Associacao existe no SIGES mas foi removido LOCALMENTE";
342,10 → 566,10
}
}
 
//PASSO 3
//PASSO 3 - Sao adicionadas ao aluno as unidades que o aluno ainda nao tiver da lista unitsFromSigesPersistentInBaco
if(student.getSubscribedUnits() != null)
{
for(CourseUnit c: units)
for(CourseUnit c: unitsFromSigesPersistentInBaco)
{
boolean isIn = false;
for(CourseUnit tc : student.getSubscribedUnits())
367,7 → 591,7
}
}
else
student.setSubscribedUnits(units);
student.setSubscribedUnits(unitsFromSigesPersistentInBaco);
 
//PASSO 4
//Remover unidades deste ano que nao vem do SIGES e que nao foram adicionadas localmente
385,7 → 609,7
{
 
boolean added = false;
for(CourseUnit c: units)
for(CourseUnit c: unitsFromSigesPersistentInBaco)
{
if(cUNow.equals(c))
{
396,7 → 620,7
if(!added)
{
 
if(!sImpl.isLocalUnit(cUNow))
if(!studentImpl.isLocalUnit(cUNow))
{
String msg = "Removendo unidade: " + ((CourseUnitImpl)cUNow).getSigesUniqueIdentifiers() + " - do aluno: " + student.getSigesCode() + " - Associacao desapareceu do SIGES";
serviceLogInfo(msg);
417,6 → 641,41
}
}
 
private CourseUnit tryFindCourseUnitWithOutTurma(DefaultLogMessages logMessages, String cdDuracao, String codigo,String codigoCurso,String cdLectivo,String cdTurma)
{
CourseUnit courseUnit = null;
String msg = "Unit not found with turma code : semestre:" + cdDuracao + " codigo:" + codigo + " course:" + codigoCurso + " year:" + cdLectivo + " turma: " + cdTurma;
logMessages.addMessage(new DefaultLogMessage("", LogMessageTypeEnum.WARNING,msg));
serviceLogWarn(msg);
logger.warn(msg);
msg = "Trying without Turma code...";
serviceLogWarn(msg);
logger.warn(msg);
List<CourseUnit> cus = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode("" + codigo,"" + codigoCurso,cdDuracao,cdLectivo);
if(cus != null && cus.size() == 1)
{
courseUnit = cus.get(0);
msg = "Found ok...";
serviceLogInfo(msg);
logger.info(msg);
}
else if(cus !=null && cus.size() > 1)
{
courseUnit = cus.get(0);
msg = "Found More than one, unexpected situation..." + cus.get(0).getId() + " - " + cus.get(1).getId();
logMessages.addMessage(new DefaultLogMessage("", LogMessageTypeEnum.WARNING,msg));
serviceLogWarn(msg);
logger.warn(msg);
}
else
{
msg = "Not Found ...";
serviceLogInfo(msg);
logger.info(msg);
}
return courseUnit;
 
}
private void cloneFields(Aluno alunoSiges, Student student) {
student.setName(alunoSiges.getNome());
student.setEmail(alunoSiges.getEmail());
430,14 → 689,12
student.setBirthDate(alunoSiges.getDataNascimento().toGregorianCalendar().getTime());
student.setUsername("a" + alunoSiges.getCodigo().intValue());
}
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
 
@Override
protected void runJobServiceTask() throws Throwable {
protected ILogMessages runJobServiceTask() throws Throwable {
 
String importYear = (String) getParametersMap().get(JOB_importYear_KEY).getObject();
run(importYear);
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
ILogMessages messages = run(importYear);
return messages;
 
}
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/LoadSumariesToPDF.java
67,7 → 67,7
}
AbstractDao.getCurrentSession().beginTransaction();
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().get(courseUnitId);
ArrayOfAula arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), c.getImportYear(),c.getCode(),c.getSemestre());
ArrayOfAula arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), c.getImportYear(),c.getCode(),c.getSemestre(),c.getCourse().getCode());
 
if(arrayOfAulas != null && arrayOfAulas.getAula() != null)
{
139,7 → 139,7
//comentario de teste
try
{
arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),DatesUtils.getSemestre());
arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),DatesUtils.getSemestre(),c.getCourse().getCode());
break;
}
catch(Throwable t)
/impl/src/java/pt/estgp/estgweb/services/sigesimports/SincronizeLastYearCourseUnitProgramsService.java
80,8 → 80,10
serviceLogInfo(logMessages.getLastMessage());
 
int i = 0;
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadYear(year);
for (CourseUnit cu: units)
List<Long> units = DaoFactory.getCourseUnitDaoImpl().loadIds(year);
//List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadYear(year);
for (Long cuId: units)
// for (CourseUnit cu: units)
{
 
SaveCourseUnitProgram service = new SaveCourseUnitProgram();
92,10 → 94,9
{
i = 0;
setProgress((int) (((float)foundTotal)/((float)units.size())*100.0f));
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
serviceLogInfo("Commiting database");
commitPartially();
}
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(cuId);
if(cu.getCourseUnitProgram() == null || !cloneOnlyNews)
{
 
183,6 → 184,7
 
//cu.setValidProgram(true);
}
setProgress(100);
logger.info("######################################");
serviceLogInfo("######################################");
logger.info("######################################");
263,7 → 265,6
logger.info("terminating programs sincronization");
serviceLogInfo("terminating programs sincronization");
logMessages.addMessage(new DefaultLogMessage("courseunitprograms.sincronization.terminating", LogMessageTypeEnum.INFO));
setProgress(100);
return logMessages;
}
 
385,10 → 386,6
}
 
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_cloneOnlyNews_KEY = "JOB_cloneOnlyNews_KEY";
public static final String JOB_generateAllPdfs_KEY = "JOB_generateAllPdfs_KEY";
public static final String JOB_validate_KEY = "JOB_validade_KEY";
 
/**
* Parameters for ServiceJob
399,13 → 396,16
* @throws Throwable
*/
@Override
protected void runJobServiceTask() throws Throwable
protected ILogMessages runJobServiceTask() throws Throwable
{
String importYear = (String) getParametersMap().get(JOB_importYear_KEY).getObject();
Boolean cloneOnlyNews = (Boolean) getParametersMap().get(JOB_cloneOnlyNews_KEY).getObject();
Boolean generateAllPdfs = (Boolean) getParametersMap().get(JOB_generateAllPdfs_KEY).getObject();
Boolean validate = (Boolean) getParametersMap().get(JOB_validate_KEY).getObject();
run(importYear,cloneOnlyNews,generateAllPdfs,validate);
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
String cloneOnlyNewsStr = getParametersMap().get(JOB_cloneOnlyNews_KEY).getObject();
String generateAllPdfsStr = getParametersMap().get(JOB_generateAllPdfs_KEY).getObject();
String validateStr = getParametersMap().get(JOB_validate_KEY).getObject();
boolean cloneOnlyNews = cloneOnlyNewsStr != null && Boolean.parseBoolean(cloneOnlyNewsStr);
boolean generateAllPdfs = generateAllPdfsStr != null && Boolean.parseBoolean(generateAllPdfsStr);
boolean validate = validateStr != null && Boolean.parseBoolean(validateStr);
return run(importYear,cloneOnlyNews,generateAllPdfs,validate);
}
 
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/connection/ConnectionManager.java
New file
0,0 → 1,27
package pt.estgp.estgweb.services.sigesimports.oracle.dao.connection;
 
import oracle.jdbc.pool.OracleDataSource;
import pt.estgp.estgweb.utils.ConfigProperties;
 
import java.sql.Connection;
import java.sql.SQLException;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class ConnectionManager
{
private static Connection connection = null;
 
 
public static Connection openConnection() throws SQLException
{
OracleDataSource ods = new OracleDataSource();
ods.setUser(ConfigProperties.getProperty("oracle.siges.username"));
ods.setPassword(ConfigProperties.getProperty("oracle.siges.password"));
ods.setURL(ConfigProperties.getProperty("oracle.siges.url"));
// Connect to the database
Connection conn = ods.getConnection();
return conn;
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/AlunoDao.java
New file
0,0 → 1,170
package pt.estgp.estgweb.services.sigesimports.oracle.dao;
 
import pt.estgp.estgweb.services.sigesimports.oracle.domain.Aluno;
import pt.estgp.estgweb.services.sigesimports.oracle.domain.AlunoHistorico;
import pt.estgp.estgweb.services.sigesimports.oracle.domain.Disciplina;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class AlunoDao extends AbstractDao<Aluno> {
private static AlunoDao instance = null;
 
private AlunoDao() {
}
 
public static AlunoDao getInstance() {
if (instance == null)
instance = new AlunoDao();
return instance;
}
 
protected String getTable() {
return "CSE.T_ALUNOS";
}
 
protected String getIdColumn() {
return "CD_ALUNO";
}
 
public Aluno load(ResultSet aReader) throws SQLException {
Aluno a = new Aluno();
a.codigo = getDecimal("CD_ALUNO", aReader);
//a.nome = getString("NM_ALUNO",aReader);
a.nome = getString("NM_COMPLETO", aReader);
 
//d.nomeFuncionario = getString("NM_COMPLETO", aReader); //ok T_INDIVIDUO FALTA VER O "NOME"
//d.nomeFuncionarioInt = getString("NM_FUNC_INT", aReader);
//d.nomeFuncionario = getString("NM_ABREVIADO", aReader); //ok T_INDIVIDUO
//d.nomeAcademico = getString("NM_ACADEMICO", aReader); //ok T_INDIVIDUO
 
//a.sexo = getString("CD_SEXO", aReader);
a.sexo = getString("SEXO", aReader);
 
//a.data_nascimento = getDateTime("DT_NASCIME", aReader);
//a.morada = getString("DS_MORADA", aReader);
//a.codigoPostal = getInteger("CD_POSTAL", aReader);
//a.subCodigoPostal = getInteger("CD_SUBPOS", aReader);
//a.email = getString("DS_EMAIL", aReader);
//a.numeroBi = getString("NR_BI", aReader);
a.telemovel = getString("NR_TELEMOVEL", aReader);
 
 
a.data_nascimento = getDateTime("DT_NASCIMENTO", aReader);
a.morada = getString("DS_MORADA", aReader);
a.codigoPostal = getDecimal("CD_POSTAL", aReader);
a.subCodigoPostal = getDecimal("CD_SUBPOS", aReader);
a.email = getString("EMAIL", aReader);
a.numeroBi = getString("IDENTIFICACAO", aReader);
 
 
//a.usernameNetpa = getString("USERNAME_NETPA", aReader);
a.usernameNetpa = getString("USER_NETPA", aReader); //T_ALUNO
return a;
}
 
/*Valid with diagrams*/
public ArrayList<Integer> loadCodigosAlunos(Integer codigoInstituicao, String ano) throws SQLException {
ArrayList<Integer> codigos = new ArrayList<Integer>();
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT DISTINCT CSE.T_ALUNOS.CD_ALUNO AS CD_ALUNO FROM CSE.T_ALUNOS INNER JOIN (CSE.T_INSCRI INNER JOIN CSE.T_TBDISCIP ON CSE.T_INSCRI.CD_DISCIP = CSE.T_TBDISCIP.CD_DISCIP) ON CSE.T_ALUNOS.CD_ALUNO = CSE.T_INSCRI.CD_ALUNO WHERE (((CSE.T_TBDISCIP.CD_INSTITUIC)=" + codigoInstituicao + ") AND ((CSE.T_INSCRI.CD_LECTIVO)='" + ano + "') AND ((CSE.T_ALUNOS.CD_SITUA_PAR)=1) AND ((CSE.T_INSCRI.CD_STATUS)<>5))");
ResultSet aReader = catCMD.executeQuery();
while (aReader.next()) {
codigos.add(getDecimal("CD_ALUNO", aReader));
}
//close the reader
aReader.close();
return codigos;
}
 
public Aluno loadInscrito(Integer codigo, Integer codigoInstituicao, String ano) throws SQLException {
 
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT * FROM " + getTable() + " INNER JOIN SIGES.T_INDIVIDUO on SIGES.T_INDIVIDUO.ID_INDIVIDUO = CSE.T_ALUNOS.ID_INDIVIDUO where CD_SITUA_PAR = 1 AND " + getIdColumn() + "=" + codigo);
ResultSet aReader = catCMD.executeQuery();
if (aReader.next()) {
Aluno a = load(aReader);
a.disciplinasInscrito = (Disciplina[]) loadDiscilpinasInscrito(codigo, codigoInstituicao, ano).toArray();
a.historicos = (AlunoHistorico[]) getHistorico(codigo).toArray();
aReader.close();
return a;
}
aReader.close();
//close the reader
return null;
}
 
/*Mudar a lista para uma lista de Códigos com pelo menos CD_LECTIVO, CD_DISCIP, CD_CURSO, CD_TURMA*/
/*Do lado do Baco as Disciplinas são criadas uma por (CD_LECTIVO, CODIGO, CURSO, SEMESTRE) ficam anexadas todas as turmas encontradas*/
/* O Serviço de Leituras de Sumarios pede apenas os detalhe_aula com codigos de turma igual ao pedido e CD_LECTIVO = actual */
public ArrayList<Disciplina> loadDiscilpinasInscrito(Integer codigo, Integer codigoInstituicao, String ano) throws SQLException {
ArrayList<Disciplina> disciplinas = new ArrayList<Disciplina>();
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT " +
"CSE.T_INSCRI.CD_TIPDIS AS CD_TIPDIS, " +
"CSE.T_INSCRI.CD_DISCIP AS CD_DISCIP, " +
"CSE.T_INSCRI.CD_DURACAO AS CD_DURACAO, " +
"CSE.T_INSCRI.CD_CURSO AS CD_CURSO, " +
"CSE.T_INSCRI.CD_TURMA_T AS CD_TURMA, " +
"CSE.T_INSCRI.CD_TURMA_P, " +
"CSE.T_INSCRI.CD_TURMA_L, " +
"CSE.T_INSCRI.CD_TURMA_TP " +
"FROM CSE.T_ALUNOS INNER JOIN (CSE.T_INSCRI INNER JOIN CSE.T_TBDISCIP ON CSE.T_INSCRI.CD_DISCIP = CSE.T_TBDISCIP.CD_DISCIP) ON CSE.T_ALUNOS.CD_ALUNO = CSE.T_INSCRI.CD_ALUNO WHERE CSE.T_ALUNOS.CD_ALUNO = " + codigo + " AND (((CSE.T_TBDISCIP.CD_INSTITUIC)=" + codigoInstituicao + ") AND ((CSE.T_INSCRI.CD_LECTIVO)='" + ano + "') AND ((CSE.T_ALUNOS.CD_SITUA_PAR)=1) AND ((CSE.T_INSCRI.CD_STATUS)<>5) AND (CSE.T_INSCRI.CD_TIPDIS = 2 OR CSE.T_INSCRI.CD_TIPDIS = 1 OR CSE.T_INSCRI.CD_TIPDIS = 6))");
//CD_TIPDISC = 1 Inscricoes normais
//CD_TIPDISC = 2 Nao conta para media
//CD_TIPDISC = 3 Qualitativa
//CD_TIPDISC = 4 Equivalencia
//CD_TIPDISC = 5 Equivalencia sem nota
//CD_TIPDISC = 6 Extra Curricular
//CD_TIPDISC = 7 Suplemento Diploma
//CD_TIPDISC = 8 Integracao ou refazimento do plano de estudos
 
ResultSet aReader = catCMD.executeQuery();
while (aReader.next()) {
Disciplina d = new Disciplina();
d.codigo = getDecimal("CD_DISCIP", aReader);
d.codigoCurso = getDecimal("CD_CURSO", aReader);
d.codigoInstituicao = codigoInstituicao;
d.cdLectivo = ano;
d.cdTipoDisciplina = getDecimal("CD_TIPDIS", aReader);
d.cdDuracao = getString("CD_DURACAO", aReader);
d.cdTurma = getString("CD_TURMA", aReader);
disciplinas.add(d);
}
//close the reader
aReader.close();
return disciplinas;
}
 
/*Mudar a lista para uma lista de Códigos com pelo menos CD_LECTIVO, CD_DISCIP, CD_CURSO, CD_TURMA*/
/*Do lado do Baco as Disciplinas são criadas uma por (CD_LECTIVO, CODIGO, CURSO, SEMESTRE) ficam anexadas todas as turmas encontradas*/
/* O Serviço de Leituras de Sumarios pede apenas os detalhe_aula com codigos de turma igual ao pedido e CD_LECTIVO = actual */
public ArrayList<AlunoHistorico> getHistorico(Integer codigo) throws SQLException {
ArrayList<AlunoHistorico> historicos = new ArrayList<AlunoHistorico>();
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT CSE.T_HISTALUN.CD_LECTIVO AS CD_LECTIVO, CSE.T_HISTALUN.CD_CURSO AS CD_CURSO, CSE.T_HISTALUN.DT_MATRIC AS DT_MATRIC, CSE.T_HISTALUN.PROTEGIDO AS PROTEGIDO, CSE.T_HISTALUN.CD_PROPINA AS CD_PROPINA FROM CSE.T_HISTALUN WHERE CSE.T_HISTALUN.CD_ALUNO = " + codigo + "");
 
 
ResultSet aReader = catCMD.executeQuery();
while (aReader.next()) {
AlunoHistorico a = new AlunoHistorico();
a.codigo = codigo;
a.codigoCurso = getDecimal("CD_CURSO", aReader);
a.codigoLectivo = getString("CD_LECTIVO", aReader);
a.dataMatricula = getDateTime("DT_MATRIC", aReader);
a.propinaEmDia = getString("CD_PROPINA", aReader);
a.historicoProtegido = getString("PROTEGIDO", aReader);
historicos.add(a);
}
//close the reader
aReader.close();
return historicos;
}
 
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/LEMBRETES
New file
0,0 → 1,7
NO FINAL PROCURAR POR TODOS OS GET CONNECTION E METER CLOSES
 
meter closes nos PS quando ha closes nos RS
 
TODO ver no Aula Dao o remove trouble chars
 
Sumarios de gestão de projecto
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/AulaDao.java
New file
0,0 → 1,355
package pt.estgp.estgweb.services.sigesimports.oracle.dao;
 
import pt.estgp.estgweb.services.sigesimports.oracle.domain.Aula;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class AulaDao extends AbstractDao<Aula>
{
private static AulaDao instance = null;
 
private AulaDao() {
}
 
public static AulaDao getInstance() {
if (instance == null)
instance = new AulaDao();
return instance;
}
 
protected String getTable() {
return "CSE.T_OCUPACOES";
}
 
protected String getIdColumn() {
return null;
}
 
public static String RemoveTroublesomeCharacters(String inString) {
if (inString == null) return null;
 
StringBuilder newString = new StringBuilder();
char ch;
 
for (int i = 0; i < inString.length(); i++) {
 
ch = inString.charAt(i);
// remove any characters outside the valid UTF-8 range as well as all control characters
// except tabs and new lines
if ((ch < 0x00FD && ch > 0x001F) || ch == '\t' || ch == '\n' || ch == '\r')
//if using .NET version prior to 4, use above logic
//if (XmlConvert.IsXmlChar(ch)) //this method is new in .NET 4
{
newString.append(ch);
}
}
return newString.toString();
}
 
/*String RemoveInvalidXmlChars(String text)
{
Regex r = new Regex(@"(?<=\<\w+)[#\{\}\(\)\&](?=\>)|(?<=\</\w+)[#\{\}\(\)\&](?=\>)");
text = r.Replace(text, new MatchEvaluator(deleteMatch));
 
return text;
}
String deleteMatch(Match m) { return ""; }
*/
 
 
protected Aula load(ResultSet aReader) throws SQLException {
Aula a = new Aula();
a.data = getDateTime("DT_OCUPACAO", aReader);
a.numeroOcupacao = getDecimal("NR_OCUPACAO", aReader);
a.tipoOcupacao = getDecimal("CD_TIPO_OCUPACAO", aReader);
a.numeroCelulas = getDecimal("TOTAL_CELULAS", aReader);
a.observacoes = getString("OBSERVACOES", aReader);
a.numeroAula = getDecimal("NR_AULA", aReader);
a.horaInicial = getDecimal("HORA_INICIAL", aReader);
a.horaFinal = getDecimal("HORA_FINAL", aReader);
 
a.descricao = getString("DO_DESCRICAO", aReader);
if (a.descricao != null)
a.descricao = RemoveTroublesomeCharacters(a.descricao);
 
a.codigoSala = getDecimal("DO_CD_SALA", aReader);
a.codigoResponsavel = getDecimal("DO_CD_RESPONSAVEL", aReader);
a.codigoSituacao = getString("DO_CD_SITUACAO", aReader);
a.codigoSumario = getDecimal("DO_CD_SUMARIO", aReader);
 
a.aula_codigoLectivo = getString("DA_CD_LECTIVO", aReader);
a.aula_codigoPeriodo = getString("DA_CD_PERIODO", aReader);
a.aula_codigoDisciplina = getDecimal("DA_CD_DISCIP", aReader);
a.aula_codigoTurma = getString("DA_CD_TURMA", aReader);
a.aula_codigoDocente = getDecimal("DA_CD_DOCENTE", aReader);
a.aula_codigoSalaAula = getDecimal("DA_CD_SALA", aReader);
a.aula_codigoSumario = getDecimal("DA_CD_SUMARIO", aReader);
 
a.sum_HoraInicial = getDecimal("SUM_HORA_INICIAL", aReader);
a.sum_HoraFinal = getDecimal("SUM_HORA_FINAL", aReader);
a.sum_numeroAlunos = getDecimal("SUM_NUMERO_ALUNOS", aReader);
a.sum_numeroAula = getDecimal("SUM_NUMERO_AULA", aReader);
//
a.sum_tipoAula = "" + getDecimal("SUM_CD_TIPO_AULA", aReader);
a.sum_titulo = getString("SUM_TITULO", aReader);
if (a.sum_titulo != null)
a.sum_titulo = RemoveTroublesomeCharacters(a.sum_titulo);
a.sum_descricao = getString("SUM_DESCRICAO", aReader);
if (a.sum_descricao != null)
a.sum_descricao = RemoveTroublesomeCharacters(a.sum_descricao);
a.sum_identificador = getString("SUM_IDENTIFICADOR", aReader);
a.sum_cdEstado = getDecimal("SUM_CD_ESTADO", aReader);
a.sum_numeroPresencas = getDecimal("SUM_NR_PRESENCAS", aReader);
 
return a;
}
 
 
public ArrayList<Aula> loadAulas(Integer codigoInstituicao, String anolectivo, String codigoUnidade, String semestre, String codigoCurso) throws SQLException {
Integer limiteSalaInferior = codigoInstituicao * 1000;
Integer limiteSalaSuperior = (codigoInstituicao + 1) * 1000;
 
ArrayList<Aula> aulas = new ArrayList<Aula>();
Connection conn = getCurrentConnection();
String query;
query = "SELECT "
+ "CSH.T_OCUPACOES.DT_OCUPACAO AS DT_OCUPACAO,"
+ "CSH.T_OCUPACOES.NR_OCUPACAO AS NR_OCUPACAO,"
+ "CSH.T_OCUPACOES.CD_TIPO_OCUPACAO AS CD_TIPO_OCUPACAO,"
+ " CSH.T_OCUPACOES.TOTAL_CELULAS AS TOTAL_CELULAS,"
+ " CSH.T_OCUPACOES.OBSERVACOES AS OBSERVACOES,"
+ " CSH.T_OCUPACOES.NR_AULA AS NR_AULA,"
 
+ " CSH.T_DETALHE_OCUPACAO.DESCRICAO AS DO_DESCRICAO,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SALA AS DO_CD_SALA,"
+ " CSH.T_DETALHE_OCUPACAO.CD_RESPONSAVEL AS DO_CD_RESPONSAVEL,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SITUACAO AS DO_CD_SITUACAO,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SUMARIO AS DO_CD_SUMARIO,"
 
 
+ " CSH.T_DETALHE_AULA.CD_LECTIVO AS DA_CD_LECTIVO ,"
+ " CSH.T_DETALHE_AULA.CD_PERIODO AS DA_CD_PERIODO ,"
+ " CSH.T_DETALHE_AULA.CD_DISCIP AS DA_CD_DISCIP ,"
+ " CSH.T_DETALHE_AULA.CD_TURMA AS DA_CD_TURMA ,"
+ " CSH.T_DETALHE_AULA.CD_DOCENTE AS DA_CD_DOCENTE ,"
+ " CSH.T_DETALHE_AULA.CD_SALA AS DA_CD_SALA ,"
+ " CSH.T_DETALHE_AULA.CD_SUMARIO AS DA_CD_SUMARIO ,"
 
 
+ " CSD.T_SUMARIOS_AULAS.HORA_INICIAL AS SUM_HORA_INICIAL ,"
+ " CSD.T_SUMARIOS_AULAS.HORA_FINAL AS SUM_HORA_FINAL ,"
+ " CSD.T_SUMARIOS_AULAS.NUMERO_ALUNOS AS SUM_NUMERO_ALUNOS ,"
+ " CSD.T_SUMARIOS_AULAS.NUMERO_AULA AS SUM_NUMERO_AULA ,"
+ " CSD.T_SUMARIOS_AULAS.CD_TIPO_AULA AS SUM_CD_TIPO_AULA ,"
+ " CSD.T_SUMARIOS_AULAS.TITULO AS SUM_TITULO ,"
+ " CSD.T_SUMARIOS_AULAS.DESCRICAO AS SUM_DESCRICAO ,"
+ " CSD.T_SUMARIOS_AULAS.IDENTIFICADOR AS SUM_IDENTIFICADOR ,"
+ " CSD.T_SUMARIOS_AULAS.CD_ESTADO AS SUM_CD_ESTADO ,"
+ " CSD.T_SUMARIOS_AULAS.NR_PRESENCAS AS SUM_NR_PRESENCAS,"
+ " CSD.T_SUMARIOS_AULAS.HORA_INICIAL AS HORA_INICIAL,"
+ " CSD.T_SUMARIOS_AULAS.HORA_FINAL AS HORA_FINAL"
 
+ " FROM "
 
+ " ((((CSH.T_OCUPACOES LEFT OUTER JOIN CSH.T_DETALHE_OCUPACAO ON "
 
+ " CSH.T_DETALHE_OCUPACAO.CAMPO_REFERENCIA = CSH.T_OCUPACOES.CAMPO_REFERENCIA"
+ " AND"
+ " CSH.T_DETALHE_OCUPACAO.DT_OCUPACAO = CSH.T_OCUPACOES.DT_OCUPACAO"
+ " AND"
+ " CSH.T_DETALHE_OCUPACAO.NR_OCUPACAO = CSH.T_OCUPACOES.NR_OCUPACAO"
+ " )"
+ " LEFT OUTER JOIN CSH.T_DETALHE_AULA ON"
+ " CSH.T_DETALHE_AULA.CAMPO_REFERENCIA = CSH.T_OCUPACOES.CAMPO_REFERENCIA"
+ " AND"
+ " CSH.T_DETALHE_AULA.DT_OCUPACAO = CSH.T_OCUPACOES.DT_OCUPACAO"
+ " AND"
+ " CSH.T_DETALHE_AULA.NR_OCUPACAO = CSH.T_OCUPACOES.NR_OCUPACAO"
+ " )"
+ " LEFT OUTER JOIN CSD.T_SUMARIOS_AULAS ON"
+ " CSD.T_SUMARIOS_AULAS.CD_SUMARIO = CSH.T_DETALHE_AULA.CD_SUMARIO"
+ " )"
+ " LEFT OUTER JOIN CSE.T_TURMA ON"
+ " CSH.T_DETALHE_AULA.CD_TURMA = CSE.T_TURMA.CD_TURMA"
+ " AND"
+ " CSH.T_DETALHE_AULA.CD_LECTIVO = CSE.T_TURMA.CD_LECTIVO"
+ " AND"
+ " CSH.T_DETALHE_AULA.CD_PERIODO = CSE.T_TURMA.CD_DURACAO"
+ " AND"
+ " CSH.T_DETALHE_AULA.CD_DISCIP = CSE.T_TURMA.CD_DISCIP "
+ " )"
+ " WHERE "
//+ " CD_DOCENTE = 20128 AND CD_LECTIVO = '200708'";
+ " CSH.T_DETALHE_AULA.CD_DISCIP = " + codigoUnidade
+ " AND CSH.T_DETALHE_AULA.CD_LECTIVO = '" + anolectivo + "'"
+ " AND CSH.T_DETALHE_AULA.CD_SALA > " + limiteSalaInferior + " AND CSH.T_DETALHE_AULA.CD_SALA < " + limiteSalaSuperior
+ " AND CSH.T_DETALHE_AULA.CD_PERIODO = '" + semestre + "'"
+ " AND (CSE.T_TURMA.CD_CURSO = '" + codigoCurso + "' OR CSE.T_TURMA.CD_CURSO is NULL)"
+ " order by CSH.T_OCUPACOES.DT_OCUPACAO asc";
 
PreparedStatement catCMD = conn.prepareStatement(query);
ResultSet aReader = catCMD.executeQuery();
while (aReader.next()) {
aulas.add(load(aReader));
}
//close the reader
aReader.close();
catCMD.close();
conn.close();
return aulas;
}
 
 
/**
* @deprecated
* @param aReader
* @return
* @throws SQLException
*/
private Aula loadSum(ResultSet aReader) throws SQLException {
Aula a = new Aula();
//a.data = getDateTime("DT_OCUPACAO", aReader);
//a.numeroOcupacao = getDecimal("NR_OCUPACAO", aReader);
//a.tipoOcupacao = getDecimal("CD_TIPO_OCUPACAO", aReader);
//a.numeroCelulas = getDecimal("TOTAL_CELULAS", aReader);
//a.observacoes = getString("OBSERVACOES", aReader);
//a.numeroAula = getDecimal("NR_AULA", aReader);
 
//a.descricao = getString("DO_DESCRICAO", aReader);
//a.codigoSala = getDecimal("DO_CD_SALA", aReader);
//a.codigoResponsavel = getDecimal("DO_CD_RESPONSAVEL", aReader);
//a.codigoSituacao = getString("DO_CD_SITUACAO", aReader);
//a.codigoSumario = getDecimal("DO_CD_SUMARIO", aReader);
 
a.aula_codigoLectivo = getString("DA_CD_LECTIVO", aReader);
a.aula_codigoPeriodo = getString("DA_CD_PERIODO", aReader);
a.aula_codigoDisciplina = getDecimal("DA_CD_DISCIP", aReader);
a.aula_codigoTurma = getString("DA_CD_TURMA", aReader);
a.aula_codigoDocente = getDecimal("DA_CD_DOCENTE", aReader);
a.aula_codigoSalaAula = getDecimal("DA_CD_SALA", aReader);
a.aula_codigoSumario = getDecimal("DA_CD_SUMARIO", aReader);
 
/*
a.sum_HoraInicial = getDecimal("SUM_HORA_INICIAL", aReader);
a.sum_HoraFinal = getDecimal("SUM_HORA_FINAL", aReader);
a.sum_numeroAlunos = getDecimal("SUM_NUMERO_ALUNOS", aReader);
a.sum_numeroAula = getDecimal("SUM_NUMERO_AULA", aReader);
//
a.sum_tipoAula = "" + getDecimal("SUM_CD_TIPO_AULA", aReader);
a.sum_titulo = getString("SUM_TITULO", aReader);
a.sum_descricao = getString("SUM_DESCRICAO", aReader);
a.sum_identificador = getString("SUM_IDENTIFICADOR", aReader);
a.sum_cdEstado = getDecimal("SUM_CD_ESTADO", aReader);
a.sum_numeroPresencas = getDecimal("SUM_NR_PRESENCAS", aReader);
*/
return a;
}
 
/**
* @deprecated apenas para testes
* @param codigoInstituicao
* @param anolectivo
* @param codigoUnidade
* @param semestre
* @return
* @throws SQLException
*/
private ArrayList<Aula> loadSumarios(Integer codigoInstituicao, String anolectivo, String codigoUnidade, String semestre) throws SQLException {
Integer limiteSalaInferior = codigoInstituicao * 1000;
Integer limiteSalaSuperior = (codigoInstituicao + 1) * 1000;
 
ArrayList<Aula> aulas = new ArrayList<Aula>();
Connection conn = getCurrentConnection();
String query;
query = "SELECT "
/*
+ "CSH.T_OCUPACOES.DT_OCUPACAO AS DT_OCUPACAO,"
+ "CSH.T_OCUPACOES.NR_OCUPACAO AS NR_OCUPACAO,"
+ "CSH.T_OCUPACOES.CD_TIPO_OCUPACAO AS CD_TIPO_OCUPACAO,"
+ " CSH.T_OCUPACOES.TOTAL_CELULAS AS TOTAL_CELULAS,"
+ " CSH.T_OCUPACOES.OBSERVACOES AS OBSERVACOES,"
+ " CSH.T_OCUPACOES.NR_AULA AS NR_AULA,"
 
+ " CSH.T_DETALHE_OCUPACAO.DESCRICAO AS DO_DESCRICAO,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SALA AS DO_CD_SALA,"
+ " CSH.T_DETALHE_OCUPACAO.CD_RESPONSAVEL AS DO_CD_RESPONSAVEL,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SITUACAO AS DO_CD_SITUACAO,"
+ " CSH.T_DETALHE_OCUPACAO.CD_SUMARIO AS DO_CD_SUMARIO,"
 
*/
+ " CSH.T_DETALHE_AULA.CD_LECTIVO AS DA_CD_LECTIVO ,"
+ " CSH.T_DETALHE_AULA.CD_PERIODO AS DA_CD_PERIODO ,"
+ " CSH.T_DETALHE_AULA.CD_DISCIP AS DA_CD_DISCIP ,"
+ " CSH.T_DETALHE_AULA.CD_TURMA AS DA_CD_TURMA ,"
+ " CSH.T_DETALHE_AULA.CD_DOCENTE AS DA_CD_DOCENTE ,"
+ " CSH.T_DETALHE_AULA.CD_SALA AS DA_CD_SALA ,"
+ " CSH.T_DETALHE_AULA.CD_SUMARIO AS DA_CD_SUMARIO " //,"
 
/*
 
+ " CSD.T_SUMARIOS_AULAS.HORA_INICIAL AS SUM_HORA_INICIAL ,"
+ " CSD.T_SUMARIOS_AULAS.HORA_FINAL AS SUM_HORA_FINAL ,"
+ " CSD.T_SUMARIOS_AULAS.NUMERO_ALUNOS AS SUM_NUMERO_ALUNOS ,"
+ " CSD.T_SUMARIOS_AULAS.NUMERO_AULA AS SUM_NUMERO_AULA ,"
+ " CSD.T_SUMARIOS_AULAS.CD_TIPO_AULA AS SUM_CD_TIPO_AULA ,"
+ " CSD.T_SUMARIOS_AULAS.TITULO AS SUM_TITULO ,"
+ " CSD.T_SUMARIOS_AULAS.DESCRICAO AS SUM_DESCRICAO ,"
+ " CSD.T_SUMARIOS_AULAS.IDENTIFICADOR AS SUM_IDENTIFICADOR ,"
+ " CSD.T_SUMARIOS_AULAS.CD_ESTADO AS SUM_CD_ESTADO ,"
+ " CSD.T_SUMARIOS_AULAS.NR_PRESENCAS AS SUM_NR_PRESENCAS"
*/
+ " FROM "
 
/*
*
*/
+ " CSH.T_DETALHE_AULA " //LEFT OUTER JOIN CSH.T_DETALHE_AULA ON"
//+ " CSD.T_SUMARIOS_AULAS.CD_SUMARIO = CSH.T_DETALHE_AULA.CD_SUMARIO "
/**/
 
/**
+ " (((CSH.T_OCUPACOES LEFT OUTER JOIN CSH.T_DETALHE_OCUPACAO ON "
 
+ " CSH.T_DETALHE_OCUPACAO.CAMPO_REFERENCIA = CSH.T_OCUPACOES.CAMPO_REFERENCIA"
+ " AND"
+ " CSH.T_DETALHE_OCUPACAO.DT_OCUPACAO = CSH.T_OCUPACOES.DT_OCUPACAO"
+ " AND"
+ " CSH.T_DETALHE_OCUPACAO.NR_OCUPACAO = CSH.T_OCUPACOES.NR_OCUPACAO"
+ " )"
+ " LEFT OUTER JOIN CSH.T_DETALHE_AULA ON"
+ " CSH.T_DETALHE_AULA.CAMPO_REFERENCIA = CSH.T_OCUPACOES.CAMPO_REFERENCIA"
+ " AND"
+ " CSH.T_DETALHE_AULA.DT_OCUPACAO = CSH.T_OCUPACOES.DT_OCUPACAO"
+ " AND"
+ " CSH.T_DETALHE_AULA.NR_OCUPACAO = CSH.T_OCUPACOES.NR_OCUPACAO"
+ " )"
+ " LEFT OUTER JOIN CSD.T_SUMARIOS_AULAS ON"
+ " CSD.T_SUMARIOS_AULAS.CD_SUMARIO = CSH.T_DETALHE_AULA.CD_SUMARIO"
+ " )"*/
+ " WHERE "
//+ " CD_DOCENTE = 20128 AND CD_LECTIVO = '200708'";
+ " CSH.T_DETALHE_AULA.CD_DISCIP = " + codigoUnidade
+ " AND CSH.T_DETALHE_AULA.CD_LECTIVO = '" + anolectivo + "'";
//+ " AND CSH.T_DETALHE_AULA.CD_SALA > " + limiteSalaInferior + " AND CSH.T_DETALHE_AULA.CD_SALA < " + limiteSalaSuperior
//+ " AND CSH.T_DETALHE_AULA.CD_PERIODO = '" + semestre + "'";
// + " order by CSH.T_OCUPACOES.DT_OCUPACAO asc";
 
PreparedStatement catCMD = conn.prepareStatement(query);
ResultSet aReader = catCMD.executeQuery();
while (aReader.next()) {
aulas.add(loadSum(aReader));
}
 
//close the reader
aReader.close();
return aulas;
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/AbstractDao.java
New file
0,0 → 1,104
package pt.estgp.estgweb.services.sigesimports.oracle.dao;
 
import pt.estgp.estgweb.services.sigesimports.oracle.dao.connection.ConnectionManager;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public abstract class AbstractDao<CLAZZ>
{
 
protected Connection getCurrentConnection() throws SQLException
{
return ConnectionManager.openConnection();
}
 
protected abstract String getTable();
 
protected abstract String getIdColumn();
 
protected abstract CLAZZ load(ResultSet rs) throws SQLException;
 
protected CLAZZ load(Integer codigo) throws SQLException
{
 
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT * FROM " + getTable() + " where " + getIdColumn() + "=" + codigo);
ResultSet rs = catCMD.executeQuery();
if (rs.next())
{
CLAZZ c = load(rs);
rs.close();
catCMD.close();
return c;
}
rs.close();
catCMD.close();
//close the reader
return null;
}
 
protected ArrayList<CLAZZ> loadAll() throws SQLException {
ArrayList<CLAZZ> l = new ArrayList<CLAZZ>();
Connection conn = getCurrentConnection();
PreparedStatement catCMD = conn.prepareStatement("SELECT * FROM " + getTable() + " where ROWNUM < 10");
ResultSet rs = catCMD.executeQuery();
if (rs.next())
{
CLAZZ c = load(rs);
l.add(c);
}
//close the reader
rs.close();
catCMD.close();
return l;
}
 
protected Integer getDecimal(String column, ResultSet aReader) throws SQLException {
if (aReader.getObject(column)==null)
return -1;
else
return aReader.getInt(column);
}
 
protected String getString(String column,ResultSet aReader) throws SQLException {
if (aReader.getObject(column)==null)
return null;
else
return aReader.getString(column);
}
 
 
/*
public Int32 getInt32(string column, OdbcDataReader aReader)
{
if (aReader.IsDBNull(aReader.GetOrdinal(column)))
return -1;
else
return aReader.GetInt32(aReader.GetOrdinal(column));
}
 
public Int64 getInt64(string column, OdbcDataReader aReader)
{
if (aReader.IsDBNull(aReader.GetOrdinal(column)))
return -1;
else
return aReader.GetInt64(aReader.GetOrdinal(column));
}
*/
 
protected Date getDateTime(String column, ResultSet aReader) throws SQLException {
if (aReader.getObject(column)==null)
return new Date(0);
else
return new Date(aReader.getTimestamp(column).getTime());
}
 
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/OracleConnectionTest.java
New file
0,0 → 1,39
package pt.estgp.estgweb.services.sigesimports.oracle;
 
import oracle.jdbc.pool.OracleDataSource;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class OracleConnectionTest
{
public static void main(String[] args) throws SQLException
{
OracleDataSource ods = new OracleDataSource();
ods.setUser("estgac");
ods.setPassword("estgac11");
ods.setURL("jdbc:oracle:thin:@localhost:1521:SIGES11");
 
// Connect to the database
Connection conn = ods.getConnection();
 
 
System.out.println();
 
// Prepare a statement to cleanup the employees table
PreparedStatement ps = conn.prepareStatement("SELECT DISTINCT CSE.T_TBDISCIP.CD_DISCIP AS CD_DISCIP, CSE.T_TBDISCIP.DS_DISCIP AS DS_DISCIP, CSE.T_TBDISCIP.CD_INSTITUIC AS CD_INSTITUIC, CSE.T_INSCRI.CD_CURSO AS CD_CURSO, CSE.T_CURSOS.NM_CURSO AS NM_CURSO, CSE.T_CURSOS.CD_GRAU1 AS CD_GRAU1 FROM CSE.T_INSCRI INNER JOIN CSE.T_TBDISCIP ON CSE.T_INSCRI.CD_DISCIP=CSE.T_TBDISCIP.CD_DISCIP INNER JOIN CSE.T_CURSOS ON CSE.T_CURSOS.CD_CURSO = CSE.T_INSCRI.CD_CURSO WHERE (((CSE.T_TBDISCIP.CD_INSTITUIC)=1) AND ((CSE.T_INSCRI.CD_LECTIVO)='201516')) AND (CSE.T_INSCRI.CD_TIPDIS = 1)");
ResultSet rs = ps.executeQuery();
while(rs.next())
{
System.out.println(rs.getString("CD_DISCIP") + ";" + rs.getString("DS_DISCIP"));
}
rs.close();
ps.close();
conn.close();
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/domain/Disciplina.java
New file
0,0 → 1,31
package pt.estgp.estgweb.services.sigesimports.oracle.domain;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class Disciplina
{
 
 
public Integer codigo;
public String cdLectivo;
public Integer codigoCurso;
public String cdDuracao;
public Integer codigoInstituicao;
public String cdTurma;
 
 
public String nome;
public String nomeCurso;
public String grauCurso;
//Tipo 1 ou 6 no caso de ser 6 ignorar o codigo do curso e olhar para a Turma
//Da turma tirar o código do curso
//No caso de haver mais que um curso nos pares Curso Turma reportar Inconsistencia e avisar administradores
//Mas isto tudo do lado do Baco
public Integer cdTipoDisciplina;
 
public Disciplina()
{
 
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/domain/AlunoHistorico.java
New file
0,0 → 1,20
package pt.estgp.estgweb.services.sigesimports.oracle.domain;
 
import java.util.Date;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class AlunoHistorico
{
public Integer codigo;
public String codigoLectivo;
public Integer codigoCurso;
public Date dataMatricula;
public String historicoProtegido;
public String propinaEmDia;
 
public AlunoHistorico()
{
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/domain/Aula.java
New file
0,0 → 1,183
package pt.estgp.estgweb.services.sigesimports.oracle.domain;
 
import java.util.Date;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class Aula {
 
public Date data;
public Integer numeroOcupacao;
public Integer tipoOcupacao;
public Integer duracao;
public Integer numeroCelulas;
public String observacoes;
public Integer numeroAula;
public Integer horaInicial;
public Integer horaFinal;
 
//novo
public String codigoCurso;
 
//DETALHE OCUPACAO
public String descricao;
public Integer codigoSala;
public Integer codigoResponsavel;
public String codigoSituacao;
public Integer codigoSumario;
 
//Aula
public String aula_codigoLectivo;
public Integer aula_codigoDisciplina;
public String aula_codigoPeriodo;
public String aula_codigoTurma;
public Integer aula_codigoDocente;
public Integer aula_codigoSumario;
public Integer aula_codigoSalaAula;
 
//Sumario
public Integer sum_HoraInicial;
public Integer sum_HoraFinal;
public Integer sum_numeroAlunos;
public Integer sum_numeroAula;
public String sum_tipoAula;
public String sum_titulo;
public String sum_descricao;
public String sum_identificador;
public Integer sum_cdEstado;
public Integer sum_numeroPresencas;
 
public Aula()
{
 
}
 
public Date getData() {
return data;
}
 
public Integer getNumeroOcupacao() {
return numeroOcupacao;
}
 
public Integer getTipoOcupacao() {
return tipoOcupacao;
}
 
public Integer getDuracao() {
return duracao;
}
 
public Integer getNumeroCelulas() {
return numeroCelulas;
}
 
public String getObservacoes() {
return observacoes;
}
 
public Integer getNumeroAula() {
return numeroAula;
}
 
public Integer getHoraInicial() {
return horaInicial;
}
 
public Integer getHoraFinal() {
return horaFinal;
}
 
public String getCodigoCurso() {
return codigoCurso;
}
 
public String getDescricao() {
return descricao;
}
 
public Integer getCodigoSala() {
return codigoSala;
}
 
public Integer getCodigoResponsavel() {
return codigoResponsavel;
}
 
public String getCodigoSituacao() {
return codigoSituacao;
}
 
public Integer getCodigoSumario() {
return codigoSumario;
}
 
public String getAula_codigoLectivo() {
return aula_codigoLectivo;
}
 
public Integer getAula_codigoDisciplina() {
return aula_codigoDisciplina;
}
 
public String getAula_codigoPeriodo() {
return aula_codigoPeriodo;
}
 
public String getAula_codigoTurma() {
return aula_codigoTurma;
}
 
public Integer getAula_codigoDocente() {
return aula_codigoDocente;
}
 
public Integer getAula_codigoSumario() {
return aula_codigoSumario;
}
 
public Integer getAula_codigoSalaAula() {
return aula_codigoSalaAula;
}
 
public Integer getSum_HoraInicial() {
return sum_HoraInicial;
}
 
public Integer getSum_HoraFinal() {
return sum_HoraFinal;
}
 
public Integer getSum_numeroAlunos() {
return sum_numeroAlunos;
}
 
public Integer getSum_numeroAula() {
return sum_numeroAula;
}
 
public String getSum_tipoAula() {
return sum_tipoAula;
}
 
public String getSum_titulo() {
return sum_titulo;
}
 
public String getSum_descricao() {
return sum_descricao;
}
 
public String getSum_identificador() {
return sum_identificador;
}
 
public Integer getSum_cdEstado() {
return sum_cdEstado;
}
 
public Integer getSum_numeroPresencas() {
return sum_numeroPresencas;
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/domain/Aluno.java
New file
0,0 → 1,30
package pt.estgp.estgweb.services.sigesimports.oracle.domain;
 
import java.util.Date;
 
/**
* Created by jorgemachado on 07/01/16.
*/
public class Aluno
{
public Integer codigo;
public String nome;
public String telemovel;
public String sexo;
public Date data_nascimento;
public String morada;
public Integer codigoPostal;
public Integer subCodigoPostal;
public String email;
public String numeroBi;
public String usernameNetpa;
public Disciplina[] disciplinasInscrito;
public AlunoHistorico[] historicos;
 
public Aluno()
{
//
// TODO: Add constructor logic here
//
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java
40,12 → 40,14
 
private static final Logger logger = Logger.getLogger(ImportTeachersService.class);
 
private static final int MAX_COMMIT = 100;
private static final int MAX_COMMIT = 20;
 
//int studentsMerged = 0;
int teachersNew = 0;
int teachersZeroUnits = 0;
int unitsNotFound = 0;
int unitsNotFoundCourseNotFound = 0;
int unitsFoundForCourseNotFound = 0;
int unitsAddedToTeachers = 0;
int unitsRemovedToTeachers = 0;
int unitsLocalAddedNotRemoved = 0;
61,6 → 63,8
teachersNew = 0;
teachersZeroUnits = 0;
unitsNotFound = 0;
unitsNotFoundCourseNotFound = 0;
unitsFoundForCourseNotFound = 0;
unitsAddedToTeachers = 0;
unitsRemovedToTeachers = 0;
unitsLocalAddedNotRemoved = 0;
103,8 → 107,7
{
i = 0;
setProgress((int) (((float)teachersFound)/((float)codigos.size())*100.0f));
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
commitPartially();
}
 
 
122,7 → 125,7
t = DomainObjectFactory.createTeacherImpl();
DaoFactory.getTeacherDaoImpl().save(t);
newUser = true;
teachersNew++;
//teachersNew++;
}
else
{
135,7 → 138,7
serviceLogInfo(msgS);
try
{
persist(d, t, newUser,year);
persist(d, t, newUser,year,logMessages);
}
catch (Exception e)
{
177,23 → 180,47
throw new ServiceException(e.toString(), e);
}
 
 
 
 
 
 
serviceLogInfo("############################");
serviceLogInfo("############################");
serviceLogInfo("#Teachers found: " + teachersFound);
serviceLogInfo("#Teachers New: " + teachersNew);
serviceLogInfo("#Teachers Zero Units: " + teachersZeroUnits);
serviceLogInfo("#Units not found: " + unitsNotFound);
serviceLogInfo("#Units with NULL COURSE : " + unitsNotFoundCourseNotFound);
serviceLogInfo("#Units removed to Teachers: " + unitsRemovedToTeachers);
serviceLogInfo("#Units added to Teachers: " + unitsAddedToTeachers);
serviceLogInfo("#Units not Removed because localy added: " + unitsLocalAddedNotRemoved);
serviceLogInfo("#Units not Added because localy removed: " + unitsLocallyRemovedNotAdded);
 
logger.info("############################");
logger.info("############################");
logger.info("#Teachers found: " + teachersFound);
logger.info("#Teachers New: " + teachersNew);
logger.info("#Teachers Zero Units: " + teachersZeroUnits);
logger.info("#Units not found: " + unitsNotFound);
logger.info("#Units with NULL COURSE : " + unitsNotFoundCourseNotFound);
logger.info("#Units removed to Teachers: " + unitsRemovedToTeachers);
logger.info("#Units added to Teachers: " + unitsAddedToTeachers);
logger.info("#Units not Removed because localy added: " + unitsLocalAddedNotRemoved);
logger.info("#Units not Added because localy removed: " + unitsLocallyRemovedNotAdded);
 
 
if(teachersChangeBI>0)
{
serviceLogInfo("#>>>>>AVISO AVISO<<<<<<<<<: ");
serviceLogInfo("#>>>>>AVISO AVISO<<<<<<<<<: ");
serviceLogInfo("#>>>>>NUMEROS DE PROFESSORES MUDARAM DE BI<<<<<<<<<: CONSULTAR LOG");
serviceLogInfo("#CODIGO SIGES COM BIs DIFERENTES:" + teachersChangeBI);
 
logger.info("#>>>>>AVISO AVISO<<<<<<<<<: ");
logger.info("#>>>>>AVISO AVISO<<<<<<<<<: ");
logger.info("#>>>>>NUMEROS DE PROFESSORES MUDARAM DE BI<<<<<<<<<: CONSULTAR LOG");
logger.info("#CODIGO SIGES COM BIs DIFERENTES:" + teachersChangeBI);
}
setProgress(100);
 
222,6 → 249,7
List<String> arguments = new ArrayList<String>();
arguments.add(cause.replace("\n","<br/>"));
Email email = new Email(subject,emails,Globals.SYSTEM_EMAIL_BOX,"messageToAdmin_pt.txt",arguments);
email.setHtml(true);
try {
new SendEmailService().sendEmail(email);
} catch (ServiceException e) {
302,11 → 330,14
* @param teacher teacher
* @throws Exception .
*/
private void persist(Docente teacherSiges, Teacher teacher, boolean newUser, String year) throws Exception
private void persist(Docente teacherSiges, Teacher teacher, boolean newUser, String year,DefaultLogMessages logmessages) throws Exception
{
String msgS;
 
 
if(teacherSiges.getCodigoFuncionario().longValue()==20115)
System.out.println("Sergio");
if(teacherSiges.getCodigoFuncionario().longValue()==20219)
System.out.println("Eliseu");
try
{
 
325,14 → 356,14
 
builder.append("ATENCAO NUMERO DE PROFESSOR " + teacherSiges.getCodigoFuncionario() + " MUDOU DE DONO VAI SER BLOQUEADO IMEDIATAMENTE\n");
builder.append("ALTERANDO DADOS DO PROFESSOR " + teacherSiges.getCodigoFuncionario() + "\n");
builder.append("<<<<<<<ANTES: " + "\n");
builder.append("<<<<<<<BI: " + teacher.getBi() + "\n");
builder.append("<<<<<<<Nome: " + teacher.getName() + "\n");
builder.append("<<<<<<<Username: " + teacher.getUserNameNetpa() + "\n");
builder.append("<<<<<<<Address: " + teacher.getAddress() + "\n");
builder.append("<<<<<<<Zip: " + teacher.getZip() + "\n");
builder.append("<<<<<<<Email: " + teacher.getEmail() + "\n");
builder.append("<<<<<<<Phone: " + teacher.getPhonenumber() + "\n");
builder.append("-------ANTES: " + "\n");
builder.append("-------BI: " + teacher.getBi() + "\n");
builder.append("-------Nome: " + teacher.getName() + "\n");
builder.append("-------Username: " + teacher.getUserNameNetpa() + "\n");
builder.append("-------Address: " + teacher.getAddress() + "\n");
builder.append("-------Zip: " + teacher.getZip() + "\n");
builder.append("-------Email: " + teacher.getEmail() + "\n");
builder.append("-------Phone: " + teacher.getPhonenumber() + "\n");
 
cloneFields(teacherSiges, teacher);
 
426,16 → 457,74
Set<CourseUnit> units = new HashSet<CourseUnit>();
for (Disciplina disciplina : teacherSiges.getDisciplinas().getDisciplina())
{
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(), "" + disciplina.getCodigoCurso(), "" + disciplina.getCdDuracao(), "" + disciplina.getCdLectivo());
List<CourseUnit> loadedunits = new ArrayList<CourseUnit>();
if(disciplina.getCodigoCurso().intValue() < 0)
{
//TODO -- CASO ESPECIAL TEM DE SER TRATADO DE FORMA ESPECIAL
//TODO -- ISTO VAI OBRIGAR A FAZER O MESMO PROCESSO N VEZES MUDAMOS PARA UMA LISTA DE LOADEDUNITS
//TODO -- TEMOS MESMO DE IR BUSCAR AS CADEIRAS AO MAPA DAS TURMAS PRIMEIRO, O MAPA DEVOLVE O CURSO REAL DA TURMA??? PODE SER QUE NAO
//TODO -- >>>>>NO CASO DA IMPORTACAO DE ESTUDANTES JA GARANTIMOS QUE A TROCA DE CURSO E FEITA PARA O CORRECTO<<<<<<<
//TODO -- OU SEJA SE OPTASSEMOS POR IR BUSCAR O CURSO REAL AO MAPA: 1) Caso seja apenas 1 para essa turma é esse o curso real,
//TODO -- mas nesse caso também existe apenas uma cadeira com essa Turma que é nesse curso
//TODO -- que é precisamente a cadeira com o curso real, será? pode haver uma cadeira noutro curso nessa turma se o mapa der um curso real unico? Nao.
//TODO -- O WEB SERVICE DEVOLVE TODAS AS COMBINACOES POSSIVEIS ASSUMIDAS DE INSCRICOES NORMAIS COM CD_TIPDISC = 1 ou 2
//TODO -- Caso 2) Caso haja duas metemos o docente em todas as cadeiras possiveis (CASO ESCPECIAL), ou as guardamos no mapa de cursos reais,
//TODO -- ou então vamos à base de dados buscar todas as possiveis e metemos o docente em todas.
//TODO -- PORTANTO AS CADEIRAS QUE TEMOS NA NOSSA BD JA SAO APENAS AS VALIDAS GARANTIDAS NA IMPORTACAO DE ESTUDANTES
//TODO -- NAO HA CURSO VINDO DO WEB-SERVICE METEMOS O DOCENTE COM TODAS AS POSSIVEIS CONSIDERANDO A TURMA
//TODO -- FORMA DE ENCONTRAR A TURMA DEPOIS, TEM DE MUDAR PORQUE VAI MUDAR DE TABELA
 
if (courseUnit == null)
//TODO -- Isto vai passar a vir com Tipologias. Muda alguma coisa? A mesma cadeira vem duas vezes, mas o procedimento tem de ser o mesmo para as duas vezes
//TODO -- que ela é devolvida, caso já exista nao se faz nada, pode-se meter na lista à mesma, fica lá duas vezes, sera?
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUniqueAllCourses("" + disciplina.getCodigo(), "" + disciplina.getCdDuracao(), "" + disciplina.getCdLectivo(), disciplina.getCdTurma());
if(courseUnits!=null)
loadedunits = courseUnits;
 
if(loadedunits.size() > 0)
{
msgS = "Unit No Course -> course = " + disciplina.getCodigoCurso().intValue() + " semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " year:" + disciplina.getCdLectivo()
+ " will load of all possible courses:{ ";
for(CourseUnit cc : courseUnits)
{
msgS+= cc.getCourseCode() + ",";
}
msgS+=" } all added to teacher: " + teacher.getSigesCode();
logmessages.addMessage(new DefaultLogMessage("import.teachers", LogMessageTypeEnum.WARNING,msgS ));
unitsFoundForCourseNotFound++;
}
}
else{
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(), "" + disciplina.getCodigoCurso(), "" + disciplina.getCdDuracao(), "" + disciplina.getCdLectivo(),disciplina.getCdTurma());
if(courseUnit != null)
loadedunits.add(courseUnit);
 
}
 
//Ja todas as unidades tem todas turma, um dos docentes vai perder uma e o outro docente perde a outra
//por exemplo uma que era dos dois vai continuar nos dois e será removida de um deles
//a outra será adicionada
 
if (loadedunits.size() == 0)
{
msgS = "Unit not found: semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + disciplina.getCodigoCurso() + " year:" + disciplina.getCdLectivo();
unitsNotFound++;
if(disciplina.getCodigoCurso()==null || disciplina.getCodigoCurso().intValue() < 0)
{
unitsNotFoundCourseNotFound++;
msgS += "... unit with No Course Found in SIGES";
logmessages.addMessage(new DefaultLogMessage("import.teachers", LogMessageTypeEnum.WARNING,msgS ));
}
else
{
msgS += "... probably unit with zero students not imported in CoursesImport";
}
logger.warn(msgS);
serviceLogWarn(msgS);
 
}
else
units.add(courseUnit);
units.addAll(loadedunits);
}
//PASSO 2
Iterator<CourseUnit> iter = units.iterator();
469,7 → 558,7
}
if (!isIn)
{
String msg = "Adicionando unidade: " + ((CourseUnitImpl)c).getSigesUniqueIdentifiers() + " - ao teacher: " + teacher.getSigesCode() + " - Associacao nova no SIGES";
String msg = "Adicionando unidade: " + ((CourseUnitImpl)c).getSigesUniqueIdentifiers() + " - ao teacher: " + teacher.getSigesCode() + " turma " + c.getCdTurma() + " - Associacao nova no SIGES";
serviceLogInfo(msg);
logger.info(msg);
unitsAddedToTeachers++;
511,12 → 600,14
if(!added)
{
 
if(!tImpl.isLocalRemovedUnit(cUNow))
if(!tImpl.isLocalUnit(cUNow))
{
String msg = "Removendo unidade: " + ((CourseUnitImpl)cUNow).getSigesUniqueIdentifiers() + " - do docente: " + teacher.getSigesCode() + " - Associacao desapareceu do SIGES";
//todo e tirar a linha de baixo no futuro - String msg = "Removendo unidade: " + ((CourseUnitImpl)cUNow).getSigesUniqueIdentifiers() + " - do docente: " + teacher.getSigesCode() + " - Associacao desapareceu do SIGES";
String msg = "Temporariamente não mas sim adicionando localmente, Removendo unidade: " + ((CourseUnitImpl)cUNow).getSigesUniqueIdentifiers() + " - do docente: " + teacher.getSigesCode() + " - Associacao desapareceu do SIGES";
((TeacherImpl)tImpl).addUnitLocaly(cUNow);
serviceLogInfo(msg);
logger.info(msg);
iterNowUnits.remove();
//todo iterNowUnits.remove();
unitsRemovedToTeachers++;
}
else
549,11 → 640,10
}
 
@Override
protected void runJobServiceTask() throws Throwable {
protected ILogMessages runJobServiceTask() throws Throwable {
 
String importYear = (String) getParametersMap().get(JOB_importYear_KEY).getObject();
run(importYear);
 
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
return run(importYear);
}
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportCourseService.java
19,9 → 19,7
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessages;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Email;
import pt.ipportalegre.siges.web.services.ArrayOfDisciplina;
import pt.ipportalegre.siges.web.services.Disciplina;
import pt.ipportalegre.siges.web.services.SiGesWEB;
import pt.ipportalegre.siges.web.services.*;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import javax.xml.namespace.QName;
60,6 → 58,10
HashMap<String, Disciplina> disciplinasMapS1 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapS2 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapA = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapT1 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapT2 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapT3 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapT4 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> cursosMap = new HashMap<String, Disciplina>();
 
/**
80,9 → 82,14
return logMessages;
}
 
 
importUnitsSemestre(service, "S1", year, disciplinasMap, disciplinasMapS1, cursosMap, logMessages);
importUnitsSemestre(service, "S2", year, disciplinasMap, disciplinasMapS2, cursosMap, logMessages);
importUnitsSemestre(service, "A", year, disciplinasMap, disciplinasMapA, cursosMap, logMessages);
importUnitsSemestre(service, "T1", year, disciplinasMap, disciplinasMapT1, cursosMap, logMessages);
importUnitsSemestre(service, "T2", year, disciplinasMap, disciplinasMapT2, cursosMap, logMessages);
importUnitsSemestre(service, "T3", year, disciplinasMap, disciplinasMapT3, cursosMap, logMessages);
importUnitsSemestre(service, "T4", year, disciplinasMap, disciplinasMapT4, cursosMap, logMessages);
 
/**
* Import Courses
105,9 → 112,11
// DaoFactory.getCourseDaoImpl().save(c);
}
c.setName(d.getNomeCurso());
if(d.getGrauCurso() == null || d.getGrauCurso().trim().length() == 0)
d.setGrauCurso("unknown");
String grauBaco = ConfigProperties.getProperty("siges.degree."+d.getGrauCurso());
if(c.getDegree() == null)
c.setDegree(grauBaco);
 
c.setDegree(grauBaco);
c.setCode("" + d.getCodigoCurso().intValue());
c.setImportYear(year);
c.setInstitutionalCode("" + d.getCodigoInstituicao().intValue());
117,9 → 126,13
/**
* Update Course Units
*/
updateCourseUnits(disciplinasMapS1, "S1",logMessages,year);
updateCourseUnits(disciplinasMapS2, "S2",logMessages,year);
updateCourseUnits(disciplinasMapA, "A",logMessages,year);
updateCourseUnits(disciplinasMapS1, "S1",logMessages,year,service);
updateCourseUnits(disciplinasMapS2, "S2",logMessages,year,service);
updateCourseUnits(disciplinasMapA, "A",logMessages,year,service);
updateCourseUnits(disciplinasMapT1, "T1",logMessages,year,service);
updateCourseUnits(disciplinasMapT2, "T2",logMessages,year,service);
updateCourseUnits(disciplinasMapT3, "T3",logMessages,year,service);
updateCourseUnits(disciplinasMapT4, "T4",logMessages,year,service);
 
serviceLogInfo("######################################");
serviceLogInfo("######################################");
127,10 → 140,27
serviceLogInfo("#Units Imported S1:" + disciplinasMapS1.size());
serviceLogInfo("#Units Imported S2:" + disciplinasMapS2.size());
serviceLogInfo("#Units Imported A:" + disciplinasMapA.size());
serviceLogInfo("#Units Imported T1:" + disciplinasMapT1.size());
serviceLogInfo("#Units Imported T2:" + disciplinasMapT2.size());
serviceLogInfo("#Units Imported T3:" + disciplinasMapT3.size());
serviceLogInfo("#Units Imported T4:" + disciplinasMapT4.size());
serviceLogInfo("#New Courses Found:" + newCourses);
serviceLogInfo("#New Units Found:" + newUnits);
 
logger.info("######################################");
logger.info("######################################");
logger.info("#Courses Imported:" + cursosMap.size());
logger.info("#Units Imported S1:" + disciplinasMapS1.size());
logger.info("#Units Imported S2:" + disciplinasMapS2.size());
logger.info("#Units Imported A:" + disciplinasMapA.size());
logger.info("#Units Imported T1:" + disciplinasMapT1.size());
logger.info("#Units Imported T2:" + disciplinasMapT2.size());
logger.info("#Units Imported T3:" + disciplinasMapT3.size());
logger.info("#Units Imported T4:" + disciplinasMapT4.size());
logger.info("#New Courses Found:" + newCourses);
logger.info("#New Units Found:" + newUnits);
 
 
}
catch (Throwable e)
{
154,8 → 184,8
*/
private void sendNotificationAdmin(String subject, String cause)
{
//todo JOB
 
 
List<String> emails = ConfigProperties.getListValues("admin.email");
for(String email:emails)
{
165,6 → 195,7
List<String> arguments = new ArrayList<String>();
arguments.add(cause.replace("\n","<br/>"));
Email email = new Email(subject,emails,Globals.SYSTEM_EMAIL_BOX,"messageToAdmin_pt.txt",arguments);
email.setHtml(true);
try {
new SendEmailService().sendEmail(email);
} catch (ServiceException e) {
181,6 → 212,8
HashMap<String, Disciplina> cursosMap,
DefaultLogMessages logMessages)
{
 
 
logMessages.addMessage(new DefaultLogMessage("import.semestre.course.units." + semestre, LogMessageTypeEnum.INFO));
serviceLogInfo("importing " + semestre + " course units");
logger.info("importing " + semestre + " course units");
188,43 → 221,94
List<Disciplina> disciplinas = arrayOfDisciplina.getDisciplina();
for (Disciplina d : disciplinas)
{
if (disciplinasMap.get(d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + semestre) != null)
if (disciplinasMap.get(getDisciplinaUniqueRef(d)) != null)
{
logMessages.addMessage(new DefaultLogMessage("import.semestre.repeated." + semestre, "unit: " + d.getCodigo().intValue(), "", LogMessageTypeEnum.WARNING));
serviceLogWarn("repeated unit in " + semestre + ":" + d.getCodigo().intValue());
logger.warn("repeated unit in " + semestre + ":" + d.getCodigo().intValue());
}
disciplinasMap.put(d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + semestre, d);
disciplinasMapSemestre.put(d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + semestre, d);
disciplinasMap.put(getDisciplinaUniqueRef(d), d);
disciplinasMapSemestre.put(getDisciplinaUniqueRef(d), d);
cursosMap.put(d.getCodigoCurso().intValue()+":"+year, d);
}
}
 
private void updateCourseUnits(HashMap<String, Disciplina> disciplinasMapS, String semestre, DefaultLogMessages logMessages, String year)
private String getDisciplinaUniqueRef(Disciplina d)
{
return d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + d.getCdDuracao() + ":" + d.getCdTurma();
}
 
public static final int SIGES_CODIGO_TIPO_DISCIPLINA_EXTRA_CURRICULAR = ConfigProperties.getIntProperty("siges.codigo.tipo.disciplina.extra.curricular");
private void updateCourseUnits(HashMap<String, Disciplina> disciplinasMapS, String semestre, DefaultLogMessages logMessages, String year,SiGesWEB service)
{
logMessages.addMessage(new DefaultLogMessage("import.semestre.updating.course.units." + semestre, LogMessageTypeEnum.INFO));
 
 
logger.info("updating " + semestre + " course units");
serviceLogInfo("updating " + semestre + " course units");
Set<Map.Entry<String, Disciplina>> set = disciplinasMapS.entrySet();
for (Map.Entry<String, Disciplina> entry : set)
{
Disciplina d = entry.getValue();
//TIPO 6 é uma EXTRA CURRICULAR
if(d.getCdTipoDisciplina().longValue() == SIGES_CODIGO_TIPO_DISCIPLINA_EXTRA_CURRICULAR)
{
logMessages.addMessage(new DefaultLogMessage("import.error","Ignorando disciplina com tipo = " + d.getCdTipoDisciplina(), "see log for details", LogMessageTypeEnum.WARNING));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
 
continue;
}
CourseUnit c;
try{
c = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + d.getCodigo(), "" + d.getCodigoCurso(), semestre, year);
c = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + d.getCodigo(), "" + d.getCodigoCurso(), semestre, year, d.getCdTurma());
}catch(NonUniqueResultException e)
{
logger.fatal("Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year);
serviceLogFatal("Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year);
logMessages.addMessage(new DefaultLogMessage("import.error","Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year, "see log for details", LogMessageTypeEnum.ERROR));
logger.fatal(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
 
throw e;
}
//NOVO pode ainda nao ter turma
if(c == null)
{
List<CourseUnit> cus = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeTurmaNull("" + d.getCodigo(), "" + d.getCodigoCurso(), semestre, year);
if(cus == null || cus.size() == 0 )
{
// nao faz nada deixa ir null para criar
 
}
else if(cus.size() == 1)
{
//Tem de levar turma
c = cus.get(0);
c.setCdTurma(d.getCdTurma());
//é a primeira leva com o primeiro código de turma mete-se já este mas a seguir pode vir outro
logger.info("Adding turma code: " + d.getCdTurma() + " to unit:" + d.getCodigo() + "/" + d.getNome() + " curso:" + d.getCodigoCurso() + "/" + d.getNomeCurso());
serviceLogInfo("Adding turma code: " + d.getCdTurma() + " to unit:" + d.getCodigo() + "/" + d.getNome() + " curso:" + d.getCodigoCurso() + "/" + d.getNomeCurso());
}
else
{
logMessages.addMessage(new DefaultLogMessage("import.error", "Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year + " " + d.getCdTurma(), "see log for details", LogMessageTypeEnum.ERROR));
logger.fatal(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
}
//NOVO
if (c == null)
{
c = DomainObjectFactory.createCourseUnitImpl();
DaoFactory.getCourseUnitDaoImpl().save(c);
serviceLogInfo("New Unit Found: (" + d.getCodigo() + ") " + d.getNome() + " - curso (" + d.getNomeCurso() + ") " + d.getNomeCurso());
logMessages.addMessage(new DefaultLogMessage("import.error", "New Unit Found: (" + d.getCodigo() + ") " + d.getNome() + " - curso (" + d.getNomeCurso() + ") " + d.getNomeCurso() + " turma(" + d.getCdTurma() + ")", "see log for details", LogMessageTypeEnum.INFO));
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
newUnits++;
}
//NOVO
 
c.setCdTurma("" + d.getCdTurma());
//FIM NOVO
c.setName(d.getNome());
c.setInstitutionCode("" + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode());
c.setCode("" + d.getCodigo().intValue());
234,17 → 318,16
c.setImportYear(year);
Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(c.getCourseCode());
c.setCourse(course);
 
}
}
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
 
@Override
protected void runJobServiceTask() throws Throwable {
protected ILogMessages runJobServiceTask() throws Throwable {
 
String importYear = (String) getParametersMap().get(JOB_importYear_KEY).getObject();
run(importYear);
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
ILogMessages messages = run(importYear);
return messages;
 
}
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumariesJson.java
25,10 → 25,9
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessage;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessages;
import pt.estgp.estgweb.services.sigesimports.oracle.dao.AulaDao;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.web.FtpServer;
import pt.ipportalegre.siges.web.services.ArrayOfAula;
import pt.ipportalegre.siges.web.services.Aula;
import pt.ipportalegre.siges.web.services.SiGesWEB;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
39,7 → 38,6
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
57,7 → 55,7
 
private static final Logger logger = Logger.getLogger(ImportSumariesJson.class);
 
private static final int MAX_COMMIT = 100;
private static final int MAX_COMMIT = 10;
 
 
public ILogMessages run(String year,String semestre) throws ServiceException
79,6 → 77,7
int countUnits = 0;
int countUnitsOk = 0;
int countUnitsZeroSummaries = 0;
int countUnitsZeroValidSummaries = 0;
 
List<String> unitsZeroSummaries = new ArrayList<String>();
List<String> unitsFailed = new ArrayList<String>();
107,7 → 106,7
String nowCode = "";
for(Long cId: cUs)
{
nowCode = "BACO_ONLY_CODE" + cId;
nowCode = "" + cId;
countUnits++;
try
{
115,9 → 114,7
{
i = 0;
setProgress((int) (((float)countUnits)/((float)cUs.size())*100.0f));
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
serviceLogInfo("Commiting database");
commitPartially();
}
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().load(cId);
nowCode = c.getCode();
126,13 → 123,15
serviceLogInfo(logMessages.getLastMessage());
 
int tries = 3;
ArrayOfAula arrayOfAulas = null;
//ArrayOfAula arrayOfAulas = null;
ArrayList<pt.estgp.estgweb.services.sigesimports.oracle.domain.Aula> arrayOfAulas = null;
while(tries > 0)
{
//comentario de teste
try
{
arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),semestre);
//arrayOfAulas = service.getSiGesWEBSoap().getAulas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year,c.getCode(),semestre,c.getCourse().getCode());
arrayOfAulas = AulaDao.getInstance().loadAulas(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode(),year,c.getCode(),semestre,c.getCourse().getCode());
break;
}
catch(Throwable t)
144,13 → 143,15
break;
}
 
 
logger.error("WebService Fail, trying " + tries + " times sleeping a while");
serviceLogError("WebService Fail, trying " + tries + " times sleeping a while");
serviceLogError("WebService Fail, trying " + tries + " times sleeping a while " + t.toString());
serviceLogError("WebService Fail, trying " + tries + " times sleeping a while " + t.getCause());
Thread.sleep(5000);
}
}
 
if(arrayOfAulas != null && arrayOfAulas.getAula() != null)
if(arrayOfAulas != null && arrayOfAulas.size() > 0)
{
List<CourseUnitSummary> courseUnitSummaries = new ArrayList<CourseUnitSummary>();
 
163,9 → 164,25
JSONObject summariesJson = new JSONObject();
JSONArray summaries = new JSONArray();
summariesJson.put("summary",summaries);
for(Aula aula: arrayOfAulas.getAula())
int summariesValid = 0;
for(pt.estgp.estgweb.services.sigesimports.oracle.domain.Aula aula: arrayOfAulas)
{
 
//todo cdTurma Rollback aqui não retirar o sumário
//Mas pensar em separar os sumários na página, podemos
//separar tendo em conta quem entra, se for aluno só vê os
//seus sumários, se for prof vê os sumários das suas turmas
 
if(c.getCdTurma() != null && aula.getAula_codigoTurma()!=null
&& c.getCdTurma().trim().length() > 0
&& aula.getAula_codigoTurma().trim().length() > 0
&& !aula.getAula_codigoTurma().equals(c.getCdTurma()))
{
//Código de Turma diferente
System.out.println("Ignoring summary code: " + aula.getAula_codigoTurma() + " for unit " + c.getName() + "/" + c.getCode() + " T:" + c.getCdTurma());
continue;
}
 
//CourseUnitSummary s = map.get(aula.getSumNumeroAula() + ":" + aula.getCodigoSumario());
//if(s == null)
//{
175,25 → 192,40
//DaoFactory.getCourseUnitSummaryDaoImpl().save(s);
//summaries.add();
//}
s.setCdTipoOcupacao(aula.getTipoOcupacao().intValue());
s.setNrAula(aula.getNumeroAula().intValue());
s.setCodigoSumario(""+aula.getCodigoSumario().intValue());
s.setCodigoAula(""+aula.getSumNumeroAula().intValue());
s.setNumeroAula(aula.getSumNumeroAula().intValue());
s.setDataAula(aula.getData().toGregorianCalendar().getTime());
s.setTipoAula(aula.getSumTipoAula());
s.setCodigoSalaAula("" + aula.getAulaCodigoSalaAula().intValue());
s.setAlunosPresentes(aula.getSumNumeroAlunos().intValue());
s.setTitulo(aula.getSumTitulo());
s.setDescricao(aula.getSumDescricao());
s.setcEstado(""+aula.getSumCdEstado().intValue());
s.setCodigoAula("" + aula.getSum_numeroAula().intValue());
s.setNumeroAula(aula.getSum_numeroAula().intValue());
s.setDataAula(aula.getData());
s.setTipoAula(aula.getSum_tipoAula());
s.setCodigoSalaAula("" + aula.getAula_codigoSalaAula().intValue());
s.setAlunosPresentes(aula.getSum_numeroPresencas().intValue());
s.setTitulo(aula.getSum_titulo());
s.setCodigoDocente(aula.getAula_codigoDocente()+ "");
s.setDescricao(aula.getSum_descricao());
s.setcEstado(""+aula.getSum_cdEstado().intValue());
s.setNumeroHoras("" + aula.getNumeroCelulas().intValue());
summaries.put(s.getJson());
courseUnitSummaries.add(s);
if(s.getNumeroAula() > 0)
summariesValid++;
}
if(courseUnitSummaries.size() == 0)
{
countUnitsZeroSummaries++;
unitsZeroSummaries.add(c.getCode());
logger.info("ZERO SUMARIES unit:" + c.getCode() + " course: " + c.getCourseCode());
serviceLogInfo("ZERO SUMARIES unit:" + c.getCode() + " course: " + c.getCourseCode());
}
else if(summariesValid == 0)
{
//NAO METE OK NEM ZERO
countUnitsZeroValidSummaries++;
unitsZeroSummaries.add(c.getCode());
logger.info("ZERO VALID SUMARIES unit:" + c.getCode() + " course: " + c.getCourseCode());
serviceLogInfo("ZERO VALID SUMARIES unit:" + c.getCode() + " course: " + c.getCourseCode());
}
else
{
countUnitsOk++;
213,6 → 245,7
}
else
{
//NAO METE OK MAS METE ZERO
countUnitsZeroSummaries++;
unitsZeroSummaries.add(c.getCode());
logger.error("Summaries come null in unit:" + c.getCode());
221,6 → 254,7
}
catch(Throwable e)
{
//NAO METE OK
unitsFailed.add(nowCode);
logger.error(e,e);
serviceLogError(e.toString(),e);
243,13 → 277,33
logger.info("terminating summaries import");
serviceLogInfo(logMessages.getLastMessage());
 
StringBuilder failedUnitsExc = new StringBuilder();
for(String cId: unitsFailed)
failedUnitsExc.append(cId).append(";");
 
serviceLogInfo("#######################################");
serviceLogInfo("#######################################");
serviceLogInfo("UNITS PROCESSED: " + countUnits);
serviceLogInfo("UNITS FAILED: " + (countUnits - countUnitsZeroSummaries - countUnitsOk));
serviceLogInfo("UNITS FAILED: " + (countUnits - countUnitsZeroSummaries - countUnitsOk - countUnitsZeroValidSummaries));
serviceLogInfo("UNITS FAILED EXCEPTION PARSING XML WEB SERVICE: " + unitsFailed.size());
serviceLogInfo("UNITS IMPORT OK: " + countUnitsOk);
serviceLogInfo("UNITS ZERO SUMARIES: " + countUnitsZeroSummaries);
serviceLogInfo("UNITS ZERO VALID SUMARIES: " + countUnitsZeroValidSummaries);
serviceLogInfo("#######################################");
serviceLogWarn("####FAILED Exception (Check exceptions in log): Units Baco Id Code : " + failedUnitsExc.toString());
 
logger.info("#######################################");
logger.info("#######################################");
logger.info("UNITS PROCESSED: " + countUnits);
logger.info("UNITS FAILED: " + (countUnits - countUnitsZeroSummaries - countUnitsOk - countUnitsZeroValidSummaries));
logger.info("UNITS FAILED EXCEPTION PARSING XML WEB SERVICE: " + unitsFailed.size());
logger.info("UNITS IMPORT OK: " + countUnitsOk);
logger.info("UNITS ZERO SUMARIES: " + countUnitsZeroSummaries);
logger.info("UNITS ZERO VALID SUMARIES: " + countUnitsZeroValidSummaries);
logger.info("#######################################");
logger.warn("####FAILED Exception (Check exceptions in log): Units Baco Id Code : " + failedUnitsExc.toString());
 
 
return logMessages;
}
 
345,8 → 399,8
 
String year = DaoFactory.getConfigurationDaoImpl().getImportsDefaultImportYearCreateTransaction();
String semestre = null;
boolean sendIonline = true;
boolean sendEmail = true;
boolean sendIonline = false;
boolean sendEmail = false;
if(args != null && args.length > 0)
year = args[0];
 
372,20 → 426,16
}
 
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_semestre_KEY = "JOB_semestre_KEY";
public static final String JOB_sendIonline_KEY = "JOB_sendIonline_KEY";
public static final String JOB_sendEmail_KEY = "JOB_sendEmail_KEY";
 
@Override
protected void runJobServiceTask() throws Throwable {
protected ILogMessages runJobServiceTask() throws Throwable {
 
String importYear = (String) getParametersMap().get(JOB_importYear_KEY).getObject();
String semestre = (String) getParametersMap().get(JOB_semestre_KEY).getObject();
Boolean sendIonline = (Boolean) getParametersMap().get(JOB_sendIonline_KEY).getObject();
Boolean sendEmail = (Boolean) getParametersMap().get(JOB_sendEmail_KEY).getObject();
run(importYear,semestre,sendIonline,sendEmail);
 
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
String semestre = getParametersMap().get(JOB_semestre_KEY).getObject();
String sendIonlineStr = getParametersMap().get(JOB_sendIonline_KEY).getObject();
String sendEmailStr = getParametersMap().get(JOB_sendEmail_KEY).getObject();
boolean sendIonline = sendIonlineStr != null && Boolean.parseBoolean(sendIonlineStr);
boolean sendEmail = sendEmailStr != null && Boolean.parseBoolean(sendEmailStr);
return run(importYear,semestre,sendIonline,sendEmail);
}
 
}
/impl/src/java/pt/estgp/estgweb/services/ftpservices/FtpService.java
69,13 → 69,13
{
 
}
else if(passwordCode != null)
else
{
logger.info("using saved password");
password = DesUtils.getInstance().decrypt(passwordCode);
//System.out.println("SAVEDPASS:" + password);
}
else if(userSession.getUser().getPop3password() != null && userSession.getUser().getPop3password().length() > 0)
/*else if(userSession.getUser().getPop3password() != null && userSession.getUser().getPop3password().length() > 0)
{
logger.info("trying pop 3 password");
password = DesUtils.getInstance().decrypt(userSession.getUser().getPop3password());
84,7 → 84,7
{
logger.info("trying last used login password");
password = DesUtils.getInstance().decrypt(userSession.getUser().getPassword());
}
}*/
username = ftpRequestForm.getUsername();
if(username == null || username.trim().length() == 0)
username = userSession.getUsername();
/impl/src/java/pt/estgp/estgweb/services/jobs/JobServiceInterfaces.java
New file
0,0 → 1,52
package pt.estgp.estgweb.services.jobs;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.JobServiceTaskImpl;
import pt.estgp.estgweb.domain.JobServiceTaskScheduler;
import pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.List;
 
/**
* Created by jorgemachado on 02/11/15.
*
* Todos os serviços podem correr em BackGround através da chamada ao JobRunner
* desde que implementem esta interface
*/
public class JobServiceInterfaces implements IService
{
 
 
/*Class regular log*/
private static final Logger logger = Logger.getLogger(JobServiceInterfaces.class);
 
 
public JobServiceTaskSchedulerImpl loadJobServiceTaskScheduler(Long id, UserSession sess)
{
JobServiceTaskSchedulerImpl job = (JobServiceTaskSchedulerImpl) DaoFactory.getJobServiceTaskSchedulerDaoImpl().get(id);
if(job.getLastJobServiceTask() != null)
job.getLastJobServiceTask().getId();
return job;
}
 
public JobServiceTaskImpl loadJobServiceTask(Long id, UserSession sess)
{
JobServiceTaskImpl job = (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().get(id);
return job;
}
 
public List<JobServiceTaskScheduler> loadJobServiceTaskSchedullers(UserSession sess)
{
List<JobServiceTaskScheduler> tasks = DaoFactory.getJobServiceTaskSchedulerDaoImpl().findAll();
for(JobServiceTaskScheduler jobServiceTaskScheduler: tasks)
{
if(jobServiceTaskScheduler.getLastJobServiceTask() != null)
jobServiceTaskScheduler.getLastJobServiceTask().getId();
}
return tasks;
}
}
 
/impl/src/java/pt/estgp/estgweb/services/jobs/JobScheduleService.java
1,6 → 1,7
package pt.estgp.estgweb.services.jobs;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.sigesimports.*;
18,6 → 19,8
public class JobScheduleService implements IService
{
 
private static final Logger logger = Logger.getLogger(JobScheduleService.class);
 
private static JobScheduleService instance = new JobScheduleService();
 
public static JobScheduleService getInstance()
103,10 → 106,169
}
}
 
public void runNow(Long schedulerId, UserSession sess)
{
JobServiceTaskScheduler persistent = DaoFactory.getJobServiceTaskSchedulerDaoImpl().load(schedulerId);
logger.info("Will run now task " + persistent.getTargetService() + " id:" + schedulerId);
persistent.setNow(true);
}
 
public JobServiceTaskScheduler toggleActive(Long schedulerId, UserSession sess)
{
JobServiceTaskScheduler persistent = DaoFactory.getJobServiceTaskSchedulerDaoImpl().load(schedulerId);
if(persistent.isActive())
logger.info("Will deactivate task " + persistent.getTargetService() + " id:" + schedulerId);
else
logger.info("Will activate task " + persistent.getTargetService() + " id:" + schedulerId);
persistent.setActive(!persistent.isActive());
return persistent;
}
 
public void delete(Long schedulerId, UserSession sess)
{
 
JobServiceTaskScheduler persistent = DaoFactory.getJobServiceTaskSchedulerDaoImpl().load(schedulerId);
logger.warn("Will delete task " + persistent.getTargetService() + " id:" + schedulerId);
Set<JobServiceTaskSchedulerParameter> params = persistent.getServiceTaskSchedulerParameters();
if(params != null)
{
Iterator<JobServiceTaskSchedulerParameter> iterParam = params.iterator();
while(iterParam.hasNext()) {
JobServiceTaskSchedulerParameter next = iterParam.next();
next.setJobServiceTaskScheduler(null);
iterParam.remove();
DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl().delete(next);
}
}
DaoFactory.getJobServiceTaskSchedulerDaoImpl().delete(persistent);
}
 
public void save(JobServiceTaskSchedulerImpl scheduler
,String jobCloneOnlyNewsKey
,String jobJobGenerateAllPdfsKey
,String jobJobImportYearKey
,String jobJobSemestreKey
,String jobSendEmailKey
,String jobSendIonlineKey
,String jobJobValidateKey
,UserSession sess)
{
JobServiceTaskSchedulerImpl persistent;
if(scheduler.getId() <= 0)
{
persistent = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
persistent.setSaveDate(new Date());
persistent.setActive(false);
persistent.setCreatedBy(sess.getUser());
DaoFactory.getJobServiceTaskSchedulerDaoImpl().save(persistent);
 
logger.info("Will create task scheduller " + persistent.getTargetService() + " id:" + scheduler.getId());
}
else
{
persistent = (JobServiceTaskSchedulerImpl) DaoFactory.getJobServiceTaskSchedulerDaoImpl().load(scheduler.getId());
logger.warn("Will update task scheduller " + persistent.getTargetService() + " id:" + scheduler.getId());
}
 
persistent.setTargetService(scheduler.getTargetService());
persistent.setDaily(scheduler.isDaily());
persistent.setMonthly(scheduler.isMonthly());
persistent.setWeekly(scheduler.isWeekly());
 
persistent.setHour(scheduler.getHour());
persistent.setMinute(scheduler.getMinute());
persistent.setSecond(scheduler.getSecond());
persistent.setDescription(scheduler.getDescription());
 
Set<JobServiceTaskSchedulerParameter> params = persistent.getServiceTaskSchedulerParameters();
if(persistent.getTargetService().equals(ImportCourseService.class.getName()) ||
persistent.getTargetService().equals(ImportGradesService.class.getName()) ||
persistent.getTargetService().equals(ImportStudentsService.class.getName()) ||
persistent.getTargetService().equals(ImportTeachersService.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
}
JobServiceTaskSchedulerParameter parameter = params.iterator().next();
parameter.setObject(jobJobImportYearKey);
}
else if(persistent.getTargetService().equals(ImportSumariesJson.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
createParameter(persistent,ServiceJob.JOB_semestre_KEY);
createParameter(persistent,ServiceJob.JOB_sendIonline_KEY);
createParameter(persistent,ServiceJob.JOB_sendEmail_KEY);
}
for(JobServiceTaskSchedulerParameter param:persistent.getServiceTaskSchedulerParameters())
{
if(param.getName().equals(ServiceJob.JOB_importYear_KEY))
{
param.setObject(jobJobImportYearKey);
}
else if(param.getName().equals(ServiceJob.JOB_semestre_KEY))
{
param.setObject(jobJobSemestreKey);
}
else if(param.getName().equals(ServiceJob.JOB_sendIonline_KEY))
{
param.setObject(jobSendIonlineKey);
}
else if(param.getName().equals(ServiceJob.JOB_sendEmail_KEY))
{
param.setObject(jobSendEmailKey);
}
}
 
}
else if(persistent.getTargetService().equals(SincronizeLastYearCourseUnitProgramsService.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
createParameter(persistent,ServiceJob.JOB_cloneOnlyNews_KEY);
createParameter(persistent,ServiceJob.JOB_generateAllPdfs_KEY);
createParameter(persistent,ServiceJob.JOB_validate_KEY);
}
for(JobServiceTaskSchedulerParameter param:persistent.getServiceTaskSchedulerParameters())
{
if(param.getName().equals(ServiceJob.JOB_importYear_KEY))
{
param.setObject(jobJobImportYearKey);
}
else if(param.getName().equals(ServiceJob.JOB_cloneOnlyNews_KEY))
{
param.setObject(jobCloneOnlyNewsKey);
}
else if(param.getName().equals(ServiceJob.JOB_generateAllPdfs_KEY))
{
param.setObject(jobJobGenerateAllPdfsKey);
}
else if(param.getName().equals(ServiceJob.JOB_validate_KEY))
{
param.setObject(jobJobValidateKey);
}
}
}
}
 
private void createParameter(JobServiceTaskSchedulerImpl persistent,String name) {
JobServiceTaskSchedulerParameterImpl param = DomainObjectFactory.createJobServiceTaskSchedulerParameterImpl();
param.setJobServiceTaskScheduler(persistent);
persistent.getServiceTaskSchedulerParameters().add(param);
param.setName(name);
DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl().save(param);
}
 
public static void main(String[] args) throws SQLException
{
AbstractDao.getCurrentSession().beginTransaction();
scheduleImportSummaries();
scheduleImportTeachers();
scheduleImportCourses();
scheduleImportStudents();
AbstractDao.getCurrentSession().getTransaction().commit();
}
 
130,10 → 292,10
param2.setDescription("desc2");
param3.setDescription("desc3");
param4.setDescription("desc4");
param1.setObject(new Boolean(false));
param2.setObject(new Boolean(true));
param1.setObject("false");
param2.setObject("true");
param3.setObject("201415");
param4.setObject(new Boolean(true));
param4.setObject("true");
Set<JobServiceTaskSchedulerParameter> params = new HashSet<JobServiceTaskSchedulerParameter>();
params.add(param1);
params.add(param2);
142,7 → 304,7
jobServiceTaskScheduler.setServiceTaskSchedulerParameters(params);
 
jobServiceTaskScheduler.setDaily(true);
jobServiceTaskScheduler.setMonthday(GregorianCalendar.NOVEMBER);
jobServiceTaskScheduler.setMonthday(1);
jobServiceTaskScheduler.setWeekday(GregorianCalendar.MONDAY);
jobServiceTaskScheduler.setHour(01);
jobServiceTaskScheduler.setMinute(0);
181,10 → 343,10
param2.setDescription("desc2");
param3.setDescription("desc3");
param4.setDescription("desc4");
param1.setObject("201415");
param1.setObject("201516");
param2.setObject("S1");
param3.setObject(new Boolean(false));
param4.setObject(new Boolean(false));
param3.setObject("false");
param4.setObject("true");
Set<JobServiceTaskSchedulerParameter> params = new HashSet<JobServiceTaskSchedulerParameter>();
params.add(param1);
params.add(param2);
193,9 → 355,11
jobServiceTaskScheduler.setServiceTaskSchedulerParameters(params);
 
jobServiceTaskScheduler.setDaily(true);
jobServiceTaskScheduler.setMonthday(GregorianCalendar.NOVEMBER);
jobServiceTaskScheduler.setWeekly(false);
jobServiceTaskScheduler.setMonthly(false);
jobServiceTaskScheduler.setMonthday(1);
jobServiceTaskScheduler.setWeekday(GregorianCalendar.MONDAY);
jobServiceTaskScheduler.setHour(01);
jobServiceTaskScheduler.setHour(05);
jobServiceTaskScheduler.setMinute(0);
jobServiceTaskScheduler.setSecond(0);
jobServiceTaskScheduler.setTargetService(ImportSumariesJson.class.getName());
207,7 → 371,7
}
};
sess.setUser(u);
jobServiceTaskScheduler.setDescription("TESTE Sumaries");
jobServiceTaskScheduler.setDescription("Sumarios");
new JobScheduleService().createOrUpdateScheduleServiceTask(jobServiceTaskScheduler,sess);
 
}
220,13 → 384,14
param1.setJobServiceTaskScheduler(jobServiceTaskScheduler);
param1.setName(ImportCourseService.JOB_importYear_KEY);
param1.setDescription("desc1");
param1.setObject("201415");
param1.setObject("201516");
Set<JobServiceTaskSchedulerParameter> params = new HashSet<JobServiceTaskSchedulerParameter>();
params.add(param1);
jobServiceTaskScheduler.setServiceTaskSchedulerParameters(params);
 
jobServiceTaskScheduler.setDaily(true);
jobServiceTaskScheduler.setMonthday(GregorianCalendar.NOVEMBER);
jobServiceTaskScheduler.setMonthly(false);
jobServiceTaskScheduler.setMonthday(1);
jobServiceTaskScheduler.setWeekday(GregorianCalendar.MONDAY);
jobServiceTaskScheduler.setHour(01);
jobServiceTaskScheduler.setMinute(0);
240,11 → 405,13
}
};
sess.setUser(u);
jobServiceTaskScheduler.setDescription("TESTE Courses");
jobServiceTaskScheduler.setDescription("Cursos");
new JobScheduleService().createOrUpdateScheduleServiceTask(jobServiceTaskScheduler,sess);
 
}
 
 
 
public static void scheduleImportStudents()
{
JobServiceTaskScheduler jobServiceTaskScheduler = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
253,15 → 420,17
param1.setJobServiceTaskScheduler(jobServiceTaskScheduler);
param1.setName(ImportStudentsService.JOB_importYear_KEY);
param1.setDescription("desc1");
param1.setObject("201415");
param1.setObject("201516");
Set<JobServiceTaskSchedulerParameter> params = new HashSet<JobServiceTaskSchedulerParameter>();
params.add(param1);
jobServiceTaskScheduler.setServiceTaskSchedulerParameters(params);
 
jobServiceTaskScheduler.setDaily(true);
jobServiceTaskScheduler.setMonthly(false);
jobServiceTaskScheduler.setWeekly(false);
jobServiceTaskScheduler.setMonthday(GregorianCalendar.NOVEMBER);
jobServiceTaskScheduler.setWeekday(GregorianCalendar.MONDAY);
jobServiceTaskScheduler.setHour(01);
jobServiceTaskScheduler.setHour(03);
jobServiceTaskScheduler.setMinute(0);
jobServiceTaskScheduler.setSecond(0);
jobServiceTaskScheduler.setTargetService(ImportStudentsService.class.getName());
273,7 → 442,7
}
};
sess.setUser(u);
jobServiceTaskScheduler.setDescription("TESTE Students");
jobServiceTaskScheduler.setDescription("Estudantes");
new JobScheduleService().createOrUpdateScheduleServiceTask(jobServiceTaskScheduler,sess);
 
}
286,15 → 455,17
param1.setJobServiceTaskScheduler(jobServiceTaskScheduler);
param1.setName(ImportTeachersService.JOB_importYear_KEY);
param1.setDescription("desc1");
param1.setObject("201415");
param1.setObject("201516");
Set<JobServiceTaskSchedulerParameter> params = new HashSet<JobServiceTaskSchedulerParameter>();
params.add(param1);
jobServiceTaskScheduler.setServiceTaskSchedulerParameters(params);
 
jobServiceTaskScheduler.setDaily(true);
jobServiceTaskScheduler.setWeekly(false);
jobServiceTaskScheduler.setMonthly(false);
jobServiceTaskScheduler.setMonthday(GregorianCalendar.NOVEMBER);
jobServiceTaskScheduler.setWeekday(GregorianCalendar.MONDAY);
jobServiceTaskScheduler.setHour(01);
jobServiceTaskScheduler.setHour(02);
jobServiceTaskScheduler.setMinute(0);
jobServiceTaskScheduler.setSecond(0);
jobServiceTaskScheduler.setTargetService(ImportTeachersService.class.getName());
306,7 → 477,7
}
};
sess.setUser(u);
jobServiceTaskScheduler.setDescription("TESTE Teachers");
jobServiceTaskScheduler.setDescription("Professores");
new JobScheduleService().createOrUpdateScheduleServiceTask(jobServiceTaskScheduler,sess);
 
}
/impl/src/java/pt/estgp/estgweb/services/jobs/ServiceJob.java
1,5 → 1,6
package pt.estgp.estgweb.services.jobs;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
7,6 → 8,7
import pt.estgp.estgweb.domain.JobServiceTask;
import pt.estgp.estgweb.domain.JobServiceTaskImpl;
import pt.estgp.estgweb.domain.JobServiceTaskParameter;
import pt.estgp.estgweb.services.logresults.ILogMessages;
 
import java.io.IOException;
import java.util.*;
20,7 → 22,15
public abstract class ServiceJob implements JobHandler
{
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_semestre_KEY = "JOB_semestre_KEY";
public static final String JOB_sendIonline_KEY = "JOB_sendIonline_KEY";
public static final String JOB_sendEmail_KEY = "JOB_sendEmail_KEY";
public static final String JOB_cloneOnlyNews_KEY = "JOB_cloneOnlyNews_KEY";
public static final String JOB_generateAllPdfs_KEY = "JOB_generateAllPdfs_KEY";
public static final String JOB_validate_KEY = "JOB_validade_KEY";
/*Log for service run*/
 
protected final Logger serviceLog = Logger.getLogger(ServiceJob.class);
 
/*Class regular log*/
97,10 → 107,16
jobServiceTask.setStatusEnum(JobServiceTaskImpl.JobStatus.STARTED);
jobServiceTask.setServiceStartDate(new Date());
jobServiceTask.setServiceLastUpdateDate(new Date());
commitPartially();
try {
//call the implementation of service this will update serviceLog and progress
runJobServiceTask();
jobServiceTask.setStatusEnum(JobServiceTaskImpl.JobStatus.FINISHED);
ILogMessages messages = runJobServiceTask();
if(messages.hasErrors())
jobServiceTask.setStatusEnum(JobServiceTaskImpl.JobStatus.FINISHED_ERRORS);
else if(messages.hasWarnings())
jobServiceTask.setStatusEnum(JobServiceTaskImpl.JobStatus.FINISHED_WARNINGS);
else
jobServiceTask.setStatusEnum(JobServiceTaskImpl.JobStatus.FINISHED);
jobServiceTask.setServiceLastUpdateDate(new Date());
jobServiceTask.setServiceFinishDate(new Date());
serviceLog.info("FINISHING SERVICE");
125,5 → 141,13
public void serviceLogFatal(String str, Throwable e){ if(jobServiceTask != null) serviceLog.fatal(str,e);}
 
//Implemented in SubService to run the Job
protected abstract void runJobServiceTask() throws Throwable;
protected abstract ILogMessages runJobServiceTask() throws Throwable;
 
protected void commitPartially() {
 
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
if(jobServiceTask != null)
AbstractDao.getCurrentSession().update(jobServiceTask);
}
}
/impl/src/java/pt/estgp/estgweb/services/jobs/JobDeamon.java
107,10 → 107,9
 
if(isRunnableNow(schedule, last))
{
logger.info("Schedulling one job " + schedule.getTargetService() + " to run");
JobServiceTaskImpl jobServiceTask = DomainObjectFactory.createJobServiceTaskImpl();
DaoFactory.getJobServiceTaskDaoImpl().save(jobServiceTask);
jobServiceTask.setStartDate(new Date());
DaoFactory.getJobServiceTaskDaoImpl().flush();
jobServiceTask.setTargetService(schedule.getTargetService());
jobServiceTask.setCreatedBy(schedule.getCreatedBy());
jobServiceTask.setExecuted(false);
121,6 → 120,9
jobServiceTask.setRequestStop(false);
jobServiceTask.setOwner(schedule.getCreatedBy());
jobServiceTask.setJobHandler(new SerializableNullJobHandler());
jobServiceTask.setProgress(0);
DaoFactory.getJobServiceTaskDaoImpl().save(jobServiceTask);
schedule.setLastJobServiceTask(jobServiceTask);
try {
String filePath = Class.forName(schedule.getTargetService()).getSimpleName() + "-" + DatesUtils.getFormatedFileSystem(new Date());
jobServiceTask.setLogFilePath( filePath + ".log");
139,25 → 141,26
paramJob.setJobServiceTask(jobServiceTask);
DaoFactory.getJobServiceTaskParameterDaoImpl().save(paramJob);
}
DaoFactory.getJobServiceTaskParameterDaoImpl().flush();
jobServiceTask.setServiceTaskParameters(paramsJob);
DaoFactory.getJobServiceTaskDaoImpl().saveOrUpdate(jobServiceTask);
 
//DaoFactory.getJobServiceTaskDaoImpl().saveOrUpdate(jobServiceTask);
 
//a last schedule date e a hora a que foi marcado para correr a ultima vez
//a partir do momento que e' agendado o trabalho ele vai correr portanto
//e' esta a hora que se considera para a corrida
schedule.setLastScheduleDate(new Date());
if(schedule.isNow())
{
schedule.setNow(false);
}
}
//Remove Now Schedules
if(schedule.isNow())
{
DaoFactory.getJobServiceTaskSchedulerDaoImpl().delete(schedule);
}
}
}
 
private boolean isRunnableNow(JobServiceTaskScheduler schedule,Date lastDate)
{
if(!schedule.isActive())
return false;
if(lastDate == null)
lastDate = new Date(0);
GregorianCalendar gC = new GregorianCalendar();
/impl/src/java/pt/estgp/estgweb/services/logresults/impl/DefaultLogMessages.java
3,6 → 3,7
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.services.logresults.ILogMessages;
import pt.estgp.estgweb.services.logresults.ILogMessage;
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum;
 
import java.util.List;
import java.util.ArrayList;
40,6 → 41,26
return summaries;
}
 
@Override
public boolean hasErrors() {
if(logMessages == null)
return false;
for(ILogMessage m:logMessages)
if(m.getType() == LogMessageTypeEnum.ERROR || m.getType() == LogMessageTypeEnum.FATAL)
return true;
return false;
}
 
@Override
public boolean hasWarnings() {
if(logMessages == null)
return false;
for(ILogMessage m:logMessages)
if(m.getType() == LogMessageTypeEnum.WARNING)
return true;
return false;
}
 
public void setSummaries(List<CourseUnitSummary> summaries) {
this.summaries = summaries;
}
/impl/src/java/pt/estgp/estgweb/services/logresults/ILogMessages.java
13,4 → 13,6
{
public List<ILogMessage> getLogMessages();
List<CourseUnitSummary> getSummaries();
public boolean hasErrors();
public boolean hasWarnings();
}
/impl/src/java/pt/estgp/estgweb/services/blogs/LoadEditableBlogs.java
1,16 → 1,15
package pt.estgp.estgweb.services.blogs;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.BlogView;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.BlogView;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.Globals;
import org.apache.log4j.Logger;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
34,4 → 33,18
}
return blogViews;
}
 
public List<BlogView> loadMax(Integer max,UserSession userSession) throws ServiceException
{
boolean internal = true;
if (userSession.getUser() == null)
internal = false;
List<BlogImpl> blogs = DaoFactory.getBlogDaoImpl().findBlogs(userSession.getUser().getRolesList(), internal,max);
List<BlogView> blogViews = new ArrayList<BlogView>();
for(BlogImpl b: blogs)
{
blogViews.add(new BlogView(b));
}
return blogViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/blogs/LoadOwnerBlogs.java
30,4 → 30,14
}
return blogViews;
}
public List<BlogView> loadMax(Integer max, UserSession userSession) throws ServiceException
{
List<BlogImpl> blogs = DaoFactory.getBlogDaoImpl().loadOwnedBlogs(userSession.getUser().getId(),max);
List<BlogView> blogViews = new ArrayList<BlogView>();
for(BlogImpl b: blogs)
{
blogViews.add(new BlogView(b));
}
return blogViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/blogs/LoadOwnerBlogPosts.java
1,17 → 1,15
package pt.estgp.estgweb.services.blogs;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.BlogView;
import pt.estgp.estgweb.domain.views.BlogPostView;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.BlogPostImpl;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.BlogPostImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.BlogPostView;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import org.apache.log4j.Logger;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
32,4 → 30,15
}
return blogViews;
}
 
public List<BlogPostView> loadMax(Integer max, UserSession userSession) throws ServiceException
{
List<BlogPostImpl> blogs = DaoFactory.getBlogPostDaoImpl().loadOwnedBlogPostsMax(userSession.getUser().getId(), max);
List<BlogPostView> blogViews = new ArrayList<BlogPostView>();
for(BlogPostImpl b: blogs)
{
blogViews.add(new BlogPostView(b));
}
return blogViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/data/RepositoryService.java
115,6 → 115,10
return repositoryFile;
}
 
public IRepositoryFile loadByIdentifier(String identifier)
{
return load(identifier,null);
}
/**
* @param identifier .
* @param userSession .
/impl/src/java/pt/estgp/estgweb/services/directories/DirectoryService.java
3,23 → 3,35
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import pt.estgp.estgweb.domain.DirectoryImpl;
import pt.estgp.estgweb.domain.ConfigurationDirectoryImpl;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.services.directories.xsd.Directory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
 
/**
* @author Jorge Machado
*/
public class DirectoryService
public class DirectoryService implements IService
{
 
private static final Logger logger = Logger.getLogger(DirectoryService.class);
 
 
/*
public List<DirectoryImpl> loadDirectories(String classesPath, String place)
{
List<DirectoryImpl> directories = new ArrayList<DirectoryImpl>();
68,4 → 80,159
}
return directories;
}
*/
 
public Directory loadDirectory(String identifier, UserSession sess)
{
Directory directory = null;
ConfigurationDirectoryImpl dir = DaoFactory.getConfigurationDirectoryDaoImpl().loadDirectory(identifier);
JAXBContext jc;
if(dir == null)
{
try
{
jc = JAXBContext.newInstance(Directory.class);
 
Unmarshaller unmarshaller = jc.createUnmarshaller();
directory = (Directory) unmarshaller.unmarshal(DirectoryService.class.getResourceAsStream("/pt/estgp/estgweb/directories/" + identifier + ".xml"));
 
dir = DomainObjectFactory.createConfigurationDirectoryImpl();
dir.setDescricao("");
dir.setIdDir(identifier);
 
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter sw = new StringWriter();
marshaller.marshal(directory, sw);
 
dir.setXml(sw.toString());
DaoFactory.getConfigurationDirectoryDaoImpl().save(dir);
return directory;
} catch (JAXBException e) {
logger.error(e,e);
}
}
else
{
try
{
jc = JAXBContext.newInstance(Directory.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
StringReader r = new StringReader(dir.getXml());
directory = (Directory) unmarshaller.unmarshal(r);
return directory;
} catch (JAXBException e) {
logger.error(e,e);
}
}
 
return directory;
}
 
public String loadDirectoryXml(String identifier, UserSession sess)
{
ConfigurationDirectoryImpl dir = DaoFactory.getConfigurationDirectoryDaoImpl().loadDirectory(identifier);
JAXBContext jc;
if(dir == null)
{
try
{
jc = JAXBContext.newInstance(Directory.class);
 
Unmarshaller unmarshaller = jc.createUnmarshaller();
Directory directory = (Directory) unmarshaller.unmarshal(DirectoryService.class.getResourceAsStream("/pt/estgp/estgweb/directories/" + identifier + ".xml"));
 
dir = DomainObjectFactory.createConfigurationDirectoryImpl();
dir.setDescricao("");
dir.setIdDir(identifier);
 
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter sw = new StringWriter();
marshaller.marshal(directory, sw);
 
dir.setXml(sw.toString());
DaoFactory.getConfigurationDirectoryDaoImpl().save(dir);
return sw.toString();
} catch (JAXBException e) {
logger.error(e,e);
}
}
else
{
return dir.getXml();
}
return null;
}
 
private static Map<String,String> cachedHtml = new HashMap<String, String>();
 
private static synchronized String getOrAddOrRemove(String id,String html,boolean remove)
{
if(remove)
cachedHtml.remove(id);
else if(html != null)
cachedHtml.put(id,html);
else
return cachedHtml.get(id);
return null;
}
public String loadDirectoryHtml(String identifier, Map<String,Object> parameters, UserSession sess) throws ServiceException {
String html = getOrAddOrRemove(identifier,null,false);
if(html != null)
return html;
 
String xml = loadDirectoryXml(identifier,sess);
try
{
JAXBContext jc = JAXBContext.newInstance(Directory.class);
 
Unmarshaller unmarshaller = jc.createUnmarshaller();
Directory directory = (Directory) unmarshaller.unmarshal(DirectoryService.class.getResourceAsStream("/pt/estgp/estgweb/directories/" + identifier + ".xml"));
 
Document dom = Dom4jUtil.parse(xml);
html = Dom4jUtil.styleDocument(dom,"/pt/estgp/estgweb/directories/" + directory.getStyle(), parameters);
getOrAddOrRemove(identifier,html,false);
} catch (JAXBException e) {
logger.error(e,e);
throw new ServiceException("Cant load Menu");
} catch (DocumentException e) {
logger.error(e, e);
throw new ServiceException("Cant load Menu");
} catch (Exception e) {
logger.error(e, e);
throw new ServiceException("Cant load Menu");
}
return html;
}
 
 
public void saveDirectory(Directory directory,UserSession sess) throws NotFoundException, ServiceException {
ConfigurationDirectoryImpl dir = DaoFactory.getConfigurationDirectoryDaoImpl().loadDirectory(directory.getId());
if(dir != null)
{
JAXBContext jc = null;
try {
jc = JAXBContext.newInstance(Directory.class);
 
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter sw = new StringWriter();
marshaller.marshal(directory, sw);
 
dir.setXml(sw.toString());
getOrAddOrRemove(directory.getId(),null,true);
}
catch (JAXBException e)
{
logger.error(e,e);
throw new ServiceException(e.toString(),e);
}
}
else
{
throw new NotFoundException("Directory does not exist with that ID " + directory.getId());
}
 
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/RightImpl.java
New file
0,0 → 1,7
package pt.estgp.estgweb.services.directories.xsd;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class RightImpl extends RightsT.Right {
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/TestDynamicLists.java
New file
0,0 → 1,43
package pt.estgp.estgweb.services.directories.xsd;
 
import junit.framework.TestCase;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class TestDynamicLists extends TestCase
{
public void testLists()
{
 
Directory d = new DirectoryImpl();
d.getGroupsDeclaration().getGroup().get(0).setName("teste");
d.getGroupsDeclaration().getGroup().get(1).setName("teste");
d.getRights().getRight().get(0).setName("teste");
d.getRights().getRight().get(1).setName("teste");
d.getLeaf().get(0).setAbsolute(true);
d.getLeaf().get(1).setAbsolute(true);
d.getLeaf().get(2).setAbsolute(true);
 
d.getLeaf().get(2).getLeaf().get(3).setAbsolute(true);
d.getLeaf().get(2).getLeaf().get(2).setAbsolute(false);
d.getLeaf().get(2).getLeaf().get(1).setAbsolute(true);
d.getLeaf().get(2).getLeaf().get(0).setAbsolute(false);
 
assertTrue(d.getGroupsDeclaration().getGroup().size() == 2);
assertTrue(d.getRights().getRight().size() == 2);
assertTrue(d.getLeaf().size() == 3);
 
 
 
assertTrue(d.getLeaf().get(2).getLeaf().get(0).getAbsolute() == false);
assertTrue(d.getLeaf().get(2).getLeaf().get(1).getAbsolute() == true);
assertTrue(d.getLeaf().get(2).getLeaf().get(2).getAbsolute() == false);
assertTrue(d.getLeaf().get(2).getLeaf().get(3).getAbsolute() == true);
 
d.getLeaf().get(3).getRights().getRight().get(0).setName("teste55");
 
assertEquals(d.getLeaf().get(3).getRights().getRight().get(0).getName(), "teste55");
 
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/DirectoryImpl.java
New file
0,0 → 1,32
package pt.estgp.estgweb.services.directories.xsd;
 
import pt.estgp.estgweb.utils.DynamicArrayList;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class DirectoryImpl extends Directory
{
public DirectoryImpl()
{
super();
setRights(new RightsTImpl());
setGroupsDeclaration(new GroupsDeclarationTImpl());
leaf = new DynamicArrayList<LeafT>(LeafTImpl.class);
}
 
public boolean isGroupDeclarationEmpty()
{
return groupsDeclaration == null || groupsDeclaration.getGroup() == null || groupsDeclaration.getGroup().size() == 0;
}
 
public boolean isRightsEmpty()
{
return rights == null || rights.getRight() == null || rights.getRight().size() == 0;
}
 
public boolean isLeafEmpty()
{
return leaf == null || leaf.size() == 0;
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/RightsTImpl.java
New file
0,0 → 1,22
package pt.estgp.estgweb.services.directories.xsd;
 
import pt.estgp.estgweb.utils.DynamicArrayList;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class RightsTImpl extends RightsT {
 
public RightsTImpl()
{
super();
right = new DynamicArrayList<Right>(RightImpl.class);
 
}
 
 
public boolean isRightEmpty()
{
return right == null || right.size() == 0;
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/GroupsDeclarationTImpl.java
New file
0,0 → 1,20
package pt.estgp.estgweb.services.directories.xsd;
 
import pt.estgp.estgweb.utils.DynamicArrayList;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class GroupsDeclarationTImpl extends GroupDeclarationT
{
public GroupsDeclarationTImpl()
{
super();
group = new DynamicArrayList<Group>(GroupImpl.class);
}
 
public boolean isGroupEmpty()
{
return group == null || group.size() == 0;
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/LeafTImpl.java
New file
0,0 → 1,89
package pt.estgp.estgweb.services.directories.xsd;
 
import pt.estgp.estgweb.utils.DynamicArrayList;
 
import java.util.Iterator;
import java.util.List;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class LeafTImpl extends LeafT
{
public LeafTImpl()
{
super();
setRights(new RightsTImpl());
setGroupsDeclaration(new GroupsDeclarationTImpl());
leaf = new DynamicArrayList<LeafT>(LeafTImpl.class);
}
 
public boolean isGroupDeclarationEmpty()
{
return groupsDeclaration == null || groupsDeclaration.getGroup() == null || groupsDeclaration.getGroup().size() == 0;
}
 
public boolean isRightsEmpty()
{
return rights == null || rights.getRight() == null || rights.getRight().size() == 0;
}
 
public boolean isLeafEmpty()
{
return leaf == null || leaf.size() == 0;
}
 
public static LeafT findLeaf(Directory d,String id)
{
return findLeafT(d.getLeaf(),id);
}
 
public static LeafT removeLeaf(Directory d,String id)
{
return removeLeafT(d.getLeaf(), id);
}
 
public static LeafT removeLeaf(LeafT l,String id)
{
return removeLeafT(l.getLeaf(), id);
}
public static LeafT findLeaf(LeafT l,String id)
{
return findLeafT(l.getLeaf(),id);
}
 
private static LeafT findLeafT(List<LeafT> leafs,String id)
{
if(leafs == null || leafs.size() == 0)
return null;
for(LeafT l: leafs)
{
if(l.getId().equals(id))
return l;
LeafT inside = findLeafT(l.getLeaf(),id);
if(inside != null)
return inside;
}
return null;
}
 
private static LeafT removeLeafT(List<LeafT> leafs,String id)
{
if(leafs == null || leafs.size() == 0)
return null;
Iterator<LeafT> iter = leafs.iterator();
while(iter.hasNext())
{
LeafT l = iter.next();
if(l.getId().equals(id))
{
iter.remove();
return l;
}
LeafT inside = removeLeafT(l.getLeaf(),id);
if(inside != null)
return inside;
}
return null;
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/xsd/GroupImpl.java
New file
0,0 → 1,9
package pt.estgp.estgweb.services.directories.xsd;
 
/**
* Created by jorgemachado on 16/11/15.
*/
public class GroupImpl extends GroupDeclarationT.Group
{
 
}
/impl/src/java/pt/estgp/estgweb/services/announcements/CreateAnnouncementService.java
4,6 → 4,7
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.dao.impl.AnnouncementDaoImpl;
import pt.estgp.estgweb.domain.enums.LangEnum;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.views.UserView;
85,12 → 86,13
return all;
}
}
public List<UserView> sendMessage(HttpServletRequest request, String from, String year, String department, long courseId, long courseUnitId, String semestre, MessageTarget target, String text,String subject, UserSession userSession)
public List<UserView> sendMessageOld(HttpServletRequest request, String from, String year, String department, long courseId, long courseUnitId, String semestre, MessageTarget target, String text,String subject, UserSession userSession)
{
List<User> users = DaoFactory.getAnnouncementDaoImpl().findUsers(year,department,courseId,courseUnitId,semestre,target);
List<User> usersToConsume = new ArrayList<User>();
for(User u: users)
usersToConsume.add(u);
logger.info("Scheduling mail jobs to " + usersToConsume.size() + " recipients");
while(usersToConsume.size() > 0)
{
Iterator<User> iter = usersToConsume.iterator();
102,6 → 104,41
iter.remove();
contador++;
}
Email e = sendEmailService.getMessageEmailOld(
jomm.utils.MessageResources.getMessage(request, "user.role." + from),
subject,
text,
LangEnum.PORTUGUESE,
jomm.utils.MessageResources.getMessage(request, "submit.todo.message." + target.getTarget()),
usersToJob,
userSession.getUser());
e.setHtml(true);
EMAILJob emailJob = new EMAILJob(e);
JobScheduleService.getInstance().scheduleNow(emailJob,"Message Email from " + userSession.getUsername() + " as " + from + ": year:" + year + " - department:" + department + " - courseId:" + courseId + " - courseUnitId:" + courseUnitId + " - semestre:" + semestre + " - target:" + target + " - subject:" + subject ,userSession);
}
List<UserView> userViews = UserView.getViews(users);
return userViews;
}
 
public Integer sendMessage(HttpServletRequest request, String from, String year, String department, long courseId, long courseUnitId, String semestre, MessageTarget target, String text,String subject, UserSession userSession)
{
//List<User> users = DaoFactory.getAnnouncementDaoImpl().findUsers(year,department,courseId,courseUnitId,semestre,target);
AnnouncementDaoImpl.FindUsersResult result = DaoFactory.getAnnouncementDaoImpl().findUsersEmails(year, department, courseId, courseUnitId, semestre, target);
List<String> usersToConsume = result.emails;
 
 
logger.info("Scheduling mail jobs to " + result.users + " users: " + usersToConsume.size() + " recipients");
while(usersToConsume.size() > 0)
{
Iterator<String> iter = usersToConsume.iterator();
List<String> usersToJob = new ArrayList<String>();
int contador = 0;
while(iter.hasNext() && contador < 20)
{
usersToJob.add(iter.next());
iter.remove();
contador++;
}
Email e = sendEmailService.getMessageEmail(
jomm.utils.MessageResources.getMessage(request,"user.role." + from),
subject,
114,8 → 151,8
EMAILJob emailJob = new EMAILJob(e);
JobScheduleService.getInstance().scheduleNow(emailJob,"Message Email from " + userSession.getUsername() + " as " + from + ": year:" + year + " - department:" + department + " - courseId:" + courseId + " - courseUnitId:" + courseUnitId + " - semestre:" + semestre + " - target:" + target + " - subject:" + subject ,userSession);
}
List<UserView> userViews = UserView.getViews(users);
return userViews;
 
return result.users;
}
 
public AnnouncementView run(AnnouncementView announcementView, Image imageBig, Image imageSmall, UserSession userSession)
/impl/src/java/pt/estgp/estgweb/services/announcements/LoadOwnerAnnouncements.java
1,18 → 1,16
package pt.estgp.estgweb.services.announcements;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.AnnouncementImpl;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.services.blogs.LoadBlogService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.domain.views.BlogView;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.AnnouncementImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
33,4 → 31,16
}
return announcementViews;
}
 
 
public List<AnnouncementView> loadMax(Integer max, UserSession userSession) throws ServiceException
{
List<AnnouncementImpl> announcements = DaoFactory.getAnnouncementDaoImpl().loadOwnedAnnouncements(userSession.getUser().getId(),max);
List<AnnouncementView> announcementViews = new ArrayList<AnnouncementView>();
for(AnnouncementImpl announcement: announcements)
{
announcementViews.add(new AnnouncementView(announcement));
}
return announcementViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateService.java
4,6 → 4,7
import openldap.ILdapManager;
import openldap.LdapManagerFactory;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.common.CommonServicesManager;
125,6 → 126,8
userSession.setName(u.getName());
userSession.setUsername(u.getUsername());
userSession.setUser(u);
if(u.getRoles() == null || u.getRoles().trim().length() == 0)
u.setRoles(Globals.ROLE_INVITED);
 
DaoFactory.getUserSessionDaoImpl().reattach(userSession);
return userSession;
/impl/src/java/pt/estgp/estgweb/domain/StudentImpl.java
7,7 → 7,9
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
* @author Jorge Machado
66,6 → 68,26
return getUnitsSemestre("A",getSubscribedUnitsView());
}
 
public List<CourseUnit> getSubscribedUnitsViewT1()
{
return getUnitsSemestre("T1",getSubscribedUnitsView());
}
 
public List<CourseUnit> getSubscribedUnitsViewT2()
{
return getUnitsSemestre("T2",getSubscribedUnitsView());
}
 
public List<CourseUnit> getSubscribedUnitsViewT3()
{
return getUnitsSemestre("T3",getSubscribedUnitsView());
}
 
public List<CourseUnit> getSubscribedUnitsViewT4()
{
return getUnitsSemestre("T4",getSubscribedUnitsView());
}
 
public List<CourseUnit> getSubscribedUnitsView()
{
if(subscribedUnitsView == null)
95,6 → 117,23
return subscribedUnitsView;
}
 
public List<CourseUnit> getSubscribedUnitsCurrentYearViewT1()
{
return getUnitsSemestre("T1",getSubscribedUnitsCurrentYearView());
}
public List<CourseUnit> getSubscribedUnitsCurrentYearViewT2()
{
return getUnitsSemestre("T2",getSubscribedUnitsCurrentYearView());
}
public List<CourseUnit> getSubscribedUnitsCurrentYearViewT3()
{
return getUnitsSemestre("T3",getSubscribedUnitsCurrentYearView());
}
public List<CourseUnit> getSubscribedUnitsCurrentYearViewT4()
{
return getUnitsSemestre("T4",getSubscribedUnitsCurrentYearView());
}
 
public List<CourseUnit> getSubscribedUnitsCurrentYearViewS1()
{
return getUnitsSemestre("S1",getSubscribedUnitsCurrentYearView());
137,6 → 176,61
return subscribedUnitsCurrentYearView;
}
 
Map<String,List<CourseUnit>> subscribedUnitsYear = new HashMap<String,List<CourseUnit>>();
 
public List<CourseUnit> getSubscribedUnitsView(String year)
{
List<CourseUnit> cuYear = subscribedUnitsYear.get(year);
if(cuYear == null)
{
try
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable","year"};
Object[] args = new Object[]{getId(),year};
cuYear = (List<CourseUnit>) sm.execute(null, "LoadSubscribedUnitsGivenYear", args, names);
 
if(cuYear != null)
subscribedUnitsYear.put(year,cuYear);
else
subscribedUnitsYear.put(year,new ArrayList<CourseUnit>());
}
catch (Throwable e)
{
logger.error(e,e);
}
}
return cuYear;
}
public List<CourseUnit> getSubscribedUnitsViewA(String year)
{
return getUnitsSemestre("A", getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewS1(String year)
{
return getUnitsSemestre("S1",getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewS2(String year)
{
return getUnitsSemestre("S2",getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewT1(String year)
{
return getUnitsSemestre("T1",getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewT2(String year)
{
return getUnitsSemestre("T2",getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewT3(String year)
{
return getUnitsSemestre("T3",getSubscribedUnitsView(year));
}
public List<CourseUnit> getSubscribedUnitsViewT4(String year)
{
return getUnitsSemestre("T4",getSubscribedUnitsView(year));
}
 
public List<CourseUnit> getSubscribedUnitsOldYearsViewS1()
{
return getUnitsSemestre("S1",getSubscribedUnitsOldYearsView());
/impl/src/java/pt/estgp/estgweb/domain/CourseUnitProgramImpl.java
505,9 → 505,13
 
private static void importCourseUnit(CourseUnitInputLine line, String importYear) throws TransformerException, IOException, FOPException {
 
CourseUnit cu;
CourseUnit cu = null;
try{
cu = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique(line.codigoSIGESUnidade,line.codigoCurso,line.semestre, importYear);
//todo revisao necessaria
System.out.println("######FRAGMENTO DE CODIGO DESATUALIZADO, NESTE MOMENTO UMA CADEIRA AQUI NAO E UNICA (FALTA ID DE TURMA) -> NECESSITA DE REVISAO");
List<CourseUnit> cs = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode(line.codigoSIGESUnidade,line.codigoCurso,line.semestre, importYear);
if(cs!=null && cs.size() > 0)
cu=cs.get(0);
}catch(NonUniqueResultException e)
{
errors.add("unidade nao unica: " + line.codigoSIGESUnidade + ":" + line.codigoCurso + ":" + line.semestre + ":" + importYear );
/impl/src/java/pt/estgp/estgweb/domain/ConfigurationGradesStatusEpocaImpl.java
New file
0,0 → 1,27
package pt.estgp.estgweb.domain;
 
import java.io.Serializable;
import java.util.Date;
 
/**
* Created by jorgemachado on 02/11/15.
*/
public class ConfigurationGradesStatusEpocaImpl extends ConfigurationGradesStatusEpoca {
 
public ConfigurationGradesStatusEpocaImpl()
{
}
@Override
public Serializable getSerializable() {
return getId();
}
 
public static ConfigurationGradesStatusEpocaImpl create(String status, String descricao)
{
ConfigurationGradesStatusEpocaImpl obj = DomainObjectFactory.createConfigurationGradesStatusEpocaImpl();
obj.setStatus(status);
obj.setDescricao(descricao);
obj.setSaveDate(new Date());
return obj;
}
}
/impl/src/java/pt/estgp/estgweb/domain/TeacherImpl.java
70,6 → 70,27
{
return getUnitsSemestre("A",getTeachedUnitsView());
}
 
public List<CourseUnit> getTeachedUnitsViewT1()
{
return getUnitsSemestre("T1",getTeachedUnitsView());
}
 
public List<CourseUnit> getTeachedUnitsViewT2()
{
return getUnitsSemestre("T2",getTeachedUnitsView());
}
 
public List<CourseUnit> getTeachedUnitsViewT3()
{
return getUnitsSemestre("T3",getTeachedUnitsView());
}
 
public List<CourseUnit> getTeachedUnitsViewT4()
{
return getUnitsSemestre("T4",getTeachedUnitsView());
}
 
public List<CourseUnit> getTeachedUnitsView()
{
if(teachedUnitsView == null)
112,8 → 133,28
return getUnitsSemestre("A",getTeachedUnitsCurrentYearView());
}
 
public List<CourseUnit> getTeachedUnitsCurrentYearViewT1()
{
return getUnitsSemestre("T1",getTeachedUnitsCurrentYearView());
}
 
public List<CourseUnit> getTeachedUnitsCurrentYearViewT2()
{
return getUnitsSemestre("T2",getTeachedUnitsCurrentYearView());
}
 
public List<CourseUnit> getTeachedUnitsCurrentYearViewT3()
{
return getUnitsSemestre("T3",getTeachedUnitsCurrentYearView());
}
 
public List<CourseUnit> getTeachedUnitsCurrentYearViewT4()
{
return getUnitsSemestre("T4",getTeachedUnitsCurrentYearView());
}
 
 
 
public List<CourseUnit> getTeachedUnitsViewS1(String year)
{
return getUnitsSemestre("S1",getTeachedUnitsView(year));
127,6 → 168,26
return getUnitsSemestre("A",getTeachedUnitsView(year));
}
 
public List<CourseUnit> getTeachedUnitsViewT1(String year)
{
return getUnitsSemestre("T1",getTeachedUnitsView(year));
}
 
public List<CourseUnit> getTeachedUnitsViewT2(String year)
{
return getUnitsSemestre("T2",getTeachedUnitsView(year));
}
 
public List<CourseUnit> getTeachedUnitsViewT3(String year)
{
return getUnitsSemestre("T3",getTeachedUnitsView(year));
}
 
public List<CourseUnit> getTeachedUnitsViewT4(String year)
{
return getUnitsSemestre("T4",getTeachedUnitsView(year));
}
 
Map<String,List<CourseUnit>> teachedUnitsYear = new HashMap<String,List<CourseUnit>>();
Map<String,List<Course>> teachedCourseYear = new HashMap<String,List<Course>>();
 
/impl/src/java/pt/estgp/estgweb/domain/UserManagedRoleImpl.java
1,12 → 1,12
package pt.estgp.estgweb.domain;
 
import jomm.utils.StringsUtils;
import pt.estgp.estgweb.utils.RoleManager;
 
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
 
import pt.estgp.estgweb.utils.RoleManager;
 
 
public abstract class UserManagedRoleImpl extends UserImpl
{
 
61,6 → 61,7
}
}
}
 
return super.getRoles();
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/JobServiceTaskSchedulerView.java
New file
0,0 → 1,130
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.JobServiceTaskScheduler;
import pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl;
import pt.estgp.estgweb.domain.JobServiceTaskSchedulerParameter;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.utils.DynamicArrayList;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 19:34:49
* @see pt.estgp.estgweb.domain.views
*/
public class JobServiceTaskSchedulerView extends DomainObjectView
{
 
private static Logger logger = Logger.getLogger(JobServiceTaskSchedulerView.class);
 
 
JobServiceTaskSchedulerImpl jobServiceTaskScheduler;
List<JobServiceTaskSchedulerParameter> parameters;
 
@Override
public Class getReferenceClass() {
return JobServiceTaskScheduler.class;
}
 
@Override
public Serializable getSerializable()
{
return jobServiceTaskScheduler.getId();
}
 
public JobServiceTaskSchedulerView()
{
 
}
 
public JobServiceTaskSchedulerView(JobServiceTaskSchedulerImpl jobServiceTaskScheduler)
{
super(jobServiceTaskScheduler);
init(jobServiceTaskScheduler);
}
public void init(JobServiceTaskSchedulerImpl jobServiceTaskScheduler)
{
parameters = new ArrayList<JobServiceTaskSchedulerParameter>();
 
if(jobServiceTaskScheduler.getServiceTaskSchedulerParameters() != null)
{
parameters.addAll(jobServiceTaskScheduler.getServiceTaskSchedulerParameters());
}
 
}
 
public void persistViewInObject(JobServiceTaskScheduler jobServiceTaskScheduler)
{
jobServiceTaskScheduler.setDescription(this.jobServiceTaskScheduler.getDescription());
jobServiceTaskScheduler.setTargetService(this.jobServiceTaskScheduler.getTargetService());
jobServiceTaskScheduler.setWeekly(this.jobServiceTaskScheduler.isWeekly());
jobServiceTaskScheduler.setWeekday(this.jobServiceTaskScheduler.getWeekday());
jobServiceTaskScheduler.setDaily(this.jobServiceTaskScheduler.isDaily());
jobServiceTaskScheduler.setHour(this.jobServiceTaskScheduler.getHour());
jobServiceTaskScheduler.setMinute(this.jobServiceTaskScheduler.getMinute());
jobServiceTaskScheduler.setSecond(this.jobServiceTaskScheduler.getSecond());
jobServiceTaskScheduler.setMonthly(this.jobServiceTaskScheduler.isMonthly());
jobServiceTaskScheduler.setMonthday(this.jobServiceTaskScheduler.getMonthday());
jobServiceTaskScheduler.setNow(this.jobServiceTaskScheduler.isNow());
 
//Remover apagados
List<JobServiceTaskSchedulerParameter> deleted = DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl()
.deleteMissing(
this.parameters,
jobServiceTaskScheduler.getServiceTaskSchedulerParameters(),
new Comparator<JobServiceTaskSchedulerParameter>()
{
@Override
public int compare(JobServiceTaskSchedulerParameter j1, JobServiceTaskSchedulerParameter j2) {
return (int) (j1.getId() - j2.getId());
}
});
for(JobServiceTaskSchedulerParameter d: deleted)
d.setJobServiceTaskScheduler(null);
 
for(JobServiceTaskSchedulerParameter newParam: parameters)
{
if(newParam.getId() <= 0)
{
newParam.setJobServiceTaskScheduler(jobServiceTaskScheduler);
jobServiceTaskScheduler.getServiceTaskSchedulerParameters().add(newParam);
newParam.setSaveDate(new Date());
DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl().save(newParam);
}
else
{
JobServiceTaskSchedulerParameter persistentParam = DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl().load(newParam.getId());
persistentParam.setDescription(newParam.getDescription());
persistentParam.setName(newParam.getName());
persistentParam.setObject(newParam.getObject());
}
}
}
 
public JobServiceTaskSchedulerImpl getJobServiceTaskScheduler() {
return jobServiceTaskScheduler;
}
 
public void setJobServiceTaskScheduler(JobServiceTaskSchedulerImpl jobServiceTaskScheduler) {
this.jobServiceTaskScheduler = jobServiceTaskScheduler;
}
 
public List<JobServiceTaskSchedulerParameter> getParameters() {
if(parameters == null)
parameters = new DynamicArrayList<JobServiceTaskSchedulerParameter>(JobServiceTaskSchedulerParameter.class);
return parameters;
}
 
public void setParameters(List<JobServiceTaskSchedulerParameter> parameters) {
this.parameters = parameters;
}
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitEvaluationView.java
19,6 → 19,7
private CourseUnitEvaluation courseUnitEvaluation;
private boolean fechar = false;
private boolean teacherComplete = false;
private boolean autosave = false;
 
public Class getReferenceClass()
{
83,4 → 84,12
public void setTeacherComplete(boolean teacherComplete) {
this.teacherComplete = teacherComplete;
}
 
public boolean isAutosave() {
return autosave;
}
 
public void setAutosave(boolean autosave) {
this.autosave = autosave;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/ConfigurationGradesView.java
New file
0,0 → 1,64
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.*;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by jorgemachado on 12/11/15.
*/
public class ConfigurationGradesView extends DomainObjectView {
 
long id;
List<ConfigurationGradesStatusEpoca> statusEpocas;
List<ConfigurationGradesEpocaAvaliacao> epocasAvaliacao;
 
@Override
public Class getReferenceClass() {
return ConfigurationGrades.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
 
public void init(ConfigurationGrades configurationGrades)
{
this.id = configurationGrades.getId();
statusEpocas = new ArrayList<ConfigurationGradesStatusEpoca>(configurationGrades.getStatusEpoca());
epocasAvaliacao = new ArrayList<ConfigurationGradesEpocaAvaliacao>(configurationGrades.getEpocasAvaliacao());
}
 
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public List<ConfigurationGradesStatusEpoca> getStatusEpocas() {
return statusEpocas;
}
 
public void setStatusEpocas(List<ConfigurationGradesStatusEpoca> statusEpocas) {
this.statusEpocas = statusEpocas;
}
 
public List<ConfigurationGradesEpocaAvaliacao> getEpocasAvaliacao() {
return epocasAvaliacao;
}
 
public void setEpocasAvaliacao(List<ConfigurationGradesEpocaAvaliacao> epocasAvaliacao) {
this.epocasAvaliacao = epocasAvaliacao;
}
 
public void persist(ConfigurationGrades grades)
{
 
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/CourseView.java
6,10 → 6,12
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.web.utils.DatesUtils;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
 
/**
22,6 → 24,15
{
private static final Logger logger = Logger.getLogger(CourseView.class);
 
static HashMap<String,String> degrees = new HashMap<String, String>();
static
{
List<String> degreesProps = ConfigProperties.getListValues("siges.degree.");
for(String degree: degreesProps)
{
degrees.put(degree,degree);
}
}
 
private long id;
 
35,12 → 46,35
private UserView coordinator;
private UserView director;
private List<CourseUnitView> courseUnits;
 
private List<CourseUnitView> courseUnitsWithNoProgramA;
private List<CourseUnitView> courseUnitsWithProgramCheckedA;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedA;
 
private List<CourseUnitView> courseUnitsWithNoProgramS1;
private List<CourseUnitView> courseUnitsWithProgramCheckedS1;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedS1;
 
private List<CourseUnitView> courseUnitsWithNoProgramS2;
private List<CourseUnitView> courseUnitsWithProgramCheckedS2;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedS2;
 
private List<CourseUnitView> courseUnitsWithNoProgramT1;
private List<CourseUnitView> courseUnitsWithProgramCheckedT1;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedT1;
 
private List<CourseUnitView> courseUnitsWithNoProgramT2;
private List<CourseUnitView> courseUnitsWithProgramCheckedT2;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedT2;
 
private List<CourseUnitView> courseUnitsWithNoProgramT3;
private List<CourseUnitView> courseUnitsWithProgramCheckedT3;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedT3;
 
private List<CourseUnitView> courseUnitsWithNoProgramT4;
private List<CourseUnitView> courseUnitsWithProgramCheckedT4;
private List<CourseUnitView> courseUnitsWithProgramNotCheckedT4;
 
private String studiesPlanStreamId;
private RepositoryFileImpl studiesPlan;
private String htmlResult;
227,7 → 261,15
{
return degree;
}
public String getDegreeCleanCode()
{
 
if(degree == null || degree.trim().length() > 0)
if(degrees.get(degree)!=null)
return degree;
return Globals.COURSE_DEGREE_UNKNOWN; //for unknown
}
 
public void setDegree(String degree)
{
this.degree = degree;
380,10 → 422,28
}
 
 
public List<CourseUnitView> getCourseUnitsWithNoProgramS1()
public List<CourseUnitView> getCourseUnitsWithNoProgramA() { return courseUnitsWithNoProgramA; }
public List<CourseUnitView> getCourseUnitsWithNoProgramS1() { return courseUnitsWithNoProgramS1; }
public List<CourseUnitView> getCourseUnitsWithNoProgramS2()
{
return courseUnitsWithNoProgramS1;
return courseUnitsWithNoProgramS2;
}
public List<CourseUnitView> getCourseUnitsWithNoProgramT1()
{
return courseUnitsWithNoProgramT1;
}
public List<CourseUnitView> getCourseUnitsWithNoProgramT2()
{
return courseUnitsWithNoProgramT2;
}
public List<CourseUnitView> getCourseUnitsWithNoProgramT3()
{
return courseUnitsWithNoProgramT3;
}
public List<CourseUnitView> getCourseUnitsWithNoProgramT4()
{
return courseUnitsWithNoProgramT4;
}
 
 
public String getValidationRole() {
394,23 → 454,144
this.validationRole = validationRole;
}
 
public void setCourseUnitsWithNoProgramA(List<CourseUnitView> courseUnitsWithNoProgramA)
{
this.courseUnitsWithNoProgramA = courseUnitsWithNoProgramA;
}
public void setCourseUnitsWithNoProgramS1(List<CourseUnitView> courseUnitsWithNoProgramS1)
{
this.courseUnitsWithNoProgramS1 = courseUnitsWithNoProgramS1;
}
public void setCourseUnitsWithNoProgramS2(List<CourseUnitView> courseUnitsWithNoProgramS2)
{
this.courseUnitsWithNoProgramS2 = courseUnitsWithNoProgramS2;
}
public void setCourseUnitsWithNoProgramT1(List<CourseUnitView> courseUnitsWithNoProgramT1)
{
this.courseUnitsWithNoProgramT1 = courseUnitsWithNoProgramT1;
}
public void setCourseUnitsWithNoProgramT2(List<CourseUnitView> courseUnitsWithNoProgramT2)
{
this.courseUnitsWithNoProgramT2 = courseUnitsWithNoProgramT2;
}
public void setCourseUnitsWithNoProgramT3(List<CourseUnitView> courseUnitsWithNoProgramT3)
{
this.courseUnitsWithNoProgramT3 = courseUnitsWithNoProgramT3;
}
public void setCourseUnitsWithNoProgramT4(List<CourseUnitView> courseUnitsWithNoProgramT4)
{
this.courseUnitsWithNoProgramT4 = courseUnitsWithNoProgramT4;
}
 
public boolean getHasA() { return getHasCourseUnitsWithNoProgramA() || getHasCourseUnitsWithProgramCheckedA() || getHasCourseUnitsWithProgramNotCheckedA(); }
public boolean getHasS1() { return getHasCourseUnitsWithNoProgramS1() || getHasCourseUnitsWithProgramCheckedS1() || getHasCourseUnitsWithProgramNotCheckedS1(); }
public boolean getHasS2() { return getHasCourseUnitsWithNoProgramS2() || getHasCourseUnitsWithProgramCheckedS2() || getHasCourseUnitsWithProgramNotCheckedS2(); }
public boolean getHasT1() { return getHasCourseUnitsWithNoProgramT1() || getHasCourseUnitsWithProgramCheckedT1() || getHasCourseUnitsWithProgramNotCheckedT1(); }
public boolean getHasT2() { return getHasCourseUnitsWithNoProgramT2() || getHasCourseUnitsWithProgramCheckedT2() || getHasCourseUnitsWithProgramNotCheckedT2(); }
public boolean getHasT3() { return getHasCourseUnitsWithNoProgramT3() || getHasCourseUnitsWithProgramCheckedT3() || getHasCourseUnitsWithProgramNotCheckedT3(); }
public boolean getHasT4() { return getHasCourseUnitsWithNoProgramT4() || getHasCourseUnitsWithProgramCheckedT4() || getHasCourseUnitsWithProgramNotCheckedT4(); }
 
public boolean getHasCourseUnitsWithProgramCheckedA() { return courseUnitsWithProgramCheckedA!=null && courseUnitsWithProgramCheckedA.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedS1() { return courseUnitsWithProgramCheckedS1!=null && courseUnitsWithProgramCheckedS1.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedS2() { return courseUnitsWithProgramCheckedS2!=null && courseUnitsWithProgramCheckedS2.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedT1() { return courseUnitsWithProgramCheckedT1!=null && courseUnitsWithProgramCheckedT1.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedT2() { return courseUnitsWithProgramCheckedT2!=null && courseUnitsWithProgramCheckedT2.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedT3() { return courseUnitsWithProgramCheckedT3!=null && courseUnitsWithProgramCheckedT3.size() > 0; }
public boolean getHasCourseUnitsWithProgramCheckedT4() { return courseUnitsWithProgramCheckedT4!=null && courseUnitsWithProgramCheckedT4.size() > 0; }
 
public boolean getHasCourseUnitsWithProgramNotCheckedA() { return courseUnitsWithProgramNotCheckedA!=null && courseUnitsWithProgramNotCheckedA.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedS1() { return courseUnitsWithProgramNotCheckedS1!=null && courseUnitsWithProgramNotCheckedS1.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedS2() { return courseUnitsWithProgramNotCheckedS2!=null && courseUnitsWithProgramNotCheckedS2.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedT1() { return courseUnitsWithProgramNotCheckedT1!=null && courseUnitsWithProgramNotCheckedT1.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedT2() { return courseUnitsWithProgramNotCheckedT2!=null && courseUnitsWithProgramNotCheckedT2.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedT3() { return courseUnitsWithProgramNotCheckedT3!=null && courseUnitsWithProgramNotCheckedT3.size() > 0; }
public boolean getHasCourseUnitsWithProgramNotCheckedT4() { return courseUnitsWithProgramNotCheckedT4!=null && courseUnitsWithProgramNotCheckedT4.size() > 0; }
 
public boolean getHasCourseUnitsWithNoProgramA() { return courseUnitsWithNoProgramA!=null && courseUnitsWithNoProgramA.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramS1() { return courseUnitsWithNoProgramS1!=null && courseUnitsWithNoProgramS1.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramS2() { return courseUnitsWithNoProgramS2!=null && courseUnitsWithNoProgramS2.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramT1() { return courseUnitsWithNoProgramT1!=null && courseUnitsWithNoProgramT1.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramT2() { return courseUnitsWithNoProgramT2!=null && courseUnitsWithNoProgramT2.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramT3() { return courseUnitsWithNoProgramT3!=null && courseUnitsWithNoProgramT3.size() > 0; }
public boolean getHasCourseUnitsWithNoProgramT4() { return courseUnitsWithNoProgramT4!=null && courseUnitsWithNoProgramT4.size() > 0; }
 
 
public List<CourseUnitView> getCourseUnitsWithProgramCheckedA()
{
if(courseUnitsWithProgramCheckedA==null)
courseUnitsWithProgramCheckedA = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedA;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedS1()
{
if(courseUnitsWithProgramCheckedS1==null)
courseUnitsWithProgramCheckedS1 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedS1;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedS2()
{
if(courseUnitsWithProgramCheckedS2==null)
courseUnitsWithProgramCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedS2;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedT1()
{
if(courseUnitsWithProgramCheckedT1==null)
courseUnitsWithProgramCheckedT1 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedT1;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedT2()
{
if(courseUnitsWithProgramCheckedT2==null)
courseUnitsWithProgramCheckedT2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedT2;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedT3()
{
if(courseUnitsWithProgramCheckedT3==null)
courseUnitsWithProgramCheckedT3 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedT3;
}
public List<CourseUnitView> getCourseUnitsWithProgramCheckedT4()
{
if(courseUnitsWithProgramCheckedT4==null)
courseUnitsWithProgramCheckedT4 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedT4;
}
 
public void setCourseUnitsWithProgramCheckedS1(List<CourseUnitView> courseUnitsWithProgramCheckedS1)
 
 
public void setCourseUnitsWithProgramCheckedA(List<CourseUnitView> courseUnitsWithProgramCheckedA) { this.courseUnitsWithProgramCheckedA = courseUnitsWithProgramCheckedA; }
public void setCourseUnitsWithProgramCheckedS1(List<CourseUnitView> courseUnitsWithProgramCheckedS1) { this.courseUnitsWithProgramCheckedS1 = courseUnitsWithProgramCheckedS1; }
public void setCourseUnitsWithProgramCheckedS2(List<CourseUnitView> courseUnitsWithProgramCheckedS2)
{
this.courseUnitsWithProgramCheckedS1 = courseUnitsWithProgramCheckedS1;
this.courseUnitsWithProgramCheckedS2 = courseUnitsWithProgramCheckedS2;
}
public void setCourseUnitsWithProgramCheckedT1(List<CourseUnitView> courseUnitsWithProgramCheckedT1)
{
this.courseUnitsWithProgramCheckedT1 = courseUnitsWithProgramCheckedT1;
}
public void setCourseUnitsWithProgramCheckedT2(List<CourseUnitView> courseUnitsWithProgramCheckedT2)
{
this.courseUnitsWithProgramCheckedT2 = courseUnitsWithProgramCheckedT2;
}
public void setCourseUnitsWithProgramCheckedT3(List<CourseUnitView> courseUnitsWithProgramCheckedT3)
{
this.courseUnitsWithProgramCheckedT3 = courseUnitsWithProgramCheckedT3;
}
public void setCourseUnitsWithProgramCheckedT4(List<CourseUnitView> courseUnitsWithProgramCheckedT4)
{
this.courseUnitsWithProgramCheckedT4 = courseUnitsWithProgramCheckedT4;
}
 
 
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedA()
{
if(courseUnitsWithProgramNotCheckedA==null)
courseUnitsWithProgramNotCheckedA = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedA;
}
 
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedS1()
{
if(courseUnitsWithProgramNotCheckedS1==null)
418,45 → 599,83
return courseUnitsWithProgramNotCheckedS1;
}
 
public void setCourseUnitsWithProgramNotCheckedS1(List<CourseUnitView> courseUnitsWithProgramNotCheckedS1)
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedS2()
{
this.courseUnitsWithProgramNotCheckedS1 = courseUnitsWithProgramNotCheckedS1;
if(courseUnitsWithProgramNotCheckedS2==null)
courseUnitsWithProgramNotCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedS2;
}
 
public List<CourseUnitView> getCourseUnitsWithNoProgramS2()
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedT1()
{
return courseUnitsWithNoProgramS2;
if(courseUnitsWithProgramNotCheckedT1==null)
courseUnitsWithProgramNotCheckedT1 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedT1;
}
 
public void setCourseUnitsWithNoProgramS2(List<CourseUnitView> courseUnitsWithNoProgramS2)
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedT2()
{
this.courseUnitsWithNoProgramS2 = courseUnitsWithNoProgramS2;
if(courseUnitsWithProgramNotCheckedT2==null)
courseUnitsWithProgramNotCheckedT2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedT2;
}
 
public List<CourseUnitView> getCourseUnitsWithProgramCheckedS2()
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedT3()
{
if(courseUnitsWithProgramCheckedS2==null)
courseUnitsWithProgramCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramCheckedS2;
if(courseUnitsWithProgramNotCheckedT3==null)
courseUnitsWithProgramNotCheckedT3 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedT3;
}
 
public void setCourseUnitsWithProgramCheckedS2(List<CourseUnitView> courseUnitsWithProgramCheckedS2)
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedT4()
{
this.courseUnitsWithProgramCheckedS2 = courseUnitsWithProgramCheckedS2;
if(courseUnitsWithProgramNotCheckedT4==null)
courseUnitsWithProgramNotCheckedT4 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedT4;
}
 
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedS2()
 
 
public void setCourseUnitsWithProgramNotCheckedA(List<CourseUnitView> courseUnitsWithProgramNotCheckedA)
{
if(courseUnitsWithProgramNotCheckedS2==null)
courseUnitsWithProgramNotCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class);
return courseUnitsWithProgramNotCheckedS2;
this.courseUnitsWithProgramNotCheckedA = courseUnitsWithProgramNotCheckedA;
}
 
public void setCourseUnitsWithProgramNotCheckedS1(List<CourseUnitView> courseUnitsWithProgramNotCheckedS1)
{
this.courseUnitsWithProgramNotCheckedS1 = courseUnitsWithProgramNotCheckedS1;
}
public void setCourseUnitsWithProgramNotCheckedS2(List<CourseUnitView> courseUnitsWithProgramNotCheckedS2)
{
this.courseUnitsWithProgramNotCheckedS2 = courseUnitsWithProgramNotCheckedS2;
}
public void setCourseUnitsWithProgramNotCheckedT1(List<CourseUnitView> courseUnitsWithProgramNotCheckedT1)
{
this.courseUnitsWithProgramNotCheckedT1 = courseUnitsWithProgramNotCheckedT1;
}
public void setCourseUnitsWithProgramNotCheckedT2(List<CourseUnitView> courseUnitsWithProgramNotCheckedT2)
{
this.courseUnitsWithProgramNotCheckedT2 = courseUnitsWithProgramNotCheckedT2;
}
public void setCourseUnitsWithProgramNotCheckedT3(List<CourseUnitView> courseUnitsWithProgramNotCheckedT3)
{
this.courseUnitsWithProgramNotCheckedT3 = courseUnitsWithProgramNotCheckedT3;
}
public void setCourseUnitsWithProgramNotCheckedT4(List<CourseUnitView> courseUnitsWithProgramNotCheckedT4)
{
this.courseUnitsWithProgramNotCheckedT4 = courseUnitsWithProgramNotCheckedT4;
}
 
 
 
 
 
 
 
 
 
 
 
 
public String getUserGroupStudents() {
return userGroupStudents;
}
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitGradeView.java
1,15 → 1,12
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.CourseUnitGrade;
import pt.estgp.estgweb.domain.CourseUnitGradeImpl;
import pt.estgp.estgweb.services.courseunits.LoadCourseUnitAnnouncements;
import org.apache.log4j.Logger;
 
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.io.Serializable;
import java.util.Date;
import java.io.Serializable;
 
/**
* @author Jorge Machado
31,6 → 28,8
private int statusEpoca;
private UserView student;
private Date publishDate;
private String descEpoca;
private String descStatusEpoca;
 
private CourseUnitGrade courseUnitGrade;
 
57,6 → 56,8
grade = courseUnitGrade.getGrade();
statusEpoca = courseUnitGrade.getStatusEpoca();
publishDate = courseUnitGrade.getPublishDate();
descEpoca = courseUnitGrade.getDescEpoca();
descStatusEpoca = courseUnitGrade.getDescStatusEpoca();
}
 
 
126,4 → 127,20
return df.format(publishDate);
return "";
}
 
public String getDescEpoca() {
return descEpoca;
}
 
public void setDescEpoca(String descEpoca) {
this.descEpoca = descEpoca;
}
 
public String getDescStatusEpoca() {
return descStatusEpoca;
}
 
public void setDescStatusEpoca(String descStatusEpoca) {
this.descStatusEpoca = descStatusEpoca;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java
1,18 → 1,17
package pt.estgp.estgweb.domain.views;
 
import jomm.utils.BytesUtils;
import jomm.utils.DesUtils;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.enums.RecordEnum;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.Globals;
 
import java.io.Serializable;
import java.util.*;
 
import jomm.utils.DesUtils;
import jomm.utils.BytesUtils;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
73,6 → 72,8
 
private List<CourseUnitView> responsableCourseUnits;
 
private boolean propinasEmDia = false;
 
public UserView()
{}
 
122,6 → 123,7
{
mainArea = ((Student)user).getMainArea();
code = ((Student)user).getSigesCode();
propinasEmDia = ((Student)user).isPropinasEmDia();
}
}
 
718,7 → 720,15
this.deleted = deleted;
}
 
// public List<Course> getCourses()
public boolean isPropinasEmDia() {
return propinasEmDia;
}
 
public void setPropinasEmDia(boolean propinasEmDia) {
this.propinasEmDia = propinasEmDia;
}
 
// public List<Course> getCourses()
// {
// if(courses == null)
// {
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitView.java
25,6 → 25,7
 
LoadCourseUnitAnnouncements loadCourseUnitAnnouncements = new LoadCourseUnitAnnouncements();
 
 
private long id;
private String name;
private String code;
55,16 → 56,22
private String evaluationStreamId;
private boolean validProgram;
private UserView validatorUser;
private boolean teacherCompleteEvaluation = false;
private boolean validEvaluation = false;
private int programSize;
private String extension;
private List<CourseUnitAssignementView> courseUnitAssignements;
private String sumariosPathFileIntranet;
private String cdTurma;
 
private boolean notFound = false;
 
private CourseView courseView;
 
private String interfaceImportYear = null;
 
private boolean evaluationOpenByAdmin = false;
 
public Class getReferenceClass()
{
return CourseUnitImpl.class;
115,6 → 122,9
 
private void init(CourseUnit courseUnit, boolean initTeachers, boolean initStudents, boolean initBlog, boolean validatorUser)
{
 
this.interfaceImportYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear();
 
this.pathIntranet = courseUnit.getPathIntranet();
this.normalizedName = courseUnit.getNormalizedName();
this.courseUnit = courseUnit;
126,6 → 136,8
this.courseCode = courseUnit.getCourseCode();
this.summariesJson = courseUnit.getSummariesJson();
this.sumariosPathFileIntranet = ((CourseUnitImpl)courseUnit).getSummariosPathFileIntranet();
this.evaluationOpenByAdmin = courseUnit.isEvaluationOpenByAdmin(); //nao tem persistencia propria tem de ser feito num serviço
this.cdTurma = courseUnit.getCdTurma();
 
// this.objectives = courseUnit.getObjectives(); DEPRECATED
if(courseUnit.getCourseUnitProgram() !=null && courseUnit.getCourseUnitProgram().getCourseUnitProgramPart2() != null)
148,6 → 160,7
{
evaluationStreamId = courseUnit.getEvaluationStreamId();
validEvaluation = courseUnit.getCourseUnitEvaluation().isClosed();
teacherCompleteEvaluation = courseUnit.getCourseUnitEvaluation().isTeacherComplete();
}
 
// if(courseUnit.getBlog() != null)
193,6 → 206,9
return evaluationStreamId;
}
 
public boolean isTeacherCompleteEvaluation() {
return teacherCompleteEvaluation;
}
 
public String getSumariosPathFileIntranet() {
return sumariosPathFileIntranet;
215,6 → 231,10
return responsableId;
}
 
public String getCdTurma() {
return cdTurma;
}
 
public void setResponsableId(long responsableId) {
this.responsableId = responsableId;
}
342,6 → 362,7
c.setImportYear(importYear);
c.setName(name);
c.setCode(code);
c.setCdTurma(cdTurma);
c.setSemestre(semestre);
if(courseId > 0)
{
476,6 → 497,10
return summariesJson;
}
 
public void setCdTurma(String cdTurma) {
this.cdTurma = cdTurma;
}
 
List<CourseUnitSummaryView> summariesFromJson = null;
/**
*
483,6 → 508,7
*/
 
int lateSummaries = 0;
List<String> lateSummariesDates = new ArrayList<String>();
 
public synchronized List<CourseUnitSummaryView> getSummariesFromJson() {
if(summariesFromJson != null)
503,13 → 529,16
CourseUnitSummaryView view = new CourseUnitSummaryView(sum);
summariesFromJson.add(view);
}
else
else if(importYear.equals(interfaceImportYear))
//so verifica atrasados para unidades do ano corrente a titulo informativo
{
CourseUnitSummaryView view = new CourseUnitSummaryView(sum);
if(view.getNumber() < 0 && view.getOriginalDate().getTime() < System.currentTimeMillis())
if(view.getNumber() < 0 && view.getOriginalDate().getTime() + 48*60*60*1000 < System.currentTimeMillis())
{
System.out.println(view.getNumber() + " " + view.getDate() + " " + view.getOriginalDate());
 
//System.out.println(view.getNumber() + " " + view.getDate() + " " + view.getOriginalDate());
lateSummaries++;
lateSummariesDates.add(view.getDate());
}
}
}
532,6 → 561,10
return null;
}
 
public List<String> getLateSummariesDates() {
return lateSummariesDates;
}
 
public int getLateSummaries()
{
getSummariesFromJson();
636,6 → 669,15
return summaries;
}
 
 
public boolean isEvaluationOpenByAdmin() {
return evaluationOpenByAdmin;
}
 
public void setEvaluationOpenByAdmin(boolean evaluationOpenByAdmin) {
this.evaluationOpenByAdmin = evaluationOpenByAdmin;
}
 
public String getTeachersSnipet()
{
String sep = "";
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java
337,4 → 337,24
{
return new JobServiceTaskSchedulerParameterImpl();
}
 
public static ConfigurationGradesImpl createConfigurationGradesImpl()
{
return new ConfigurationGradesImpl();
}
 
public static ConfigurationGradesStatusEpocaImpl createConfigurationGradesStatusEpocaImpl()
{
return new ConfigurationGradesStatusEpocaImpl();
}
 
public static ConfigurationGradesEpocaAvaliacaoImpl createConfigurationGradesEpocaAvaliacaoImpl()
{
return new ConfigurationGradesEpocaAvaliacaoImpl();
}
 
public static ConfigurationDirectoryImpl createConfigurationDirectoryImpl()
{
return new ConfigurationDirectoryImpl();
}
}
/impl/src/java/pt/estgp/estgweb/domain/UserImpl.java
15,6 → 15,8
}
 
 
 
 
public boolean isNewUser()
{
return newUser;
/impl/src/java/pt/estgp/estgweb/domain/JobServiceTaskImpl.java
43,6 → 43,8
PENDING,
STARTED,
FINISHED,
FINISHED_ERRORS,
FINISHED_WARNINGS,
FAILED,
UNKNOWN_ERROR;
 
56,6 → 58,10
return STARTED;
if(status.equals(FINISHED.name()))
return FINISHED;
if(status.equals(FINISHED_ERRORS.name()))
return FINISHED_ERRORS;
if(status.equals(FINISHED_WARNINGS.name()))
return FINISHED_WARNINGS;
if(status.equals(FAILED.name()))
return FAILED;
return UNKNOWN_ERROR;
74,4 → 80,21
setStatus(statusEnum.name());
}
 
public String getServiceLastUpdateDateFormated() {
if(getServiceLastUpdateDate() == null)
return "";
return pt.estgp.estgweb.web.utils.DatesUtils.getStringFromDateWithMinutesAndSeconds(getServiceLastUpdateDate());
}
 
public String getServiceFinishDateFormated() {
if(getServiceFinishDate() == null)
return "";
return pt.estgp.estgweb.web.utils.DatesUtils.getStringFromDateWithMinutesAndSeconds(getServiceFinishDate());
}
 
public String getServiceStartDateFormated() {
if(getServiceStartDate() == null)
return "";
return pt.estgp.estgweb.web.utils.DatesUtils.getStringFromDateWithMinutesAndSeconds(getServiceStartDate());
}
}
/impl/src/java/pt/estgp/estgweb/domain/ConfigurationDirectoryImpl.java
New file
0,0 → 1,26
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 4/Abr/2013
* Time: 17:02:06
* To change this template use File | Settings | File Templates.
*/
public class ConfigurationDirectoryImpl extends ConfigurationDirectory
{
private static final Logger logger = Logger.getLogger(ConfigurationDirectoryImpl.class);
 
 
@Override
public Serializable getSerializable() {
return getId();
}
}
 
 
 
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/CourseUnitImpl.java
94,15 → 94,35
if(anotherInstance instanceof CourseUnitImpl)
{
CourseUnitImpl anCourseUnit = (CourseUnitImpl) anotherInstance;
boolean turmaVazia =getCdTurma() == null || getCdTurma().trim().length() == 0;
boolean anotherTurmaVazia = anCourseUnit.getCdTurma() == null || anCourseUnit.getCdTurma().trim().length() == 0;
boolean turmasIguais = (turmaVazia && anotherTurmaVazia) || (!turmaVazia && !anotherTurmaVazia && getCdTurma().equals(anCourseUnit.getCdTurma()));
 
return anCourseUnit.getCode() != null && getCode() != null && getCode().equals(anCourseUnit.getCode()) &&
anCourseUnit.getCourseCode() != null && getCourseCode() != null && getCourseCode().equals(anCourseUnit.getCourseCode()) &&
anCourseUnit.getSemestre() != null && getSemestre() != null && getSemestre().equals(anCourseUnit.getSemestre()) &&
anCourseUnit.getImportYear() != null && getImportYear() != null && getImportYear().equals(anCourseUnit.getImportYear());
anCourseUnit.getImportYear() != null && getImportYear() != null && getImportYear().equals(anCourseUnit.getImportYear()) &&
turmasIguais;
}
return false;
 
}
 
public boolean equalsIgnoringTurma(Object anotherInstance)
{
if(anotherInstance instanceof CourseUnitImpl)
{
CourseUnitImpl anCourseUnit = (CourseUnitImpl) anotherInstance;
 
return anCourseUnit.getCode() != null && getCode() != null && getCode().equals(anCourseUnit.getCode()) &&
anCourseUnit.getCourseCode() != null && getCourseCode() != null && getCourseCode().equals(anCourseUnit.getCourseCode()) &&
anCourseUnit.getSemestre() != null && getSemestre() != null && getSemestre().equals(anCourseUnit.getSemestre()) &&
anCourseUnit.getImportYear() != null && getImportYear() != null && getImportYear().equals(anCourseUnit.getImportYear());
}
return false;
 
}
 
/**
* Means that is teacher os responsable teacher or from course commission
* Only works in open transaction
124,6 → 144,12
return Globals.FTP_IONLINE_START_PATH + "/" + getPathIntranet() + "/" + Globals.INTRANET_DTP + "/" + Globals.INTRANET_DTP_Sumarios;
}
 
public String getInqueritosPedagogicosPathIntranet()
{
return Globals.FTP_IONLINE_START_PATH + getPathIntranet() + "/" + Globals.INTRANET_DTP + "/" + Globals.INTRANET_DTP_InqueritoPedagogico;
}
 
 
public String getSummariosPathFileIntranet()
{
return getSummariosPathIntranet() + "/" + getSummariosFileNameIntranet();
137,7 → 163,7
public String getSigesUniqueIdentifiers()
{
return "SIGES:" + getCode() + ", COURSE: " + getCourseCode() +
", " + getSemestre() + " of " + getImportYear() + " - " + getName();
", " + getSemestre() + " of " + getImportYear() + " - " + getName() + " Turma - " + getCdTurma();
}
 
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationGradesStatusEpocaDaoImpl.java
New file
0,0 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
* @time 2:51:06
* @see pt.estgp.estgweb.domain.dao.impl
*/
public class ConfigurationGradesStatusEpocaDaoImpl extends ConfigurationGradesStatusEpocaDao
{
public static ConfigurationGradesStatusEpocaDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new ConfigurationGradesStatusEpocaDaoImpl();
return (ConfigurationGradesStatusEpocaDaoImpl) myInstance;
}
 
 
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserDaoImpl.java
12,7 → 12,9
import pt.estgp.estgweb.services.common.SearchTypeEnum;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.*;
133,7 → 135,17
 
public List<User> loadRoleUsers(String role)
{
return createCriteria().add(like("roles", "%" + role + "%")).addOrder(Order.asc("name")).list();
if(role == null || role.trim().length() == 0)
return new ArrayList<User>();
List<User> users = createCriteria().add(like("roles", "%" + role + "%")).addOrder(Order.asc("name")).list();
Iterator<User> iter = users.iterator();
while(iter.hasNext())
{
User u = iter.next();
if(!u.hasRole(role))
iter.remove();
}
return users;
}
 
public List<User> loadRoleAreaUsers(String role, String area)
141,7 → 153,15
Criteria c = createCriteria().add(like("roles", "%" + role + "%")).addOrder(Order.asc("name"));
if(area != null && area.trim().length() > 0)
c.add(eq("mainArea",area));
return c.list();
List<User> users = c.list();
Iterator<User> iter = users.iterator();
while(iter.hasNext())
{
User u = iter.next();
if(!u.hasRole(role))
iter.remove();
}
return users;
}
 
public List<User> findUsers(String textToSearch)
226,10 → 246,14
// Duarte Santos
public List<User> loadRolesUsers(List<String> roles)
{
if(roles == null || roles.size() == 0)
return new ArrayList<User>();
Criteria criteria = createCriteria();
Criterion co = null;
for (String role : roles)
{
if(role.trim().length() == 0)
continue;
Criterion cor = like("roles", "%" + role + "%");
if (co == null)
co = cor;
237,6 → 261,23
co = or(co, cor);
}
criteria.add(co);
return criteria.list();
List<User> users = criteria.list();
Iterator<User> iter = users.iterator();
while(iter.hasNext())
{
boolean hasIt = false;
User u = iter.next();
for(String role: roles)
{
if(u.hasRole(role))
{
hasIt = true;
break;
}
}
if(!hasIt)
iter.remove();
}
return users;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/JobServiceTaskDaoImpl.java
1,5 → 1,9
package pt.estgp.estgweb.domain.dao.impl;
 
import org.hibernate.criterion.Order;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
15,7 → 19,12
return (JobServiceTaskDaoImpl) myInstance;
}
 
public List<JobServiceTaskDaoImpl> findLastNJobTasks(int max)
{
return createCriteria().addOrder(Order.desc("serviceStartDate")).setMaxResults(max).list();
}
 
 
 
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/BlogPostDaoImpl.java
1,23 → 1,20
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.domain.BlogImpl;
import jomm.utils.MyCalendar;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import pt.estgp.estgweb.domain.BlogPost;
import pt.estgp.estgweb.domain.BlogPostImpl;
import pt.estgp.estgweb.domain.Blog;
import pt.estgp.estgweb.domain.BlogPost;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
 
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Calendar;
import java.util.Iterator;
import java.util.ArrayList;
 
import static org.hibernate.criterion.Restrictions.*;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Criterion;
import org.hibernate.Query;
import org.hibernate.Criteria;
import jomm.utils.MyCalendar;
 
/**
* @author Jorge Machado
39,12 → 36,18
{
return createCriteria().add(eq("owner.id", ownerId)).list();
}
public List<BlogPostImpl> loadOwnedBlogPostsMax(long ownerId,int max)
{
return createCriteria().add(eq("owner.id", ownerId)).addOrder(Order.desc("updateDate")).setMaxResults(max).list();
}
 
public List<BlogPostImpl> loadOwnedBlogPosts(long ownerId, long blogId)
{
return createCriteria().add(eq("owner.id", ownerId)).add(eq("blog.id",blogId)).list();
}
 
 
 
public List<BlogPostImpl> loadBlogPosts(long blogId, int month, int year)
{
Calendar bottom = new MyCalendar(year,month,1);
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationGradesEpocaAvaliacaoDaoImpl.java
New file
0,0 → 1,23
package pt.estgp.estgweb.domain.dao.impl;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
* @time 2:51:06
* @see pt.estgp.estgweb.domain.dao.impl
*/
public class ConfigurationGradesEpocaAvaliacaoDaoImpl extends ConfigurationGradesEpocaAvaliacaoDao
{
public static ConfigurationGradesEpocaAvaliacaoDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new ConfigurationGradesEpocaAvaliacaoDaoImpl();
return (ConfigurationGradesEpocaAvaliacaoDaoImpl) myInstance;
}
 
 
 
 
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationDaoImpl.java
1,13 → 1,15
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.Configuration;
import pt.estgp.estgweb.domain.ConfigurationImpl;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.utils.StringsUtils;
 
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
 
 
//TODO PRECISA DE CHAMAR UM SERVICO EM VEZ DE SER ASSIM porque esta a abrir transacoes por todo lado
//PRECISA DE SE FAZER UM CHECK A TODO O CODIGO QUE ABRE TRANSACOES FORA DOS SERVICOS
/**
* @author Jorge Machado
* @date 28/Fev/2008
26,6 → 28,7
public Configuration load()
{
List<Configuration> configs = createCriteria().list();
Configuration config = null;
if(configs.size() == 0)
{
Configuration configuration = new ConfigurationImpl();
36,11 → 39,37
configuration.setSaveDate(new Date());
configuration.setSigesInstitutionCode(1);
save(configuration);
return configuration;
config = configuration;
}
return configs.get(0);
else
config = configs.get(0);
 
if(config.getConfigurationGrades() == null)
{
//init by default with ESTG values
ConfigurationGradesImpl grades = DomainObjectFactory.createConfigurationGradesImpl();
grades.create();
for(ConfigurationGradesEpocaAvaliacao epoca: grades.getEpocasAvaliacao())
DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().save(epoca);
for(ConfigurationGradesStatusEpoca status: grades.getStatusEpoca())
DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().save(status);
DaoFactory.getConfigurationGradesDaoImpl().save(grades);
config.setConfigurationGrades(grades);
}
return config;
}
 
public Configuration loadSimpleConfigurationForConsult()
{
List<Configuration> configs = createCriteria().list();
if(configs.size() == 0)
{
return null;
}
else
return configs.get(0);
}
 
public void updateInterfaceImportYearCreateTransaction(String importYear)
{
getCurrentSession().beginTransaction();
104,6 → 133,24
return load().getCourseUnitEvaluationActiveYear();
}
 
public List<String> getCourseUnitEvaluationActiveDegrees()
{
String degrees = load().getCourseUnitEvaluationActiveDegrees();
if(degrees == null || degrees.trim().length() == 0)
return null;
List<String> degreesList = StringsUtils.getStringsFromSerial(degrees,";");
return degreesList;
}
 
public List<Long> getCourseUnitEvaluationActiveCourseIds()
{
String courseIds = load().getCourseUnitEvaluationActiveCourseIds();
if(courseIds == null || courseIds.trim().length() == 0)
return null;
List<Long> courseIdsListLongs = StringsUtils.getLongsFromSerial(courseIds,";");
return courseIdsListLongs;
}
 
public String getCourseUnitEvaluationActiveYearCreateTransaction()
{
getCurrentSession().beginTransaction();
112,12 → 159,40
return activeYear;
}
 
public List<String> getCourseUnitEvaluationActiveDegreesCreateTransaction()
{
getCurrentSession().beginTransaction();
List<String> activeDegrees = getCourseUnitEvaluationActiveDegrees();
getCurrentSession().getTransaction().commit();
return activeDegrees;
}
 
public List<Long> getCourseUnitEvaluationActiveCourseIdsCreateTransaction()
{
getCurrentSession().beginTransaction();
List<Long> activeCourseIds = getCourseUnitEvaluationActiveCourseIds();
getCurrentSession().getTransaction().commit();
return activeCourseIds;
}
 
public void updateCourseUnitEvaluationActiveYear(String activeYear)
{
Configuration config = load();
config.setCourseUnitEvaluationActiveYear(activeYear);
}
 
public void updateCourseUnitEvaluationActiveDegrees(List<String> activeDegrees)
{
Configuration config = load();
config.setCourseUnitEvaluationActiveDegrees(StringsUtils.getSerialStrings(activeDegrees,";"));
}
 
public void updateCourseUnitEvaluationActiveCourseIds(List<Long> activeCourseIds)
{
Configuration config = load();
config.setCourseUnitEvaluationActiveCourseIds(StringsUtils.getSerialLongs(activeCourseIds,";"));
}
 
public void updateCourseUnitEvaluationActiveYearCreateTransaction(String activeYear)
{
getCurrentSession().beginTransaction();
125,8 → 200,69
getCurrentSession().getTransaction().commit();
}
 
public void updateCourseUnitEvaluationActiveDegreesCreateTransaction(List<String> activeDegrees)
{
getCurrentSession().beginTransaction();
updateCourseUnitEvaluationActiveDegrees(activeDegrees);
getCurrentSession().getTransaction().commit();
}
 
public void updateCourseUnitEvaluationActiveCourseIdsCreateTransaction(List<Long> activeCourseIds)
{
getCurrentSession().beginTransaction();
updateCourseUnitEvaluationActiveCourseIds(activeCourseIds);
getCurrentSession().getTransaction().commit();
}
 
/**
* Return if the course id or the degree together with import year is active
* or if the unit is specially opened for edition
* @param courseUnitId
* @return
*/
public boolean isCourseUniEvaluationActivePeriodInTransaction(long courseUnitId)
{
getCurrentSession().beginTransaction();
String activeYear = getCourseUnitEvaluationActiveYear();
List<String> activeDegrees = getCourseUnitEvaluationActiveDegrees();
List<Long> activeCourseIds = getCourseUnitEvaluationActiveCourseIds();
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().get(courseUnitId);
boolean isActiveYear = activeYear != null && cu.getImportYear().equals(activeYear);
boolean isActiveDegree = activeDegrees!=null && activeDegrees.contains(cu.getCourse().getDegree());
boolean isActiveCourseId = activeCourseIds!=null && activeCourseIds.contains(cu.getCourse().getId());
 
 
boolean activePeriod =
cu.isEvaluationOpenByAdmin() ||
(isActiveYear && (isActiveCourseId || isActiveDegree));
getCurrentSession().getTransaction().commit();
return activePeriod;
}
 
/**
* Return if the course or the degree ant import year is active
* @param courseUnitId
* @return
*/
public boolean isCourseUniEvaluationRegularActivePeriodInTransaction(long courseUnitId)
{
getCurrentSession().beginTransaction();
String activeYear = getCourseUnitEvaluationActiveYear();
List<String> activeDegrees = getCourseUnitEvaluationActiveDegrees();
List<Long> activeCourseIds = getCourseUnitEvaluationActiveCourseIds();
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().get(courseUnitId);
boolean isActiveYear = activeYear != null && cu.getImportYear().equals(activeYear);
boolean isActiveDegree = activeDegrees!=null && activeDegrees.contains(cu.getCourse().getDegree());
boolean isActiveCourseId = activeCourseIds!=null && activeCourseIds.contains(cu.getCourse().getId());
 
 
boolean activePeriod = (isActiveYear && (isActiveCourseId || isActiveDegree));
getCurrentSession().getTransaction().commit();
return activePeriod;
}
 
 
 
public String getSigesWebServicesWsdl()
{
return load().getSigesWebServicesWsdl();
190,11 → 326,18
return load().getNationalInstitutionCode();
}
 
/**
* This method only creates transaction if not already active
* @return
*/
public int getNationalInstitutionCodeCreateTransaction()
{
getCurrentSession().beginTransaction();
//boolean alreadyActive = getCurrentSession().getTransaction().isActive();
//if(!alreadyActive)
getCurrentSession().beginTransaction();
int code = getNationalInstitutionCode();
getCurrentSession().getTransaction().commit();
//if(!alreadyActive)
getCurrentSession().getTransaction().commit();
return code;
}
 
208,7 → 351,7
{
Configuration config = load();
config.setNationalInstitutionCode(instCode);
Globals.NATIONAL_INSTITUTION_CODE = new BigDecimal(instCode);
//Globals.NATIONAL_INSTITUTION_CODE = new BigDecimal(instCode);
}
 
 
222,7 → 365,7
{
getCurrentSession().beginTransaction();
updateNationalInstitutionCode(instCode);
Globals.NATIONAL_INSTITUTION_CODE = new BigDecimal(instCode);
//Globals.NATIONAL_INSTITUTION_CODE = new BigDecimal(instCode);
getCurrentSession().getTransaction().commit();
}
 
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java
53,6 → 53,47
.list().size();
}
 
public int countCoursesUnits(String importYear,long courseId)
{
return createCriteria()
.createAlias("courseUnits", "c")
.setProjection(Projections.property("c.id"))
.add(eq("c.importYear", importYear))
.add(eq("id", courseId))
.list().size();
}
public int countCoursesUnitsNot(String importYear,long courseId)
{
return createCriteria()
.createAlias("courseUnits", "c")
.setProjection(Projections.property("c.id"))
.add(not(eq("c.importYear", importYear)))
.add(eq("id", courseId))
.list().size();
}
 
public List<Long> findCoursesUnitsIds(String importYear,long courseId)
{
return createCriteria()
.createAlias("courseUnits", "c")
.setProjection(Projections.property("c.id"))
.add(eq("id", courseId))
.add(eq("c.importYear", importYear))
.addOrder(Order.asc("c.name"))
.list();
}
 
public List<Long> findCoursesUnitsIds(long courseId)
{
return createCriteria()
.createAlias("courseUnits","c")
.setProjection(Projections.property("c.id"))
.add(eq("id", courseId))
.addOrder(Order.asc("c.importYear"))
.addOrder(Order.asc("c.name"))
.list();
}
 
public List<Course> searchActualYear(String query, SearchTypeEnum searchTypeEnum, int max, int page)
{
Criterion c = DaoUtils.createSearchQuery(query, searchTypeEnum, "name", "description");
133,18 → 174,44
{
Criteria c = createCriteria();
 
/* c.setProjection(Projections.projectionList()
.add(Projections.distinct(Projections.id())));*/
c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
c.createAlias("courseUnits","cu");
if (importYear != null && importYear.length() > 0)
c.add(eq("cu.importYear", importYear));
 
String query = "select distinct c from c in class Course join c.courseUnits cu where ";
String logic = " ";
if (importYear != null && importYear.length() > 0)
{
query += logic + "cu.importYear = :importYear ";
logic = " and ";
}
if (area != null && area.length() > 0)
c.add(eq("area", area));
{
query += logic + "c.area = :area ";
logic = " and ";
}
if (type != null && type.length() > 0)
c.add(eq("degree", type));
return c.addOrder(Order.asc("name"))
.list();
{
query += logic + "c.degree = :degree ";
logic = " and ";
}
query += " order by c.name asc";
 
Query q = getCurrentSession().createQuery(query);
if (importYear != null && importYear.length() > 0)
{
q.setString("importYear",importYear);
}
if (area != null && area.length() > 0)
{
q.setString("area",area);
}
if (type != null && type.length() > 0)
{
q.setString("degree",type);
}
/* c.setProjection(Projections.projectionList()
.add(Projections.distinct(Projections.id())));*/
return q.list();
}
 
 
183,10 → 250,24
 
public List<Course> findAll(String importYear)
{
return createCriteria().add(eq("importYear", importYear))
return createCriteria().add(eq("importYear", importYear)).addOrder(Order.asc("name"))
.list();
}
 
public List<Course> findAllStatus(String importYear,boolean status)
{
return createCriteria()
.add(eq("importYear", importYear))
.add(eq("status", status))
.addOrder(Order.asc("name"))
.list();
}
 
public List<Course> findActiveCourses(String importYear)
{
return findAllStatus(importYear,true);
}
 
public List<Course> findAllNotIn(String importYear)
{
return createCriteria().add(not(eq("importYear", importYear)))
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/BlogDaoImpl.java
1,23 → 1,17
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.domain.User;
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import pt.estgp.estgweb.domain.Blog;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.Blog;
import pt.estgp.estgweb.domain.Announcement;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import java.util.ArrayList;
import java.io.Serializable;
 
import org.hibernate.HibernateException;
import org.hibernate.Criteria;
import static org.hibernate.criterion.Restrictions.*;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import jomm.dao.DaoException;
 
/**
* @author Jorge Machado
43,12 → 37,27
return createCriteria().add(eq("owner.id", ownerId)).list();
}
 
public List<BlogImpl> loadOwnedBlogs(long ownerId, int max)
{
return createCriteria().add(eq("owner.id", ownerId)).addOrder(Order.desc("updateDate")).setMaxResults(max).list();
}
 
public List<BlogImpl> findBlogs(List<String> roles, boolean internal)
{
return findBlogs(roles,internal,null);
}
public List<BlogImpl> findBlogs(List<String> roles, boolean internal, int max)
{
return findBlogs(roles,internal,null,max);
}
 
public List<BlogImpl> findBlogs(List<String> roles, boolean internal, String type)
{
return findBlogs(roles,internal,type,-1);
}
 
public List<BlogImpl> findBlogs(List<String> roles, boolean internal, String type, int max)
{
if (roles == null)
{
roles = new ArrayList<String>();
69,11 → 78,13
if (co != null)
criteria.add(co);
criteria.add(eq("status", true))
.addOrder(Order.desc("title"));
.addOrder(Order.desc("updateDate"));
if(type != null)
criteria.add(eq("type",type));
else
criteria.add(isNull("type"));
if(max > 0)
criteria.setMaxResults(max);
return criteria.list();
}
 
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AnnouncementDaoImpl.java
4,6 → 4,8
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
34,6 → 36,292
}
 
 
public static class FindUsersResult
{
public int users;
public List<String> emails;
}
public FindUsersResult findUsersEmails(String year, String department, long courseId, long courseUnitId, String semestre, CreateAnnouncementService.MessageTarget target)
{
FindUsersResult findUsersResult = new FindUsersResult();
List<String> users = new ArrayList<String>();
findUsersResult.emails = users;
 
ProjectionList projList = Projections.projectionList();
projList.add(Projections.distinct(Projections.property("id")));
projList.add(Projections.property("sigesCode"));
projList.add(Projections.property("email"));
projList.add(Projections.property("outEmail"));
 
if(target.isWorkers())
{
Criteria criteria = createCriteria(User.class);
criteria.add(like("roles", "%worker%"));
List<User > l = criteria.list();
findUsersResult.users = l.size();
for(User u: l)
{
if(u.getEmail() != null)
users.add(u.getEmail());
if(u.getOutEmail() != null)
users.add(u.getOutEmail());
}
}
 
if(courseUnitId > 0)
{
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(courseUnitId);
if(target.isTeachers())
{
findUsersResult.users = cu.getTeachers().size();
for(Teacher t: cu.getTeachers())
{
 
if(t.getEmail() != null)
users.add(t.getEmail());
if(t.getOutEmail() != null)
users.add(t.getOutEmail());
}
}
if(target.isStudents())
{
findUsersResult.users = cu.getStudents().size();
for(Student t: cu.getStudents())
{
if(t.getEmail() != null)
users.add(t.getEmail());
if(t.getOutEmail() != null)
users.add(t.getOutEmail());
}
}
}
else if(semestre != null && semestre.length() > 0)
{
if(target.isTeachers())
{
Criteria usersC = createCriteria(Teacher.class);
usersC.setProjection(projList);
usersC.createAlias("teachedUnits", "tU");
usersC.createAlias("tU.course","tUC");
usersC.add(eq("tU.semestre",semestre))
.add(eq("tUC.id",courseId));
//NOVO
if(year != null && year.length() > 0)
usersC.add(eq("tU.importYear",year));
//NOVO
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
if(target.isStudents())
{
Criteria usersC = createCriteria(Student.class);
usersC.setProjection(projList);
usersC.createAlias("subscribedUnits", "sU");
usersC.createAlias("sU.course","sUC");
usersC.add(eq("sU.semestre",semestre))
.add(eq("sUC.id",courseId));
if(year != null && year.length() > 0)
usersC.add(eq("sU.importYear",year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
 
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
}
else if(courseId > 0)
{
if(target.isTeachers())
{
Criteria usersC = createCriteria(Teacher.class);
usersC.setProjection(projList);
usersC.createAlias("teachedUnits", "tU");
usersC.createAlias("tU.course","tUC");
usersC.add(eq("tUC.id",courseId));
if(year != null && year.length() > 0)
usersC.add(eq("tU.importYear",year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
if(target.isStudents())
{
Criteria usersC = createCriteria(Student.class);
usersC.setProjection(projList);
usersC.createAlias("subscribedUnits", "sU");
usersC.createAlias("sU.course","sUC");
usersC.add(eq("sUC.id",courseId));
if(year != null && year.length() > 0)
usersC.add(eq("sU.importYear",year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
}
else if(department != null && department.length() > 0)
{
if(target.isTeachers())
{
Criteria usersC = createCriteria(Teacher.class);
usersC.setProjection(projList);
usersC.createAlias("teachedUnits", "tU");
usersC.createAlias("tU.course","tUC");
usersC.add(eq("tUC.area",department));
if(year != null && year.length() > 0)
usersC.add(eq("tU.importYear",year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
if(target.isStudents())
{
Criteria usersC = createCriteria(Student.class);
usersC.setProjection(projList);
usersC.createAlias("subscribedUnits", "sU");
usersC.createAlias("sU.course","sUC");
usersC.add(eq("sUC.area",department));
if(year != null && year.length() > 0)
usersC.add(eq("sU.importYear",year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
}
else if(year != null && year.length() > 0)
{
if(target.isTeachers())
{
Criteria usersC = createCriteria(Teacher.class).
setProjection(projList).
createAlias("teachedUnits", "tU")
.add(eq("tU.importYear", year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
if(target.isStudents())
{
Criteria usersC = createCriteria(Student.class).
setProjection(projList).
createAlias("subscribedUnits", "sU").
add(eq("sU.importYear", year));
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(t[1] + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
}
else
{
if(target.isTeachers())
{
Criteria usersC = createCriteria(Teacher.class).
setProjection(projList);
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
//if(t[1] != null)
// users.add(((String) t[1]) + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
if(target.isStudents())
{
Criteria usersC = createCriteria(Student.class).
setProjection(projList);
List<Object[]> l = usersC.list();
findUsersResult.users = l.size();
for(Object[] t: l)
{
// if(t[1] != null)
// users.add(((String) t[1]) + "@" + Globals.EMAIL_LOCAL_SUFFIX);
if(t[2] != null)
users.add((String) t[2]);
if(t[3] != null)
users.add((String) t[3]);
}
}
}
 
// System.out.println("Selected People:" + users.size());
// for(User u : users)
// {
// System.out.println(u.getName());
// }
// System.out.println("/Selected Students:" + users.size());
 
return findUsersResult;
 
 
}
 
public List<User> findUsers(String year, String department, long courseId, long courseUnitId, String semestre, CreateAnnouncementService.MessageTarget target)
{
List<User> users = new ArrayList<User>();
372,8 → 660,13
return createCriteria().add(eq("owner.id", ownerId)).addOrder(Order.desc("updateDate")).list();
}
 
public List<AnnouncementImpl> loadOwnedAnnouncements(long ownerId, int size)
{
return createCriteria().add(eq("owner.id", ownerId)).setMaxResults(size).addOrder(Order.desc("updateDate")).list();
}
 
 
 
public List<Announcement> loadInvalidAnnouncements()
{
Criteria c = createCriteria()
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationDirectoryDaoImpl.java
New file
0,0 → 1,46
package pt.estgp.estgweb.domain.dao.impl;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.ConfigurationDirectoryImpl;
 
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.eq;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:37:29
* To change this template use File | Settings | File Templates.
*/
public class ConfigurationDirectoryDaoImpl extends AbstractDao<ConfigurationDirectoryImpl>{
 
private static final Logger logger = Logger.getLogger(ConfigurationDirectoryDaoImpl.class);
 
protected static ConfigurationDirectoryDaoImpl myInstance = null;
public static ConfigurationDirectoryDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof ConfigurationDirectoryDaoImpl))
myInstance = new ConfigurationDirectoryDaoImpl();
return (ConfigurationDirectoryDaoImpl) myInstance;
}
 
@Override
protected Class getReferenceClass() {
return ConfigurationDirectoryImpl.class;
}
 
public ConfigurationDirectoryImpl loadDirectory(String identifier)
{
List<ConfigurationDirectoryImpl> dirs = createCriteria().add(eq("idDir", identifier)).list();
if(dirs != null && dirs.size() > 0)
{
return dirs.get(0);
}
else
{
return null;
}
}
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationGradesDaoImpl.java
New file
0,0 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
* @time 2:51:06
* @see pt.estgp.estgweb.domain.dao.impl
*/
public class ConfigurationGradesDaoImpl extends ConfigurationGradesDao
{
public static ConfigurationGradesDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new ConfigurationGradesDaoImpl();
return (ConfigurationGradesDaoImpl) myInstance;
}
 
 
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
5,7 → 5,9
import org.hibernate.Query;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.sql.JoinFragment;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.dao.DaoUtils;
80,16 → 82,19
 
public List<CourseUnit> loadSubscribedImportYearUnits(long studentId, String importYear)
{
return createCriteria().add(eq("importYear", importYear))
return createCriteria()
.createAlias("students", "st")
.add(eq("st.id", studentId)).addOrder(Order.asc("name")).list();
.add(eq("st.id", studentId))
.add(eq("importYear", importYear))
.addOrder(Order.asc("name"))
.list();
}
public List<CourseUnit> loadSubscribedImportYearSemestreUnits(long studentId, String importYear, String semestre)
{
Criteria c =createCriteria()
.add(eq("importYear", importYear))
.createAlias("students", "st")
.add(eq("st.id", studentId));
.createAlias("students", "st")
.add(eq("st.id", studentId))
.add(eq("importYear", importYear));
if(semestre != null)
c.add(eq("semestre", semestre));
return c.addOrder(Order.asc("name")).list();
215,28 → 220,90
}
 
 
//TODO Na actualiza��o de uma cadeira para o curso de TESTE mudar o coursecode para o o coursecode desse curso para nao deixar os dados duplicados e mal
//TODO Na actualizacao de uma cadeira para o curso de TESTE mudar o coursecode para o o coursecode desse curso para nao deixar os dados duplicados e mal
//se nao a carregar unidades vai buscar a errada
public CourseUnit loadBySigesCodeUnique(String sigesCode, String courseCode, String semestre, String year)
 
/**
* Turma required to be unique in BACO Model
* @param sigesCode
* @param courseCode
* @param semestre
* @param year
* @return
*/
public List<CourseUnit> loadBySigesCode(String sigesCode, String courseCode, String semestre, String year)
{
return
createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.add(eq("importYear", year))
.list();
}
 
/**
* Metodo especial para a fase de transicao para terem código de turma
* @param sigesCode
* @param courseCode
* @param semestre
* @param year
* @return
*/
public List<CourseUnit> loadBySigesCodeTurmaNull(String sigesCode, String courseCode, String semestre, String year)
{
//todo cdTurma Rollback
return (List<CourseUnit>)
createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.add(eq("importYear", year))
.add(isNull("cdTurma"))
.list();
}
 
//TODO Na actualizacao de uma cadeira para o curso de TESTE mudar o coursecode para o o coursecode desse curso para nao deixar os dados duplicados e mal
//se nao a carregar unidades vai buscar a errada
public CourseUnit loadBySigesCodeUnique(String sigesCode, String courseCode, String semestre, String year,String turma)
{
//todo cdTurma Rollback
return (CourseUnit)
createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.add(eq("importYear", year))
.add(eq("cdTurma", turma))
.uniqueResult();
}
 
public List<CourseUnit> loadBySigesCodeUniqueAllCourses(String sigesCode, String semestre, String year,String turma)
{
//todo cdTurma Rollback
return
createCriteria()
.add(eq("code", sigesCode))
// REMOVED TO LET BE ALL COURSES .add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.add(eq("importYear", year))
.add(eq("cdTurma", turma))
.list();
}
 
public CourseUnit loadBySigesCodeUniqueMostRecent(String sigesCode, String courseCode, String semestre)
{
return (CourseUnit)
List<CourseUnit> cus =
createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.addOrder(Order.desc("importYear"))
.setMaxResults(1).list().get(0);
.setMaxResults(1).list();
if(cus.size() > 0)
return cus.get(0);
logger.warn("Accessing unit not existent with siges code " + sigesCode + " course code: " + courseCode + " semestre: " + semestre);
return null;
}
 
 
265,6 → 332,61
.list();
}
 
/**
* Metodo usado para carregar unidades de anos anteriores que possam estar em edição
* para mostrar na página da unidade
*
* Este metodo nao serve para mais nada, nao é usado nas Tarefas da Home
* @param sigesCode
* @param courseCode
* @return
*/
public CourseUnit loadUnitInEvaluationBySigesCodes(String sigesCode, String courseCode)
{
String activeImportYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear();
 
Criterion crtDegrees = getCourseUnitActiveDegreeCourseIdsCriterion(activeImportYear);
if(crtDegrees == null)
{
//Nao ha graus nem cursos portanto o ano não interessa
//o ano deve ser usado para abrir graus ou cursos senao nao
//abre nada
crtDegrees = eq("evaluationOpenByAdmin",true);
}
else
{
crtDegrees = and(eq("importYear", activeImportYear),crtDegrees);
crtDegrees = or(eq("evaluationOpenByAdmin",true),crtDegrees);
}
 
List<CourseUnit> cus = (List<CourseUnit>) createCriteria()
.createAlias("course","c")
.createAlias("courseUnitEvaluation","ce")
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(crtDegrees)
.add(eq("ce.closed",false))
.list();
List<CourseUnit> cusNull = (List<CourseUnit>) createCriteria()
.createAlias("course","c")
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(crtDegrees)
.add(isNull("courseUnitEvaluation"))
.list();
cus.addAll(cusNull);
if(cus != null && cus.size() > 1)
{
logger.warn("Mais do que uma unidade do mesmo codigo em avaliacao curricular, e suposto haver apenas uma, verificar logica aplicacional");
}
else if(cus != null && cus.size() > 0)
{
return cus.get(0);
}
 
return null;
}
 
public List<CourseUnit> loadCourseUnits(long courseId, String semestre, String year, boolean withTeacher, boolean withNoTeacher)
{
Criteria c = createCriteria();
342,6 → 464,8
{
//todo falta a projeccao do teacher id
return createCriteria()
.createAlias("course","c")
.add(eq("c.status", true))
.add(eq("importYear", DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear()))
.add((or(isNull("programStreamId"), eq("programStreamId", ""))))
.createAlias("teachers", "th")
443,13 → 567,19
public Course course;
public List<CourseUnit> courseUnits;
}
 
/**
* Load all programs from active courses that are for validation
* @param userSession
* @return
*/
public List<CourseMissingValidationProgram> loadMissingProgramValidate(UserSession userSession)
{
List<CourseMissingValidationProgram> result = new ArrayList<CourseMissingValidationProgram>();
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
List<Course> courses = DaoFactory.getCourseDaoImpl().findActiveCourses(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
for(Course course: courses)
{
if(userSession.getUser().hasRole(course.getValidationRole()))
if(userSession.getUser().hasRole(course.getValidationRole()) || userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
{
List<CourseUnit> courseUnits = loadMissingProgramValidateGivenCourse(course.getId());
if(courseUnits != null && courseUnits.size() > 0)
463,6 → 593,32
}
return result;
}
 
/**
* Load all programs missing from active courses
* @param userSession
* @return
*/
public List<CourseMissingValidationProgram> loadMissingPrograms(UserSession userSession)
{
List<CourseMissingValidationProgram> result = new ArrayList<CourseMissingValidationProgram>();
List<Course> courses = DaoFactory.getCourseDaoImpl().findActiveCourses(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
for(Course course: courses)
{
if(userSession.getUser().hasRole(course.getValidationRole()) || userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
{
List<CourseUnit> courseUnits = loadMissingProgramGivenCourse(course.getId());
if(courseUnits != null && courseUnits.size() > 0)
{
CourseMissingValidationProgram c = new CourseMissingValidationProgram();
c.course = course;
c.courseUnits = courseUnits;
result.add(c);
}
}
}
return result;
}
public static class CourseMissingValidationEvaluation
{
public Course course;
475,7 → 631,7
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll();
for(Course course: courses)
{
if(userSession.getUser().hasRole(course.getValidationRole()))
if(userSession.getUser().hasRole(course.getValidationRole()) || userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
{
List<CourseUnit> courseUnits = loadMissingEvaluationValidateGivenCourse(course.getId());
if(courseUnits != null && courseUnits.size() > 0)
490,32 → 646,141
return result;
}
 
 
 
/*
* Neste caso apenas se validam as do ano anterior*/
 
public List<CourseUnit> loadMissingEvaluationValidateGivenCourse(long courseId)
{
if(DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear()==null)
String activeYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear();
 
Criterion degreesCrit = getCourseUnitActiveDegreeCourseIdsCriterion(activeYear);
if(degreesCrit == null)
return new ArrayList<CourseUnit>();
 
return createCriteria()
.createAlias("course", "c")
.createAlias("courseUnitEvaluation", "ce")
.add(eq("c.id", courseId))
.add(eq("importYear", DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear()))
//.add(ge("importYear", "201415"))//FirstYear where there was configurations
.add(eq("importYear", activeYear))
.add(degreesCrit)
.add((eq("ce.closed", false)))
.add((eq("ce.teacherComplete", true)))
.list();
}
 
/**
*
* @return devolve todos os ids de unidades que verifiquem a condição de avaliação
* do periodo actual e tenham o programa fechado pela comissão
*/
 
public List<Long> loadClosedCourseUnitsEvaluations()
{
String activeYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear();
 
Criterion degreesCrit = getCourseUnitActiveDegreeCourseIdsCriterion(activeYear);
if(degreesCrit == null)
return new ArrayList<Long>();
 
return createCriteria()
.setProjection(Projections.property("id"))
.createAlias("course", "c")
.createAlias("courseUnitEvaluation", "ce")
.add(eq("importYear", activeYear))
.add(degreesCrit)
.add((eq("ce.closed", true)))
.list();
}
 
/**
* Devolve um criteio OR para todos os cursos de grau pertencente à lista de graus
* ou pertencete à lista de cursoIds
 
* @return
*/
private Criterion getCourseUnitActiveDegreeCourseIdsCriterion(String activeYear)
{
List<String> activeDegrees = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveDegrees();
List<Long> activeCourseIds = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveCourseIds();
boolean activeDegreesOff = activeDegrees == null || activeDegrees.size() == 0;
boolean activeCourseIdsOff = activeCourseIds == null || activeCourseIds.size() == 0;
if(activeYear == null || (activeDegreesOff && activeCourseIdsOff))
return null;
 
Criterion crit = null;
 
if(activeDegrees != null)
for(String degree: activeDegrees)
{
if(crit == null)
crit = eq("c.degree",degree);
else
crit = or(crit,eq("c.degree",degree));
}
if(activeCourseIds != null)
for(Long courseId: activeCourseIds)
{
if(crit == null)
crit = eq("c.id",courseId);
else
crit = or(crit,eq("c.id",courseId));
}
 
return crit;
}
 
 
public List<CourseUnit> loadTeacherUnitsMissingEvaluation(UserSession userSession)
{
String activeYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear();
 
Criterion degreesCrit = getCourseUnitActiveDegreeCourseIdsCriterion(activeYear);
if(degreesCrit == null)
return new ArrayList<CourseUnit>();
 
 
List<CourseUnit> nulls =
createCriteria()
.createAlias("course", "c")
.createAlias("teachers", "t")
.add(eq("importYear", activeYear))
//.add(not(eq("importYear", DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear())))
//.add(ge("importYear", "201415" ))
//.add(isNull("courseUnitEvaluation"))
//todo novo testar
.add(eq("t.id", userSession.getUser().getId()))
.add(degreesCrit)
.add(isNull("courseUnitEvaluation"))
.list();
 
List<CourseUnit> teacherCompleteFalse =
createCriteria()
.createAlias("course", "c")
.createAlias("courseUnitEvaluation", "ce")
.createAlias("teachers", "t")
.add(eq("t.id", userSession.getUser().getId()))
.add(eq("importYear", activeYear))
//.add(not(eq("importYear", DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear())))
//.add(ge("importYear", "201415" ))
//.add(isNull("courseUnitEvaluation"))
//todo novo testar
.add(degreesCrit)
.add(eq("ce.teacherComplete", false))
.list();
teacherCompleteFalse.addAll(nulls);
return teacherCompleteFalse;
}
 
 
public List<CourseMissingValidationEvaluation> loadMissingEvaluation(UserSession userSession)
{
List<CourseMissingValidationEvaluation> result = new ArrayList<CourseMissingValidationEvaluation>();
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll();
for(Course course: courses)
{
if(userSession.getUser().hasRole(course.getValidationRole()))
if(userSession.getUser().hasRole(course.getValidationRole()) || userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
{
List<CourseUnit> courseUnits = loadMissingEvaluation(course.getId());
if(courseUnits != null && courseUnits.size() > 0)
532,19 → 797,33
 
public List<CourseUnit> loadMissingEvaluation(long courseId)
{
if(DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear()==null)
 
String activeYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear();
Criterion degreesCrit = getCourseUnitActiveDegreeCourseIdsCriterion(activeYear);
 
if(degreesCrit == null)
return new ArrayList<CourseUnit>();
 
return createCriteria()
List<CourseUnit> nulls =
createCriteria()
.createAlias("course", "c")
.add(eq("c.id", courseId))
.add(eq("importYear", DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYear()))
//.add(not(eq("importYear", DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear())))
//.add(ge("importYear", "201415" ))
//.add(isNull("courseUnitEvaluation"))
//todo novo testar
.add(or(isNull("courseUnitEvaluation"),(eq("courseUnitEvaluation.teacherComplete", false))))
.add(eq("importYear", activeYear))
.add(degreesCrit)
.add(isNull("courseUnitEvaluation"))
.list();
 
List<CourseUnit> teacherCompleteFalse =
createCriteria()
.createAlias("course", "c")
.createAlias("courseUnitEvaluation", "ce")
.add(eq("c.id", courseId))
.add(degreesCrit)
.add(eq("importYear", activeYear))
.add(eq("ce.teacherComplete", false))
.list();
teacherCompleteFalse.addAll(nulls);
return teacherCompleteFalse;
}
 
public CourseUnit loadByEvaluationStreamId(String identifier)
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitGradeDaoImpl.java
1,19 → 1,9
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.Blog;
import pt.estgp.estgweb.domain.CourseUnitGrade;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
 
import java.util.List;
import java.util.ArrayList;
import static org.hibernate.criterion.Restrictions.eq;
 
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import static org.hibernate.criterion.Restrictions.*;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
40,5 → 30,14
.uniqueResult();
}
 
public CourseUnitGrade find(long courseUnitId, long studentId, String momento,String epoca)
{
return (CourseUnitGrade) createCriteria().add(eq("student.id",studentId))
.add(eq("courseUnit.id",courseUnitId))
.add(eq("codigoMomento",momento))
.add(eq("codigoEpoca",epoca))
.uniqueResult();
}
 
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java
327,5 → 327,25
return ConfigurationDaoImpl.getInstance();
}
 
public static ConfigurationGradesDaoImpl getConfigurationGradesDaoImpl() {
return ConfigurationGradesDaoImpl.getInstance();
}
 
public static ConfigurationGradesEpocaAvaliacaoDaoImpl getConfigurationGradesEpocaAvaliacaoDaoImpl() {
return ConfigurationGradesEpocaAvaliacaoDaoImpl.getInstance();
}
 
public static ConfigurationGradesStatusEpocaDaoImpl getConfigurationGradesStatusEpocaDaoImpl() {
return ConfigurationGradesStatusEpocaDaoImpl.getInstance();
}
 
public static ConfigurationDirectoryDaoImpl getConfigurationDirectoryDaoImpl() {
return ConfigurationDirectoryDaoImpl.getInstance();
}
 
 
 
 
 
 
}
/impl/src/java/pt/estgp/estgweb/domain/ConfigurationGradesEpocaAvaliacaoImpl.java
New file
0,0 → 1,29
package pt.estgp.estgweb.domain;
 
import java.io.Serializable;
import java.util.Date;
 
/**
* Created by jorgemachado on 02/11/15.
*/
public class ConfigurationGradesEpocaAvaliacaoImpl extends ConfigurationGradesEpocaAvaliacao {
 
public ConfigurationGradesEpocaAvaliacaoImpl()
{
}
@Override
public Serializable getSerializable() {
return getId();
}
 
public static ConfigurationGradesEpocaAvaliacao create(String epoca, String momento, String descricao)
{
ConfigurationGradesEpocaAvaliacao obj = DomainObjectFactory.createConfigurationGradesEpocaAvaliacaoImpl();
obj.setCodigoMomento(momento);
obj.setCodigoEpoca(epoca);
obj.setDescricao(descricao);
obj.setSaveDate(new Date());
return obj;
}
 
}
/impl/src/java/pt/estgp/estgweb/domain/JobServiceTaskSchedulerImpl.java
16,4 → 16,92
public Serializable getSerializable() {
return getId();
}
 
public String getWeekDayMsgKey()
{
String dayOfTheWeek = "";
int i = getWeekday();
if(i == 2){
dayOfTheWeek = "Mon";
} else if (i==3){
dayOfTheWeek = "Tue";
} else if (i==4){
dayOfTheWeek = "Wed";
} else if (i==5){
dayOfTheWeek = "Thu";
} else if (i==6){
dayOfTheWeek = "Fri";
} else if (i==7){
dayOfTheWeek = "Sat";
} else if (i==1){
dayOfTheWeek = "Sun";
}
return dayOfTheWeek;
}
 
public String getTypeMsgKey()
{
if(isDaily())
return "dally";
else if(isMonthly())
return "monthly";
else if(isWeekly())
return "weekly";
else if(isNow())
return "now";
else
return "unknown";
}
 
private String calendarization;
 
public String getCalendarization() {
 
if(calendarization == null)
{
if(isDaily())
return CalendarizationEnum.DAILY.name();
else if(isMonthly())
return CalendarizationEnum.MONTLY.name();
else if(isWeekly())
return CalendarizationEnum.WEEKLY.name();
else
return CalendarizationEnum.DAILY.name();
}
return calendarization;
 
}
 
public void setCalendarization(String calendarization) {
 
this.calendarization = calendarization;
CalendarizationEnum calendarizationEnum = CalendarizationEnum.parse(calendarization);
setDaily(false);
setMonthly(false);
setWeekly(false);
if(calendarizationEnum == CalendarizationEnum.DAILY)
setDaily(true);
else if(calendarizationEnum == CalendarizationEnum.MONTLY)
setMonthly(true);
else if(calendarizationEnum == CalendarizationEnum.WEEKLY)
setWeekly(true);
 
}
 
 
 
public enum CalendarizationEnum
{
DAILY,WEEKLY,MONTLY;
 
public static CalendarizationEnum parse(String cal)
{
if(cal == null)
return MONTLY;
for(CalendarizationEnum en: CalendarizationEnum.values())
if(en.name().equals(cal))
return en;
return MONTLY;
}
}
}
/impl/src/java/pt/estgp/estgweb/domain/UserSessionImpl.java
1,7 → 1,9
package pt.estgp.estgweb.domain;
 
import jomm.utils.DesUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.ftpservices.FtpService;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
24,6 → 26,7
{
 
private Set<SessionObject> removeList;
private Configuration nowConfiguration;
 
/**
* @return
279,4 → 282,20
}
}
 
public Configuration getNowConfiguration() {
return nowConfiguration;
}
 
public void setNowConfiguration(Configuration nowConfiguration) {
this.nowConfiguration = nowConfiguration;
}
 
public String getUserPasswordInSession()
{
String passCrypt = (String) get(FtpService.FTP_PASSWORD);
if(passCrypt != null)
return DesUtils.getInstance().decrypt(passCrypt);
return null;
}
 
}
/impl/src/java/pt/estgp/estgweb/domain/ConfigurationGradesImpl.java
New file
0,0 → 1,68
package pt.estgp.estgweb.domain;
 
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
 
/**
* Created by jorgemachado on 02/11/15.
*/
public class ConfigurationGradesImpl extends ConfigurationGrades {
 
public ConfigurationGradesImpl()
{
}
@Override
public Serializable getSerializable() {
return getId();
}
 
 
 
public void create()
{
Set<ConfigurationGradesEpocaAvaliacao> epocas = new HashSet<ConfigurationGradesEpocaAvaliacao>();
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("3", "99", "Época de Recurso"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("4", "99", "Exame de Melhoria"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("5", "99", "Época Especial"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("14", "99", "2ª Oportunidade - Bolonha (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("6", "99", "Equivalência"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("7", "99", "Estatutos Especiais/Dirigente Associativo (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("12", "99", "Equivalência Vasco da Gama (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("13", "99", "Atleta de Alta Competição (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("20", "99", "Época Normal (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("22", "99", "Equivalência Erasmus (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("36", "99", "Época de Recurso (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("37", "99", "Época de Melhoria (ESTG)"));
epocas.add(ConfigurationGradesEpocaAvaliacaoImpl.create("38", "99", "Época Especial (ESTG)"));
setEpocasAvaliacao(epocas);
 
Set<ConfigurationGradesStatusEpoca> status = new HashSet<ConfigurationGradesStatusEpoca>();
status.add(ConfigurationGradesStatusEpocaImpl.create("1","Inscrito"));
status.add(ConfigurationGradesStatusEpocaImpl.create("2","Avaliado"));
status.add(ConfigurationGradesStatusEpocaImpl.create("19","A Terminar Posteriormente 6 A pagamento"));
status.add(ConfigurationGradesStatusEpocaImpl.create("5","Anulou"));
status.add(ConfigurationGradesStatusEpocaImpl.create("7","Faltou"));
status.add(ConfigurationGradesStatusEpocaImpl.create("8","Desistiu"));
status.add(ConfigurationGradesStatusEpocaImpl.create("9","Dispensado"));
status.add(ConfigurationGradesStatusEpocaImpl.create("3","Aprovado"));
status.add(ConfigurationGradesStatusEpocaImpl.create("4","Reprovado"));
status.add(ConfigurationGradesStatusEpocaImpl.create("10","Admitido a Exame"));
status.add(ConfigurationGradesStatusEpocaImpl.create("11","Não Admitido"));
status.add(ConfigurationGradesStatusEpocaImpl.create("12","Sem avaliação"));
status.add(ConfigurationGradesStatusEpocaImpl.create("13","Insc. Pendente"));
status.add(ConfigurationGradesStatusEpocaImpl.create("14","Sem elementos de avaliação"));
status.add(ConfigurationGradesStatusEpocaImpl.create("15","Reprovado por faltas"));
status.add(ConfigurationGradesStatusEpocaImpl.create("16","Não atingiu a nota minima"));
status.add(ConfigurationGradesStatusEpocaImpl.create("18","Aguarda Equivalência"));
status.add(ConfigurationGradesStatusEpocaImpl.create("17","Não cumpriu critérios de avaliação"));
status.add(ConfigurationGradesStatusEpocaImpl.create("20","Prova anulada"));
status.add(ConfigurationGradesStatusEpocaImpl.create("21","Não atingiu todas as competências da unidade"));
status.add(ConfigurationGradesStatusEpocaImpl.create("22","Sem Nota Lançada"));
status.add(ConfigurationGradesStatusEpocaImpl.create("23","Frequentou"));
status.add(ConfigurationGradesStatusEpocaImpl.create("24","Melhoria não Atribuida"));
setStatusEpoca(status);
}
 
 
}
/impl/src/java/pt/estgp/estgweb/filters/filters/Session.java
3,10 → 3,7
import org.apache.log4j.Logger;
import org.hibernate.ObjectNotFoundException;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.SessionObject;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.filters.chains.FlowFilter;
import pt.estgp.estgweb.utils.ConfigProperties;
39,16 → 36,23
 
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception {
UserSessionImpl userSession = null;
Configuration config = DaoFactory.getConfigurationDaoImpl().loadSimpleConfigurationForConsult();
 
try
{
userSession = (UserSessionImpl) DaoFactory.getUserSessionDaoImpl().get((Serializable) request.getRequester());
 
if(userSession != null && userSession.getObjects() != null)
{
userSession.setNowConfiguration(config);
for(SessionObject sessionObject: userSession.getObjects())
{
sessionObject.getObject();
}
}
if(userSession != null && new Date().getTime() - userSession.getSaveDate().getTime() < TIMEOUT_SESSION)
{
userSession.setNowConfiguration(config);
putSessionInArgs(userSession,request);
userSession.setSaveDate(new Date()); //todo NOVO refrescar a sessao
return;
79,6 → 83,8
userSession.setUpdateDate(new Date());
DaoFactory.getUserSessionDaoImpl().saveOrUpdate(userSession);
// System.out.println(Thread.currentThread().getId() +"UPDATE: " + request.getRequester());
userSession.setNowConfiguration(config);
 
putSessionInArgs(userSession,request);
}
}
/impl/src/java/pt/estgp/estgweb/web/LogsServiceStream.java
New file
0,0 → 1,120
package pt.estgp.estgweb.web;
 
import jomm.utils.StreamsUtils;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
 
/**
* @author Fabio
* @date 4/Abr/2008
* @time 11:03:00
* @see pt.estgp.estgweb.web
*/
public class LogsServiceStream extends HttpServlet
{
 
private static final Logger logger = Logger.getLogger(LogsServiceStream.class);
 
 
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
 
 
 
 
 
String logRequired = request.getPathInfo();
logRequired = logRequired.substring(1);
 
 
String logFile = pt.estgp.estgweb.Globals.JOB_SERVICES_LOG_DIR + java.io.File.separator + logRequired;
java.io.File f = new java.io.File(logFile);
if(!f.exists())
{
response.sendError(404);
return;
}
 
String line = request.getParameter("l");
if(line != null)
{
processJson(f,line,request,response);
return;
}
 
 
try
{
response.setContentType("text/plain");
OutputStream out = response.getOutputStream();
response.setContentLength((int) f.length());
StreamsUtils.inputStream2OutputStream(new FileInputStream(f),out);
out.flush();
out.close();
}
catch (Throwable e1)
{
logger.error(e1 );
response.sendError(404);
}
 
}
 
private void processJson(File f, String line, HttpServletRequest request, HttpServletResponse response) throws IOException {
int l = Integer.parseInt(line);
response.setContentType("application/json");
 
JSONObject obj = new JSONObject();
JSONArray lines = new JSONArray();
 
try {
obj.put("lines",lines);
obj.put("ok","ok");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f),"UTF-8"));
String readedLine;
int i;
boolean endReached = false;
for(i = 0; i < l;i++)
{
if(reader.readLine() == null)
{
endReached = true;
break;
}
}
if(!endReached)
{
while((readedLine = reader.readLine())!=null)
{
lines.put(readedLine);
}
}
 
String toWrite = obj.toString();
response.setCharacterEncoding("ISO-8859-1");
response.setContentLength(toWrite.length());
response.getOutputStream().print(toWrite);
 
}
catch (FileNotFoundException e)
{
logger.error(e,e);
response.sendError(500);
} catch (JSONException e) {
logger.error(e,e);
response.sendError(500);
}
 
}
 
}
 
/impl/src/java/pt/estgp/estgweb/web/DirWebProxy.java
169,7 → 169,12
{
endPath = path.substring(startPath.length());
}
path = startPath + leafUrl + endPath;
if(leafUrl.endsWith("/") && endPath.startsWith("/"))
{
path = startPath + leafUrl.substring(0,leafUrl.length()-1) + endPath;
}
else
path = startPath + leafUrl + endPath;
}
if(!extendDiretoryDocument(request, response, path, proxyKey, server, startPath + leafUrl, directoryDocument))
return;
212,27 → 217,34
}
 
 
protected static boolean extendDiretoryDocument(HttpServletRequest request,HttpServletResponse response, String path, String serverStr, String server, String startPath, Document directoryDocument)
protected static boolean extendDiretoryDocument(HttpServletRequest request,HttpServletResponse response, String path, String server, String serverUrl, String startPath, Document directoryDocument)
throws ServletException, IOException
{
 
try
{
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
FTPFileProxy.UserCredentialsForFtp u = FTPFileProxy.getUserCredentialsForFtp(server, userSession);
 
String username = u.username;
String password = u.password;
 
if(username == null || password == null) //NAO PODE LIGAR
{
response.sendError(401);
return false;
}
 
if (path != null)
{
 
FtpServer ftpServer = FtpServer.getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
FtpServer ftpServer = FtpServer.getServer(serverUrl, username, password);
FTPClient client = FTPFileProxy.getFtpClient(ftpServer, userSession, server, serverUrl);
if(client == null)
{
logger.warn("###################");
logger.warn("################### > CANT CONNECT FTP");
response.sendError(408);
return false;
}
 
Element actualNode = (Element) request.getAttribute("actualNode");
 
246,11 → 258,12
throw new NotAuthorizedException();
}
FTPFile[] files = client.listFiles();
List<IFile> iFiles = FtpFile.init(files, server, path);
List<IFile> iFiles = FtpFile.init(files, serverUrl, path);
//root
for (IFile iFile : iFiles)
{
Element iFileElem = actualNode.addElement("leaf");
addAttribute(iFileElem, "node", "false");
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + "0_" + iFile.getName());
addAttribute(iFileElem, "idPrefixSize","" + (FTP_FILE_PREFIX + "0_").length());
276,7 → 289,7
 
String pathAux = path.substring(startPath.length());
String[] pathFragments;
if(path.startsWith("/"))
if(pathAux.startsWith("/"))
pathFragments = pathAux.substring(1).split("/");
else
pathFragments = pathAux.split("/");
287,13 → 300,13
throw new NotAuthorizedException();
}
FTPFile[] files = client.listFiles();
List<IFile> iFiles = FtpFile.init(files, server, path);
List<IFile> iFiles = FtpFile.init(files, serverUrl, path);
Element goDeepElement = null;
String actualId = null;
for (IFile iFile : iFiles)
{
Element iFileElem = actualNode.addElement("node");
 
Element iFileElem = actualNode.addElement("leaf");
addAttribute(iFileElem, "node", "true");
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + "0_" + iFile.getName());
addAttribute(iFileElem, "idPrefixSize","" + (FTP_FILE_PREFIX + "0_").length());
 
335,16 → 348,22
}
 
files = client.listFiles();
iFiles = FtpFile.init(files, server, path);
iFiles = FtpFile.init(files, serverUrl, path);
 
for (IFile iFile : iFiles)
{
Element iFileElem;
 
if(i == pathFragments.length - 1)
{
iFileElem = goDeepElement.addElement("leaf");
addAttribute(iFileElem, "node","false");
}
else
iFileElem = goDeepElement.addElement("node");
{
iFileElem = goDeepElement.addElement("leaf");
addAttribute(iFileElem, "node","true");
}
 
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + (i+1) + "_" + iFile.getName());
addAttribute(iFileElem, "idPrefixSize","" + (FTP_FILE_PREFIX + (i+1) + "_").length());
379,7 → 398,7
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
throw new FileNotFoundException("url not found for server:" + serverUrl + " and path:" + path);
}
}
catch (Throwable e)
/impl/src/java/pt/estgp/estgweb/web/utils/DatesUtils.java
1,13 → 1,12
package pt.estgp.estgweb.web.utils;
 
import jomm.utils.MyCalendar;
import org.apache.log4j.Logger;
 
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
 
import org.apache.log4j.Logger;
 
/**
* @author Jorge Machado
* @date 6/Mar/2008
19,6 → 18,7
 
private static final Logger logger = Logger.getLogger(DatesUtils.class);
 
private static SimpleDateFormat hourMinute = new SimpleDateFormat("HH:mm");
private static SimpleDateFormat minutesSecondsDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private static SimpleDateFormat filenameDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static SimpleDateFormat userViewDateFormat = new SimpleDateFormat("yyyy/MM/dd");
64,4 → 64,9
return null;
}
}
 
public String getTimeHHMM(Date d)
{
return hourMinute.format(d);
}
}
/impl/src/java/pt/estgp/estgweb/web/DirLayoutController.java
1,36 → 1,29
package pt.estgp.estgweb.web;
 
import org.apache.struts.action.Action;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.log4j.Logger;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.httpclient.util.URIUtil;
import org.dom4j.*;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.services.directories.DirectoryNodeType;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.*;
import java.util.List;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.net.URL;
import java.net.MalformedURLException;
 
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.services.directories.DirectoryNodeType;
import jomm.web.ftp.IFile;
import jomm.web.ftp.impl.FtpFile;
import jomm.web.utils.NavPlace;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
107,8 → 100,24
 
try
{
Document directoryDocument = Dom4jUtil.parseSourceFileFromCache("/pt/estgp/estgweb/directories/" + directory + ".xml");
 
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{directory};
Document directoryDocument;
try
{
String dXml = (String) sm.execute(RequestUtils.getRequester(request, response), "LoadDirectoryServiceXml", args, names);
directoryDocument = Dom4jUtil.parse(dXml);
}
catch (Throwable e)
{
logger.error(e, e);
throw new IOException(e.toString());
}
 
 
if (path.startsWith("/"))
path = path.substring(1);
String[] ids = path.split("/");
133,13 → 142,14
if (r != null)
rights.add(r);
String name = idElem.getQName().getName();
if (name.equals("leaf"))
boolean node = Boolean.parseBoolean(idElem.attributeValue("node"));
if (name.equals("leaf") && !node)
{
directoryNodeType = DirectoryNodeType.leaf;
actualNodeId = id;
actualNode = idElem;
}
else if (name.equals("node"))
else if (name.equals("leaf") && node)
{
directoryNodeType = DirectoryNodeType.node;
actualNodeId = id;
234,8 → 244,7
}
}
}
catch (DocumentException e)
{
catch (Throwable e) {
logger.error(e, e);
throw new IOException(e.toString());
}
350,8 → 359,8
}
 
public static Namespace dirNamespace = new Namespace("d", "http://www.estgp.pt/baco/directory/");
public static QName nodeDir = new QName("node", dirNamespace);
public static QName leafDir = new QName("leaf", dirNamespace);
//public static QName nodeDir = new QName("node", dirNamespace);
//public static QName leafDir = new QName("leaf", dirNamespace);
 
private boolean pruneDocument(Element startElem, Map namespaces, UserSession userSession)
{
363,8 → 372,12
parentNode.remove(startElem);
return false;
}
List<Element> nodes = startElem.elements(nodeDir);
List<Element> leafs = startElem.elements(leafDir);
XPath leafXpath = startElem.createXPath("./d:leaf[@node='false']");
XPath nodeXpath = startElem.createXPath("./d:leaf[@node='true']");
leafXpath.setNamespaceURIs(namespaces);
nodeXpath.setNamespaceURIs(namespaces);
List<Element> nodes = nodeXpath.selectNodes(startElem);
List<Element> leafs = leafXpath.selectNodes(startElem);
for (Element childNode : nodes)
{
pruneDocument(childNode, namespaces, userSession);
387,11 → 400,11
{
Rights rights = new Rights();
 
XPath userXpath = rightsElem.createXPath("./d:user");
XPath userXpath = rightsElem.createXPath("./d:right[@target='user']");
userXpath.setNamespaceURIs(namespaces);
List<Element> userElems = userXpath.selectNodes(rightsElem);
 
XPath roleXpath = rightsElem.createXPath("./d:role");
XPath roleXpath = rightsElem.createXPath("./d:right[@target='role']");
roleXpath.setNamespaceURIs(namespaces);
List<Element> rolesElems = roleXpath.selectNodes(rightsElem);
 
408,7 → 421,7
{
RightsT rightsT = new RightsT();
rightsT.rightsTClass = RightsT.RightsTClass.user;
rightsT.text = userElem.getText();
rightsT.text = userElem.attribute("name").getText();
String type = userElem.attribute("type").getText();
if (type.equals("permit"))
rightsT.type = RightsT.RightsTType.permit;
424,7 → 437,7
{
RightsT rightsT = new RightsT();
rightsT.rightsTClass = RightsT.RightsTClass.role;
rightsT.text = roleElem.getText();
rightsT.text = roleElem.attribute("name").getText();
String type = roleElem.attribute("type").getText();
if (type.equals("permit"))
rightsT.type = RightsT.RightsTType.permit;
/impl/src/java/pt/estgp/estgweb/web/FtpServer.java
2,7 → 2,10
 
import org.apache.commons.net.ftp.FTPClient;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserSessionImpl;
 
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
43,6 → 46,19
this.password = password;
}
 
public static FtpServer getFtpServerForCurrentUser(String urlStr, HttpServletRequest request) throws MalformedURLException
{
URL url = new URL(urlStr);
int port = url.getPort();
if (port <= 0)
port = 21;
String host = url.getHost();
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
String username = userSession.getUsername();
String password = ((UserSessionImpl)userSession).getUserPasswordInSession();
return new FtpServer(host,port,username,password);
}
 
private static final int FTP_TIMEOUT_SECONDS = pt.estgp.estgweb.Globals.FTP_TIMEOUT_SECONDS;
public FTPClient getClient() throws IOException
{
79,11 → 95,21
logger.error(e,e);
}
 
if (username != null && password != null)
{
if(ftp.login(username,password))
{
return ftp;
}
}
return null;
 
/* estava assim
if (username != null)
ftp.user(username);
if (password != null)
ftp.pass(password);
return ftp;
ftp.pass(password);*/
//return ftp;
}
 
public String getHost()
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
1,6 → 1,5
package pt.estgp.estgweb.web;
 
import jomm.utils.DesUtils;
import jomm.web.ftp.IFile;
import jomm.web.ftp.impl.FtpFile;
import jomm.web.utils.NavPlace;
12,8 → 11,6
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.services.ftpservices.FtpService;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException;
120,7 → 117,7
 
 
 
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String serverStr, String server, String startPath)
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String server, String serverUrl, String startPath)
throws ServletException, IOException
{
try
131,17 → 128,20
FtpManager.checkOperations(this,request,response);
 
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
//String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
 
FTPFileProxy.UserCredentialsForFtp u = FTPFileProxy.getUserCredentialsForFtp(server, userSession);
String username = u.username;
String password = u.password;
 
 
if (path != null)
{
 
boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes");
String user;
String pass;
//boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes");
//String user;
//String pass;
 
/*
if(isStaticAccess)
{
user = ConfigProperties.getProperty(serverStr + ".user");
155,8 → 155,9
pass= DesUtils.getInstance().decrypt(passwordCode);
//pass= ((UserImpl)userSession.getUser()).getPop3PassDecrypted();
}
FtpServer ftpServer = FtpServer.getNewServer(server, user, pass);
FTPClient client = ftpServer.getClient();
*/
FtpServer ftpServer = FtpServer.getNewServer(serverUrl, username, password);
FTPClient client = FTPFileProxy.getFtpClient(ftpServer,userSession,server,serverUrl);
if(client == null)
{
logger.warn("###################");
175,8 → 176,8
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFiles.add(iFile);
}
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path,startPath);
187,7 → 188,7
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
throw new FileNotFoundException("url not found for server:" + serverUrl + " and path:" + path);
}
}
catch (Throwable e)
/impl/src/java/pt/estgp/estgweb/web/form/courses/CourseForm.java
67,7 → 67,7
 
public List<String> getImportYears()
{
return DatesUtils.getImportYears(5);
return DatesUtils.getImportYears(20);
}
 
 
/impl/src/java/pt/estgp/estgweb/web/form/courseunits/CourseUnitsForm.java
3,28 → 3,16
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.form.ApplicationForm;
import pt.estgp.estgweb.web.form.commons.TeachersForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.CourseUnitAssignementView;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.CourseUnitDeliverableView;
import pt.estgp.estgweb.domain.TeacherImpl;
import pt.estgp.estgweb.domain.Teacher;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.*;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.web.form.commons.TeachersForm;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
 
/**
* @author Jorge Machado
97,7 → 85,7
 
public List<String> getImportYears()
{
return DatesUtils.getImportYears(5);
return DatesUtils.getImportYears(15);
}
 
 
/impl/src/java/pt/estgp/estgweb/web/form/configuration/DirectoriesForm.java
New file
0,0 → 1,71
package pt.estgp.estgweb.web.form.configuration;
 
import pt.estgp.estgweb.services.directories.xsd.Directory;
import pt.estgp.estgweb.services.directories.xsd.DirectoryImpl;
import pt.estgp.estgweb.web.form.ApplicationForm;
 
/**
* @author Jorge Machado
* @date 25/Jun/2008
* @see pt.estgp.estgweb.web.form.courses
*/
public class DirectoriesForm extends ApplicationForm
{
 
private Directory directory;
private String id;
private String rtarget;
private String rtype;
private String rname;
 
 
 
public DirectoriesForm()
{
 
}
 
public Directory getDirectory()
{
if(directory == null)
directory = new DirectoryImpl();
return directory;
}
 
public void setDirectory(Directory directory)
{
this.directory = directory;
}
 
public String getId() {
return id;
}
 
public void setId(String id) {
this.id = id;
}
 
public String getRtarget() {
return rtarget;
}
 
public void setRtarget(String rtarget) {
this.rtarget = rtarget;
}
 
public String getRtype() {
return rtype;
}
 
public void setRtype(String rtype) {
this.rtype = rtype;
}
 
public String getRname() {
return rname;
}
 
public void setRname(String rname) {
this.rname = rname;
}
}
/impl/src/java/pt/estgp/estgweb/web/form/configuration/ConfigurationGradesForm.java
New file
0,0 → 1,60
package pt.estgp.estgweb.web.form.configuration;
 
import jomm.utils.AutoFillArrayList;
import pt.estgp.estgweb.domain.ConfigurationGradesEpocaAvaliacaoImpl;
import pt.estgp.estgweb.domain.ConfigurationGradesStatusEpocaImpl;
import pt.estgp.estgweb.domain.views.ConfigurationGradesView;
import pt.estgp.estgweb.web.form.ApplicationForm;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 25/Jun/2008
* @see pt.estgp.estgweb.web.form.courses
*/
public class ConfigurationGradesForm extends ApplicationForm
{
 
private String dispatch;
private long id;
private ConfigurationGradesView configurationGrades;
 
 
public ConfigurationGradesForm()
{
 
}
 
public ConfigurationGradesView getConfigurationGrades() {
if(configurationGrades == null)
{
configurationGrades = new ConfigurationGradesView();
List o = new AutoFillArrayList<ConfigurationGradesEpocaAvaliacaoImpl>(ConfigurationGradesEpocaAvaliacaoImpl.class);
List o2 = new AutoFillArrayList<ConfigurationGradesStatusEpocaImpl>(ConfigurationGradesStatusEpocaImpl.class);
configurationGrades.setEpocasAvaliacao(o);
configurationGrades.setStatusEpocas(o2);
}
return configurationGrades;
}
 
public String getOp() {
return dispatch;
}
 
public void setOp(String dispatch) {
this.dispatch = dispatch;
}
 
public void setConfigurationGrades(ConfigurationGradesView configurationGrades) {
this.configurationGrades = configurationGrades;
}
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
}
/impl/src/java/pt/estgp/estgweb/web/form/configuration/SchedulleTasksForm.java
New file
0,0 → 1,130
package pt.estgp.estgweb.web.form.configuration;
 
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.JobServiceTaskImpl;
import pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl;
import pt.estgp.estgweb.web.form.ApplicationForm;
 
/**
* @author Jorge Machado
* @date 25/Jun/2008
* @see pt.estgp.estgweb.web.form.courses
*/
public class SchedulleTasksForm extends ApplicationForm
{
 
private JobServiceTaskSchedulerImpl jobScheduller;
private JobServiceTaskImpl jobServiceTask;
private Long id;
 
 
private String jobImportYearKey;
private String jobSemestreKey;
private String jobSendIonlineKey;
private String jobSendEmailKey;
private String jobCloneOnlyNewsKey;
private String jobGenerateAllPdfsKey;
private String jobValidateKey;
 
 
 
 
 
public SchedulleTasksForm()
{
if(jobScheduller == null)
{
jobScheduller = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
}
}
 
public String getJobImportYearKey() {
return jobImportYearKey;
}
 
public void setJobImportYearKey(String jobImportYearKey) {
this.jobImportYearKey = jobImportYearKey;
}
 
public String getJobSemestreKey() {
return jobSemestreKey;
}
 
public void setJobSemestreKey(String jobSemestreKey) {
this.jobSemestreKey = jobSemestreKey;
}
 
public String getJobSendIonlineKey() {
return jobSendIonlineKey;
}
 
public void setJobSendIonlineKey(String jobSendIonlineKey) {
this.jobSendIonlineKey = jobSendIonlineKey;
}
 
public String getJobSendEmailKey() {
return jobSendEmailKey;
}
 
public void setJobSendEmailKey(String jobSendEmailKey) {
this.jobSendEmailKey = jobSendEmailKey;
}
 
public String getJobCloneOnlyNewsKey() {
return jobCloneOnlyNewsKey;
}
 
public void setJobCloneOnlyNewsKey(String jobCloneOnlyNewsKey) {
this.jobCloneOnlyNewsKey = jobCloneOnlyNewsKey;
}
 
public String getJobGenerateAllPdfsKey() {
return jobGenerateAllPdfsKey;
}
 
public void setJobGenerateAllPdfsKey(String jobGenerateAllPdfsKey) {
this.jobGenerateAllPdfsKey = jobGenerateAllPdfsKey;
}
 
public String getJobValidateKey() {
return jobValidateKey;
}
 
public void setJobValidateKey(String jobValidateKey) {
this.jobValidateKey = jobValidateKey;
}
 
public JobServiceTaskSchedulerImpl getDirectory()
{
if(jobScheduller == null)
jobScheduller = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
return jobScheduller;
}
 
public JobServiceTaskSchedulerImpl getJobScheduller() {
return jobScheduller;
}
 
public void setJobScheduller(JobServiceTaskSchedulerImpl jobScheduller) {
this.jobScheduller = jobScheduller;
}
 
public Long getId() {
return id;
}
 
public void setId(Long id) {
this.id = id;
}
 
public JobServiceTaskImpl getJobServiceTask()
{
return jobServiceTask;
}
 
public void setJobServiceTask(JobServiceTaskImpl jobServiceTask) {
this.jobServiceTask = jobServiceTask;
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/UserSessionProxy.java
96,6 → 96,24
}
}
 
public static UserSession createUserSession(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
try
{
 
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{RequestUtils.getRequester(request, response)};
UserSession userSession = (UserSession) sm.execute(RequestUtils.getRequester(request, response),"LoadUserSession",args);
 
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
return userSession;
}
catch (Throwable e)
{
throw e;
}
}
 
public static UserSession loadUserSessionFromRequest(HttpServletRequest request)
{
return (UserSession) request.getAttribute(Globals.USER_SESSION_KEY);
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java
284,6 → 284,11
CourseForm cF = (CourseForm) form;
String importYear = cF.getImportYear();
long courseId = cF.getCourseId();
if(courseId <= 0)
{
addError(request,"courses.fill.course");
return mapping.findForward("load.courses.programs");
}
String semestre = cF.getSemestre();
String area = cF.getArea();
DirectedCoordinatedUnitsService.TeachersSituationEnum teachersSituationEnum = cF.getTeacherSituationEnum();
/impl/src/java/pt/estgp/estgweb/web/controllers/courseunits/CourseUnitsEvaluationController.java
85,16 → 85,65
HttpServletResponse response)
throws ServletException
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
try
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
long id = cUF.getCourseUnitView().getId();
CourseUnitEvaluationView cuV = cUF.getCourseUnitEvaluationView();
if(request.getParameter("json")!=null && request.getParameter("json").equals("true"))
{
cuV.setAutosave(true);
}
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{cuV, id};
cuV = (CourseUnitEvaluationView) sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
CourseUnitView cV = loadCourseUnitView(id,true,false, mapping, request, response);
cUF.setCourseUnitView(cV);
request.setAttribute("CourseUnitView", cV);
addMessage(request,"courseunit.evaluation.success");
if(request.getParameter("json")!=null && request.getParameter("json").equals("true"))
{
return mapping.findForward("jsonOk");
}
else
return mapping.findForward("load");
 
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (NotFoundException e)
{
return mapping.findForward("error404");
}
catch (Throwable e)
{
logger.error(e, e);
addError(request, "courseunit.evaluation.tryagain");
return editEvaluation(mapping,cUF,request,response);
}
}
 
 
public ActionForward teacherCompleteEvaluation(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
try
{
 
 
long id = cUF.getCourseUnitView().getId();
CourseUnitEvaluationView cuV = cUF.getCourseUnitEvaluationView();
cuV.setTeacherComplete(true);
 
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{cuV, id};
sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
cuV = (CourseUnitEvaluationView) sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
CourseUnitView cV = loadCourseUnitView(id,true,false, mapping, request, response);
cUF.setCourseUnitView(cV);
request.setAttribute("CourseUnitView", cV);
112,7 → 161,9
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
addError(request, "courseunit.evaluation.tryagain");
return editEvaluation(mapping,cUF,request,response);
//return mapping.findForward("error500");
}
}
 
122,18 → 173,18
HttpServletResponse response)
throws ServletException
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
try
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
 
long id = cUF.getCourseUnitView().getId();
CourseUnitEvaluationView cuV = cUF.getCourseUnitEvaluationView();
cuV.setFechar(true);
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{cuV, id};
sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
cuV = (CourseUnitEvaluationView) sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
CourseUnitView cV = loadCourseUnitView(id,true,false, mapping, request, response);
cUF.setCourseUnitView(cV);
cUF.setCourseUnitEvaluationView(cuV);
request.setAttribute("CourseUnitView", cV);
addMessage(request,"courseunit.evaluation.success");
return mapping.findForward("load");
149,7 → 200,8
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
addError(request, "courseunit.evaluation.tryagain");
return editEvaluation(mapping,cUF,request,response);
}
}
 
/impl/src/java/pt/estgp/estgweb/web/controllers/courseunits/CourseUnitsAdminController.java
5,14 → 5,10
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.CourseUnitProgram;
import pt.estgp.estgweb.domain.CourseUnitProgramImpl;
import pt.estgp.estgweb.domain.CourseUnitProgramPart2Impl;
import pt.estgp.estgweb.domain.views.CourseUnitProgramView;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitProgramForm;
import pt.estgp.estgweb.services.courseunits.DeleteCourseUnitService;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitsForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
375,23 → 371,25
{
 
try {
// long id = Long.parseLong(request.getParameter("id"));
// IServiceManager sm = null;
// sm = ServiceManager.getInstance();
// String[] names = new String[]{};
// Object[] args = new Object[]{id};
long id = Long.parseLong(request.getParameter("id"));
IServiceManager sm = null;
sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{id};
 
// sm.execute(RequestUtils.getRequester(request, response), "DeleteCourseUnit", args, names);
 
// addMessage(request,"courseunit.removed");
logger.info("N�o implementado por razoes de seguran�a");
addMessage(request,"courseunit.security.not.implemented");
DeleteCourseUnitService.CourseUnitContentsInfo result = (DeleteCourseUnitService.CourseUnitContentsInfo) sm.execute(RequestUtils.getRequester(request, response), "TryDeleteCourseUnitService", args, names);
if(result.isCanDelete())
addMessage(request,"courseunit.removed");
else
addError(request,"courseunit.cant.be.removed");
//logger.info("Não implementado por razoes de segurança");
//addMessage(request,"courseunit.security.not.implemented");
return mapping.findForward("delete");
} catch (Throwable e) {
addMessage(request,"error.500");
logger.error(e,e);
return mapping.findForward("error500");
}
 
return mapping.getInputForward();
}
 
public ActionForward search(ActionMapping mapping,
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java
1,33 → 1,38
package pt.estgp.estgweb.web.controllers.profile;
 
import java.io.Serializable;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.views.RecordView;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.AddRolesController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.form.profile.ProfileForm;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.RecordView;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterRetrieveException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.IncompatibleFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterExpressionException;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.*;
import org.apache.log4j.Logger;
import org.apache.struts.action.*;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
 
import pt.estgp.estgweb.web.form.AddRolesForm;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
522,4 → 527,32
}
}
 
public ActionForward addRole(ActionMapping mapping,
ActionForm form ,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
ProfileForm profileForm = (ProfileForm) form;
UserView uV = loadUser(profileForm.getUserView().getId(), request, response);
profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal());
profileForm.setUserView(uV);
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
return super.addRole(mapping,form,request,response);
}
 
public ActionForward removeRole(ActionMapping mapping,
ActionForm form ,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
ProfileForm profileForm = (ProfileForm) form;
UserView uV = loadUser(profileForm.getUserView().getId(), request, response);
profileForm.setUserView(uV);
profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal());
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
return super.removeRole(mapping,form,request,response);
}
 
}
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/DirectoriesController.java
New file
0,0 → 1,339
package pt.estgp.estgweb.web.controllers.configuration;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.services.directories.xsd.*;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.form.configuration.DirectoriesForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Iterator;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class DirectoriesController extends ApplicationDispatchController
{
 
private static final Logger logger = Logger.getLogger(DirectoriesController.class);
 
 
public ActionForward load(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{df.getId()};
 
try
{
Directory d = (Directory) sm.execute(RequestUtils.getRequester(request, response), "LoadDirectoryService", args, names);
df.setDirectory(d);
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("directory");
}
public ActionForward addLeaf(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
addMessage(request,"directories.add.leaf",idParent);
leaf.getLeaf().add(new LeafTImpl());
return mapping.findForward("directory");
}
 
 
public ActionForward refresh(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
 
 
addMessage(request, "directories.refresh");
 
return mapping.findForward("directory");
}
 
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable {
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
 
DirectoriesForm df = (DirectoriesForm) form;
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{df.getDirectory()};
 
try {
sm.execute(RequestUtils.getRequester(request, response), "SaveDirectoryService", args, names);
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
 
addMessage(request, "directories.saved");
 
return mapping.findForward("directories");
}
 
public ActionForward cancel(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
addMessage(request, "directories.canceled");
return mapping.findForward("directories");
}
 
 
public ActionForward removeLeaf(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.removeLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
addMessage(request, "directories.removed.leaf", idParent);
leaf.getLeaf().add(new LeafTImpl());
return mapping.findForward("directory");
}
 
 
public ActionForward addRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
 
leaf.getRights().getRight().add(new RightImpl());
addMessage(request, "directories.add.right", idParent);
return mapping.findForward("directory");
}
 
public ActionForward removeRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
 
 
Iterator<RightsT.Right> iter = leaf.getRights().getRight().iterator();
while(iter.hasNext())
{
RightsT.Right r =iter.next();
if(r.getName().equals(df.getRname()) && r.getTarget().equals(df.getRtarget()) && df.getRtype().equals(r.getType()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.right", df.getRname(),df.getRtarget(),df.getRtype());
return mapping.findForward("directory");
}
 
public ActionForward addDirRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
df.getDirectory().getRights().getRight().add(new RightImpl());
addMessage(request, "directories.add.right");
return mapping.findForward("directory");
}
 
public ActionForward removeDirRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
 
Iterator<RightsT.Right> iter = df.getDirectory().getRights().getRight().iterator();
while(iter.hasNext())
{
RightsT.Right r =iter.next();
if(r.getName().equals(df.getRname()) && r.getTarget().equals(df.getRtarget()) && df.getRtype().equals(r.getType()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.right", df.getRname(),df.getRtarget(),df.getRtype());
return mapping.findForward("directory");
}
 
public ActionForward addDirGroup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
df.getDirectory().getGroupsDeclaration().getGroup().add(new GroupImpl());
addMessage(request, "directories.add.group");
return mapping.findForward("directory");
}
 
public ActionForward removeDirGroup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
 
Iterator<GroupDeclarationT.Group> iter = df.getDirectory().getGroupsDeclaration().getGroup().iterator();
while(iter.hasNext())
{
GroupDeclarationT.Group g =iter.next();
if(g.getName().equals(df.getRname()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.group");
return mapping.findForward("directory");
}
 
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/SchedulerTasksController.java
New file
0,0 → 1,340
package pt.estgp.estgweb.web.controllers.configuration;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.services.directories.xsd.LeafT;
import pt.estgp.estgweb.services.directories.xsd.LeafTImpl;
import pt.estgp.estgweb.services.jobs.ServiceJob;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.form.configuration.DirectoriesForm;
import pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class SchedulerTasksController extends ApplicationDispatchController
{
 
private static final Logger logger = Logger.getLogger(SchedulerTasksController.class);
 
public ActionForward newTask(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
sf.setJobScheduller(DomainObjectFactory.createJobServiceTaskSchedulerImpl());
return mapping.findForward("task");
}
 
public ActionForward load(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getId()};
 
try
{
JobServiceTaskSchedulerImpl d = (JobServiceTaskSchedulerImpl) sm.execute(RequestUtils.getRequester(request, response), "LoadJobServiceTaskScheduler", args, names);
for(JobServiceTaskSchedulerParameter p: d.getServiceTaskSchedulerParameters())
{
if(p.getName().equals(ServiceJob.JOB_importYear_KEY))
{
sf.setJobImportYearKey(p.getObject());
}else if(p.getName().equals(ServiceJob.JOB_semestre_KEY))
{
sf.setJobSemestreKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_cloneOnlyNews_KEY))
{
sf.setJobCloneOnlyNewsKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_generateAllPdfs_KEY))
{
sf.setJobGenerateAllPdfsKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_sendEmail_KEY))
{
sf.setJobSendEmailKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_sendIonline_KEY))
{
sf.setJobSendIonlineKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_validate_KEY))
{
sf.setJobValidateKey(p.getObject());
}
}
 
sf.setJobScheduller(d);
 
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("task");
}
 
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getJobScheduller()
,sf.getJobCloneOnlyNewsKey()
,sf.getJobGenerateAllPdfsKey()
,sf.getJobImportYearKey()
,sf.getJobSemestreKey()
,sf.getJobSendEmailKey()
,sf.getJobSendIonlineKey()
,sf.getJobValidateKey()
};
 
try
{
sm.execute(RequestUtils.getRequester(request, response), "SaveJobServiceTaskScheduler", args, names);
addMessage(request, "configuration.tasks.saved");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("tasks");
}
 
public ActionForward loadLog(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getId()};
 
try
{
JobServiceTaskImpl j = (JobServiceTaskImpl) sm.execute(RequestUtils.getRequester(request, response), "LoadJobServiceTask", args, names);
sf.setJobServiceTask(j);
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
if(request.getParameter("from")!=null)
return mapping.findForward("taskLogfrom" + request.getParameter("from"));
else
return mapping.findForward("taskLog");
}
 
public ActionForward runNow(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getId()};
 
try
{
sm.execute(RequestUtils.getRequester(request, response), "RunNowJobServiceTaskScheduller", args, names);
addMessage(request,"job.schedule.for.now");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("tasks");
}
 
public ActionForward toggleActive(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getId()};
 
try
{
JobServiceTaskScheduler scheduler = (JobServiceTaskScheduler) sm.execute(RequestUtils.getRequester(request, response), "ToggleActiveJobServiceTaskScheduller", args, names);
if(scheduler.isActive())
addMessage(request,"job.schedule.active");
else
addMessage(request,"job.schedule.inactive");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("tasks");
}
 
public ActionForward delete(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getId()};
 
try
{
sm.execute(RequestUtils.getRequester(request, response), "DeleteJobServiceTaskScheduller", args, names);
addMessage(request,"job.schedule.deleted");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("tasks");
}
 
 
 
 
 
 
 
 
 
 
public ActionForward addLeaf(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
addMessage(request,"directories.add.leaf",idParent);
leaf.getLeaf().add(new LeafTImpl());
return mapping.findForward("directory");
}
 
 
public ActionForward refresh(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
 
 
addMessage(request, "directories.refresh");
 
return mapping.findForward("directory");
}
 
 
 
public ActionForward cancel(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
addMessage(request, "configuration.tasks.canceled");
return mapping.findForward("tasks");
}
 
 
 
 
 
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/GradesController.java
New file
0,0 → 1,151
package pt.estgp.estgweb.web.controllers.configuration;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.ConfigurationGradesEpocaAvaliacao;
import pt.estgp.estgweb.domain.ConfigurationGradesStatusEpoca;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.form.configuration.ConfigurationGradesForm;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class GradesController extends ApplicationDispatchController
{
 
private static final Logger logger = Logger.getLogger(GradesController.class);
 
 
 
public ActionForward saveGrades(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
 
ConfigurationGradesForm f = (ConfigurationGradesForm) form;
AbstractDao.getCurrentSession().beginTransaction();
for(ConfigurationGradesEpocaAvaliacao a: f.getConfigurationGrades().getEpocasAvaliacao())
{
if(a.getId() > 0)
{
ConfigurationGradesEpocaAvaliacao persist = DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().load(a.getId());
persist.setCodigoEpoca(a.getCodigoEpoca());
persist.setCodigoMomento(a.getCodigoMomento());
persist.setObs(a.getObs());
persist.setDescricao(a.getDescricao());
}
}
 
for(ConfigurationGradesStatusEpoca a: f.getConfigurationGrades().getStatusEpocas())
{
if(a.getId() > 0)
{
ConfigurationGradesStatusEpoca persist = DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().load(a.getId());
persist.setStatus(a.getStatus());
persist.setObs(a.getObs());
persist.setDescricao(a.getDescricao());
}
}
AbstractDao.getCurrentSession().getTransaction().commit();
 
return mapping.findForward("grades");
}
 
public ActionForward addEpocaAvaliacao(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
AbstractDao.getCurrentSession().beginTransaction();
 
ConfigurationGradesEpocaAvaliacao epoca = DomainObjectFactory.createConfigurationGradesEpocaAvaliacaoImpl();
DaoFactory.getConfigurationDaoImpl().load().getConfigurationGrades().getEpocasAvaliacao().add(epoca);
DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().save(epoca);
AbstractDao.getCurrentSession().getTransaction().commit();
return mapping.findForward("grades");
}
 
public ActionForward addSatusEpoca(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
AbstractDao.getCurrentSession().beginTransaction();
ConfigurationGradesStatusEpoca status = DomainObjectFactory.createConfigurationGradesStatusEpocaImpl();
DaoFactory.getConfigurationDaoImpl().load().getConfigurationGrades().getStatusEpoca().add(status);
DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().save(status);
AbstractDao.getCurrentSession().getTransaction().commit();
return mapping.findForward("grades");
}
 
public ActionForward deleteEpocaAvaliacao(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
ConfigurationGradesForm f = (ConfigurationGradesForm) form;
AbstractDao.getCurrentSession().beginTransaction();
DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().delete(f.getId());
AbstractDao.getCurrentSession().getTransaction().commit();
return mapping.findForward("grades");
}
 
public ActionForward deleteStatusEpoca(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
ConfigurationGradesForm f = (ConfigurationGradesForm) form;
 
AbstractDao.getCurrentSession().beginTransaction();
DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().delete(f.getId());
AbstractDao.getCurrentSession().getTransaction().commit();
return mapping.findForward("grades");
}
 
}
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/SchedullerTasksJson.java
New file
0,0 → 1,191
package pt.estgp.estgweb.web.controllers.configuration;
 
import com.owlike.genson.Genson;
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.JobServiceTask;
import pt.estgp.estgweb.domain.JobServiceTaskImpl;
import pt.estgp.estgweb.domain.JobServiceTaskScheduler;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.filterManager.exceptions.*;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
 
/**
* Created by jorgemachado on 23/11/15.
*/
public class SchedullerTasksJson extends HttpServlet
{
private static final Logger logger = Logger.getLogger(SchedullerTasksJson.class);
 
 
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
try {
process(request,response);
} catch (Throwable e) {
response.sendError(500);
logger.error(e,e);
}
}
 
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
try {
process(request,response);
} catch (Throwable e) {
response.sendError(500);
logger.error(e, e);
}
}
 
private void process(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
String service = request.getParameter("service");
 
this.getClass().getMethod(service,HttpServletRequest.class,HttpServletResponse.class)
.invoke(this,request,response);
}
 
public void loadLog(HttpServletRequest request,HttpServletResponse response) throws IOException, IncompatibleFilterException, InvalidFilterException, ClassNotIFilterException, FilterRetrieveException, ServiceManagerException, InvalidFilterExpressionException {
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("ci"))
{
response.sendError(403);
return;
}
 
String id = request.getParameter("id");
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{Long.parseLong(id)};
 
try
{
JobServiceTaskImpl j = (JobServiceTaskImpl) sm.execute(RequestUtils.getRequester(request, response), "LoadJobServiceTask", args, names);
 
Genson genson = new Genson.Builder()
.exclude(Object.class)
.include("serviceStartDateFormated", JobServiceTask.class)
.include("serviceLastUpdateDateFormated", JobServiceTask.class)
.include("serviceFinishDateFormated", JobServiceTask.class)
.include("status", JobServiceTask.class)
.include("progress",JobServiceTask.class)
.create();
 
String json = genson.serialize(j);
response.setContentType("application/json");
response.setCharacterEncoding("ISO-8859-1");
response.setContentLength(json.length());
response.getOutputStream().print(json);
 
}
catch (FilterChainFailedException e)
{
logger.error(e,e);
response.sendError(500);
}
catch (Throwable e)
{
logger.error(e,e);
response.sendError(500);
}
}
 
 
 
public void loadTasks(HttpServletRequest request,HttpServletResponse response) throws IOException, IncompatibleFilterException, InvalidFilterException, ClassNotIFilterException, FilterRetrieveException, ServiceManagerException, InvalidFilterExpressionException {
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("ci"))
{
response.sendError(403);
return;
}
 
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
 
try
{
List<JobServiceTaskScheduler> tasks = (List<JobServiceTaskScheduler>) sm.execute(RequestUtils.getRequester(request, response), "LoadJobServiceTaskSchedullers", args, names);
 
 
Genson genson = new Genson.Builder()
.exclude(Object.class)
.include("serviceStartDateFormated", JobServiceTask.class)
.include("serviceLastUpdateDateFormated", JobServiceTask.class)
.include("serviceFinishDateFormated", JobServiceTask.class)
.include("status", JobServiceTask.class)
.include("progress",JobServiceTask.class)
.include("progress",JobServiceTask.class)
.include("lastJobServiceTask",JobServiceTaskScheduler.class)
.create();
 
String json = genson.serialize(tasks);
 
response.setContentType("application/json");
response.setCharacterEncoding("ISO-8859-1");
response.setContentLength(json.length());
response.getOutputStream().print(json);
 
}
catch (FilterChainFailedException e)
{
logger.error(e,e);
response.sendError(500);
}
catch (Throwable e)
{
logger.error(e,e);
response.sendError(500);
}
}
public static void main(String[] args2) throws IncompatibleFilterException, InvalidFilterException, ClassNotIFilterException, FilterRetrieveException, ServiceManagerException, InvalidFilterExpressionException {
String id = "44365";
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{Long.parseLong(id)};
 
try
{
AbstractDao.getCurrentSession().beginTransaction();
JobServiceTaskImpl j = (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().get(new Long(44365));
 
AbstractDao.getCurrentSession().getTransaction().commit();
 
Genson genson = new Genson.Builder()
.exclude(Object.class)
.include("serviceStartDate", JobServiceTask.class)
.include("serviceLastUpdateDate", JobServiceTask.class)
.include("serviceFinishDate", JobServiceTask.class)
.include("status", JobServiceTask.class)
.include("progress",JobServiceTask.class)
.create();
 
String json = genson.serialize(j);
 
System.out.println("");
}
catch (Throwable e)
{
logger.error(e,e);
 
}
}
}
/impl/src/java/pt/estgp/estgweb/web/controllers/announcements/MessagesController.java
1,36 → 1,25
package pt.estgp.estgweb.web.controllers.announcements;
 
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsController;
import pt.estgp.estgweb.web.form.courses.CourseForm;
import pt.estgp.estgweb.web.form.announcements.MessagesForm;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.domain.views.CourseView;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.services.announcements.CreateAnnouncementService;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterExpressionException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.IncompatibleFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterRetrieveException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsController;
import pt.estgp.estgweb.web.form.announcements.MessagesForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
 
/**
* @author Jorge Machado
58,7 → 47,7
MessagesForm mF = (MessagesForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new String[]{"",mF.getDepartamento()};
Object[] args = new String[]{mF.getImportYear(),mF.getDepartamento()};
List<CourseView> courseViews = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesImportYearArea", args, names);
mF.setCourseViews(courseViews);
addMessage(request,"submit.todo.message.courses.loaded");
151,9 → 140,9
String[] names = new String[]{};
Object[] args = new Object[]{request, mF.getFromRole(),mF.getImportYear(),mF.getDepartamento(),mF.getCourseId(),mF.getCourseUnitId(),mF.getSemestre(), CreateAnnouncementService.MessageTarget.parse(mF.getTarget()),mF.getText(),mF.getSubject()};
// String from, String year, String department, long courseId, long courseUnitId, String semestre, MessageTarget target,
List<UserView> users = (List<UserView>) sm.execute(RequestUtils.getRequester(request, response), "SendMessage", args, names);
Integer size = (Integer) sm.execute(RequestUtils.getRequester(request, response), "SendMessage", args, names);
 
addMessage(request,"submit.todo.message.success","" + users.size());
addMessage(request,"submit.todo.message.success","" + size);
return mapping.findForward("success");
}
catch (FilterChainFailedException e)
/impl/src/java/pt/estgp/estgweb/web/filters/UserSessionFilter.java
3,6 → 3,7
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
12,6 → 13,7
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Locale;
 
96,6 → 98,20
try
{
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(hrequest,((HttpServletResponse) response));
boolean dummy = false;
if(userSession == null)
{
dummy = true;
System.out.println("Creating dummy UserSession");
userSession = new UserSessionImpl();//creating a dummy there is no cookie
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
userSession.setIpAddress(request.getRemoteAddr() + " : " + request.getRemoteHost() + " : " + request.getRemotePort());
userSession.setSaveDate(new Date());
userSession.setNowConfiguration(DaoFactory.getConfigurationDaoImpl().loadSimpleConfigurationForConsult());
chain.doFilter(request,response);
return;
}
 
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
userSession.setIpAddress(request.getRemoteAddr() + " : " + request.getRemoteHost() + " : " + request.getRemotePort());
String lang = request.getParameter("language");
/impl/src/java/pt/estgp/estgweb/web/FTPFileProxy.java
10,6 → 10,7
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.services.ftpservices.FtpService;
import pt.estgp.estgweb.utils.ConfigProperties;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
32,6 → 33,115
*/
private static final Logger logger = Logger.getLogger(FTPFileProxy.class);
 
public static class UserCredentialsForFtp
{
String username;
String password;
}
 
/**
*
* @param server
* @param userSession
* @return CONFERE SITUACAO DE AUTENTICACAO E SERVIDOR e devolve user e pass em uso
*/
 
public static UserCredentialsForFtp getUserCredentialsForFtp(String server, UserSession userSession)
{
UserCredentialsForFtp u = new UserCredentialsForFtp();
boolean useDefaultCredentialsRead = ConfigProperties.getBooleanProperty(server + ".use.default.credentials.to.read");
String passwordUserInSessionCript = null;
if(userSession != null && ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD) != null)
passwordUserInSessionCript = (String) ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD);
 
if(!useDefaultCredentialsRead && // DEVE USAR AS DO USER
passwordUserInSessionCript != null && userSession.getUser() != null) // E ESTA AUTENTICADO
{
//ESTA AINDA PODE FALHAR AGORA QUANDO TENTAR SE FOR UM USER SEM LIGACAO AO FTP
//AI TEM DE TENTAR AS DEFAULT SE ESTIVER AUTORIZADO
u.username = userSession.getUsername();
u.password = DesUtils.getInstance().decrypt(passwordUserInSessionCript);
logger.warn("Will use User Credentials for server " + server + " and user " + u.username);
}
else if(!useDefaultCredentialsRead && // DEVE USAR AS DO USER
(passwordUserInSessionCript == null || userSession.getUser() == null) && //MAS NAO AUTENTICADO
ConfigProperties.getBooleanProperty(server + ".use.default.credentials.to.read.if.user.fail.when.not.authenticated")) // MAS PODE USAR DEFAULTS SEM ESTAR AUTENTICADO
{
logger.warn("There is no user authenticated, is configured to use not default credentials, but will use default password for server " + server);
u.username = ConfigProperties.getProperty(server + ".user");
u.password = ConfigProperties.getProperty(server + ".pass");
}
else if(!useDefaultCredentialsRead && // DEVE USAR AS DO USER
(passwordUserInSessionCript == null || userSession.getUser() == null) && //MAS NAO AUTENTICADO
!ConfigProperties.getBooleanProperty(server + ".use.default.credentials.to.read.if.user.fail.when.not.authenticated")) // NO ENTANTO NAO PODE USAR DEFAULTS SEM ESTAR AUTENTICADO
{
u.username = null;
u.password = null;
}
else if(useDefaultCredentialsRead) // DEVE USAR AS DEFAULT SEMPRE
{
u.username = ConfigProperties.getProperty(server + ".user");
u.password = ConfigProperties.getProperty(server + ".pass");
}
return u;
}
 
/**
* @param ftpServer
* @param userSession
* @param server
* @param serverUrl
* @return return ftpClient if OK or try to inspect policy of connecting with defaults if authentication fails
* @throws IOException
*/
public static FTPClient getFtpClient(FtpServer ftpServer, UserSession userSession, String server, String serverUrl)
throws IOException
{
FTPClient client = ftpServer.getClient();
if(client == null)
{
//FALHOU PODE A PASS DO USER NAO DAR POR NAO ESTAR NO FTP
//TEM DE VERIFICAR SE PODE USAR DEFAULTS QUANDO AUTENTICACAO FALHA
if(userSession.getUsername() != null &&
ConfigProperties
.getBooleanProperty(
server + ".use.default.credentials.to.read.if.user.fail.when.authenticated"))
{
// ESTA AUTENTICADO E TENTOU USAR A DO USER FALHOU, OU JA ESTA NA DEFAULT E FALHOU A MESMA
//COMO PODE TENTAR USAR AS DEFAULTS NESTE CASO VAI TENTAR
logger.warn("###################");
logger.warn("################### > CANT CONNECT FTP");
//VELHO response.sendError(408);
//NOVO
logger.info("User cant connect to directory, probably user is not in ftp server, trying defaults");
ftpServer = FtpServer.getNewServer(
serverUrl
,ConfigProperties.getProperty(server + ".user")
,ConfigProperties.getProperty(server + ".pass"));
 
return ftpServer.getClient();
}
else if(userSession.getUsername() != null &&
!ConfigProperties
.getBooleanProperty(
server + ".use.default.credentials.to.read.if.user.fail.when.authenticated"))
{
// USER AUTENTICADO FALHOU E SEM AUTORIZACAO PARA LIGAR COM AS DEFAULTS
logger.info("System is not authorized to use default password for " + server);
return null;
}
else
{
//NEM HA USER JA DEVIA TER FALHADO ANTES
logger.info("No user authenticated will return without response");
return null;
}
 
//velho return;
}
return client;
}
 
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
40,41 → 150,42
String server = objectRequired.substring(0,objectRequired.indexOf("/"));
String path = objectRequired.substring(objectRequired.indexOf("/"));
 
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
 
 
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
String passwordUserInSession = (String) ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD);
logger.info("server:" + server);
logger.info("path:" + path);
if(username == null || passwordUserInSession == null)
//LOGICA DE LIGACAO NESTE METODO
UserCredentialsForFtp u = getUserCredentialsForFtp(server,userSession);
 
String username = u.username;
String password = u.password;
 
 
if(username == null || password == null) //NAO PODE LIGAR
{
response.sendError(401);
return;
}
passwordUserInSession = DesUtils.getInstance().decrypt(passwordUserInSession);
 
if(path != null)
{
server = pt.estgp.estgweb.utils.ConfigProperties.getProperty("server." + server);
String serverUrl = pt.estgp.estgweb.utils.ConfigProperties.getProperty("server." + server);
String remoteName = path.substring(path.lastIndexOf("/")+1);
String remoteDirectory = path.substring(0,path.lastIndexOf("/"));
FtpServer ftpServer = FtpServer.getNewServer(server,username,passwordUserInSession);
FtpServer ftpServer = FtpServer.getNewServer(serverUrl,username,password);
FTPClient client = null;
try
{
client = ftpServer.getClient();
client = getFtpClient(ftpServer,userSession,server,serverUrl);
if(client == null)
{
logger.warn("###################");
logger.warn("################### > CANT CONNECT FTP");
response.sendError(408);
return;
}
 
 
client.changeWorkingDirectory(remoteDirectory);
 
 
 
FTPFile[] files = client.listFiles();
boolean found = false;
for (FTPFile file : files) {
86,7 → 197,7
InputStream stream = client.retrieveFileStream(file.getName());
response.setContentLength((int)file.getSize());
response.setContentType(MimeTypeGuesser.getInstance().guessMimeType(file.getName()));
response.setHeader("Content-disposition","inline; filename=" + file.getName());
response.setHeader("Content-disposition","attachment; filename=" + file.getName());
StreamsUtils.inputStream2OutputStream(stream, response.getOutputStream());
stream.close();
 
110,6 → 221,7
client.disconnect();
}
response.sendError(404);
logger.error(e,e);
return;
}
finally {
/impl/src/java/pt/estgp/estgweb/examples/DBInit.java
70,6 → 70,9
announcement3.setPopupwidthpx(0);
announcement3.setPosition(0);
DaoFactory.getAnnouncementDaoImpl().save(announcement3);
 
 
 
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/doc/TarefasManutencaoBaco.docx
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/doc/mysql/ConfigurarMysql.txt
New file
0,0 → 1,11
 
 
my.conf
 
[mysqld]
default-storage-engine = innodb
transaction-isolation = READ-COMMITTED
 
restart mysql
 
restart no mac /usr/local/mysql/support-files/mysql.server restart
/impl/src/doc/EMAIL_SEND_CONF.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream