/impl/importRoutines.xml |
---|
52,7 → 52,10 |
<!-- JOB RUNNER --> |
<target name="jobs"> |
<java classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib" fork="true"> |
<java classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib" |
fork="true"> |
<!--Usar isto em ANT_OPTS no LINUX PARA EVITAR O FORK |
O FORK PODE COMPROMETER O KILL DE TAREFAS POR NAO HAVER COMO AS IDENTIFICAR--> |
<jvmarg value="-Djava.security.egd=file:/dev/urandom"/> |
</java> |
/impl/conf/language/MessageResources.properties |
---|
148,14 → 148,19 |
user.role.studentsID=Alunos de Informação e Documentação |
user.role.studentsFSIR=Alunos de Fontes de Informação e Serviço de Referência |
user.role.sendMailMessages=Enviar Mensagens de Correio Electronico |
user.role.pedagogicCouncilSecretariat=Secretaria do Conselho Pedagógico |
user.role.directionSecretariat=Secretaria da Direcção |
user.role.pedagogicCouncilSecretariat=Secretariado do Conselho Pedagógico |
user.role.directionSecretariat=Secretariado da Direcção |
user.role.studentsSecretariat=Secretaria de Alunos |
user.role.admin,teacher=Admin e Professor |
user.role.assessementsTester=Testador de Provas de Avaliação |
user.role.processes.admin=Inspector de Processos |
#Filter Errors |
role=Papel Institucional |
role.value.default=Tradução Principal |
role.value.default.required=O papel {0} não tem tradução principal |
role.value.key.repeated=A chave {0} já existe na lista de papeis |
fail.role=Lamentamos o incómodo, mas necessita de permissões especiais para aceder a esta área. |
fail.owner=Lamentamos o incómodo, mas não tem permissões sobre o objecto ao qual tentou aceder. |
fail.timer=Lamentamos o incomodo, mas a acção que tentou efectuar não pode ser executada nesta data. |
480,11 → 485,15 |
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.userRoles=Configuração de Papeis Institucionais |
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} |
configuration.roles=Configurar Papeis Institucionais |
configuration.roles.saved=Papeis salvos com sucesso |
configuration.role.saved=Papel {0} salvo com sucesso |
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. |
/impl/conf/WEB-INF/struts/struts-configuration.xml |
---|
6,6 → 6,7 |
<struts-config> |
<form-beans> |
<form-bean type="pt.estgp.estgweb.web.form.configuration.ConfigurationUserRolesForm" name="ConfigurationUserRolesForm"/> |
<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"/> |
21,7 → 22,19 |
<action-mappings> |
<action path="/user/configurationUserRoles" forward="page.configuration.userRoles"/> |
<action path="/user/userRoles" |
type="pt.estgp.estgweb.web.controllers.configuration.UserRolesController" |
name="ConfigurationUserRolesForm" |
scope="request" |
parameter="dispatch" |
validate="true" |
input="page.configuration.userRoles"> |
<forward name="save" path="page.separators.serviceZone"/> |
<forward name="userRoles" path="page.configuration.userRoles"/> |
</action> |
<action path="/user/configurationGrades" forward="page.configuration.grades"/> |
<action path="/user/grades" |
/impl/conf/WEB-INF/struts/tiles-configuration.xml |
---|
12,6 → 12,11 |
<put name="body" value="/admin/configuration/grades.jsp"/> |
</definition> |
<definition name="page.configuration.userRoles" extends="page.separators.serviceZone"> |
<put name="title" value="Configuração Papeis Institucionais"/> |
<put name="topnav" value="/user/serviceZone/topnavConfigurationUserRoles.jsp"/> |
<put name="body" value="/admin/configuration/userRoles.jsp"/> |
</definition> |
<definition name="page.configuration.directories" extends="page.separators.serviceZone"> |
<put name="title" value="Configuração Directorios"/> |
/impl/conf/WEB-INF/struts/struts-default.xml |
---|
187,7 → 187,8 |
</action-mappings> |
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" /> |
<message-resources parameter="MessageResources"/> |
<!--<message-resources parameter="MessageResources"/>--> |
<message-resources parameter="MessageResources" factory="pt.estgp.estgweb.utils.ReloadablePropertyMessageResourcesFactory"/> |
<plug-in className="org.apache.struts.tiles.TilesPlugin"> |
<set-property property="definitions-config" |
/impl/conf/WEB-INF/tlds/struts-bean.tld |
---|
147,6 → 147,7 |
</attribute> |
</tag> |
<tag> |
<name>message</name> |
<tagclass>org.apache.struts.taglib.bean.MessageTag</tagclass> |
<bodycontent>empty</bodycontent> |
/impl/conf/WEB-INF/web.xml |
---|
11,6 → 11,10 |
</listener> |
<filter> |
<filter-name>UserRoleProxy</filter-name> |
<filter-class>pt.estgp.estgweb.web.filters.UserRoleProxy</filter-class> |
</filter> |
<filter> |
<filter-name>RequestedUrlFilter</filter-name> |
<filter-class>pt.estgp.estgweb.web.filters.RequestURLFilter</filter-class> |
</filter> |
76,6 → 80,10 |
<url-pattern>/*</url-pattern> |
</filter-mapping> |
<filter-mapping> |
<filter-name>UserRoleProxy</filter-name> |
<url-pattern>/*</url-pattern> |
</filter-mapping> |
<filter-mapping> |
<filter-name>UserFilter</filter-name> |
<url-pattern>/user/*</url-pattern> |
</filter-mapping> |
269,6 → 277,12 |
<servlet-name>ws</servlet-name> |
<url-pattern>/ws/api</url-pattern> |
</servlet-mapping> |
<servlet-mapping> |
<servlet-name>ws</servlet-name> |
<url-pattern>/ws/siges</url-pattern> |
</servlet-mapping> |
<!--SOAP Tutorial--> |
/impl/conf/app.properties |
---|
184,98 → 184,11 |
user.identifiersManagers=identifiersManager |
user.servicesPrograms=servicesPrograms |
user.role.00=all |
user.role.01=admin |
user.role.02=student |
user.role.03=erasmusStudent |
user.role.04=oldStudent |
user.role.05=futureStudent |
user.role.06=ci |
user.role.07=teacher |
user.role.08=teacher.eg |
user.role.09=teacher.dg |
user.role.10=teacher.ce |
user.role.11=teacher.ch |
user.role.12=worker |
user.role.13=invited |
user.role.14=services |
user.role.15=administrativeCouncil |
user.role.1511=administrativeCouncil.director |
user.role.1512=administrativeCouncil.vice |
user.role.1513=schoolSecretary |
user.role.1514=administrativeCouncilSecretariat |
user.role.1515=teachersSecretariat |
user.role.1516=dtd.president |
user.role.1517=cesh.president |
user.role.1518=dtd.presidency |
user.role.1519=cesh.presidency |
user.role.1520=scientificCouncil |
user.role.1521=scientificCouncil.president |
user.role.1522=representativeCouncil |
user.role.1523=representativeCouncil.president |
user.role.1524=pedagogicCouncil |
user.role.1525=pedagogicCouncil.president |
user.role.1611=pedagogicCouncilSecretariat |
user.role.1612=directionSecretariat |
user.role.18=erasmusCouncil |
user.role.19=courseCoordinator |
user.role.20=studentAssociation |
user.role.22=computerCenter |
user.role.23=courseCoordinator |
user.role.24=courseDirector |
user.role.25=identifiersManager |
user.role.26=identifiersCollectionCreator |
user.role.27=servicesPrograms |
user.role.28=studentsID |
user.role.29=studentsFSIR |
user.role.30=student.eg |
user.role.31=student.dg |
user.role.32=student.ce |
user.role.33=student.ch |
user.role.34=student.td |
user.role.35=student.cesh |
user.role.36=teacher.td |
user.role.37=teacher.cesh |
user.role.51=courseValidateProgramCET_TD |
user.role.52=courseValidateProgramEI |
user.role.53=courseValidateProgramEC |
user.role.54=courseValidateProgramBioEng |
user.role.55=courseValidateProgramEGI |
user.role.56=courseValidateProgramEERA |
user.role.57=courseValidateProgramDC |
user.role.58=courseValidateProgramDA |
user.role.59=courseValidateProgramTVAPE |
user.role.60=courseValidateProgramMI |
user.role.61=courseValidateProgramCET_CESH |
user.role.62=courseValidateProgramAPM |
user.role.63=courseValidateProgramAA |
user.role.64=courseValidateProgramG |
user.role.65=courseValidateProgramID |
user.role.66=courseValidateProgramGPME |
user.role.78=courseValidateProgramRPS |
user.role.79=courseValidateProgramTGI |
user.role.80=courseValidateProgramRU |
user.role.85=courseValidateProgramCF |
user.role.86=courseValidateProgramTPB |
user.role.81=courseValidatePrograms |
user.role.82=sendMailMessages |
user.role.83=assessementsTester |
user.role.84=processes.admin |
######################################################################### |
# |
# Modules |
/impl/conf/template/email/courseUnitWork_pt.txt |
---|
1,5 → 1,4 |
|
# 0 : Course Unit Name |
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
/impl/conf/berserk/sd.xml |
---|
2267,10 → 2267,47 |
</service> |
<!--UserRole Services--> |
<service> |
<name>LoadRoleTranslationsIfDirty</name> |
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass> |
<description></description> |
<isTransactional>true</isTransactional> |
<defaultMethod>loadRolesIfDirty</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
</filterChains> |
</service> |
<service> |
<name>AddUpdateDirtyRolesTranslation</name> |
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass> |
<description></description> |
<isTransactional>true</isTransactional> |
<defaultMethod>addUpdateDirtRolesTranslation</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="Admins"/> |
</filterChains> |
</service> |
<service> |
<name>AddUpdateRoleTranslation</name> |
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass> |
<description></description> |
<isTransactional>true</isTransactional> |
<defaultMethod>addUpdateRole</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="Admins"/> |
</filterChains> |
</service> |
</serviceDefinitions> |
/impl/src/java/pt/estgp/estgweb/utils/ReloadablePropertyMessageResources.java |
---|
New file |
0,0 → 1,232 |
package pt.estgp.estgweb.utils; |
import org.apache.log4j.Logger; |
import org.apache.struts.util.PropertyMessageResources; |
import pt.estgp.estgweb.web.filters.UserRoleProxy; |
import java.io.File; |
import java.net.URISyntaxException; |
import java.net.URL; |
import java.util.Locale; |
import java.util.concurrent.ConcurrentHashMap; |
/** |
* Automatisch neu ladbare MessageResources. |
* |
* @author boeckmic |
* @since Mar 26, 2008 |
*/ |
public class ReloadablePropertyMessageResources extends PropertyMessageResources { |
private static final long serialVersionUID = 4344652868862075298L; |
private final Logger logger = Logger.getLogger(ReloadablePropertyMessageResources.class); |
/** The last time the file was checked for changes. */ |
protected long lastChecked; |
/** The minimum delay in milliseconds between checks. */ |
protected long refreshDelay = DEFAULT_REFRESH_DELAY; |
/** Constant for the default refresh delay. */ |
private static final int DEFAULT_REFRESH_DELAY = 5000; |
private final ConcurrentHashMap<String, File> fileMap = new ConcurrentHashMap<String, File>(); |
private final ConcurrentHashMap<File, Long> timestampMap = new ConcurrentHashMap<File, Long>(); |
/** |
* Konstruktor aus Superklasse. |
* |
* @param factory Factory |
* @param config Name der Konfigurationsdatei |
*/ |
public ReloadablePropertyMessageResources( |
final ReloadablePropertyMessageResourcesFactory factory, final String config) { |
super(factory, config); |
} |
/** |
* Konstruktor aus Superklasse. |
* |
* @param factory Factory |
* @param config Name der Konfigurationsdatei |
* @param returnNull Fehler werfen bei nicht vorhandenem Key? |
*/ |
public ReloadablePropertyMessageResources( |
final ReloadablePropertyMessageResourcesFactory factory, final String config, |
final boolean returnNull) { |
super(factory, config, returnNull); |
} |
/** |
* Pr�ft ob ein Reload der Properties notwendig ist. |
* |
* {@inheritDoc} |
* |
* @see org.apache.struts.util.PropertyMessageResources#getMessage(java.util.Locale, |
* java.lang.String) |
*/ |
@Override |
public String getMessage(final Locale locale, final String key) { |
reload(locale); |
if(key.startsWith("user.role.")) |
{ |
logger.debug("BACO ROLES:Getting role from UserRoleProxy" + key); |
String msg = UserRoleProxy.getMessage(key.substring("user.role.".length()),locale); |
if(msg == null) |
return key; |
return msg; |
} |
return super.getMessage(locale, key); |
} |
/** |
* Pr�ft ob ein Reload der Properties notwendig ist. |
* |
* {@inheritDoc} |
* |
* @see org.apache.struts.util.MessageResources#getMessage(java.util.Locale, java.lang.String, |
* java.lang.Object[]) |
*/ |
@Override |
public String getMessage(final Locale locale, final String key, final Object[] args) { |
reload(locale); |
if(key.startsWith("user.role.")) |
{ |
logger.debug("BACO ROLES:Getting role from UserRoleProxy" + key); |
String msg = UserRoleProxy.getMessage(key.substring("user.role.".length()),locale); |
if(msg == null) |
return key; |
return msg; |
} |
return super.getMessage(locale, key, args); |
} |
/** |
* Das Resetten der Maps f�hrt zum reload der Properties. |
* |
* @param locale Locale |
*/ |
public synchronized void reload(final Locale locale) { |
if (reloadingRequired(locale)) { |
logger.info("Reloading resources " + getFilename(locale)); |
locales.clear(); |
messages.clear(); |
formats.clear(); |
} |
} |
/** |
* Pr�ft ob es notwendig ist die Properties neu zu laden. Pr�ft nur nach Ablauf des |
* {@link #refreshDelay}, um eine �berm��ige Beanspruchung des Dateisystems zu vermeiden. |
* |
* @param locale Locale |
* @return <code>true</code> falls neu geladen werden muss |
*/ |
public boolean reloadingRequired(final Locale locale) { |
boolean reloading = false; |
long now = System.currentTimeMillis(); |
if (now > lastChecked + refreshDelay) { |
lastChecked = now; |
if (hasChanged(locale)) { |
reloading = true; |
} |
} |
return reloading; |
} |
/** |
* Pr�ft ob sich die Konfiguration seit dem letzten Aufruf ge�ndert hat. |
* |
* @param locale Locale |
* @return <code>true</code> falls sich die Datei ge�ndert hat |
*/ |
protected boolean hasChanged(final Locale locale) { |
File file = getFile(locale); |
if (file == null || !file.exists()) { |
return false; |
} |
Long timestamp = timestampMap.get(file); |
if (timestamp == null) { |
timestampMap.putIfAbsent(file, Long.valueOf(file.lastModified())); |
return false; |
} |
if (file.lastModified() > timestamp.longValue()) { |
timestampMap.put(file, Long.valueOf(file.lastModified())); |
return true; |
} |
return false; |
} |
/** |
* Gibt die Datei zur Locale zur�ck. |
* |
* @param locale Locale |
* @return (gecachte) File |
*/ |
private File getFile(final Locale locale) { |
String filename = getFilename(locale); |
File f = fileMap.get(filename); |
if (f == null) { |
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); |
if (classLoader == null) { |
classLoader = getClass().getClassLoader(); |
} |
URL fileUrl = classLoader.getResource(filename); |
// no bundle for this locale found, so try default bundle |
if (fileUrl == null) { |
fileUrl = classLoader.getResource(getFilename(null)); |
} |
try { |
f = new File(fileUrl.toURI()); |
} catch (URISyntaxException e) { |
throw new IllegalArgumentException("The properties file " |
+ fileUrl.toExternalForm() + " could not be loaded.", e); |
} |
fileMap.putIfAbsent(filename, f); |
} |
return f; |
} |
/** |
* Berechnet den Dateinamen f�r die Locale. |
* |
* @param locale Locale |
* @return Dateinamen |
*/ |
private String getFilename(final Locale locale) { |
String name = config.replace('.', '/'); |
String localeKey = ""; |
if (locale != null) { |
localeKey = locale.toString(); |
int underscore = localeKey.lastIndexOf("_"); |
if (underscore > 0) { |
localeKey = localeKey.substring(0, underscore); |
} |
} |
if (localeKey.length() > 0) { |
name = name + "_" + localeKey; |
} |
return name + ".properties"; |
} |
} |
/impl/src/java/pt/estgp/estgweb/utils/ReloadablePropertyMessageResourcesFactory.java |
---|
New file |
0,0 → 1,34 |
package pt.estgp.estgweb.utils; |
import org.apache.struts.util.MessageResources; |
import org.apache.struts.util.PropertyMessageResourcesFactory; |
/** |
* Factory f�r automatisch reloadbare Struts MessageResources. |
* |
* @author boeckmic |
* @since Mar 26, 2008 |
*/ |
public class ReloadablePropertyMessageResourcesFactory extends PropertyMessageResourcesFactory { |
private static final long serialVersionUID = -5026832102361479917L; |
/** |
* Konstruktor. |
*/ |
public ReloadablePropertyMessageResourcesFactory() { |
super(); |
setFactoryClass(this.getClass().getCanonicalName()); |
} |
/** |
* {@inheritDoc} |
* |
* @see org.apache.struts.util.PropertyMessageResourcesFactory#createResources(java.lang.String) |
*/ |
@Override |
public MessageResources createResources(final String config) { |
return new ReloadablePropertyMessageResources(this, config, this.getReturnNull()); |
} |
} |
/impl/src/java/pt/estgp/estgweb/utils/RoleManager.java |
---|
1,16 → 1,11 |
package pt.estgp.estgweb.utils; |
import pt.estgp.estgweb.domain.User; |
import jomm.utils.MessageResources; |
import pt.estgp.estgweb.domain.GenericUser; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import javax.servlet.http.HttpServletRequest; |
import java.util.List; |
import java.util.ArrayList; |
import jomm.utils.MessageResources; |
import javax.servlet.http.HttpServletRequest; |
/** |
* @author Jorge Machado |
* @date 28/Fev/2008 |
66,14 → 61,14 |
} |
public static List readRoles() |
/*public static List readRoles() |
{ |
if(roles == null) |
{ |
roles = ConfigProperties.getListValues("role."); |
} |
return roles; |
} |
}*/ |
public static String getRoleDescription(HttpServletRequest request, String role) |
{ |
82,7 → 77,7 |
public static String getSerialRoles(List<String> targetRoles) |
{ |
return StringsUtils.getSerialStrings(targetRoles,ROLE_SEPARATOR); |
return getSerialStringsForRoles(targetRoles); |
} |
public static List<String> getRolesFromSerial(String rolesStr) |
127,4 → 122,19 |
return old + ROLE_SEPARATOR + newRole; |
} |
public static String getSerialStringsForRoles(List<String> strings) |
{ |
if (strings == null) |
return null; |
String roles = null; |
for (String role : strings) |
{ |
if (roles == null) |
roles = role + ROLE_SEPARATOR; |
else |
roles += role + ROLE_SEPARATOR; |
} |
return roles; |
} |
} |
/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
148,7 → 148,8 |
public static final List<String> ANNOUNCEMENT_NOT_STANDARD = ConfigProperties.getListValues("announcements.not.standard"); |
public static boolean USE_LDAP = ConfigProperties.getBooleanProperty("use.ldap"); |
public static List<String> USER_ROLES = ConfigProperties.getListValues("user.role"); |
// passou a usar-se o UserRoleProxy |
// public static List<String> USER_ROLES = ConfigProperties.getListValues("user.role"); |
public static final String STUDENT_ROLE = ConfigProperties.getProperty("user.student"); |
public static final String TEACHER_ROLE = ConfigProperties.getProperty("user.teacher"); |
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java |
---|
134,7 → 134,7 |
} |
//else |
// message.setFrom(new InternetAddress(Globals.SYSTEM_EMAIL_BOX)); |
message.setSubject(email.getSubject() + " - não responda para este endereço"); |
message.setSubject(email.getSubject() + " - não responda para este endereço","utf-8"); |
if(email.isHtml()) |
{ |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java |
---|
48,6 → 48,7 |
int unitsRemovedToStudents = 0; |
int unitsLocalAddedNotRemoved = 0; |
int unitsLocallyRemovedNotAdded = 0; |
int unitsRepeated = 0; |
int alunosFound = 0; |
int studentsChangeBI = 0; |
int unitsAddedToStudents = 0; |
60,6 → 61,8 |
//disciplinas a vulso ESS |
Integer[] cursosFicticios = {19,4,0,22}; |
static boolean studentComUnidadesRepetidas = false; |
public ILogMessages run(String year) throws ServiceException |
{ |
75,8 → 78,11 |
studentsChangeBI = 0; |
unitsAddedToStudents = 0; |
alunosErasmusCadeirasEcontradas = 0; |
unitsRepeated = 0; |
turmaMoreThanOneRegularCourse = 0; |
String activeImportYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear(); |
String msgS = "STARTING STUDENTS IMPORT SERVICE FOR YEAR: " + year; |
124,6 → 130,7 |
User u = DaoFactory.getUserDaoImpl().loadByUsernameOrSigesCode(alunoSiges.getCodigo().intValue()); |
Student s = null; |
boolean newUser = false; |
studentComUnidadesRepetidas = false; |
if(u != null && !(u instanceof Student)) |
{ |
msgS = "Student " + u.getUsername() + " already exist in system but is not a Student is a standard USER, will merge both users"; |
169,6 → 176,8 |
if (newUser) |
CommonServicesManager.getInstance().adviseNew(s); |
if(studentComUnidadesRepetidas) |
unitsRepeated++; |
else |
{ |
219,6 → 228,7 |
serviceLogInfo("#Units removed to Students: " + unitsRemovedToStudents); |
serviceLogInfo("#Units not Removed because localy added: " + unitsLocalAddedNotRemoved); |
serviceLogInfo("#Units not Added because localy removed: " + unitsLocallyRemovedNotAdded); |
serviceLogInfo("#Alunos com Unidades repetidas: " + unitsRepeated); |
serviceLogInfo("#ERASMUS Sum Subscriptions Replaced: " + alunosErasmusCadeirasEcontradas); |
if(turmaMoreThanOneRegularCourse > 0) |
serviceLogInfo("#########!!!!!!!PROBLEMA TURMAS COM MAIS DE UM CURSO: " + turmaMoreThanOneRegularCourse); |
235,6 → 245,7 |
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("#Alunos com Unidades repetidas: " + unitsRepeated); |
logger.info("#ERASMUS Sum Subscriptions Replaced: " + alunosErasmusCadeirasEcontradas); |
if(turmaMoreThanOneRegularCourse > 0) |
logger.warn("#########!!!!!!!PROBLEMA TURMAS COM MAIS DE UM CURSO: " + turmaMoreThanOneRegularCourse); |
471,8 → 482,8 |
} |
if(!student.isPropinasEmDia()) |
{ |
serviceLogWarn("ATENTION Estudante sem propina em dia: codigo " + alunoSiges.getCodigo()); |
logger.warn("ATENTION Estudante sem propina em dia: codigo " + alunoSiges.getCodigo()); |
serviceLogInfo("ATENTION Estudante sem propina em dia: codigo " + alunoSiges.getCodigo()); |
logger.info("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 */ |
528,16 → 539,24 |
logger.info(msg); |
} |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(),"" + codigoDoCurso,disciplina.getCdDuracao(),disciplina.getCdLectivo() |
,disciplina.getCdTurma()); |
//TODO JA FOI ALTERADO PARA DAR O AVISO DEVIDO AO LEGADO DAS TURMAS |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(),"" + codigoDoCurso,disciplina.getCdDuracao(),disciplina.getCdLectivo()); |
if(courseUnits != null && courseUnits.size() > 1 ) |
{ |
studentComUnidadesRepetidas=true; |
logMessages.addMessage(new DefaultLogMessage("import.warning","Unidade Repetida: (" + disciplina.getCodigo() + ") curso: " + disciplina.getCodigoCurso() + " " + disciplina.getCdDuracao() + " " + year, "see log for details", LogMessageTypeEnum.WARNING)); |
logger.fatal(logMessages.getLastMessage()); |
serviceLogWarn(logMessages.getLastMessage()); |
} |
//CourseUnit courseUnit = null; |
//Special procedure for Aluno to check if turma not exist will find without turma code to keep old years compatibility |
if(courseUnit == null) |
/*if(courseUnit == null) |
{ |
unitsNotFoundTurma++; |
courseUnit = tryFindCourseUnitWithOutTurma(logMessages,disciplina.getCdDuracao(),""+disciplina.getCodigo().intValue() |
,"" + codigoDoCurso.intValue(),disciplina.getCdLectivo(),disciplina.getCdTurma()); |
} |
if(courseUnit == null) |
}*/ |
if(courseUnits == null || courseUnits.size() == 0) |
{ |
unitsNotFound++; |
String msg = "Unit not found (student " + student.getSigesCode() + "): semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + codigoDoCurso + " year:" + disciplina.getCdLectivo() + " turma: " + disciplina.getCdTurma(); |
545,7 → 564,7 |
logger.warn(msg); |
} |
else |
unitsFromSigesPersistentInBaco.add(courseUnit); |
unitsFromSigesPersistentInBaco.addAll(courseUnits); |
} |
//PASSO 2 - Sao retiradas da lista unitsFromSigesPersistentInBaco as que o aluno tem mas que foram removidas localmente |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/DocenteDao.java |
---|
37,9 → 37,11 |
} |
public Docente load(Integer codigo, Integer codigoInstituicao, String ano) throws SQLException { |
public Docente load(Integer codigo, Integer codigoInstituicao, String ano,Connection conn) throws SQLException { |
Connection conn = getCurrentConnection(); |
boolean closeConn = conn == null; |
if(conn == null) |
conn = getCurrentConnection(); |
//NOVO DESDE A ALTERACAO DO SIGES |
PreparedStatement catCMD = conn.prepareStatement("SELECT * FROM CSP.T_FUNCIONARIOS INNER JOIN SIGES.T_INDIVIDUO on SIGES.T_INDIVIDUO.ID_INDIVIDUO = CSP.T_FUNCIONARIOS.ID_INDIVIDUO where " + getIdColumn() + "=" + codigo); |
49,12 → 51,14 |
c.disciplinas = loadDisciplinasDosDocentes(codigo, codigoInstituicao, ano); |
catCMD.close(); |
aReader.close(); |
conn.close(); |
if(closeConn) |
conn.close(); |
return c; |
} |
aReader.close(); |
catCMD.close(); |
conn.close(); |
if(closeConn) |
conn.close(); |
//close the reader |
return null; |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/oracle/dao/AulaDao.java |
---|
113,12 → 113,13 |
} |
public ArrayList<Aula> loadAulas(Integer codigoInstituicao, String anolectivo, String codigoUnidade, String semestre, String codigoCurso) throws SQLException { |
public ArrayList<Aula> loadAulas(Integer codigoInstituicao, String anolectivo, String codigoUnidade, String semestre, String codigoCurso, Connection conn) throws SQLException { |
Integer limiteSalaInferior = codigoInstituicao * 1000; |
Integer limiteSalaSuperior = (codigoInstituicao + 1) * 1000; |
boolean closeConnection = conn == null; |
ArrayList<Aula> aulas = new ArrayList<Aula>(); |
Connection conn = getCurrentConnection(); |
if(conn == null) |
conn = getCurrentConnection(); |
String query; |
query = "SELECT " |
+ "CSH.T_OCUPACOES.DT_OCUPACAO AS DT_OCUPACAO," |
203,7 → 204,8 |
//close the reader |
aReader.close(); |
catCMD.close(); |
conn.close(); |
if(closeConnection) |
conn.close(); |
return aulas; |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java |
---|
16,12 → 16,14 |
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessage; |
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessages; |
import pt.estgp.estgweb.services.sigesimports.oracle.dao.DocenteDao; |
import pt.estgp.estgweb.services.sigesimports.oracle.dao.connection.ConnectionManager; |
import pt.estgp.estgweb.services.sigesimports.oracle.domain.Disciplina; |
import pt.estgp.estgweb.services.sigesimports.oracle.domain.Docente; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.utils.Email; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import java.sql.Connection; |
import java.util.*; |
/** |
99,6 → 101,7 |
List<Integer> codigosDocentes = DocenteDao.getInstance().loadCodigosDocentes(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode(), year); |
// List<BigDecimal> codigos = codigosDocentes.getDecimal(); |
Connection conn = ConnectionManager.openConnection(); |
int i = 1; |
for (Integer c : codigosDocentes) |
{ |
114,7 → 117,7 |
logger.info("Starting import Funcionario: SIGES:" + c); |
//Docente d = service.getSiGesWEBSoap().getDocente(c, new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year); |
Docente d = DocenteDao.getInstance().load(c, DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode(), year); |
Docente d = DocenteDao.getInstance().load(c, DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode(), year,conn); |
logger.info("Codigo Funcionario Importado: SIGES(" + d.getCodigoFuncionario().intValue() + ") email IPP SIGES: " + d.getEmail()); |
serviceLogInfo("Codigo Funcionario Importado: SIGES(" + d.getCodigoFuncionario().intValue() + ") email IPP SIGES: " + d.getEmail()); |
logger.info("SIGES IMPORTED INFO: " + docenteToString(d)); |
160,6 → 163,7 |
t.setPassword(password); |
} |
} |
conn.close(); |
} |
catch(StaleStateException e) |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportCourseService.java |
---|
2,10 → 2,10 |
import jomm.dao.impl.AbstractDao; |
import org.apache.log4j.Logger; |
import org.hibernate.NonUniqueResultException; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.domain.Course; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.CourseUnitImpl; |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.domain.views.CourseView; |
19,7 → 19,9 |
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.*; |
import pt.ipportalegre.siges.web.services.ArrayOfDisciplina; |
import pt.ipportalegre.siges.web.services.Disciplina; |
import pt.ipportalegre.siges.web.services.SiGesWEB; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import javax.xml.namespace.QName; |
39,6 → 41,7 |
int newUnits = 0; |
int newCourses = 0; |
int unitsRepeated = 0; |
public ILogMessages run(String year) throws ServiceException |
{ |
String msgS = "STARTING COURSES IMPORT SERVICE FOR YEAR: " + year; |
47,6 → 50,7 |
newUnits = 0; |
newCourses = 0; |
unitsRepeated = 0; |
DefaultLogMessages logMessages = new DefaultLogMessages(); |
try |
146,6 → 150,7 |
serviceLogInfo("#Units Imported T4:" + disciplinasMapT4.size()); |
serviceLogInfo("#New Courses Found:" + newCourses); |
serviceLogInfo("#New Units Found:" + newUnits); |
serviceLogInfo("#Unidades Repetidas:" + unitsRepeated); |
logger.info("######################################"); |
logger.info("######################################"); |
159,6 → 164,7 |
logger.info("#Units Imported T4:" + disciplinasMapT4.size()); |
logger.info("#New Courses Found:" + newCourses); |
logger.info("#New Units Found:" + newUnits); |
logger.info("#Unidades Repetidas:" + unitsRepeated); |
} |
259,65 → 265,45 |
continue; |
} |
CourseUnit c; |
try{ |
c = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + d.getCodigo(), "" + d.getCodigoCurso(), semestre, year, d.getCdTurma()); |
}catch(NonUniqueResultException e) |
//CourseUnit c = null; |
List<CourseUnit> cus = null; |
cus= DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + d.getCodigo(), "" + d.getCodigoCurso(), semestre, year); |
if(cus != null && cus.size() > 1 ) |
{ |
logMessages.addMessage(new DefaultLogMessage("import.error","Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year, "see log for details", LogMessageTypeEnum.ERROR)); |
unitsRepeated++; |
logMessages.addMessage(new DefaultLogMessage("import.warning","Unidade Repetida: (" + d.getCodigo() + ") curso: " + d.getCodigoCurso() + " " + semestre + " " + year, "see log for details, vai atualizar as duas", LogMessageTypeEnum.WARNING)); |
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) |
if (cus == null || cus.size() == 0) |
{ |
c = DomainObjectFactory.createCourseUnitImpl(); |
CourseUnitImpl c = DomainObjectFactory.createCourseUnitImpl(); |
DaoFactory.getCourseUnitDaoImpl().save(c); |
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++; |
cus = new ArrayList<CourseUnit>(); |
cus.add(c); |
} |
//NOVO |
c.setCdTurma("" + d.getCdTurma()); |
//FIM NOVO |
c.setName(d.getNome()); |
c.setInstitutionCode("" + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()); |
c.setCode("" + d.getCodigo().intValue()); |
c.setCourseCode("" + d.getCodigoCurso()); |
c.setCourseName("" + d.getNomeCurso()); |
c.setSemestre(semestre); |
c.setImportYear(year); |
Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(c.getCourseCode()); |
c.setCourse(course); |
for(CourseUnit c: cus) |
{ |
//todo deixa de atualizar c.setCdTurma("" + d.getCdTurma()); |
c.setName(d.getNome()); |
c.setInstitutionCode("" + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()); |
c.setCode("" + d.getCodigo().intValue()); |
c.setCourseCode("" + d.getCodigoCurso()); |
c.setCourseName("" + d.getNomeCurso()); |
c.setSemestre(semestre); |
c.setImportYear(year); |
Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(c.getCourseCode()); |
c.setCourse(course); |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumariesJson.java |
---|
26,6 → 26,7 |
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.services.sigesimports.oracle.dao.connection.ConnectionManager; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import pt.estgp.estgweb.web.FtpServer; |
import pt.ipportalegre.siges.web.services.SiGesWEB; |
39,6 → 40,7 |
import java.io.FileOutputStream; |
import java.io.IOException; |
import java.net.URL; |
import java.sql.Connection; |
import java.util.ArrayList; |
import java.util.HashMap; |
import java.util.List; |
104,8 → 106,12 |
//List<Long> cUs = DaoFactory.getCourseUnitDaoImpl().loadIds(year,DatesUtils.getSemestre()); |
List<Long> cUs = DaoFactory.getCourseUnitDaoImpl().loadIds(year,semestre); |
String nowCode = ""; |
Connection conn = ConnectionManager.openConnection(); |
boolean connError = false; |
for(Long cId: cUs) |
{ |
if(connError) |
break; |
nowCode = "" + cId; |
countUnits++; |
try |
130,8 → 136,10 |
//comentario de teste |
try |
{ |
//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()); |
arrayOfAulas = AulaDao.getInstance().loadAulas(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode(),year,c.getCode(),semestre,c.getCourse().getCode(),conn); |
break; |
} |
catch(Throwable t) |
140,11 → 148,12 |
{ |
logger.error("Giving up of courseUnit:" + cId + " ( " + c.getName() + " ) ",t); |
serviceLogError("Giving up of courseUnit:" + cId + " ( " + c.getName() + " ) ",t); |
connError = true; |
break; |
} |
logger.error("WebService Fail, trying " + tries + " times sleeping a while"); |
logger.error("WebService Fail, trying " + tries + " times sleeping a while",t); |
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); |
237,7 → 246,12 |
{ |
String path = generatePdf(c); |
sendPdfFtpIonline(c,new ArrayList<String>(),null,path,null); |
FilesUtils.delete(path); |
try{ |
FilesUtils.delete(path); |
}catch(Throwable e) |
{ |
logger.error("trying to delete " + path,e); |
} |
} |
if(sendEMAIL) |
{ |
261,6 → 275,7 |
serviceLogError(e.toString(),e); |
} |
} |
conn.close(); |
setProgress(100); |
serviceLogError("Finish commiting"); |
/impl/src/java/pt/estgp/estgweb/services/users/UserRoleConfigService.java |
---|
New file |
0,0 → 1,203 |
package pt.estgp.estgweb.services.users; |
import org.apache.log4j.Logger; |
import org.hibernate.ObjectNotFoundException; |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.UserRoleConfig; |
import pt.estgp.estgweb.domain.UserRoleConfigImpl; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import java.io.BufferedReader; |
import java.io.IOException; |
import java.io.StringReader; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 29/01/16. |
*/ |
public class UserRoleConfigService implements IService |
{ |
private static final Logger logger = Logger.getLogger(UserRoleConfigService.class); |
private List<UserRoleConfig> loadRolesTranslations(UserSession sess) |
{ |
List<UserRoleConfig> roles = DaoFactory.getUserRoleConfigDaoImpl().findAll(); |
if(roles == null || roles.size() == 0) |
{ |
roles = initRoles(); |
} |
return roles; |
} |
private static long lastUpdate = 0; |
public List<UserRoleConfig> loadRolesIfDirty(UserSession sess) |
{ |
if(lastUpdate == 0) |
{ |
return loadRolesTranslations(sess); |
} |
UserRoleConfig lastChangeRole = DaoFactory.getUserRoleConfigDaoImpl().getLast("updateDate"); |
if(lastChangeRole.getUpdateDate().getTime() >= lastUpdate) |
{ |
List<UserRoleConfig> roles = loadRolesTranslations(sess); |
lastUpdate = System.currentTimeMillis(); |
return roles; |
} |
return null; |
} |
public void addUpdateRole(UserRoleConfigImpl userRoleConfig, UserSession sess) |
{ |
try |
{ |
UserRoleConfig roleConfig; |
if(userRoleConfig.getId() > 0) |
roleConfig = DaoFactory.getUserRoleConfigDaoImpl().load(userRoleConfig.getId()); |
else |
{ |
roleConfig = DomainObjectFactory.createUserRoleConfigImpl(); |
DaoFactory.getUserRoleConfigDaoImpl().save(roleConfig); |
} |
if(sess.getUser().isSuperuser()) |
{ |
roleConfig.setRole(userRoleConfig.getRole().trim()); |
} |
roleConfig.setValue(userRoleConfig.getValue()); |
roleConfig.setValid(userRoleConfig.isValid()); |
roleConfig.setValueEn(userRoleConfig.getValueEn()); |
roleConfig.setValueEn(userRoleConfig.getValueEs()); |
roleConfig.setValueEn(userRoleConfig.getValueFr()); |
roleConfig.setValueEn(userRoleConfig.getValuePt()); |
roleConfig.setObs(userRoleConfig.getObs()); |
} |
catch(ObjectNotFoundException o) |
{ |
DaoFactory.getUserRoleConfigDaoImpl().save(userRoleConfig); |
} |
} |
public List<UserRoleConfig> addUpdateDirtRolesTranslation(List<UserRoleConfigImpl> userRoleConfigs, UserSession sess) |
{ |
for(UserRoleConfigImpl userRoleConfig: userRoleConfigs) |
{ |
if(userRoleConfig.isDirty()) |
addUpdateRole(userRoleConfig,sess); |
} |
return loadRolesTranslations(sess); |
} |
private List<UserRoleConfig> initRoles() |
{ |
List<UserRoleConfig> roles = new ArrayList<UserRoleConfig>(); |
BufferedReader reader = new BufferedReader(new StringReader(INIT_ROLES)); |
String roleSpec = null; |
try { |
while((roleSpec = reader.readLine()) != null) |
{ |
String[] fields = roleSpec.split("="); |
String role = fields[0].substring("user.role.".length()); |
String desc = fields[1]; |
UserRoleConfigImpl userRoleConfig = DomainObjectFactory.createUserRoleConfigImpl(); |
userRoleConfig.setRole(role.trim()); |
userRoleConfig.setValue(desc); |
userRoleConfig.setValid(true); |
roles.add(userRoleConfig); |
DaoFactory.getUserRoleConfigDaoImpl().save(userRoleConfig); |
} |
} catch (IOException e) { |
logger.error(e,e); |
} |
return roles; |
} |
private static final String INIT_ROLES = "user.role.all=Todos\n" + |
"user.role.admin=Administrador\n" + |
"user.role.student=Estudante\n" + |
"user.role.erasmusStudent=Estudante de Erasmus\n" + |
"user.role.teacher=Professor\n" + |
"user.role.teacher.eg=Professor da Área de Engenharia\n" + |
"user.role.teacher.dg=Professor da Área de Design\n" + |
"user.role.teacher.ce=Professor da Área de Ciencias Empresariais\n" + |
"user.role.teacher.ch=Professor da Área de Ciencias Humanas\n" + |
"user.role.teacher.td=Professor do DTD\n" + |
"user.role.teacher.cesh=Professor do DCESH\n" + |
"user.role.student.eg=Aluno da Área de Engenharia\n" + |
"user.role.student.dg=Aluno da Área de Design\n" + |
"user.role.student.ce=Aluno da Área de Ciencias Empresariais\n" + |
"user.role.student.ch=Aluno da Área de Ciencias Humanas\n" + |
"user.role.student.td=Aluno do DTD\n" + |
"user.role.student.cesh=Aluno do DCESH\n" + |
"user.role.ci=Centro Informático\n" + |
"user.role.worker=Funcionário\n" + |
"user.role.invited=Convidado\n" + |
"user.role.services=Serviços\n" + |
"user.role.servicesPrograms=Gestão de Programas Curriculares\n" + |
"user.role.administrativeCouncil=Membro da Direcção\n" + |
"user.role.administrativeCouncil.director=Director\n" + |
"user.role.administrativeCouncil.vice=Vice Director\n" + |
"user.role.schoolSecretary=Secretário da Escola\n" + |
"user.role.administrativeCouncilSecretariat=Secretaria da Direcção\n" + |
"user.role.teachersSecretariat=Secretaria de Pessoal Docente\n" + |
"user.role.dtd.president=Presidente do DTD\n" + |
"user.role.cesh.president=Presidente do DCESH\n" + |
"user.role.dtd.presidency=Membro da Presidencia do DTD\n" + |
"user.role.cesh.presidency=Membro da Presidencia do DCESH\n" + |
"user.role.scientificCouncil.president=Presidente do Conselho Científico\n" + |
"user.role.representativeCouncil.president=Presidente do Conselho de Representantes\n" + |
"user.role.pedagogicCouncil.president=Presidente do Conselho Pedagógico\n" + |
"user.role.representativeCouncil=Conselho de Representantes\n" + |
"user.role.scientificCouncil=Conselho Científico\n" + |
"user.role.erasmusCouncil=Conselho Erasmus\n" + |
"user.role.pedagogicCouncil=Conselho Pedagógico\n" + |
"user.role.courseCoordinator=Coordenadores\n" + |
"user.role.futureStudent=Futuros Alunos\n" + |
"user.role.oldStudent=Antigos Alunos\n" + |
"user.role.studentAssociation=Associação de Estudantes\n" + |
"user.role.computerCenter=Centro Informático\n" + |
"user.role.courseDirector=Presidente de Departamento\n" + |
"user.role.identifiersManager=Utilizador de Gestão de Identificadores\n" + |
"user.role.identifiersCollectionCreator=Administrador de Colecções de Identificadores\n" + |
"user.role.studentsID=Alunos de Informação e Documentação\n" + |
"user.role.studentsFSIR=Alunos de Fontes de Informação e Serviço de Referência\n" + |
"user.role.sendMailMessages=Enviar Mensagens de Correio Electronico\n" + |
"user.role.pedagogicCouncilSecretariat=Secretariado do Conselho Pedagógico\n" + |
"user.role.directionSecretariat=Secretariado da Direcção\n" + |
"user.role.studentsSecretariat=Secretaria de Alunos\n" + |
"user.role.assessementsTester=Testador de Provas de Avaliação\n" + |
"user.role.processes.admin=Inspector de Processos" + |
"user.role.validate.ei=Comissão de Curso de Engenharia Informática\n" + |
"user.role.courseValidateProgramGPME=Comissão de Curso de Gestão de PME\n" + |
"user.role.courseValidateProgramCET_TD=Comissão de Curso de CETS de TD\n" + |
"user.role.courseValidateProgramEI=Comissão de Curso de EI\n" + |
"user.role.courseValidateProgramEC=Comissão de Curso de EC\n" + |
"user.role.courseValidateProgramBioEng=Comissão de Curso de BioEng\n" + |
"user.role.courseValidateProgramEGI=Comissão de Curso de EGI\n" + |
"user.role.courseValidateProgramEERA=Comissão de Curso de EERA\n" + |
"user.role.courseValidateProgramDC=Comissão de Curso de DC\n" + |
"user.role.courseValidateProgramDA=Comissão de Curso de DA\n" + |
"user.role.courseValidateProgramTVAPE=Comissão de Curso de TVAPE\n" + |
"user.role.courseValidateProgramMI=Comissão de Curso de MI\n" + |
"user.role.courseValidateProgramEGPMEestranho=Comissão de Curso de EPGME\n" + |
"user.role.courseValidatePrograms=Validação de Programas\n" + |
"user.role.courseValidateProgramCET_CESH=Comissão de Curso de CETS de CESH\n" + |
"user.role.courseValidateProgramAPM=Comissão de Curso de APM\n" + |
"user.role.courseValidateProgramAA=Comissão de Curso de AA\n" + |
"user.role.courseValidateProgramG=Comissão de Curso de G\n" + |
"user.role.courseValidateProgramID=Comissão de Curso de ID\n" + |
"user.role.courseValidateProgramRPS=Comissão de Curso de RPS\n" + |
"user.role.courseValidateProgramTGI=Comissão de Curso de TGI\n" + |
"user.role.courseValidateProgramRU=Comissão de Curso de RU\n" + |
"user.role.courseValidateProgramCF=Comissão de Curso de Contabilidade e Finanças\n" + |
"user.role.courseValidateProgramTPB=Comissão de Curso de Tecnologias de Produção de Biocombustíveis\n"; |
} |
/impl/src/java/pt/estgp/estgweb/domain/UserRoleConfigImpl.java |
---|
New file |
0,0 → 1,33 |
package pt.estgp.estgweb.domain; |
import java.io.Serializable; |
/** |
* Created by jorgemachado on 29/01/16. |
*/ |
public class UserRoleConfigImpl extends UserRoleConfig { |
@Override |
public Serializable getSerializable() { |
return getId(); |
} |
//Campos auziliares para os formularios |
private boolean dirty = false; |
private int posForId = -1; |
public boolean isDirty() { |
return dirty; |
} |
public void setDirty(boolean dirty) { |
this.dirty = dirty; |
} |
public int getPosForId() { |
return posForId; |
} |
public void setPosForId(int posForId) { |
this.posForId = posForId; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java |
---|
357,4 → 357,9 |
{ |
return new ConfigurationDirectoryImpl(); |
} |
public static UserRoleConfigImpl createUserRoleConfigImpl() |
{ |
return new UserRoleConfigImpl(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/ConfigurationDaoImpl.java |
---|
34,7 → 34,7 |
Configuration configuration = new ConfigurationImpl(); |
configuration.setInterfaceImportYear("201516"); |
configuration.setImportsDefaultImportYear("201516"); |
configuration.setImportsDefaultImportYear("http://172.20.100.5:8080/SigesWeb/SiGesWEB.asmx?wsdl"); |
configuration.setSigesWebServicesWsdl("http://172.20.100.5:8080/SigesWeb/SiGesWEB.asmx?wsdl"); |
configuration.setCourseUnitEvaluationActiveYear("201415"); |
configuration.setSaveDate(new Date()); |
configuration.setSigesInstitutionCode(1); |
61,13 → 61,7 |
public Configuration loadSimpleConfigurationForConsult() |
{ |
List<Configuration> configs = createCriteria().list(); |
if(configs.size() == 0) |
{ |
return null; |
} |
else |
return configs.get(0); |
return load(); |
} |
public void updateInterfaceImportYearCreateTransaction(String importYear) |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserRoleConfigDaoImpl.java |
---|
New file |
0,0 → 1,23 |
package pt.estgp.estgweb.domain.dao.impl; |
import org.apache.log4j.Logger; |
/** |
* 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 UserRoleConfigDaoImpl extends UserRoleConfigDao{ |
private static final Logger logger = Logger.getLogger(UserRoleConfigDaoImpl.class); |
protected static UserRoleConfigDaoImpl myInstance = null; |
public static UserRoleConfigDaoImpl getInstance() { |
if (myInstance == null || !(myInstance instanceof UserRoleConfigDaoImpl)) |
myInstance = new UserRoleConfigDaoImpl(); |
return myInstance; |
} |
} |
Property changes: |
Added: svn:executable |
+ * |
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java |
---|
344,6 → 344,9 |
} |
public static UserRoleConfigDaoImpl getUserRoleConfigDaoImpl(){ |
return UserRoleConfigDaoImpl.getInstance(); |
} |
/impl/src/java/pt/estgp/estgweb/domain/ConfigurationImpl.java |
---|
11,6 → 11,13 |
public class ConfigurationImpl extends Configuration |
{ |
@Override |
public String getSigesWebServicesWsdl() { |
if(super.getSigesWebServicesWsdl() == null) |
super.setSigesWebServicesWsdl("http://172.20.100.5:8080/SigesWeb/SiGesWEB.asmx?wsdl"); |
return super.getSigesWebServicesWsdl(); |
} |
public Serializable getSerializable() |
{ |
return getId(); |
/impl/src/java/pt/estgp/estgweb/web/DirLayoutController.java |
---|
500,7 → 500,7 |
if (rightsT.rightsTClass == RightsT.RightsTClass.user && userSession.getUsername() != null && userSession.getUsername().equals(rightsT.text)) |
return false; |
else |
if (rightsT.rightsTClass == RightsT.RightsTClass.role && userSession.getUsername() != null && userSession.getUser().hasRole(rightsT.text)) |
if (rightsT.rightsTClass == RightsT.RightsTClass.role && userSession.getUsername() != null && userSession.getUser() != null && userSession.getUser().hasRole(rightsT.text)) |
return false; |
} |
else |
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java |
---|
179,6 → 179,7 |
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); |
request.setAttribute("NavPlaces",navPlaces); |
/impl/src/java/pt/estgp/estgweb/web/form/AddRolesForm.java |
---|
1,6 → 1,7 |
package pt.estgp.estgweb.web.form; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.web.filters.UserRoleProxy; |
import java.util.List; |
15,7 → 16,7 |
public static final String TARGET_ROLES_KEY = "targetRoles"; |
protected String role; |
protected static List<String> targetRoles = Globals.USER_ROLES; |
protected List<String> selectedRoles; |
protected String targetRolesStr = Globals.ALL_ROLE; |
30,7 → 31,7 |
public List<String> getTargetRoles() { |
return targetRoles; |
return UserRoleProxy.getUserRoles(); |
} |
public void setTargetRoles(List<String> roles) |
/impl/src/java/pt/estgp/estgweb/web/form/configuration/ConfigurationUserRolesForm.java |
---|
New file |
0,0 → 1,118 |
package pt.estgp.estgweb.web.form.configuration; |
import org.apache.struts.action.ActionErrors; |
import pt.estgp.estgweb.domain.UserRoleConfig; |
import pt.estgp.estgweb.domain.UserRoleConfigImpl; |
import pt.estgp.estgweb.utils.DynamicArrayList; |
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 ConfigurationUserRolesForm extends ApplicationForm |
{ |
private String dispatch; |
private long id; |
List<UserRoleConfig> userRoleConfigs = null; |
public ConfigurationUserRolesForm() |
{ |
} |
public boolean isUserRolesConfigEmpty() |
{ |
return userRoleConfigs == null || userRoleConfigs.size() == 0; |
} |
public List<UserRoleConfig> getUserRolesConfig() { |
if(userRoleConfigs == null) |
{ |
userRoleConfigs = new DynamicArrayList<UserRoleConfig>(UserRoleConfigImpl.class); |
} |
return userRoleConfigs; |
} |
public String getOp() { |
return dispatch; |
} |
public void setOp(String dispatch) { |
this.dispatch = dispatch; |
} |
public void setUserRoleConfigs(List<UserRoleConfig> userRoleConfigs) { |
this.userRoleConfigs = userRoleConfigs; |
} |
public long getId() { |
return id; |
} |
public void setId(long id) { |
this.id = id; |
} |
public ActionErrors validate(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest) |
{ |
ActionErrors errors = new ActionErrors(); |
if(dispatch.equals("saveUserRole")) |
{ |
long idPosChoosed = getId(); |
for(UserRoleConfig u : getUserRolesConfig()) |
{ |
UserRoleConfigImpl ur = (UserRoleConfigImpl) u; |
if(ur.getPosForId() == idPosChoosed) |
{ |
validateRole(errors,httpServletRequest,ur); |
break; |
} |
} |
} |
else if(dispatch.equals("saveAllDirty")) |
{ |
for(UserRoleConfig u : getUserRolesConfig()) |
{ |
UserRoleConfigImpl ur = (UserRoleConfigImpl) u; |
if(ur.isDirty()) |
{ |
validateRole(errors,httpServletRequest,ur); |
} |
} |
} |
return errors; |
} |
private void validateRole(ActionErrors errors,javax.servlet.http.HttpServletRequest httpServletRequest,UserRoleConfigImpl userRoleConfig) |
{ |
userRoleConfig.setRole(userRoleConfig.getRole().trim()); |
if(userRoleConfig.getRole().trim().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","role"); |
} |
if(userRoleConfig.getValue().trim().length() == 0) |
{ |
addMessage(errors, httpServletRequest, "role.value.default.required",userRoleConfig.getRole()); |
} |
for(UserRoleConfig u : getUserRolesConfig()) |
{ |
UserRoleConfigImpl ur = (UserRoleConfigImpl) u; |
if(ur.getPosForId() != userRoleConfig.getPosForId()) |
{ |
if(ur.getRole().trim().equals(userRoleConfig.getRole().trim())) |
{ |
addMessage(errors, httpServletRequest, "role.value.key.repeated",userRoleConfig.getRole()); |
break; |
} |
} |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java |
---|
343,7 → 343,7 |
return uV; |
} |
public UserView loadUserWithRecordsCode(int code, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException |
public UserView loadUserWithRecordsCode(int code, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/UserRolesController.java |
---|
New file |
0,0 → 1,134 |
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.DomainObjectFactory; |
import pt.estgp.estgweb.domain.UserRoleConfig; |
import pt.estgp.estgweb.domain.UserRoleConfigImpl; |
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController; |
import pt.estgp.estgweb.web.filters.UserRoleProxy; |
import pt.estgp.estgweb.web.form.configuration.ConfigurationUserRolesForm; |
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 UserRolesController extends ApplicationDispatchController |
{ |
private static final Logger logger = Logger.getLogger(UserRolesController.class); |
public ActionForward addNew(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws ServletException |
{ |
UserRoleConfigImpl role = DomainObjectFactory.createUserRoleConfigImpl(); |
role.setDirty(true); |
ConfigurationUserRolesForm f = (ConfigurationUserRolesForm) form; |
f.getUserRolesConfig().add(0,role); |
return mapping.findForward("userRoles"); |
} |
public ActionForward saveAllDirty(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable { |
ConfigurationUserRolesForm f = (ConfigurationUserRolesForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new Object[]{ |
f.getUserRolesConfig() |
}; |
try |
{ |
sm.execute(RequestUtils.getRequester(request, response), "AddUpdateDirtyRolesTranslation", args, names); |
UserRoleProxy.setDirty(); |
f.setUserRoleConfigs(null); |
addMessage(request, "configuration.roles.saved"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
return mapping.findForward("userRoles"); |
} |
public ActionForward saveUserRole(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable { |
ConfigurationUserRolesForm f = (ConfigurationUserRolesForm) form; |
UserRoleConfig userRoleConfig = null; |
long idPosChoosed = f.getId(); |
for(UserRoleConfig u : f.getUserRolesConfig()) |
{ |
UserRoleConfigImpl ur = (UserRoleConfigImpl) u; |
if(ur.getPosForId() == idPosChoosed) |
{ |
userRoleConfig = ur; |
break; |
} |
} |
if(userRoleConfig == null) |
return mapping.findForward("userRoles"); |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new Object[]{ |
userRoleConfig |
}; |
try |
{ |
sm.execute(RequestUtils.getRequester(request, response), "AddUpdateRoleTranslation", args, names); |
UserRoleConfigImpl ur = (UserRoleConfigImpl) userRoleConfig; |
ur.setDirty(false); |
UserRoleProxy.setDirty(); |
//f.setUserRoleConfigs(null); |
addMessage(request, "configuration.role.saved",ur.getValue()); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
return mapping.findForward("userRoles"); |
} |
} |
Property changes: |
Added: svn:executable |
+ * |
/impl/src/java/pt/estgp/estgweb/web/filters/UserRoleProxy.java |
---|
New file |
0,0 → 1,151 |
package pt.estgp.estgweb.web.filters; |
import org.apache.log4j.Logger; |
import pt.estgp.estgweb.domain.UserRoleConfig; |
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.*; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import java.io.IOException; |
import java.util.*; |
/** |
* |
* @author Jorge Machado |
*/ |
public class UserRoleProxy implements Filter |
{ |
private static Logger logger = Logger.getLogger(UserRoleProxy.class); |
static Map<String,UserRoleConfig> userRoleConfigs = new HashMap<String,UserRoleConfig>(); |
public static List<UserRoleConfig> getUserRoleConfigs() |
{ |
List<UserRoleConfig> roles = new ArrayList<UserRoleConfig>(userRoleConfigs.values()); |
Collections.sort(roles,new Comparator<UserRoleConfig>() { |
@Override |
public int compare(UserRoleConfig userRoleConfig, UserRoleConfig userRoleConfig2) { |
return userRoleConfig.getValue().compareTo(userRoleConfig2.getValue()); |
} |
}); |
return roles; |
} |
/** |
* Olny return valid roles for choose by user in application |
* @return a list of strings keys |
*/ |
public static List<String> getUserRoles() |
{ |
List<UserRoleConfig> roles = new ArrayList<UserRoleConfig>(userRoleConfigs.values()); |
Collections.sort(roles,new Comparator<UserRoleConfig>() { |
@Override |
public int compare(UserRoleConfig userRoleConfig, UserRoleConfig userRoleConfig2) { |
return userRoleConfig.getValue().compareTo(userRoleConfig2.getValue()); |
} |
}); |
List<String> rolesStr = new ArrayList<String>(); |
for(UserRoleConfig r: roles) |
if(r.isValid()) |
rolesStr.add(r.getRole()); |
return rolesStr; |
} |
public UserRoleProxy() |
{ |
} |
public static void setDirty() |
{ |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
Object[] args = new Object[]{}; |
List<UserRoleConfig> userRoleConfigsList = (List<UserRoleConfig>) sm.execute("system", "LoadRoleTranslationsIfDirty", args); |
if(userRoleConfigsList != null && userRoleConfigsList.size() > 0) |
{ |
userRoleConfigs.clear(); |
for(UserRoleConfig c: userRoleConfigsList) |
{ |
userRoleConfigs.put(c.getRole(),c); |
} |
} |
} |
catch (Throwable e) |
{ |
logger.fatal("INIT FILTER SESSION FILTER CALLING FIRST SERVICE TO OPEN CONNECTIONS IN HIBERNATE" + e,e); |
} |
} |
public void init(FilterConfig config) |
{ |
setDirty(); |
} |
/** |
* |
* @param request The servlet request we are processing |
* @param chain The filter chain we are processing |
* |
* @exception java.io.IOException if an input/output error occurs |
* @exception javax.servlet.ServletException if a servlet error occurs |
*/ |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
throws IOException, ServletException |
{ |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
Object[] args = new Object[]{}; |
List<UserRoleConfig> userRoleConfigsNow = (List<UserRoleConfig>) sm.execute(RequestUtils.getRequester((HttpServletRequest)request,(HttpServletResponse)response), "LoadRoleTranslationsIfDirty", args); |
if(userRoleConfigsNow != null) |
{ |
for(UserRoleConfig c: userRoleConfigsNow) |
{ |
userRoleConfigs.put(c.getRole(),c); |
} |
} |
} |
catch (Throwable e) |
{ |
logger.fatal("INIT FILTER USER ROLE FILTER CALLING FIRST SERVICE TO OPEN CONNECTIONS IN HIBERNATE" + e,e); |
} |
chain.doFilter(request,response); |
} |
public static String getMessage(String role,Locale locale) |
{ |
UserRoleConfig c = userRoleConfigs.get(role); |
if(locale == null) |
return c.getValue(); |
String msg = null; |
if(locale.getCountry().equals("pt")) |
msg = c.getValuePt(); |
else if(locale.getCountry().equals("en")) |
msg = c.getValueEn(); |
else if(locale.getCountry().equals("es")) |
msg = c.getValueEs(); |
else if(locale.getCountry().equals("fr")) |
msg = c.getValueFr(); |
if(msg == null || msg.trim().length() == 0) |
msg = c.getValue(); |
if(msg == null || msg.trim().length() == 0) |
return role; |
return msg; |
} |
public void destroy() |
{ |
// Nothing |
} |
} |