/impl/conf/language/MessageResourcesEmail.properties |
---|
5,11 → 5,13 |
################################################################################ |
module.Email=Serviço de Email |
pop.no.messages=Não tem mensagens na sua caixa de correio |
pop.title=Últimas mensagens de Email<br>Ir para <a target="_blank" href="http://mail.estgp.pt/exchange/{0}">WEBMAIL</a> |
pop.title=Ir para <a target="_blank" href="http://mail.estgp.pt/exchange/{0}">WEBMAIL</a> |
pop.last.messages=Últimas mensagens de Email |
pop.text=Mensagem |
pop.from=De |
pop.to=Para |
pop.subject=Assunto |
pop.loading=Carregando mensagens de Email... |
pop.date=Recebido |
pop.not.configured=O Seu servidor de Email não está configurado |
pop.not.configured=A caixa POP do seu servidor de Email não está configurado. A sigla POP refere-se ao protocolo de leitura de mensagens em servidores de email externos. Por favor configure o seu servidor de POP nos seus dados de perfil<br>(exemplo na ESTG:<br> pop = mail.estgp.pt) |
pop.danger.messages=Existem mensagens na sua caixa de correio da escola que estão incorrectamente formatadas e que podem prejudicar a vizualização deste sítio. Por favor remova-as da sua caixa para que as restantes possam ser aqui apresentadas. |
/impl/conf/language/MessageResourcesCourse.properties |
---|
9,6 → 9,7 |
course.submit.new=Novo Curso |
course.updated.success=Curso {0} actualizado com sucesso |
course.created.success=Curso {0} criado com sucesso |
course.exists=O Curso já existe com esse código e ano |
course.select=Escolha Curso |
course.select.message=Por favor selecione o curso que deseja editar |
/impl/conf/language/MessageResourcesSruSources.properties |
---|
New file |
0,0 → 1,29 |
################################################################################ |
# |
# SRU SOURCES MESSAGE RESOURCES |
# |
################################################################################ |
module.SruSource=Pastas Partilhadas do Donald |
srusource=Fontes de Pesquisa SRU (Search and Retrieve via URL) |
srusource.create.srusource=Nova fonte SRU |
srusource.name=Nome |
srusource.zero.collections=De momento não existem colecções atribuidas |
srusource.new.collection=Adicione colecção usando este formulário |
srusource.admited.roles=Papeis Admitidos |
srusource.description=Descrição |
srusource.url=URL |
srusource.collection=Colecção de Pesquisa |
srusource.collections=Colecções |
srusource.metadataSchema=Esquema de Metadados |
srusource.metadataSchema.files=Pastas Partilhadas ESTG |
srusource.collection.add=Adicionar Collecção |
srusource.collectionField=Indice da Colecção No SRU (se não souber coloque: collection) |
srusource.create.new=Criar nova fonte SRU |
srusource.created.success=Fonte SRU criada com sucesso |
srusource.edited.success=Fonte SRU editada com sucesso |
/impl/conf/language/MessageResources.properties |
---|
308,7 → 308,7 |
#Mensagens Status |
authentication.ok=Benvindo Fulano |
logout.ok=Caro {0}, obrigado por usar o nosso serviço. |
logout.ok=Caro/a {0},<br> Obrigado por usar o nosso serviço. |
authentication.first.time=Olá bem-vindo, é a primeira vez que que se esta a ligar |
authenticate.already.authenticated=O seu usuário já está autênticado |
username=Nome de Utilizador |
323,6 → 323,7 |
remove=Remover |
yes=Sim |
no=Não |
url=URL |
wait=Aguarde um instante por favor |
name=Nome |
targets=Papeis |
/impl/conf/WEB-INF/struts/struts-srusource.xml |
---|
New file |
0,0 → 1,47 |
<?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.srusource.SruSourceForm" name="SruSourceForm"/> |
</form-beans> |
<global-exceptions> |
</global-exceptions> |
<global-forwards> |
</global-forwards> |
<action-mappings> |
<action path="/findProfile" forward="page.find.profile"/> |
<!--Mudar o perfil da area de servico pelo administrador--> |
<action path="/user/startNewSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=newSruSource&from=ServiceZone"/> |
<action path="/user/sruSourceFromServiceZone" |
type="pt.estgp.estgweb.web.controllers.srusource.SruSourceController" |
name="SruSourceForm" |
scope="request" |
parameter="dispatch" |
validate="false" |
input="page.load.srusource.from.service.zone"> |
<forward name="success" path="page.separators.serviceZone"/> |
<forward name="sruSourceData" path="page.load.srusource.from.service.zone"/> |
<forward name="from.add.role" path="page.load.srusource.from.service.zone"/> |
</action> |
</action-mappings> |
</struts-config> |
/impl/conf/WEB-INF/struts/tiles-srusource.xml |
---|
New file |
0,0 → 1,23 |
<?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> |
<!--From Service Zone--> |
<definition name="page.load.srusource.from.service.zone" extends="base.separators"> |
<put name="title" value="Sru Source" /> |
<put name="separator" value="4" type="string" /> |
<put name="topnav" value="/user/serviceZone/topnavCreateSruSource.jsp"/> |
<put name="body" value="/admin/srusource/sruSourceData.jsp" /> |
</definition> |
</tiles-definitions> |
/impl/conf/WEB-INF/struts/struts-announcements.xml |
---|
83,6 → 83,7 |
input="page.submit.announcement" |
validate="false"> |
<forward name="load" path="page.load.announcement"/> |
<forward name="success" path="page.welcome"/> |
</action> |
<action path="/user/startDeleteAnnouncementFromHome" forward="/user/loadAnnouncementFromHome.do?dispatch=delete&from=Home"/> |
<action path="/user/startEditAnnouncementFromHome" forward="/user/loadAnnouncementFromHome.do?dispatch=edit&from=Home"/> |
/impl/conf/WEB-INF/struts/struts-default.xml |
---|
195,7 → 195,8 |
/WEB-INF/struts/tiles-commons.xml, |
/WEB-INF/struts/tiles-intranet.xml, |
/WEB-INF/struts/tiles-reminders.xml, |
/WEB-INF/struts/tiles-managedidentifier.xml"/> |
/WEB-INF/struts/tiles-managedidentifier.xml, |
/WEB-INF/struts/tiles-srusource.xml"/> |
</plug-in> |
<plug-in className="org.apache.struts.validator.ValidatorPlugIn"> |
/impl/conf/WEB-INF/web.xml |
---|
143,7 → 143,8 |
/WEB-INF/struts/struts-commons.xml, |
/WEB-INF/struts/struts-intranet.xml, |
/WEB-INF/struts/struts-reminders.xml, |
/WEB-INF/struts/struts-managedidentifier.xml |
/WEB-INF/struts/struts-managedidentifier.xml, |
/WEB-INF/struts/struts-srusource.xml |
</param-value> |
</init-param> |
<init-param> |
/impl/conf/app.properties |
---|
64,6 → 64,7 |
module.profile=true |
module.sms=false |
module.quotasImpressao=true |
module.srusource=true |
################################################## |
# SMS |
# |
306,6 → 307,8 |
# |
siges.degree.1=L |
siges.degree.4=M |
siges.degree.8=C |
national.institution.code=3122 |
siges.institution.code=1 |
/impl/conf/template/email/courseUnitWork_en.txt |
---|
1,4 → 1,4 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
18,6 → 18,6 |
Best Regards {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWork_pt.txt |
---|
1,4 → 1,4 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
18,6 → 18,6 |
Com os melhores cumprimentos {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWorkChange_en.txt |
---|
New file |
0,0 → 1,26 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
# 4 : Deliver Date |
# Course Unit Assignement |
# |
Dear Student |
WORK MODIFICATION |
The details of an work were changed in: |
{0} |
{1} |
Execution or deliver date: {4} |
{2} |
Best Regards {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWorkChange_pt.txt |
---|
New file |
0,0 → 1,27 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
# 4 : Deliver Date |
# Course Unit Assignement |
# |
Caro estudante |
ALTERAÇÃO A TRABALHO |
Os detalhes de um trabalho foram alterados na unidade: |
{0} |
{1} |
Data de execução ou entrega: {4} |
{2} |
Com os melhores cumprimentos {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/berserk/sd.xml |
---|
131,6 → 131,7 |
<chain name="Session"/> |
<chain name="AuthenticatedUsers"/> |
<chain name="IsInCourseUnit"/> |
<chain name="CanAddAnnouncementInCourseUnit"/> |
</filterChains> |
</service> |
<service> |
1403,6 → 1404,35 |
<!----> |
<!--SRU Services--> |
<service> |
<name>LoadSruSourceById</name> |
<implementationClass>pt.estgp.estgweb.services.srusources.LoadSruSourceByIdService</implementationClass> |
<description>Load SruSource By ID</description> |
<isTransactional>true</isTransactional> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="Admins"/> |
</filterChains> |
</service> |
<service> |
<name>SubmitSruSource</name> |
<implementationClass>pt.estgp.estgweb.services.srusources.SruSourceService</implementationClass> |
<description>Submit SruSource By ID</description> |
<isTransactional>true</isTransactional> |
<defaultMethod>submit</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="Admins"/> |
</filterChains> |
</service> |
/impl/conf/berserk/fd.xml |
---|
62,6 → 62,16 |
<isTransactional>false</isTransactional> |
</filter> |
<filter> |
<name>CanAddAnnouncementInCourseUnit</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.CanAddAnnouncementInCourseUnit</implementationClass> |
<description> |
Checks if the requester is in course unit and if can create announcement in it of the requested bean |
filter parameter: bean serializable id |
filter parameter: bean class |
</description> |
<isTransactional>false</isTransactional> |
</filter> |
<filter> |
<name>IsStudentInCourseUnitUsersClass</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.IsStudentInCourseUnitUsersClass</implementationClass> |
<description> |
/impl/conf/berserk/fcd.xml |
---|
318,6 → 318,13 |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>CanAddAnnouncementInCourseUnit</name> |
<expression>CanAddAnnouncementInCourseUnit("object.courseUnitView.id")</expression> |
<description>Owner of an object Control Chain</description> |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass> |
</filterChain> |
<!--<filterChain>--> |
<!--<name>InternalCourseUnitBlog</name>--> |
<!--<expression>!(BooleanCheck("serializable","pt.estgp.estgweb.domain.CourseUnitImpl","unitBlog.courseUnitInternal")) || ResourceAccessControlCourseUnit</expression>--> |
/impl/src/java/jomm/web/ftp/impl/FtpFile.java |
---|
11,6 → 11,7 |
import javax.servlet.http.HttpServletRequest; |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.UnsupportedEncodingException; |
import java.net.MalformedURLException; |
import java.net.URL; |
import java.util.ArrayList; |
83,6 → 84,32 |
return name; |
} |
public String getNameEncoded() throws URIException |
{ |
return URIUtil.encodePath(name,"ISO-8859-1"); |
} |
public String getNameEscapedHtml() |
{ |
try { |
return jomm.utils.TextToHTMLEnconder.escapeHTML(new String(name.getBytes("ISO-8859-1"))); |
} catch (UnsupportedEncodingException e) { |
logger.error(e,e); |
return name; |
} |
} |
public String getNameHtml() |
{ |
try { |
return new String(name.getBytes("ISO-8859-1")); |
} catch (UnsupportedEncodingException e) { |
logger.error(e,e); |
return name; |
} |
} |
public String getExtension() |
{ |
return extension; |
/impl/src/java/jomm/web/ftp/IFile.java |
---|
22,6 → 22,9 |
public InputStream getInputStream() throws IOException; |
public Date getLastUpdate(); |
public String getName(); |
public String getNameEncoded() throws URIException; |
public String getNameEscapedHtml(); |
public String getNameHtml(); |
public String getExtension(); |
public String getName(HttpServletRequest request) throws URIException; |
public long getSize(); |
/impl/src/java/pt/estgp/estgweb/utils/HttpClient.java |
---|
New file |
0,0 → 1,70 |
package pt.estgp.estgweb.utils; |
import jomm.utils.MimeTypeGuesser; |
import java.io.*; |
import java.net.ProtocolException; |
import java.net.URL; |
import java.net.URLConnection; |
import java.net.HttpURLConnection; |
/** |
* @author Jorge Machado |
* @date 13/Nov/2009 |
* @time 17:24:38 |
* @email machadofisher@gmail.com |
*/ |
public class HttpClient |
{ |
public static InputStream sendFile(String url, File file) throws IOException, ProtocolException { |
String mimeType = MimeTypeGuesser.getInstance().guessMimeType(file); |
URL urlSolr = new URL(url); |
URLConnection urlConnection = urlSolr.openConnection(); |
urlConnection.addRequestProperty("Content-type",mimeType); |
((HttpURLConnection) urlConnection).setRequestMethod("GET"); |
urlConnection.setDoInput(true); |
urlConnection.setDoOutput(true); |
urlConnection.setUseCaches(false); |
OutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream()); |
FileInputStream fStream = new FileInputStream(file); |
byte[] bytes = new byte[1024]; |
int read; |
while((read = fStream.read(bytes)) >= 0) |
{ |
outputStream.write(bytes,0,read); |
} |
outputStream.flush(); |
outputStream.close(); |
return new DataInputStream(urlConnection.getInputStream()); |
} |
public static InputStream sendXmlData(String url, String xmlData) throws IOException, ProtocolException { |
URL urlSolr = new URL(url); |
URLConnection urlConnection = urlSolr.openConnection(); |
urlConnection.addRequestProperty("Content-type","text/xml"); |
((HttpURLConnection) urlConnection).setRequestMethod("GET"); |
urlConnection.setDoInput(true); |
urlConnection.setDoOutput(true); |
urlConnection.setUseCaches(false); |
OutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream()); |
outputStream.write(xmlData.getBytes()); |
outputStream.flush(); |
outputStream.close(); |
return new DataInputStream(urlConnection.getInputStream()); |
} |
} |
/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
251,6 → 251,8 |
public static final String EMAIL_COURSEUNIT_WORK_SUBJECT_EN = ConfigProperties.getProperty("email.courseunit.work.subject.en"); |
public static final String EMAIL_COURSEUNIT_WORK_TEMPLATE_PT = "courseUnitWork_pt.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_TEMPLATE_EN = "courseUnitWork_en.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_PT = "courseUnitWorkChange_pt.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_EN = "courseUnitWorkChange_en.txt"; |
public static final String EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_PT = ConfigProperties.getProperty("email.courseunit.blogpost.subject.pt"); |
public static final String EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_EN = ConfigProperties.getProperty("email.courseunit.blogpost.subject.en"); |
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java |
---|
14,6 → 14,7 |
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.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.utils.DatesUtils; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
77,17 → 78,24 |
public CourseView loadCourseByCode(String code, boolean initUnits) throws ServiceException |
{ |
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(code); |
if(c != null) |
{ |
CourseView cV = new CourseView(c,initUnits); |
if(c.getStudiesPlan() != null) |
try{ |
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(code); |
if(c != null) |
{ |
RepositoryFileImpl repositoryFile = repositoryService.loadView(c.getStudiesPlan()); |
cV.setStudiesPlan(repositoryFile); |
CourseView cV = new CourseView(c,initUnits); |
if(c.getStudiesPlan() != null) |
{ |
RepositoryFileImpl repositoryFile = repositoryService.loadView(c.getStudiesPlan()); |
cV.setStudiesPlan(repositoryFile); |
} |
return cV; |
} |
return cV; |
} |
catch(Throwable e) |
{ |
logger.error(e + " loading code:" + code,e); |
throw new ServiceException("loading code: " + code + " - " + e.toString(),e); |
} |
return null; |
} |
100,9 → 108,14 |
{ |
Course c; |
if(courseView.getId() > 0) |
{ |
c = DaoFactory.getCourseDaoImpl().get(courseView.getId()); |
} |
else |
{ |
c = DaoFactory.getCourseDaoImpl().findCourseByCodeAndYear(courseView.getCode(),courseView.getImportYear()); |
if(c != null) |
throw new AlreadyExistsException(AlreadyExistsException.ALREADY_EXISTS_COURSE); |
c = DomainObjectFactory.createCourseImpl(); |
DaoFactory.getCourseDaoImpl().save(c); |
} |
126,7 → 139,7 |
try |
{ |
Document dom = Dom4jUtil.parse(stream); |
String html = Dom4jUtil.styleDocument(dom, Globals.TEMPLATE_COURSE_XSL_PATH); |
String html = Dom4jUtil.styleDocument(dom, Globals.TEMPLATE_COURSE_XSL_PATH); |
c.setCacheWebDocument(html); |
} |
catch (Exception e) |
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitWorksBackupService.java |
---|
419,7 → 419,25 |
{ |
if (deliverable.getDeliverableRepositoryStream() != null && deliverable.getDeliverableRepositoryStream().length() > 0) |
{ |
String deliverDir = toDir + "/deliverable" + deliverable.getId() + "-" + deliverable.getStudent().getId() + "numero" + deliverable.getStudent().getSigesCode(); |
BytesUtils.generateHexKey(); |
String studentId; |
String sigesCode; |
if(deliverable.getStudent() != null) |
{ |
studentId = "" + deliverable.getStudent().getId(); |
sigesCode = "" + deliverable.getStudent().getSigesCode(); |
} |
else if(deliverable.getStudentId() > 0) |
{ |
studentId = "" + deliverable.getStudentId(); |
sigesCode = "desconhecido" + BytesUtils.generateHexKey(); |
} |
else |
{ |
sigesCode = "desconhecido" + BytesUtils.generateHexKey(); |
studentId = "desconhecido" + BytesUtils.generateHexKey(); |
} |
String deliverDir = toDir + "/deliverable" + deliverable.getId() + "-" + studentId + "-numero" + sigesCode; |
new File(deliverDir).mkdirs(); |
List<IRepositoryFile> iRepositoryFiles = repositoryService.loadVersions(deliverable.getDeliverableRepositoryStream(), userSession); |
for (IRepositoryFile iRepositoryFile : iRepositoryFiles) |
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitWorkService.java |
---|
57,7 → 57,10 |
{ |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().get(id); |
CourseUnitAssignement assignement; |
boolean newWork = true; |
if(cUV.getId() > 0) |
newWork = false; |
if(cUV.getId() > 0) |
assignement = DaoFactory.getCourseUnitAssignementDaoImpl().get(cUV.getId()); |
else |
{ |
80,11 → 83,11 |
} |
if(assignement.isStatus()) |
trySendWorkEmail(assignement,userSession); |
trySendWorkEmail(assignement,userSession,newWork); |
return loadCourseUnitWorks(id,userSession); |
} |
private void trySendWorkEmail(CourseUnitAssignement assignement, UserSession userSession) |
private void trySendWorkEmail(CourseUnitAssignement assignement, UserSession userSession,boolean newWork) |
{ |
CourseUnit c = assignement.getCourseUnit(); |
List<User> users = new ArrayList<User>(); |
92,14 → 95,14 |
users.addAll(c.getStudents()); |
if(c.getTeachers() != null) |
users.addAll(c.getTeachers()); |
sendWorkEmail(assignement,c.getNormalizedName(), userSession, users); |
sendWorkEmail(assignement,c.getNormalizedName(), userSession, users,newWork); |
} |
SendEmailService sendEmailService = new SendEmailService(); |
private void sendWorkEmail(CourseUnitAssignement a, String desc, UserSession userSession, List<User> users) |
private void sendWorkEmail(CourseUnitAssignement a, String desc, UserSession userSession, List<User> users, boolean newWork) |
{ |
Email e = sendEmailService.getCourseUnitWorkEmail(a, LangEnum.PORTUGUESE,userSession,users); |
Email e = sendEmailService.getCourseUnitWorkEmail(a, LangEnum.PORTUGUESE,userSession,users,newWork); |
EMAILJob emailJob = new EMAILJob(e); |
JobScheduleService.getInstance().scheduleNow(emailJob,"CourseUnit Assignement Email:" + desc,userSession); |
} |
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java |
---|
19,6 → 19,7 |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Properties; |
import java.util.Date; |
import java.text.MessageFormat; |
/** |
201,28 → 202,37 |
return new Email(subject ,recipients, fromEmail, template,arguments,Message.RecipientType.BCC); |
} |
public Email getCourseUnitWorkEmail(CourseUnitAssignement assignement, LangEnum langEnum, UserSession userSession, List<User> users) |
public Email getCourseUnitWorkEmail(CourseUnitAssignement assignement, LangEnum langEnum, UserSession userSession, List<User> users, boolean newWork) |
{ |
List<String> arguments = new ArrayList<String>(); |
arguments.add(assignement.getCourseUnit().getName()); |
arguments.add(assignement.getTitle()); |
arguments.add(assignement.getDescription()); |
if(userSession != null && userSession.getName() != null) |
arguments.add(userSession.getName()); |
else |
arguments.add("unknown"); |
arguments.add( DatesUtils.getStringFromDate(assignement.getDeliverDate())); |
String subjectTxt; |
String template; |
if(langEnum == LangEnum.PORTUGUESE) |
{ |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_PT; |
if(newWork) |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_PT; |
else |
template = Globals.EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_PT; |
subjectTxt = Globals.EMAIL_COURSEUNIT_WORK_SUBJECT_PT; |
} |
else |
{ |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_EN; |
if(newWork) |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_EN; |
else |
template = Globals.EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_EN; |
subjectTxt = Globals.EMAIL_COURSEUNIT_WORK_SUBJECT_EN; |
} |
326,10 → 336,11 |
public static void main(String [] args) |
{ |
List<String[]> grades = new ArrayList<String[]>(); |
grades.add(new String[]{"Teste","3"}); |
grades.add(new String[]{"Teste2","4"}); |
new SendEmailService().sendNewGrades(grades,LangEnum.PORTUGUESE,"jmachado@estgp.pt","jorge Machado"); |
System.out.println( DatesUtils.getStringFromDate(new Date())); |
// List<String[]> grades = new ArrayList<String[]>(); |
// grades.add(new String[]{"Teste","3"}); |
// grades.add(new String[]{"Teste2","4"}); |
// new SendEmailService().sendNewGrades(grades,LangEnum.PORTUGUESE,"jmachado@estgp.pt","jorge Machado"); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/email/ReadEmailService.java |
---|
39,15 → 39,15 |
public List<IPopEmail> run(UserSession userSession) |
{ |
if(!((UserImpl)userSession.getUser()).hasPopConfigured()) |
if (!((UserImpl) userSession.getUser()).hasPopConfigured()) |
return null; |
Properties props = new Properties(); |
Date d = (Date) ((UserSessionImpl)userSession).get(POP_MAIL_DATE_KEY); |
ArrayList<IPopEmail> oldMessages = (ArrayList<IPopEmail>) ((UserSessionImpl)userSession).get(POP_MAIL_MESSAGES_KEY); |
if(d != null && oldMessages != null) |
Date d = (Date) ((UserSessionImpl) userSession).get(POP_MAIL_DATE_KEY); |
ArrayList<IPopEmail> oldMessages = (ArrayList<IPopEmail>) ((UserSessionImpl) userSession).get(POP_MAIL_MESSAGES_KEY); |
if (d != null && oldMessages != null) |
{ |
if(System.currentTimeMillis() - d.getTime() < Globals.POP_REFRESH_TIMEOUT_MILISECONDS) |
if (System.currentTimeMillis() - d.getTime() < Globals.POP_REFRESH_TIMEOUT_MILISECONDS) |
{ |
return oldMessages; |
} |
79,67 → 79,80 |
for (int i = count; i > count - Globals.POP_MAX_MESSAGES && i > 0; i--) |
{ |
Message message = inbox.getMessage(i); |
DefaultPopEmail popEmail = new DefaultPopEmail(); |
String date = DatesUtils.getStringFromDate(message.getSentDate()); |
popEmail.setDate(date); |
popEmail.setSubject(message.getSubject()); |
popEmail.setSubjectFragment(StringsUtils.getFragment(message.getSubject(),Globals.POP_FRAGMENT_TEXT_SIZE)); |
List<IAddress> addressLst = new ArrayList<IAddress>(); |
for (Address a : message.getFrom()) |
try |
{ |
InternetAddress internetAddress = (InternetAddress) a; |
DefaultAddress address = new DefaultAddress(); |
address.setEmail(internetAddress.getAddress()); |
address.setName(internetAddress.getPersonal()); |
addressLst.add(address); |
} |
popEmail.setFrom(addressLst); |
Part messagePart = message; |
Object content = messagePart.getContent(); |
if (content instanceof Multipart) |
{ |
messagePart = ((Multipart) content).getBodyPart(0); |
} |
String contentType = messagePart.getContentType(); |
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) |
{ |
InputStream is = messagePart.getInputStream(); |
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"ISO-8859-1")); |
StringBuilder text = new StringBuilder(); |
StringBuilder textClean = new StringBuilder(); |
String thisLine = reader.readLine(); |
while (thisLine != null) |
Message message = inbox.getMessage(i); |
DefaultPopEmail popEmail = new DefaultPopEmail(); |
String date = DatesUtils.getStringFromDate(message.getSentDate()); |
popEmail.setDate(date); |
popEmail.setSubject(message.getSubject()); |
popEmail.setSubjectFragment(StringsUtils.getFragment(message.getSubject(), Globals.POP_FRAGMENT_TEXT_SIZE)); |
List<IAddress> addressLst = new ArrayList<IAddress>(); |
for (Address a : message.getFrom()) |
{ |
String thisLineTrim = thisLine.trim(); |
if(thisLineTrim.length() > 0) |
InternetAddress internetAddress = (InternetAddress) a; |
DefaultAddress address = new DefaultAddress(); |
address.setEmail(internetAddress.getAddress()); |
address.setName(internetAddress.getPersonal()); |
addressLst.add(address); |
} |
popEmail.setFrom(addressLst); |
Part messagePart = message; |
Object content = null; |
try |
{ |
content = messagePart.getContent(); |
} |
catch (Throwable e) |
{ |
content = "ESTG SITE AVISO: Conteudo possivelmente perigoso"; |
} |
if (content instanceof Multipart) |
{ |
messagePart = ((Multipart) content).getBodyPart(0); |
} |
String contentType = messagePart.getContentType(); |
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) |
{ |
InputStream is = messagePart.getInputStream(); |
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "ISO-8859-1")); |
StringBuilder text = new StringBuilder(); |
StringBuilder textClean = new StringBuilder(); |
String thisLine = reader.readLine(); |
while (thisLine != null) |
{ |
textClean.append(thisLineTrim); |
String thisLineTrim = thisLine.trim(); |
if (thisLineTrim.length() > 0) |
{ |
textClean.append(thisLineTrim); |
} |
text.append("<br>").append(thisLine.trim()); |
thisLine = reader.readLine(); |
} |
text.append("<br>").append(thisLine.trim()); |
thisLine = reader.readLine(); |
popEmail.setText(text.toString()); |
popEmail.setFragment(StringsUtils.getFragment(textClean.toString(), Globals.POP_FRAGMENT_TEXT_SIZE)); |
} |
popEmail.setText(text.toString()); |
popEmail.setFragment(StringsUtils.getFragment(textClean.toString(),Globals.POP_FRAGMENT_TEXT_SIZE)); |
popMessages.add(popEmail); |
} |
popMessages.add(popEmail); |
catch (Throwable e) |
{ |
logger.error(e, e); |
} |
} |
inbox.close(false); |
store.close(); |
((UserSessionImpl)userSession).put(POP_MAIL_DATE_KEY,new Date()); |
((UserSessionImpl)userSession).put(POP_MAIL_MESSAGES_KEY,((ArrayList)popMessages)); |
((UserSessionImpl) userSession).put(POP_MAIL_DATE_KEY, new Date()); |
((UserSessionImpl) userSession).put(POP_MAIL_MESSAGES_KEY, ((ArrayList) popMessages)); |
return popMessages; |
} |
catch (MessagingException e) |
{ |
logger.error(e, e); |
} |
catch (IOException e) |
{ |
logger.error(e, e); |
} |
return null; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java |
---|
107,7 → 107,7 |
DaoFactory.getStudentDaoImpl().save(s); |
newUser = true; |
} |
persist(d, s); |
persist(d, s, newUser); |
//Advising CommonsServicesManager before change password |
if (newUser) |
142,19 → 142,22 |
* @param d Aluno |
* @param student Student |
*/ |
private void persist(Aluno d, Student student) |
private void persist(Aluno d, Student student, boolean newUser) |
{ |
student.setName(d.getNome()); |
student.setEmail(d.getEmail()); |
student.setSigesCode(d.getCodigo().intValue()); |
student.setAddress(d.getMorada()); |
student.setPhonenumber(StringsUtils.cleanKeepNumbers(d.getTelemovel())); |
student.setZip("" + d.getCodigoPostal().intValue()); |
student.setBi(d.getNumeroBi()); |
student.setSex(d.getSexo()); |
student.setUserNameNetpa(d.getUsernameNetpa()); |
student.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
student.setUsername("a" + d.getCodigo().intValue()); |
if(newUser) |
{ |
student.setName(d.getNome()); |
student.setEmail(d.getEmail()); |
student.setSigesCode(d.getCodigo().intValue()); |
student.setAddress(d.getMorada()); |
student.setPhonenumber(StringsUtils.cleanKeepNumbers(d.getTelemovel())); |
student.setZip("" + d.getCodigoPostal().intValue()); |
student.setBi(d.getNumeroBi()); |
student.setSex(d.getSexo()); |
student.setUserNameNetpa(d.getUsernameNetpa()); |
student.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
student.setUsername("a" + d.getCodigo().intValue()); |
} |
/*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 (d.getDisciplinasInscrito() == null || d.getDisciplinasInscrito().getDisciplina() == null || d.getDisciplinasInscrito().getDisciplina().size() == 0) |
202,7 → 205,6 |
} |
else |
student.setSubscribedUnits(units); |
student.setSubscribedUnits(units); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java |
---|
75,7 → 75,7 |
logger.info("Importing: (" + t.getUsername() + ") " + t.getName()); |
try |
{ |
persist(d, t); |
persist(d, t, newUser); |
} |
catch (Exception e) |
{ |
112,20 → 112,20 |
* @param t teacher |
* @throws Exception . |
*/ |
private void persist(Docente d, Teacher t) throws Exception |
private void persist(Docente d, Teacher t, boolean newUser) throws Exception |
{ |
try |
{ |
if(t.getName() == null || t.getName().length() == 0) |
t.setName(d.getNomeFuncionarioInt()); |
//Email instituicao |
t.setEmail(d.getEmail()); |
if(t.getEmail() == null || t.getEmail().indexOf("@") < 0) |
t.setEmail(d.getEmail()); |
if (d.getEmail() != null && d.getEmail().endsWith(Globals.EMAIL_LOCAL_SUFFIX)) |
{ |
int atIndex = d.getEmail().indexOf("@"); |
if (atIndex > 0) |
t.setUsername(d.getEmail().substring(0, atIndex)); |
} |
t.setSigesCode(d.getCodigoFuncionario().intValue()); |
if(t.getAddress() == null || t.getAddress().length() == 0) |
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesManager.java |
---|
124,7 → 124,8 |
for (IResult result : searchResults.getResults()) |
{ |
DefaultResult defaultResult = (DefaultResult) result; |
defaultResult.setBestFragments(LuceneUtils.doStandardHighlights(defaultResult.getText(), query, SEARCH_FRAGMENT_SIZE, SEARCH_MAX_FRAGMENTS)); |
if(defaultResult.getBestFragments() == null || defaultResult.getBestFragments().trim().length() == 0) |
defaultResult.setBestFragments(LuceneUtils.doStandardHighlights(defaultResult.getText(), query, SEARCH_FRAGMENT_SIZE, SEARCH_MAX_FRAGMENTS)); |
if (!defaultResult.isTitleKey()) |
{ |
String title = defaultResult.getTitle(); |
139,10 → 140,14 |
if (defaultResult.getSubTitle() == null || defaultResult.getSubTitle().length() == 0) |
defaultResult.setSubTitle(subTitle); |
} |
String text = defaultResult.getText(); |
defaultResult.setText(LuceneUtils.highlight(defaultResult.getText(), query)); |
if (defaultResult.getText() == null || defaultResult.getText().length() == 0) |
defaultResult.setText(text); |
if(defaultResult.getText() != null && defaultResult.getText().trim().length() > 0) |
{ |
String text = defaultResult.getText(); |
defaultResult.setText(LuceneUtils.highlight(defaultResult.getText(), query)); |
if (defaultResult.getText() == null || defaultResult.getText().length() == 0) |
defaultResult.setText(text); |
} |
} |
} |
return searchResults; |
/impl/src/java/pt/estgp/estgweb/services/common/ModuleEnum.java |
---|
9,6 → 9,7 |
import pt.estgp.estgweb.services.courseunits.CourseUnitsCommonServices; |
import pt.estgp.estgweb.services.courses.CoursesCommonServices; |
import pt.estgp.estgweb.services.profile.ProfileCommonServices; |
import pt.estgp.estgweb.services.srusources.SruSourcesCommonServices; |
/** |
* @author Jorge Machado |
28,8 → 29,9 |
BlogPosts("module.BlogPosts", new BlogPostsCommonServices()), |
CourseUnits("module.CourseUnits", new CourseUnitsCommonServices()), |
Courses("module.Courses", new CoursesCommonServices()), |
Profile("module.Profile", new ProfileCommonServices()); |
Profile("module.Profile", new ProfileCommonServices()), |
// Questionarios("module.Qustionarios", new QuestionariosCommonServices()); |
SruSource("module.SruSource", new SruSourcesCommonServices()); |
// Events("module.Events",null), |
// Blogs("module.Blogs",null), |
/impl/src/java/pt/estgp/estgweb/services/urlstat/LoadUrlStatService.java |
---|
1,10 → 1,12 |
package pt.estgp.estgweb.services.urlstat; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import pt.estgp.estgweb.domain.UrlStat; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
24,7 → 26,8 |
*/ |
public UrlStat run(String relativePath) throws ServiceException |
{ |
return DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath); |
String relativePathDigest = BytesUtils.getMD5(relativePath); |
return DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePathDigest); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/urlstat/UrlStatService.java |
---|
6,11 → 6,14 |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.web.filters.UrlStatFilter; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import org.apache.commons.httpclient.URIException; |
import java.util.*; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.MyCalendar; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
38,15 → 41,25 |
Set<Map.Entry<String, UrlStatFilter.IntegerContainer>> set = map.entrySet(); |
for (Map.Entry<String, UrlStatFilter.IntegerContainer> entry : set) |
{ |
String relativePath = entry.getKey(); |
// String relativePath = entry.getKey(); |
String relativePath = BytesUtils.getMD5(entry.getKey()); |
UrlStatFilter.IntegerContainer ic = entry.getValue(); |
UrlStatImpl urlStat = (UrlStatImpl) DaoFactory.getUrlStatDaoImpl().loadOrNullLockUpgrade(relativePath); |
if (urlStat == null) |
{ |
logger.info("url:" + relativePath + " does not exist... creating"); |
urlStat = DomainObjectFactory.createUrlStatImpl(); |
try |
{ |
urlStat.setName(URIUtil.decode(entry.getKey(),"ISO-8859-1")); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
} |
urlStat.setRelativePath(relativePath); |
logger.info("url:" + urlStat.getName() + " does not exist... creating"); |
urlStat.setStatus(false); |
DaoFactory.getUrlStatDaoImpl().save(urlStat); |
} |
57,7 → 70,7 |
UrlStatYearImpl urlStatYear = (UrlStatYearImpl) DaoFactory.getUrlStatYearDaoImpl().loadOrNullLockUpgrade(urlStatYearId); |
if (urlStatYear == null) |
{ |
logger.info("url:" + relativePath + " first year call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first year call does not exist... creating"); |
urlStatYear = DomainObjectFactory.createUrlStatYearImpl(); |
urlStatYear.setId(urlStatYearId); |
urlStat.addYear(urlStatYear); |
71,7 → 84,7 |
UrlStatMonthImpl urlStatMonth = (UrlStatMonthImpl) DaoFactory.getUrlStatMonthDaoImpl().loadOrNullLockUpgrade(urlStatMonthId); |
if (urlStatMonth == null) |
{ |
logger.info("url:" + relativePath + " first month call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first month call does not exist... creating"); |
urlStatMonth = DomainObjectFactory.createUrlStatMonthImpl(); |
urlStatMonth.setId(urlStatMonthId); |
urlStatMonth.setDate(new MyCalendar(year, month, 1).getTime()); |
85,7 → 98,7 |
UrlStatDayImpl urlStatDay = (UrlStatDayImpl) DaoFactory.getUrlStatDayDaoImpl().loadOrNullLockUpgrade(urlStatDayId); |
if (urlStatDay == null) |
{ |
logger.info("url:" + relativePath + " first day call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first day call does not exist... creating"); |
urlStatDay = DomainObjectFactory.createUrlStatDayImpl(); |
UrlStatDayId urlStatDayId2 = new UrlStatDayId(); |
urlStatDayId2.setDay(day); |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ResetRelativePathsServiceDigests.java |
---|
New file |
0,0 → 1,61 |
package pt.estgp.estgweb.services.urlstat; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.URIException; |
import org.apache.commons.httpclient.util.URIUtil; |
import java.sql.SQLException; |
import java.sql.PreparedStatement; |
import java.sql.ResultSet; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
* @date 15/Mar/2008 |
* @time 6:55:38 |
* @see pt.estgp.estgweb.services.urlstat |
*/ |
public class ResetRelativePathsServiceDigests implements IService |
{ |
private static final Logger logger = Logger.getLogger(ResetRelativePathsServiceDigests.class); |
public static void main(String[] args) throws ServiceException, URIException, SQLException |
{ |
AbstractDao.getCurrentSession().beginTransaction(); |
PreparedStatement ps = AbstractDao.getCurrentSession().connection().prepareStatement("select relativePath from urlstat"); |
ResultSet rs = ps.executeQuery(); |
while(rs.next()) |
{ |
PreparedStatement ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstat set relativePath = ? where relativePath=?"); |
String relativePath = rs.getString("relativePath"); |
String encoded= BytesUtils.getMD5(relativePath); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatday set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatmonth set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatyear set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ChartBuilderService.java |
---|
21,6 → 21,7 |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.Globals; |
import jomm.utils.DatesUtils; |
import jomm.utils.BytesUtils; |
import jomm.dao.impl.AbstractDao; |
import jomm.web.utils.TestHttpServletRequest; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
117,7 → 118,7 |
{ |
try |
{ |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
relativePath = BytesUtils.getMD5(URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1")); |
} |
catch (URIException e) |
{ |
/impl/src/java/pt/estgp/estgweb/services/expceptions/AlreadyExistsException.java |
---|
3,6 → 3,7 |
public class AlreadyExistsException extends ServiceException |
{ |
public static final String ALREADY_EXISTS_COURSE = "course"; |
public static final String ALREADY_EXISTS_USERNAME = "username"; |
public static final String ALREADY_EXISTS_EMAIL = "email"; |
/impl/src/java/pt/estgp/estgweb/services/srusources/LoadSruSourceByIdService.java |
---|
New file |
0,0 → 1,28 |
package pt.estgp.estgweb.services.srusources; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.services.profile.LoadUserByIdService; |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.SruSource; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import org.apache.log4j.Logger; |
import java.io.Serializable; |
public class LoadSruSourceByIdService implements IService { |
private static final Logger logger = Logger.getLogger(LoadSruSourceByIdService.class); |
public SruSourceView run(Serializable id, UserSession userSession) |
{ |
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(id); |
SruSourceView sruSourceView = new SruSourceView(sruSource,sruSource.getCollections()); |
logger.info("Loading srusource view:" + sruSourceView.getId()); |
return sruSourceView; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/srusources/SruSourcesCommonServices.java |
---|
New file |
0,0 → 1,205 |
package pt.estgp.estgweb.services.srusources; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
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.DefaultToDo; |
import pt.estgp.estgweb.services.courseunits.CourseUnitsCommonServices; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.domain.views.SruSourceCollectionView; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.utils.RoleManager; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import org.apache.log4j.Logger; |
import org.dom4j.DocumentException; |
import org.dom4j.Document; |
import org.dom4j.XPath; |
import org.dom4j.Element; |
import java.util.List; |
import java.util.ArrayList; |
import java.util.Map; |
import java.util.HashMap; |
import java.net.URLEncoder; |
import java.net.URL; |
import java.net.MalformedURLException; |
import java.io.UnsupportedEncodingException; |
/* |
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt |
* |
* |
* Created at 17/Out/2003 , 23:45:24 |
* |
*/ |
/** |
* @author Jorge Machado |
* <p/> |
* <p/> |
* Created at 17/Out/2003 , 23:45:24 |
*/ |
public class SruSourcesCommonServices implements IService, IModuleCommonServices |
{ |
private static final Logger logger = Logger.getLogger(SruSourcesCommonServices.class); |
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession) |
{ |
return 0; |
} |
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) |
{ |
return search(null, search, searchType, page, maxResults, userSession); |
} |
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) |
{ |
DefaultSearchResults searchResults = new DefaultSearchResults(); |
searchResults.setModule(ModuleEnum.SruSource); |
if(userSession.getUser() == null) |
return searchResults; |
List<SruSource> sruSources = DaoFactory.getSruSourceDaoImpl().findAll(); |
List<SruSourceView> admitedSources = new ArrayList<SruSourceView>(); |
for(SruSource source: sruSources) |
{ |
List<SruSourceCollection> admitedCollections = new ArrayList<SruSourceCollection>(); |
for(SruSourceCollection sruSourceCollection : source.getCollections()) |
{ |
if(sruSourceCollection.getAdmitedRoles() == null || sruSourceCollection.getAdmitedRoles().trim().length() == 0 || RoleManager.hasRole(userSession.getUser(), RoleManager.getRolesFromSerial(sruSourceCollection.getAdmitedRoles()))) |
{ |
admitedCollections.add(sruSourceCollection); |
} |
} |
if(admitedCollections.size() > 0) |
{ |
SruSourceView sruSourceView = new SruSourceView(source,admitedCollections); |
admitedSources.add(sruSourceView); |
} |
} |
if(admitedSources.size() > 0) |
{ |
SruSourceView sruSourceView = admitedSources.get(0); |
try |
{ |
StringBuilder collectionQuery = new StringBuilder(); |
String appender = ""; |
for(SruSourceCollectionView collectionView: sruSourceView.getCollections()) |
{ |
collectionQuery.append(appender).append(collectionView.getCollection()); |
appender = " OR "; |
} |
String finalQuery = sruSourceView.getCollectionField() + ":(" + collectionQuery.toString() + ") AND (" + search + ")"; |
logger.error("Sru server " + sruSourceView.getName() + " final query: " + finalQuery); |
String sruRequest = sruSourceView.getUrl() + "?query=" + URLEncoder.encode(finalQuery,"UTF-8") + "&verb=getSRUResponseWithThisQuery&startRecord=" + page + "&maximumRecords=" + maxResults; |
URL url = new URL(sruRequest); |
Document dom = Dom4jUtil.parse(url); |
Map<String,String> namespaces = new HashMap<String,String>(); |
namespaces.put("files","http://www.estgp.pt/sru/solrFilesManager"); |
namespaces.put("srw","http://www.loc.gov/zing/srw/"); |
XPath xPathNumberOfRecords = dom.createXPath("//srw:numberOfRecords"); |
xPathNumberOfRecords.setNamespaceURIs(namespaces); |
Element numberOfRecords = (Element) xPathNumberOfRecords.selectSingleNode(dom); |
if(numberOfRecords == null) |
return searchResults; |
searchResults.setTotalResults(Integer.parseInt(numberOfRecords.getTextTrim())); |
XPath xPathRecords = dom.createXPath("//files:doc"); |
xPathRecords.setNamespaceURIs(namespaces); |
List<Element> docs = xPathRecords.selectNodes(dom); |
for(Element doc: docs) |
{ |
XPath xPathFileRelativePath = dom.createXPath("./files:fileRelativePath"); |
xPathFileRelativePath.setNamespaceURIs(namespaces); |
Object fileRelativePath = xPathFileRelativePath.selectSingleNode(doc); |
if(fileRelativePath != null ) |
{ |
XPath xPathFileUrl = dom.createXPath("./files:url"); |
xPathFileUrl.setNamespaceURIs(namespaces); |
Object fileUrl = xPathFileUrl.selectSingleNode(doc); |
if(fileUrl != null) |
{ |
DefaultResult defaultResult = new DefaultResult(); |
defaultResult.setTitle(((Element)fileRelativePath).getText()); |
// defaultResult.setSubTitle(courseUnit.getCourseName()); |
// defaultResult.setSubTitleKey(false); |
// defaultResult.setText(courseUnit.getObjectives()); |
defaultResult.setUrl(((Element)fileUrl).getTextTrim()); |
XPath xPathCollection = dom.createXPath("./files:collection"); |
xPathFileUrl.setNamespaceURIs(namespaces); |
Element collection = (Element) xPathCollection.selectSingleNode(doc); |
defaultResult.setSubTitle(collection.getTextTrim()); |
XPath xPathFragment = dom.createXPath("./files:snippet/files:fragment"); |
xPathFragment.setNamespaceURIs(namespaces); |
List<Element> fragments = (List<Element>) xPathFragment.selectNodes(doc); |
Element fragmentsA = (Element) xPathFragment.selectSingleNode(doc); |
Object fragmentsB = xPathFragment.evaluate(doc); |
if(fragments != null) |
{ |
defaultResult.setBestFragments(""); |
for(Element fragment: fragments) |
{ |
defaultResult.setBestFragments(defaultResult.getBestFragments() + " ... " + fragment.getTextTrim().replace("<em>","<b><i>").replace("</em>","</i></b>")); |
} |
} |
searchResults.addResult(defaultResult); |
} |
else |
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page + " path:" + ((Element)fileRelativePath).getText() ); |
} |
else |
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page); |
} |
} |
catch (Throwable e) |
{ |
logger.error(e,e); |
} |
} |
return searchResults; |
} |
public int countToDo(UserSession userSession) |
{ |
return 0; |
} |
public IToDoCat getToDo(UserSession userSession) |
{ |
return null; |
} |
public List<IToDo> getAllToDos(UserSession userSession) |
{ |
return null; |
}/*This method is invoked from object creation*/ |
public void adviseNew(DomainObject object) |
{ |
//To change body of implemented methods use File | Settings | File Templates. |
} |
public void adviseUpdate(DomainObject object) |
{ |
//To change body of implemented methods use File | Settings | File Templates. |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/srusources/SruSourceService.java |
---|
New file |
0,0 → 1,114 |
package pt.estgp.estgweb.services.srusources; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.services.data.RepositoryService; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.domain.views.CourseView; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.domain.views.SruSourceCollectionView; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import org.apache.log4j.Logger; |
import java.util.HashSet; |
import java.util.List; |
import java.util.ArrayList; |
/* |
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt |
* |
* |
* Created at 17/Out/2003 , 23:45:24 |
* |
*/ |
/** |
* @author Jorge Machado |
* |
* |
* Created at 17/Out/2003 , 23:45:24 |
* |
*/ |
public class SruSourceService implements IService |
{ |
private static final Logger logger = Logger.getLogger(SruSourceService.class); |
public SruSourceView submit(SruSourceView sruSourceView, UserSession userSession) throws ServiceException |
{ |
if(sruSourceView.getId() <= 0) |
{ |
logger.info("Creating new SRU Source with URL: " + sruSourceView.getUrl()); |
SruSource sruSource = DomainObjectFactory.createSruSourceImpl(); |
sruSourceView.persistViewInObject(sruSource); |
sruSource.setCreator(userSession.getUser()); |
DaoFactory.getSruSourceDaoImpl().save(sruSource); |
if(sruSourceView.getCollections() != null) |
{ |
addNewCollections(sruSource,sruSourceView); |
} |
} |
else |
{ |
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(sruSourceView.getId()); |
sruSourceView.persistViewInObject(sruSource); |
if(sruSourceView.getCollections() != null) |
{ |
if(sruSource.getCollections() == null || sruSource.getCollections().size() == 0) |
{ |
addNewCollections(sruSource,sruSourceView); |
} |
else |
{ |
List<SruSourceCollectionView> toAdd = new ArrayList<SruSourceCollectionView>(sruSourceView.getCollections()); |
List<SruSourceCollection> toRemove = new ArrayList<SruSourceCollection>(); |
for(SruSourceCollection collection: sruSource.getCollections()) |
{ |
boolean found = false; |
for(SruSourceCollectionView collectionView: sruSourceView.getCollections()) |
{ |
if(collectionView.getId() == collection.getId() || collectionView.getCollection().equals(collection.getCollection())) |
{ |
collectionView.persistViewInObject(collection); |
toAdd.remove(collectionView); |
found = true; |
break; |
} |
} |
if(!found) |
{ |
toRemove.add(collection); |
} |
} |
sruSource.getCollections().removeAll(toRemove); |
DaoFactory.getSruSourceCollectionDaoImpl().delete(toRemove); |
for(SruSourceCollectionView collectionView: toAdd) |
{ |
addNewCollection(sruSource,collectionView); |
} |
} |
} |
} |
return sruSourceView; |
} |
private void addNewCollections(SruSource sruSource, SruSourceView sruSourceView) |
{ |
sruSource.setCollections(new HashSet<SruSourceCollection>()); |
for(SruSourceCollectionView collectionView: sruSourceView.getCollections()) |
{ |
addNewCollection(sruSource,collectionView); |
} |
} |
private void addNewCollection(SruSource sruSource, SruSourceCollectionView collectionView) |
{ |
SruSourceCollection collection = DomainObjectFactory.createSruSourceCollectionImpl(); |
collectionView.persistViewInObject(collection); |
collection.setSruSource(sruSource); |
sruSource.getCollections().add(collection); |
DaoFactory.getSruSourceCollectionDaoImpl().save(collection); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/SruSourceDaoImpl.java |
---|
New file |
0,0 → 1,35 |
package pt.estgp.estgweb.domain.dao.impl; |
import pt.estgp.estgweb.services.common.SearchTypeEnum; |
import pt.estgp.estgweb.domain.dao.DaoUtils; |
import pt.estgp.estgweb.domain.SruSource; |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.GenericUser; |
import pt.estgp.estgweb.domain.SruSourceCollection; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.utils.DatesUtils; |
import pt.estgp.estgweb.utils.StringsUtils; |
import pt.estgp.estgweb.utils.RoleManager; |
import org.hibernate.criterion.Criterion; |
import static org.hibernate.criterion.Restrictions.eq; |
import org.hibernate.Criteria; |
import java.util.List; |
import java.util.ArrayList; |
/** |
* @author Jorge Machado |
* @date 13/Nov/2009 |
* @time 12:22:38 |
* @email machadofisher@gmail.com |
*/ |
public class SruSourceDaoImpl extends SruSourceDao |
{ |
public static SruSourceDaoImpl getInstance() |
{ |
if (myInstance == null) |
myInstance = new SruSourceDaoImpl(); |
return (SruSourceDaoImpl) myInstance; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java |
---|
34,6 → 34,12 |
return (CourseImpl) createCriteria().add(eq("code", code)).uniqueResult(); |
} |
public CourseImpl findCourseByCodeAndYear(String code, String year) |
{ |
return (CourseImpl) createCriteria().add(eq("code", code)).add(eq("importYear", year)).uniqueResult(); |
} |
public int countCoursesActualYear(String query, SearchTypeEnum searchType) |
{ |
Criterion c = DaoUtils.createSearchQuery(query, searchType, "name", "description"); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/SruSourceCollectionDaoImpl.java |
---|
New file |
0,0 → 1,27 |
package pt.estgp.estgweb.domain.dao.impl; |
import pt.estgp.estgweb.domain.SruSource; |
import pt.estgp.estgweb.domain.GenericUser; |
import pt.estgp.estgweb.utils.RoleManager; |
import java.util.List; |
import java.util.ArrayList; |
import org.hibernate.Criteria; |
/** |
* @author Jorge Machado |
* @date 13/Nov/2009 |
* @time 12:22:38 |
* @email machadofisher@gmail.com |
*/ |
public class SruSourceCollectionDaoImpl extends SruSourceCollectionDao |
{ |
public static SruSourceCollectionDaoImpl getInstance() |
{ |
if (myInstance == null) |
myInstance = new SruSourceCollectionDaoImpl(); |
return (SruSourceCollectionDaoImpl) myInstance; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java |
---|
187,4 → 187,14 |
{ |
return RepositoryFileVersionDaoImpl.getInstance(); |
} |
public static SruSourceDaoImpl getSruSourceDaoImpl() |
{ |
return SruSourceDaoImpl.getInstance(); |
} |
public static SruSourceCollectionDaoImpl getSruSourceCollectionDaoImpl() |
{ |
return SruSourceCollectionDaoImpl.getInstance(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/SruSourceCollectionImpl.java |
---|
New file |
0,0 → 1,17 |
package pt.estgp.estgweb.domain; |
import java.io.Serializable; |
/** |
* @author Jorge Machado |
* @date 13/Nov/2009 |
* @time 12:20:53 |
* @email machadofisher@gmail.com |
*/ |
public class SruSourceCollectionImpl extends SruSourceCollection |
{ |
public Serializable getSerializable() |
{ |
return getId(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/SruSourceImpl.java |
---|
New file |
0,0 → 1,17 |
package pt.estgp.estgweb.domain; |
import java.io.Serializable; |
/** |
* @author Jorge Machado |
* @date 13/Nov/2009 |
* @time 12:20:53 |
* @email machadofisher@gmail.com |
*/ |
public class SruSourceImpl extends SruSource |
{ |
public Serializable getSerializable() |
{ |
return getId(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/SruSourceCollectionView.java |
---|
New file |
0,0 → 1,124 |
package pt.estgp.estgweb.domain.views; |
import pt.estgp.estgweb.domain.SruSourceCollection; |
import pt.estgp.estgweb.utils.RoleManager; |
import java.io.Serializable; |
import java.util.*; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
* @time 19:34:49 |
* @see pt.estgp.estgweb.domain.views |
*/ |
public class SruSourceCollectionView extends DomainObjectView |
{ |
// private static final Logger logger = Logger.getLogger(SruSourceCollectionView.class); |
private long id; |
private Date updateDate; |
private Date saveDate; |
private String collection; |
private String admitedRoles; |
private SruSourceView sruSourceView; |
public Class getReferenceClass() |
{ |
return SruSourceCollection.class; |
} |
public Serializable getSerializable() |
{ |
return id; |
} |
public SruSourceCollectionView() { |
} |
public SruSourceCollectionView(SruSourceCollection sruSourceCollection, SruSourceView sruSourceView) |
{ |
super(sruSourceCollection); |
init(sruSourceCollection,sruSourceView); |
} |
private void init(SruSourceCollection sruSourceCollection,SruSourceView sruSourceView) |
{ |
this.id = sruSourceCollection.getId(); |
this.collection = sruSourceCollection.getCollection(); |
this.saveDate = sruSourceCollection.getSaveDate(); |
this.updateDate = sruSourceCollection.getUpdateDate(); |
this.admitedRoles = sruSourceCollection.getAdmitedRoles(); |
this.sruSourceView = sruSourceView; |
} |
public void persistViewInObject(SruSourceCollection c) |
{ |
c.setAdmitedRoles(admitedRoles); |
c.setCollection(collection); |
} |
public long getId() |
{ |
return id; |
} |
public void setId(long id) |
{ |
this.id = id; |
} |
public Date getUpdateDate() { |
return updateDate; |
} |
public void setUpdateDate(Date updateDate) { |
this.updateDate = updateDate; |
} |
public Date getSaveDate() { |
return saveDate; |
} |
public void setSaveDate(Date saveDate) { |
this.saveDate = saveDate; |
} |
public String getCollection() { |
return collection; |
} |
public void setCollection(String collection) { |
this.collection = collection; |
} |
public String getAdmitedRoles() { |
return admitedRoles; |
} |
public void setAdmitedRoles(String admitedRoles) { |
this.admitedRoles = admitedRoles; |
} |
public SruSourceView getSruSourceView() { |
return sruSourceView; |
} |
public void setSruSourceView(SruSourceView sruSourceView) { |
this.sruSourceView = sruSourceView; |
} |
public List<String> getAdmitedRolesSet() |
{ |
if(admitedRoles != null && admitedRoles.trim().length() > 0) |
return RoleManager.getRolesFromSerial(admitedRoles); |
else |
return new ArrayList<String>(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/SruSourceView.java |
---|
New file |
0,0 → 1,166 |
package pt.estgp.estgweb.domain.views; |
import pt.estgp.estgweb.domain.Course; |
import pt.estgp.estgweb.domain.SruSource; |
import pt.estgp.estgweb.domain.SruSourceCollection; |
import java.io.Serializable; |
import java.util.*; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
* @time 19:34:49 |
* @see pt.estgp.estgweb.domain.views |
*/ |
public class SruSourceView extends DomainObjectView |
{ |
// private static final Logger logger = Logger.getLogger(SruSourceView.class); |
private long id; |
private Date updateDate; |
private Date saveDate; |
private String name; |
private String collectionField; |
private String description; |
private String url; |
private String metadataSchema; |
private UserView creator; |
private List<SruSourceCollectionView> collections = new ArrayList<SruSourceCollectionView>(); |
public Class getReferenceClass() |
{ |
return SruSource.class; |
} |
public Serializable getSerializable() |
{ |
return id; |
} |
public SruSourceView() |
{ |
} |
public SruSourceView(SruSource sruSource, Collection<SruSourceCollection> collections) |
{ |
super(sruSource); |
init(sruSource,collections); |
} |
private void init(SruSource sruSource, Collection<SruSourceCollection> collections) |
{ |
this.id = sruSource.getId(); |
this.saveDate = sruSource.getSaveDate(); |
this.updateDate = sruSource.getUpdateDate(); |
this.name = sruSource.getName(); |
this.collectionField = sruSource.getCollectionField(); |
this.description = sruSource.getDescription(); |
this.metadataSchema = sruSource.getMetadataSchema(); |
this.creator = new UserView(sruSource.getCreator()); |
this.collections = new ArrayList<SruSourceCollectionView>(); |
this.url = sruSource.getUrl(); |
for(SruSourceCollection collection: collections) |
{ |
SruSourceCollectionView sruSourceCollectionView = new SruSourceCollectionView(collection,this); |
this.collections.add(sruSourceCollectionView); |
} |
} |
public void persistViewInObject(SruSource s) |
{ |
s.setDescription(description); |
s.setMetadataSchema(metadataSchema); |
s.setCollectionField(collectionField); |
s.setName(name); |
s.setUrl(url); |
} |
public long getId() |
{ |
return id; |
} |
public void setId(long id) |
{ |
this.id = id; |
} |
public Date getUpdateDate() { |
return updateDate; |
} |
public void setUpdateDate(Date updateDate) { |
this.updateDate = updateDate; |
} |
public Date getSaveDate() { |
return saveDate; |
} |
public void setSaveDate(Date saveDate) { |
this.saveDate = saveDate; |
} |
public String getName() { |
return name; |
} |
public void setName(String name) { |
this.name = name; |
} |
public String getCollectionField() { |
return collectionField; |
} |
public void setCollectionField(String collectionField) { |
this.collectionField = collectionField; |
} |
public String getDescription() { |
return description; |
} |
public void setDescription(String description) { |
this.description = description; |
} |
public String getUrl() { |
return url; |
} |
public void setUrl(String url) { |
this.url = url; |
} |
public String getMetadataSchema() { |
return metadataSchema; |
} |
public void setMetadataSchema(String metadataSchema) { |
this.metadataSchema = metadataSchema; |
} |
public UserView getCreator() { |
return creator; |
} |
public void setCreator(UserView creator) { |
this.creator = creator; |
} |
public List<SruSourceCollectionView> getCollections() { |
return collections; |
} |
public void setCollections(List<SruSourceCollectionView> collections) { |
this.collections = collections; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/UrlStatImpl.java |
---|
36,17 → 36,17 |
getYears().add(urlStatYear); |
} |
public String getName() |
{ |
if(super.getName() == null) |
try |
{ |
return URIUtil.decode(getRelativePath()); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
} |
return super.getName(); |
} |
// public String getName() |
// { |
// if(super.getName() == null) |
// try |
// { |
// return URIUtil.decode(getRelativePath(),"ISO-8859-1"); |
// } |
// catch (URIException e) |
// { |
// logger.error(e,e); |
// } |
// return super.getName(); |
// } |
} |
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java |
---|
200,4 → 200,12 |
{ |
return new RepositoryFileVersionImpl(); |
} |
public static SruSourceImpl createSruSourceImpl() { |
return new SruSourceImpl(); |
} |
public static SruSourceCollectionImpl createSruSourceCollectionImpl() { |
return new SruSourceCollectionImpl(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/filters/filters/CanAddAnnouncementInCourseUnit.java |
---|
New file |
0,0 → 1,52 |
package pt.estgp.estgweb.filters.filters; |
import pt.estgp.estgweb.filters.chains.LoadControlFilter; |
import pt.estgp.estgweb.filters.exceptions.NeedAuthenticationException; |
import pt.estgp.estgweb.filters.exceptions.AccessDeniedOperationException; |
import pt.estgp.estgweb.filters.filters.utils.LoadObjectFromParameters; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.UserImpl; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.ReflectionBean; |
import pt.utl.ist.berserk.ServiceRequest; |
import pt.utl.ist.berserk.ServiceResponse; |
import pt.utl.ist.berserk.logic.filterManager.FilterParameters; |
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterException; |
import org.apache.log4j.Logger; |
import java.io.Serializable; |
public class CanAddAnnouncementInCourseUnit extends LoadControlFilter |
{ |
private static final Logger logger = Logger.getLogger(CanAddAnnouncementInCourseUnit.class); |
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception |
{ |
UserSession userSession = (UserSession) request.getServiceParameters().getParameter(Globals.USER_SESSION_KEY); |
if(userSession.getUser() == null) |
{ |
logger.info("try access restricted area:" + request.getRequester()); |
throw new NeedAuthenticationException(); |
} |
if(userSession.getUser().isSuperuser()) |
return; |
ReflectionBean serializableBean = new ReflectionBean((String) filterParameters.parametersArray()[0]); |
Object serializableObjectContainer = request.getServiceParameters().getParameter(serializableBean.getName()); |
Serializable serializable = (Serializable) serializableBean.invoke(serializableObjectContainer); |
if(serializable != null && serializable instanceof Long && ((Long)serializable).intValue() > 0) |
{ |
CourseUnit courseUnit = (CourseUnit) LoadObjectFromParameters.loadObjectFromClassName(CourseUnit.class.getName(),filterParameters,request.getServiceParameters()); |
if(!((UserImpl)userSession.getUser()).isTeacherOfCourseUnit(courseUnit.getId(),true)) |
{ |
logger.warn(userSession.getUser().getUsername() + ": try access restricted area"); |
throw new AccessDeniedOperationException("fail.owner"); |
} |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/form/srusource/SruSourceForm.java |
---|
New file |
0,0 → 1,100 |
package pt.estgp.estgweb.web.form.srusource; |
import pt.estgp.estgweb.web.form.AddRolesForm; |
import pt.estgp.estgweb.web.utils.DatesUtils; |
import pt.estgp.estgweb.domain.views.RecordView; |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.domain.views.SruSourceCollectionView; |
import org.apache.struts.upload.FormFile; |
import org.apache.struts.action.ActionErrors; |
import javax.servlet.http.HttpServletRequest; |
import java.util.List; |
import java.util.ArrayList; |
/** |
* @author Fabio |
* @date 30/Abr/2008 |
* @time 17:18:57 |
* @see pt.estgp.estgweb.web.form.profile |
*/ |
public class SruSourceForm extends AddRolesForm { |
private SruSourceView sruSourceView = new SruSourceView(); |
private SruSourceCollectionView sruSourceCollectionView = new SruSourceCollectionView(); |
public SruSourceForm() |
{ |
sruSourceView = new SruSourceView(); |
} |
public SruSourceForm(SruSourceView sruSourceView) |
{ |
this.sruSourceView = sruSourceView; |
} |
public void reset(org.apache.struts.action.ActionMapping actionMapping, HttpServletRequest request) |
{ |
if(request.getParameter("collectionSize") != null) |
{ |
int size = Integer.parseInt(request.getParameter("collectionSize")); |
sruSourceView.setCollections(new ArrayList<SruSourceCollectionView>()); |
for(int i = 0;i < size;i++) |
sruSourceView.getCollections().add(new SruSourceCollectionView()); |
} |
} |
public SruSourceView getSruSourceView() { |
return sruSourceView; |
} |
public void setSruSourceView(SruSourceView sruSourceView) { |
this.sruSourceView = sruSourceView; |
} |
public SruSourceCollectionView getSruSourceCollectionView() { |
return sruSourceCollectionView; |
} |
public void setSruSourceCollectionView(SruSourceCollectionView sruSourceCollectionView) { |
this.sruSourceCollectionView = sruSourceCollectionView; |
} |
public ActionErrors validate(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest) |
{ |
ActionErrors errors = new ActionErrors(); |
if(sruSourceView.getName() == null || sruSourceView.getName().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","name"); |
} |
if(sruSourceView.getUrl() == null || sruSourceView.getUrl().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","url"); |
} |
if(sruSourceView.getCollectionField() == null || sruSourceView.getCollectionField().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","srusource.collectionField"); |
} |
return errors; |
} |
public ActionErrors validateCollection(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest) |
{ |
ActionErrors errors = new ActionErrors(); |
if(sruSourceCollectionView.getCollection() == null || sruSourceCollectionView.getCollection().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","srusource.collection"); |
} |
if(sruSourceCollectionView.getAdmitedRoles() == null) |
{ |
sruSourceCollectionView.setAdmitedRoles(""); |
} |
return errors; |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java |
---|
9,6 → 9,7 |
import pt.estgp.estgweb.filters.exceptions.NotFoundException; |
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses; |
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsController; |
import pt.estgp.estgweb.web.exceptions.NoCookiesException; |
import pt.estgp.estgweb.web.form.courses.CourseForm; |
164,6 → 165,20 |
addMessage(request,"course.created.success","" + cV.getCode()); |
return mapping.getInputForward(); |
} |
catch (AlreadyExistsException e) |
{ |
addErrorWithKeys(request,"course.exists",e.getMessage()); |
try |
{ |
load((CourseForm) form,request,response); |
return mapping.findForward("submit"); |
} |
catch (Throwable throwable) |
{ |
logger.error(e, e); |
return mapping.findForward("error500"); |
} |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
/impl/src/java/pt/estgp/estgweb/web/controllers/srusource/SruSourceController.java |
---|
New file |
0,0 → 1,346 |
package pt.estgp.estgweb.web.controllers.srusource; |
import pt.estgp.estgweb.web.controllers.AddRolesController; |
import pt.estgp.estgweb.web.controllers.profile.ProfileController; |
import pt.estgp.estgweb.web.form.AddRolesForm; |
import pt.estgp.estgweb.web.form.srusource.SruSourceForm; |
import pt.estgp.estgweb.web.form.profile.ProfileForm; |
import pt.estgp.estgweb.web.UserSessionProxy; |
import pt.estgp.estgweb.web.exceptions.NoCookiesException; |
import pt.estgp.estgweb.web.utils.RequestUtils; |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.domain.views.RecordView; |
import pt.estgp.estgweb.domain.views.SruSourceView; |
import pt.estgp.estgweb.domain.views.SruSourceCollectionView; |
import pt.estgp.estgweb.domain.UserSessionImpl; |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.SruSource; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.RoleManager; |
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.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 org.apache.log4j.Logger; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionErrors; |
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.HashSet; |
import java.io.Serializable; |
/** |
* @author Jorge Machado |
* @date 26/Fev/2008 |
* @time 18:01:54 |
* @see pt.estgp.estgweb.web |
*/ |
public class SruSourceController extends AddRolesController { |
private static final Logger logger = Logger.getLogger(SruSourceController.class); |
private static final String TARGET_ROLES_KEY = AddRolesForm.TARGET_ROLES_KEY; |
public ActionForward editSruSource(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException { |
SruSourceForm sruSourceForm = (SruSourceForm) form; |
ActionErrors errors = sruSourceForm.validate(mapping, request); |
if (!errors.isEmpty()) |
{ |
// if(sruSourceForm.getSruSourceView().getId() > 0) |
// { |
// SruSourceView sruSourceView = loadSruSource(sruSourceForm.getSruSourceView().getId(), request, response); |
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
// sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY)); |
// } |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY)); |
saveMessages(request, errors); |
return mapping.getInputForward(); |
} |
SruSourceView sruSourceView = sruSourceForm.getSruSourceView(); |
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new Object[]{sruSourceView}; |
boolean isNew=false; |
if(sruSourceView.getId()<=0 ) |
isNew = true; |
sruSourceView = (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "SubmitSruSource", args, names); |
if(isNew) |
addMessage(request, "srusource.created.success"); |
else |
addMessage(request, "srusource.edited.success"); |
// UserView userView = profileForm.getUserView(); |
// try |
// { |
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
// userView.setUserRoles((List<String>) userSession.get(TARGET_ROLES_KEY)); |
// IServiceManager sm = ServiceManager.getInstance(); |
// String[] names = new String[]{"object"}; |
// Object[] args = new Object[]{userView, profileForm.getTypeClass()}; |
// try |
// { |
// userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "SubmitUser", args, names); |
// } |
// catch (AlreadyExistsException e) |
// { |
// if(profileForm.getUserView().getId() > 0) |
// { |
// UserView uV = loadUser(profileForm.getUserView().getId(), request, response); |
// profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal()); |
// } |
// addErrorWithKeys(request,"user.exists",e.getMessage()); |
// return mapping.getInputForward(); |
// } |
// profileForm.setUserView(userView); |
// if (userSession.getUser().getId() == userView.getId()) |
// { |
// userSession.setUser(userView.getUser()); |
// request.setAttribute(Globals.USER_SESSION_KEY, userSession); |
// logger.info("Puting new user info in session:" + userView.getId()); |
// } |
// addMessage(request, "profile.edited.sucess"); |
return mapping.findForward("success"); |
// } |
// catch (FilterChainFailedException e) |
// { |
// return mapping.findForward("error401"); |
// } |
// catch (Throwable e) |
// { |
// logger.error(e, e); |
// throw e; |
// } |
} |
public ActionForward addSruSourceCollection(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException { |
SruSourceForm sruSourceForm = (SruSourceForm) form; |
ActionErrors errors = sruSourceForm.validateCollection(mapping, request); |
if (!errors.isEmpty()) |
{ |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY)); |
saveMessages(request, errors); |
return mapping.getInputForward(); |
} |
SruSourceView sruSourceView = sruSourceForm.getSruSourceView(); |
if(sruSourceView.getCollections() == null) |
sruSourceView.setCollections(new ArrayList<SruSourceCollectionView>()); |
SruSourceCollectionView collectionView = sruSourceForm.getSruSourceCollectionView(); |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
collectionView.setAdmitedRoles(RoleManager.getSerialRoles((List<String>) userSession.get(TARGET_ROLES_KEY))); |
userSession.remove(TARGET_ROLES_KEY); |
userSession.serialize(request,response); |
sruSourceView.getCollections().add(collectionView); |
sruSourceForm.setSruSourceCollectionView(new SruSourceCollectionView()); |
return mapping.getInputForward(); |
} |
public ActionForward newSruSource(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
{ |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
userSession.put(TARGET_ROLES_KEY,new ArrayList<String>()); |
userSession.serialize(request, response); |
return mapping.findForward("sruSourceData"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
private SruSourceView loadSruSource(long id, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException { |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args = new Object[]{id}; |
SruSourceView sruSourceView = (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSourceById", args, names); |
return sruSourceView; |
} |
public ActionForward delete(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args = new Object[]{new Long(request.getParameter("id"))}; |
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteUser", args, names); |
if (status) |
{ |
addMessage(request, "user.deleted.sucess"); |
return mapping.findForward("success"); |
} |
else |
{ |
addMessage(request, "user.deleted.fail"); |
return mapping.findForward("success"); |
} |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward createRecord(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
{ |
ProfileForm profileForm = (ProfileForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"object"}; |
Object[] args; |
if (profileForm.getUploadFile() != null) |
args = new Object[]{profileForm.getRecordView(), profileForm.getUploadFile().getInputStream(), profileForm.getUploadFile().getFileName(), profileForm.getUploadFile().getContentType(), profileForm.getUploadFile().getFileSize()}; |
else |
args = new Object[]{profileForm.getRecordView(), null, null, null, 0}; |
boolean newRecord = false; |
if(profileForm.getRecordView().getId() <= 0) |
newRecord = true; |
UserView userView; |
if (profileForm.getRecordView().getId() > 0) |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "EditUserProfileRecord", args, names); |
else |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "CreateUserProfileRecord", args, names); |
if(newRecord) |
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle()); |
else |
addMessage(request, "profile.record.updated.sucess", profileForm.getRecordView().getTitle()); |
profileForm.setUserView(userView); |
return mapping.findForward("home"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward deleteRecord(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
{ |
ProfileForm profileForm = (ProfileForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args; |
args = new Object[]{profileForm.getRecordView().getId()}; |
UserView userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "DeleteUserProfileRecord", args, names); |
addMessage(request, "profile.record.deleted.sucess"); |
profileForm.setUserView(userView); |
return mapping.findForward("home"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward loadEditRecord(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
{ |
ProfileForm profileForm = (ProfileForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args; |
args = new Object[]{profileForm.getRecordView().getId()}; |
RecordView recordView = (RecordView) sm.execute(RequestUtils.getRequester(request, response), "LoadEditUserProfileRecord", args, names); |
UserView uV = recordView.getOwnerUserView(); |
// addMessage(request, "profile.record.deleted.sucess"); |
profileForm.setUserView(uV); |
profileForm.setRecordView(recordView); |
return mapping.findForward("curriculum"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/filters/UrlStatFilter.java |
---|
21,6 → 21,7 |
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException; |
import pt.utl.ist.berserk.logic.filterManager.exceptions.*; |
import jomm.utils.MyCalendar; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
121,14 → 122,18 |
} |
} |
logger.info("accessing " + relativePath); |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
logger.info("coded to " + relativePath); |
if (userSession != null) |
{ |
if (userSession.get(relativePath) != null) |
String relativePathDigest = BytesUtils.getMD5(relativePath); |
if (userSession.get(relativePathDigest) != null) |
{ |
chain.doFilter(request, response); |
return; |
} |
userSession.put(relativePath, ""); |
userSession.put(relativePathDigest, ""); |
try |
{ |
userSession.serialize(hrequest, (HttpServletResponse) response); |
140,10 → 145,8 |
return; |
} |
} |
logger.info("accessing " + relativePath); |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
logger.info("coded to " + relativePath); |
IntegerContainer count = urlStat.get(relativePath); |
if (count == null) |
/impl/src/doc/bacoCandidaturaBoasPraticas.doc |
---|
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/estgweb.eap |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/impl/src/doc/baco.ppt |
---|
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/Programas0910.doc |
---|
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/updates/db/update4.sql |
---|
New file |
0,0 → 1,0 |
ALTER TABLE `urlstat` MODIFY COLUMN `name` TEXT DEFAULT NULL; |
/impl/src/updates/db/update5.sql |
---|
New file |
0,0 → 1,30 |
DROP TABLE IF EXISTS `sru_source`; |
CREATE TABLE `sru_source` ( |
`id` bigint(20) NOT NULL auto_increment, |
`discrimitator` varchar(255) NOT NULL, |
`updateDate` datetime NOT NULL, |
`saveDate` datetime default NULL, |
`name` varchar(255) default NULL, |
`collection_field` varchar(255) default NULL, |
`description` text, |
`url` varchar(255) default NULL, |
`metadata_schema` varchar(255) default NULL, |
`creator` bigint(20) default NULL, |
PRIMARY KEY (`id`), |
KEY `creatorFK` (`creator`), |
CONSTRAINT `creatorFK` FOREIGN KEY (`creator`) REFERENCES `user` (`id`) |
) ENGINE=Innodb DEFAULT CHARSET=latin1; |
DROP TABLE IF EXISTS `sru_source_collection`; |
CREATE TABLE `sru_source_collection` ( |
`id` bigint(20) NOT NULL auto_increment, |
`discrimitator` varchar(255) NOT NULL, |
`updateDate` datetime NOT NULL, |
`saveDate` datetime default NULL, |
`collection` varchar(255) default NULL, |
`admited_roles` varchar(255) default NULL, |
`sru_source_id` bigint(20) default NULL, |
PRIMARY KEY (`id`), |
KEY `sru_sourceFK` (`sru_source_id`), |
CONSTRAINT `sru_sourceFK` FOREIGN KEY (`sru_source_id`) REFERENCES `sru_source` (`id`) |
) ENGINE=Innodb DEFAULT CHARSET=latin1; |
/impl/src/hbm/pt/estgp/estgweb/domain/SruSource.hbm.xml |
---|
New file |
0,0 → 1,44 |
<?xml version="1.0"?> |
<!DOCTYPE hibernate-mapping |
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" |
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> |
<hibernate-mapping> |
<class name="pt.estgp.estgweb.domain.SruSource" table="sru_source" abstract="true"> |
<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta> |
<meta attribute="scope-class">public abstract</meta> |
<id name="id" type="long"> |
<generator class="native"/> |
</id> |
<discriminator column="discrimitator"/> |
<timestamp name="updateDate" unsaved-value="null"/> |
<property name="saveDate" type="timestamp"/> |
<property name="name" type="string"/> |
<property name="collectionField" column="collection_field" type="string"/> |
<property name="description" type="text"/> |
<property name="url" type="string"/> |
<property name="metadataSchema" type="string" column="metadata_schema"/> |
<many-to-one name="creator" class="pt.estgp.estgweb.domain.User" outer-join="false" lazy="proxy"/> |
<set name="collections" order-by="collection asc" lazy="true" cascade="delete"> |
<key column="sru_source_id"/> |
<one-to-many class="pt.estgp.estgweb.domain.SruSourceCollection"/> |
</set> |
<subclass name="pt.estgp.estgweb.domain.SruSourceImpl" discriminator-value="SruSourceImpl"/> |
</class> |
<class name="pt.estgp.estgweb.domain.SruSourceCollection" table="sru_source_collection" abstract="true"> |
<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta> |
<meta attribute="scope-class">public abstract</meta> |
<id name="id" type="long"> |
<generator class="native"/> |
</id> |
<discriminator column="discrimitator"/> |
<timestamp name="updateDate" unsaved-value="null"/> |
<property name="saveDate" type="timestamp"/> |
<property name="collection" type="string"/> |
<property name="admitedRoles" type="string" column="admited_roles"/> |
<many-to-one name="sruSource" column="sru_source_id" class="pt.estgp.estgweb.domain.SruSource" outer-join="false" lazy="proxy"/> |
<subclass name="pt.estgp.estgweb.domain.SruSourceCollectionImpl" discriminator-value="SruSourceCollectionImpl"/> |
</class> |
</hibernate-mapping> |
/impl/src/hbm/pt/estgp/estgweb/domain/UrlStat.hbm.xml |
---|
13,7 → 13,7 |
<discriminator column="discrimitator"/> |
<timestamp name="updateDate" unsaved-value="null"/> |
<property name="saveDate" type="timestamp"/> |
<property name="name" type="string"/> |
<property name="name" type="text"/> |
<property name="description" type="text"/> |
<property name="totalClicks" type="integer"/> |
<property name="status" type="boolean"/> |
/impl/src/web/auth/logoutok.jsp |
---|
1,13 → 1,9 |
<%-- |
Created by IntelliJ IDEA. |
User: User |
Date: 28/Fev/2008 |
Time: 20:16:38 |
To change this template use File | Settings | File Templates. |
--%> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jomm:beanArgMessage patternMessage="logout.ok" argName0="name"/> |
<div class="seccao"> |
<p class="statusOK"> |
<jomm:beanArgMessage patternMessage="logout.ok" argName0="name"/> |
</p> |
</div> |
/impl/src/web/admin/courses/course.jsp |
---|
8,6 → 8,8 |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
<jsp:useBean id="CourseView" type="pt.estgp.estgweb.domain.views.CourseView" scope="request"/> |
<html:errors/> |
<jomm:messages/> |
<html:form action="/user/courseControllerFromServiceZone" enctype="multipart/form-data"> |
<input type="hidden" name="dispatch" value="submit"/> |
<html:hidden property="courseView.id"/> |
/impl/src/web/admin/srusource/sruSourceData.jsp |
---|
New file |
0,0 → 1,166 |
<%@ page import="java.util.List" %> |
<%@ page import="pt.estgp.estgweb.web.form.srusource.SruSourceForm" %> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<div id="contentIntranet"> |
<div id="contentPane"> |
<jomm:messages/> |
<html:errors/> |
<html:form action="/user/sruSourceFromServiceZone"> |
<input type="hidden" name="dispatch" value="editSruSource"> |
<html:hidden property="sruSourceView.id"/> |
<html:hidden property="role"/> |
<input type="hidden" name="collectionSize" value="<%=((SruSourceForm)request.getAttribute("SruSourceForm")).getSruSourceView().getCollections().size()%>"> |
<table class="form"> |
<baco:isAdmin> |
<tr> |
<th> |
<bean:message key="srusource.name"/> |
</th> |
<td> |
<html:text styleClass="text" property="sruSourceView.name" maxlength="250"/> |
</td> |
</tr> |
<tr> |
<th> |
<bean:message key="srusource.description"/> |
</th> |
<td> |
<html:text styleClass="text" property="sruSourceView.description" maxlength="250"/> |
</td> |
</tr> |
<tr> |
<th> |
<bean:message key="srusource.url"/> |
</th> |
<td> |
<html:text styleClass="text" property="sruSourceView.url" maxlength="250"/> |
</td> |
</tr> |
<tr> |
<th> |
<bean:message key="srusource.collectionField"/> |
</th> |
<td> |
<html:text styleClass="text" property="sruSourceView.collectionField" maxlength="250"/> |
</td> |
</tr> |
<tr> |
<th> |
<bean:message key="srusource.metadataSchema"/> |
</th> |
<td> |
<html:select property="sruSourceView.metadataSchema"> |
<html:option value="files"><bean:message key="srusource.metadataSchema.files"/></html:option> |
</html:select> |
</td> |
</tr> |
<tr> |
<th><bean:message key="srusource.collections"/></th> |
<td> |
<table class="dataTable"> |
<logic:notEmpty name="SruSourceForm" property="sruSourceView.collections"> |
<tr> |
<th><bean:message key="srusource.collection"/></th> |
<th><bean:message key="srusource.admited.roles"/></th> |
</tr> |
<nested:iterate id="collectionView" name="SruSourceForm" property="sruSourceView.collections" > |
<tr> |
<td><bean:write name="collectionView" property="collection"/></td> |
<td> |
<nested:hidden property="id"/> |
<nested:hidden property="collection"/> |
<nested:hidden property="admitedRoles"/> |
<nested:notEmpty name="collectionView" property="admitedRolesSet"> |
<nested:iterate id="admitedRole" name="collectionView" property="admitedRolesSet"> |
<bean:message key="user.role.${admitedRole}"/>, |
</nested:iterate> |
</nested:notEmpty> |
</td> |
</tr> |
</nested:iterate> |
</logic:notEmpty> |
<logic:empty name="SruSourceForm" property="sruSourceView.collections"> |
<tr> |
<td colspan="2"> |
<bean:message key="srusource.zero.collections"/> |
</td> |
</tr> |
</logic:empty> |
</table> |
<table style="border:1px solid black"> |
<tr> |
<th colspan="2"><bean:message key="srusource.new.collection"/></th> |
</tr> |
<tr> |
<th><bean:message key="srusource.collection"/></th> |
<td><html:text property="sruSourceCollectionView.collection"/></td> |
</tr> |
<tr> |
<th> |
<bean:message key="srusource.admited.roles"/> |
</th> |
<td> |
<html:select property="targetRolesStr"> |
<logic:present name="SruSourceForm" property="targetRoles"> |
<logic:iterate id="item" name="SruSourceForm" property="targetRoles"> |
<jomm:option itemName="item" comparableObjectName="SruSourceForm" |
comparableObjectProperty="targetRolesStr"> |
<jomm:message patternMessage="user.role.{0}" name0="item"/> |
</jomm:option> |
</logic:iterate> |
<input type="button" value="<bean:message key="add"/>" |
onclick="set(this.form,'addRole');this.form.submit();"> |
</logic:present> |
</html:select> |
<logic:present name="SruSourceForm" property="selectedRoles"> |
<logic:notEmpty name="SruSourceForm" property="selectedRoles"> |
<table class="dataTable removeButton"> |
<logic:iterate id="item" name="SruSourceForm" property="selectedRoles"> |
<tr> |
<th> |
<jomm:message patternMessage="user.role.{0}" name0="item"/> |
</th> |
<td> |
<input type="button" class="removeButton" value="" |
onclick="SruSourceForm.role.value='${item}';set(this.form,'removeRole');this.form.submit();"> |
</td> |
</tr> |
</logic:iterate> |
</table> |
</logic:notEmpty> |
</logic:present> |
</td> |
</tr> |
<tr> |
<td colspan="2"> |
<input type="button" onclick="set(this.form,'addSruSourceCollection');this.form.submit()" value="<bean:message key="srusource.collection.add"/>"/> |
</td> |
</tr> |
</table> |
</td> |
</tr> |
</baco:isAdmin> |
<tr class="buttons"> |
<td colspan="2"> |
<input type="button" onclick="set(this.form,'editSruSource');this.form.submit()" |
value="<bean:message key="confirm"/>"/> |
</td> |
</tr> |
</table> |
</html:form> |
</div> |
</div> |
/impl/src/web/css/style.css |
---|
881,11 → 881,23 |
text-align:justify; |
} |
#flashBottomNews .flashNew{ |
height:230px; |
} |
.flashNew |
{ |
width:100%; |
} |
.flashNew th |
{ |
vertical-align:top; |
} |
.flashNew td |
{ |
background-color: #D3D3D3; |
/impl/src/web/js/ajax.js |
---|
494,10 → 494,10 |
} |
else |
{ |
var copiasImpressasPreto = pretoTr.getElementsByTagName('td')[1].textContent; |
var copiasDisponiveisPreto = pretoTr.getElementsByTagName('td')[2].textContent; |
var copiasImpressasCor = corTr.getElementsByTagName('td')[1].textContent; |
var copiasDisponiveisCor = corTr.getElementsByTagName('td')[2].textContent; |
var copiasImpressasPreto = pretoTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
var copiasDisponiveisPreto = pretoTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
var copiasImpressasCor = corTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
var copiasDisponiveisCor = corTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
var response = ""; |
response += "<table class=\"dataTable\">\n"; |
response += " <tr>\n"; |
/impl/src/web/user/courseunits/menu.jsp |
---|
45,7 → 45,7 |
<html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.home"/></html:link> |
</li> |
<baco:isInCourseUnit courseUnitId="${CourseUnitView.id}"> |
<baco:isTeacherOfCourseUnit courseUnitId="${CourseUnitView.id}"> |
<li> |
<html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.put.announcement"/></html:link> |
</li> |
55,7 → 55,7 |
<li> |
<a href="<%=request.getContextPath()%>${user}/startLoadCourseUnitWorks${fromAction}.do?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.assignements"/></a> |
</li> |
</baco:isInCourseUnit> |
</baco:isTeacherOfCourseUnit> |
<li> |
/impl/src/web/user/ftpclient/ftpclient.jsp |
---|
125,10 → 125,10 |
<tr class="dir"> |
<td colspan="3"> |
<a id="FTP_NODE_<%=++counter%>" style="display:none" href="javascript:if(confirmLink('<bean:message key="ftp.comfirm.delete" arg0="${i.name}"/>')){document.FormFtpManager.deleteFolder.value='<%=i.getName()%>';document.FormFtpManager.submit();}"><img border="0" src="<%=request.getContextPath()%>/imgs/delete.gif" alt="apagar"></a> |
<a id="FTP_NODE_<%=++counter%>" style="display:none" href="javascript:if(confirmLink('<bean:message key="ftp.comfirm.delete" arg0="${i.nameHtml}"/>')){document.FormFtpManager.deleteFolder.value='<%=i.getNameHtml()%>';document.FormFtpManager.submit();}"><img border="0" src="<%=request.getContextPath()%>/imgs/delete.gif" alt="apagar"></a> |
|
<img alt="<%=i.getCompleteUrl()%>" src="<%=request.getContextPath()%>/imgs/folder.gif"> <a |
href="<%=i.getName(request)%>"><%=i.getName()%> |
href="<%=i.getName(request)%>"><%=i.getNameEscapedHtml()%> |
</a> |
</td> |
</tr> |
212,8 → 212,7 |
<% |
} |
%> |
<a target="_blank" href="<%=i.getCompleteUrl()%>"><%=i.getName()%> |
</a> |
<a target="_blank" href="<%=i.getCompleteUrl()%>"><%=i.getName()%></a> |
</td> |
<td> |
/impl/src/web/user/home/student.jsp |
---|
8,13 → 8,13 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="portal"> |
<logic:notMatch value="StudentImpl" name="UserSession" property="user.class.name"> |
<ul> |
<li class="WARNING"> |
<logic:notMatch value="StudentImpl" name="UserSession" property="user.class.name"> |
<bean:message key="profile.bad.profile.student.iregular.user.class"/> |
</logic:notMatch> |
</li> |
</ul> |
</logic:notMatch> |
<table class="columnTable" width="100%"> |
<tbody> |
<tr> |
/impl/src/web/user/home/teacher.jsp |
---|
8,13 → 8,13 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="portal"> |
<logic:notMatch value="TeacherImpl" name="UserSession" property="user.class.name"> |
<ul> |
<li class="WARNING"> |
<logic:notMatch value="TeacherImpl" name="UserSession" property="user.class.name"> |
<bean:message key="profile.bad.profile.teacher.iregular.user.class"/> |
</logic:notMatch> |
<bean:message key="profile.bad.profile.teacher.iregular.user.class"/> |
</li> |
</ul> |
</logic:notMatch> |
<table class="columnTable" width="100%"> |
<tbody> |
<tr> |
35,7 → 35,7 |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS1" type="pt.estgp.estgweb.domain.CourseUnit"> |
<li> |
<html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name}</html:link> |
<html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name} (${unit.courseName} (${unit.courseCode}))</html:link> |
</li> |
</logic:iterate> |
</ul> |
/impl/src/web/user/serviceZone/serviceZone.jsp |
---|
210,6 → 210,18 |
</ul> |
</li> |
</baco:isModuleOn> |
<baco:isModuleOn module="srusource"> |
<li> |
<bean:message key="srusource"/> |
<ul> |
<li> |
<html:link target="_blank" action="/user/startNewSruSourceFromServiceZone"> |
<bean:message key="srusource.create.new"/> |
</html:link> |
</li> |
</ul> |
</li> |
</baco:isModuleOn> |
</baco:isAdmin> |
<baco:hasRole role="identifiersManager,identifiersCollectionCreator"> |
<baco:isModuleOn module="manageidentifiers"> |
/impl/src/web/user/serviceZone/topnavCreateSruSource.jsp |
---|
New file |
0,0 → 1,12 |
<%@page contentType="text/html"%> |
<%@page pageEncoding="UTF-8"%> |
<%@page import="java.util.*"%> |
<%@ page import="jomm.web.utils.NavPlace" %> |
<%@ page import="jomm.web.utils.NavPlaceServer" %> |
<%@ page import="jomm.web.utils.TopNav" %> |
<% |
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request); |
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back"); |
topNav.addNavPlace(null, "srusource.create.srusource"); |
%> |
<jsp:include page="/layout/topnav.jsp"/> |
/impl/src/web/user/pop/messages.jsp |
---|
16,7 → 16,10 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="pop"> |
<% |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new Object[]{}; |
25,17 → 28,35 |
if (popMessages == null) |
{ |
%> |
<p> |
<bean:message key="pop.not.configured"/> |
</p> |
<table class="messages"> |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
</th> |
</tr> |
<tr> |
<th> |
<bean:message key="pop.not.configured"/> |
</th> |
</tr> |
</table |
<% |
} |
else if (popMessages.size() == 0) |
{ |
%> |
<p> |
<bean:message key="pop.no.messages"/> |
</p> |
<table class="messages"> |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
</th> |
</tr> |
<tr> |
<th> |
<bean:message key="pop.no.messages"/> |
</th> |
</tr> |
</table> |
<% |
} |
else |
45,6 → 66,8 |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
<br> |
<bean:message key="pop.last.messages"/> |
</th> |
<%--<th>--%> |
<%--<bean:message key="pop.from"/>--%> |
112,5 → 135,12 |
</table> |
<% |
} |
} |
catch(Throwable e) |
{ |
%> |
<p><bean:message key="pop.danger.messages"/></p> |
<% |
} |
%> |
</div> |
/impl/etc/solr/conf.zip |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/etc/solr/telHandler.war |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/etc/solr/solrManager.zip |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/etc/todo/todo.txt |
---|
1,3 → 1,17 |
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
Novas Importacoes 200910 Problemas: |
- Importações Importar Anos Anteriores |
Notas |
Sumarios |
- Interface para aceder a cadeiras antigas |
- Programas em Falta de anos anteriores não mostra os cursos que transitaram de ano de importacao |
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
Questão da identificacao dos Noturnos |
Listagem de Programas |
- Ano > Curso > |
/impl/etc/systemDown/top.jpg |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/etc/systemDown/index.jsp |
---|
New file |
0,0 → 1,95 |
<%-- |
Created by IntelliJ IDEA. |
User: Jorge |
Date: 7/Mai/2009 |
Time: 11:43:05 |
To change this template use File | Settings | File Templates. |
--%> |
<%@ page contentType="text/html;charset=ISO-8859-1" language="java" %> |
<html> |
<head> |
<title>Sistema temporariamente em Manutenção</title> |
<style type="text/css"> |
<!-- |
#footer { |
HEIGHT: 50px; |
PADDING-TOP: 5px; |
} |
#footerStructure TABLE { |
BORDER-RIGHT: 0; |
BORDER-TOP: 0; |
RIGHT: 0; |
LEFT: 0; |
MARGIN: 0; |
BORDER-LEFT: 0; |
WIDTH: 100%; |
PADDING-TOP: 0; |
BORDER-BOTTOM: 0; |
TOP: 0; |
border-spacing: 0 |
} |
#footerStructure TABLE TD { |
VERTICAL-ALIGN: top |
} |
#license UL { |
COLOR: #4D4D4D; |
PADDING-RIGHT: 0; |
PADDING-LEFT: 0; |
FONT-SIZE: 12px; |
TEXT-ALIGN: center; |
MARGIN: 0; |
LIST-STYLE-TYPE: none; |
} |
#footer #organizations { |
} |
#footer #sponsors { |
} |
#footer a |
/*, #footer a:visited */ |
{ |
color: #4d4d4d; |
} |
#footer a:hover { |
color: #8EC73F; |
} |
--> |
</style> |
</head> |
<body> |
<img src="top.jpg" alt="ESTG"> |
<h1>O Sistema www.estgp.pt está temporariamente em Manutenção:</h1> |
<h2>Pedimos desculpa pelo incómodo que esta paragem lhe possa causar.</h2> |
<h2>Tipicamente este tipo de paragem leva apenas alguns minutos. Tentaremos ser breves.</h2> |
<h3>A administração - bacodev [AT] estgp [DOT] pt</h3> |
<div id="footerStructure"> |
<table> |
<tr> |
<td width="33%"> |
<div id="sponsors"> |
</div> |
</td> |
<td align="center" width="33%"> |
<div id="license"> |
<ul class="copyRightLink"> |
<li>Copyright © <a href="http://www.estgp.pt">ESTG</a> 2008</li> |
<!--<li>Contact ESTG Webmaster at (webmaster [AT] estgp [DOT] pt)</li>--> |
</ul> |
</div> |
</td> |
<td width="33%" align="right"> |
<div id="organizations"> |
</div> |
</td> |
</tr> |
</table> |
</div> |
</body> |
</html> |
/impl/etc/systemDown/WEB-INF/web.xml |
---|
New file |
0,0 → 1,8 |
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> |
<web-app> |
<welcome-file-list> |
<welcome-file>index.jsp</welcome-file> |
</welcome-file-list> |
</web-app> |
/impl/etc/systemDown/ROOT.war |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/build.xml |
---|
542,6 → 542,9 |
<target name="util.task.reset.urlsstats"> |
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
<target name="util.task.reset.urlsstats.digests"> |
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsServiceDigests" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
</project> |