Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 452 → Rev 465

/impl/conf/language/MessageResourcesSruSources.properties
New file
0,0 → 1,52
################################################################################
#
# 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 Colecção
 
srusource.collectionField=Indice da Colecção No SRU (se não souber coloque: collection)
 
srusource.create.new=Criar nova fonte SRU
srusource.choose.srusources=Escolha uma das Fontes SRU para editar
srusource.edit.srusources=Editar Fontes SRU
srusource.edit.srusource=Editar Fonte SRU
 
srusource.created.success=Fonte SRU criada com sucesso
srusource.edited.success=Fonte SRU editada com sucesso
 
srusource.deleted.sucess=Fonte de SRU apagada com sucesso
srusource.deleted.fail=Falhou a remoção da Fonte de SRU
 
srusource.confirm.delete=Tem a certeza que deseja apagar esta Fonte de SRU?
 
 
facet.facetType=Tipo
facet.facetLastModified=Ultima Modificação
facet.facetDir=Directorios
 
facet.facetType=Tipo
facet.facetLastModified=Ultima Modificação
facet.facetDir=Directorios
facet.year=Ano
facet.month=Ano.Mes
facet.year=Ano.Mes.Dia
facet.type=Tipo
facet.dir=Tipo
 
facets=Filtre por Facetas
/impl/conf/language/MessageResources.properties
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/language/MessageResourcesCourseUnits.properties
7,6 → 7,8
course={0} &gt
courseunit={0}
 
courseunit.menu.unit.old.units=Anos anteriores
courseunit.menu.unit.other.units=Outros Anos
courseunit.menu.unit=Unidade
courseunit.teachers=Corpo Docente
courseunit.objectives=Objectivos da Unidade
/impl/conf/WEB-INF/struts/struts-srusource.xml
New file
0,0 → 1,46
<?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>
 
<!--Mudar o perfil da area de servico pelo administrador-->
 
<action path="/user/startNewSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=newSruSource&amp;from=ServiceZone"/>
<action path="/user/startChooseSruSourceFromServiceZone" forward="page.load.srusources.from.service.zone"/>
<action path="/user/chooseSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=loadSruSource&amp;from=ServiceZone"/>
<action path="/user/deleteSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=delete&amp;from=ServiceZone"/>
deleteSruSourceFromServiceZone
<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="loadSruSources" path="page.load.srusources.from.service.zone"/>
<forward name="loadSruSource" path="page.choose.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,32
<?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>
<definition name="page.load.srusources.from.service.zone" extends="base.separators">
<put name="title" value="Choose Sru Source" />
<put name="separator" value="4" type="string" />
<put name="topnav" value="/user/serviceZone/topnavChooseSruSources.jsp"/>
<put name="body" value="/admin/srusource/chooseSruSource.jsp" />
</definition>
<definition name="page.choose.load.srusource.from.service.zone" extends="page.load.srusource.from.service.zone">
<put name="topnav" value="/user/serviceZone/topnavLoadSruSource.jsp"/>
</definition>
 
 
 
</tiles-definitions>
/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
#
/impl/conf/berserk/sd.xml
750,6 → 750,16
</filterChains>
</service>
<service>
<name>LoadCourseUnitsBySigesCodes</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitsBySigesCodesService</implementationClass>
<description>Load course old units</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
<service>
<name>LoadCourseUnitWorks</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CourseUnitWorkService</implementationClass>
<description>Load course unit works</description>
1404,12 → 1414,63
<!---->
 
 
 
 
<!--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>LoadSruSources</name>
<implementationClass>pt.estgp.estgweb.services.srusources.LoadSruSourcesService</implementationClass>
<description>Load all SruSources</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>
<service>
<name>DeleteSruSource</name>
<implementationClass>pt.estgp.estgweb.services.srusources.DeleteSruSourceService</implementationClass>
<description>Delete SruSource By ID</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
 
 
DeleteSruSource
 
 
 
 
 
 
 
</serviceDefinitions>
/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/services/courses/CoursesCommonServices.java
27,7 → 27,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class CoursesCommonServices implements IService, IModuleCommonServices
public class CoursesCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(CoursesCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitsCommonServices.java
26,7 → 26,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class CourseUnitsCommonServices implements IService, IModuleCommonServices
public class CourseUnitsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(CourseUnitsCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadCourseUnitsBySigesCodesService.java
New file
0,0 → 1,42
package pt.estgp.estgweb.services.courseunits;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitSummaryView;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.RepositoryFile;
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import org.apache.log4j.Logger;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 2:50:07
* @email machadofisher@gmail.com
*/
public class LoadCourseUnitsBySigesCodesService implements IService
{
private static final Logger logger = Logger.getLogger(LoadCourseUnitsBySigesCodesService.class);
 
public List<CourseUnitView> run(String code, String courseCode, UserSession userSession) throws ServiceException {
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodes(code, courseCode);
 
if(courseUnits == null || courseUnits.size() == 0)
return new ArrayList<CourseUnitView>();
List<CourseUnitView> courseUnitViews = new ArrayList<CourseUnitView>();
for(CourseUnit cU : courseUnits)
{
CourseUnitView cV = new CourseUnitView(cU);
courseUnitViews.add(cV);
}
return courseUnitViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/email/EmailCommonServices.java
16,7 → 16,7
* @date 22/Mai/2008
* @see pt.estgp.estgweb.services.email
*/
public class EmailCommonServices implements IModuleCommonServices
public class EmailCommonServices extends SingleSearchResults implements IModuleCommonServices
{
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java
119,13 → 119,13
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/reminders/RemindersCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class RemindersCommonServices implements IService, IModuleCommonServices
public class RemindersCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(RemindersCommonServices.class);
/impl/src/java/pt/estgp/estgweb/services/common/ISearchResults.java
22,6 → 22,9
public int getMaxResultsPage();
public String getQuery();
public String getSearchType();
public String getModuleInternalKey();
public String getDescription();
public List<IFacet> getFacets();
 
 
}
/impl/src/java/pt/estgp/estgweb/services/common/MultipleSearchResults.java
New file
0,0 → 1,31
package pt.estgp.estgweb.services.common;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.services.common.impl.DefaultSearchResults;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 1:10:00
* @email machadofisher@gmail.com
*/
public abstract class MultipleSearchResults implements IService, IModuleCommonServices
{
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
List<ISearchResults> searchResultsList = searchList(null, search, searchType,page,maxResults,userSession);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
return searchResultsList.get(0);
}
 
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
List<ISearchResults> searchResultsList = searchList(null, from,search, searchType,page,maxResults,userSession);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
return searchResultsList.get(0);
}
}
/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/common/IModuleCommonServices.java
18,6 → 18,9
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
 
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
 
public int countToDo(UserSession userSession);
public IToDoCat getToDo(UserSession userSession);
public List<IToDo> getAllToDos(UserSession userSession);
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesService.java
29,11 → 29,16
}
}
 
public ISearchResults searchModule(String from, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, int page,UserSession userSession) throws Throwable
public ISearchResults searchModule(String from, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, String moduleInternalKey, int page,UserSession userSession) throws Throwable
{
try
{
return CommonServicesManager.getInstance().search(userSession, query, searchType,moduleKey,page, from);
//In this case we are allays invoking one specific search source (in MultipleSearchResults services internalKey will be filled and the results come from one
// and one only source)
List<ISearchResults> results = CommonServicesManager.getInstance().search(userSession, query, searchType,moduleKey,moduleInternalKey, page, from);
if(results == null)
return null;
return results.get(0);
}
catch (Throwable throwable)
{
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultResult.java
21,6 → 21,7
private boolean titleKey = false;
private boolean subTitleKey = false;
private boolean textKey = false;
private boolean absoluteUrl = false;
 
private LabelGroup subTitlesGroup = null;
 
104,4 → 105,13
{
this.subTitlesGroup = subTitlesGroup;
}
 
 
public boolean isAbsoluteUrl() {
return absoluteUrl;
}
 
public void setAbsoluteUrl(boolean absoluteUrl) {
this.absoluteUrl = absoluteUrl;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultSearchResults.java
3,6 → 3,7
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.services.common.ModuleEnum;
import pt.estgp.estgweb.services.common.IResult;
import pt.estgp.estgweb.services.common.IFacet;
 
import java.util.List;
import java.util.ArrayList;
26,6 → 27,9
private int maxResultsPage;
private String query;
private String searchType;
private String moduleInternalKey = null;
private String description;
private List<IFacet> facets;
 
 
public ModuleEnum getModule() {
124,8 → 128,34
public String getSearchType() {
return searchType;
}
 
public void setSearchType(String searchType) {
this.searchType = searchType;
}
 
public String getModuleInternalKey() {
return moduleInternalKey;
}
 
public void setModuleInternalKey(String moduleInternalKey) {
this.moduleInternalKey = moduleInternalKey;
}
 
 
public String getDescription() {
return description;
}
 
public void setDescription(String description) {
this.description = description;
}
 
 
public List<IFacet> getFacets() {
return facets;
}
 
public void setFacets(List<IFacet> facets) {
this.facets = facets;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesManager.java
75,12 → 75,16
{
if (module.getModuleCommonServices() != null)
{
ISearchResults iSearchResults = search(userSession, query, searchType, module, 0, from);
if (iSearchResults != null && iSearchResults.getTotalResults() > 0)
{
results.add(iSearchResults);
commonSearchResults.addMoreResults(iSearchResults.getTotalResults());
}
List<ISearchResults> iSearchResultsList = search(userSession, query, searchType, module,null, 0, from);
if(iSearchResultsList != null && iSearchResultsList.size() > 0)
for(ISearchResults iSearchResults: iSearchResultsList)
{
if (iSearchResults != null && iSearchResults.getTotalResults() > 0)
{
results.add(iSearchResults);
commonSearchResults.addMoreResults(iSearchResults.getTotalResults());
}
}
}
}
commonSearchResults.setResults(results);
104,7 → 108,7
* @return searchResults
* @throws Throwable on not authorized and internal error
*/
public ISearchResults search(UserSession userSession, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, int page, String from) throws Throwable
public List<ISearchResults> search(UserSession userSession, String query, SearchTypeEnum searchType, ModuleEnum moduleKey,String moduleInternalKey, int page, String from) throws Throwable
{
try
{
112,9 → 116,13
// String[] names = new String[]{};
// Object[] args = new Object[]{query, searchType, page, SEARCH_MAX_RESULTS};
 
DefaultSearchResults searchResults = (DefaultSearchResults) moduleKey.getModuleCommonServices().search(from, query, searchType, page, SEARCH_MAX_RESULTS, userSession); //(DefaultSearchResults) sm.execute(requester, moduleKey.getSearchService(), "search", args, names);
if(searchResults!=null)
List<ISearchResults> searchResultsList = moduleKey.getModuleCommonServices().searchList(moduleInternalKey, from, query, searchType, page, SEARCH_MAX_RESULTS, userSession); //(DefaultSearchResults) sm.execute(requester, moduleKey.getSearchService(), "search", args, names);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
for(ISearchResults iSearchResults: searchResultsList)
{
DefaultSearchResults searchResults = (DefaultSearchResults) iSearchResults;
 
searchResults.setPage(page);
searchResults.setMaxResultsPage(SEARCH_MAX_RESULTS);
searchResults.setQuery(query.replace("'", " "));
124,7 → 132,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,16 → 148,18
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;
}
else
return null;
return searchResultsList;
}
catch (FilterRetrieveException e)
{
/impl/src/java/pt/estgp/estgweb/services/common/DefaultFacet.java
New file
0,0 → 1,31
package pt.estgp.estgweb.services.common;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:20:10
* @email machadofisher@gmail.com
*/
public class DefaultFacet implements IFacet{
 
String index;
List<IFacetLabel> labels;
 
public String getIndex() {
return index;
}
 
public void setIndex(String index) {
this.index = index;
}
 
public List<IFacetLabel> getLabels() {
return labels;
}
 
public void setLabels(List<IFacetLabel> labels) {
this.labels = labels;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/DefaultFacetLabel.java
New file
0,0 → 1,30
package pt.estgp.estgweb.services.common;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:21:02
* @email machadofisher@gmail.com
*/
public class DefaultFacetLabel implements IFacetLabel
{
String label;
int ocurrences;
 
 
public String getLabel() {
return label;
}
 
public void setLabel(String label) {
this.label = label;
}
 
public int getOccurrences() {
return ocurrences;
}
 
public void setOccurrences(int ocurrences) {
this.ocurrences = ocurrences;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/IResult.java
19,6 → 19,7
public String getText();
public boolean isTextKey();
public String getUrl();
public boolean isAbsoluteUrl();
public LabelGroup getSubTitlesGroup();
 
/**
/impl/src/java/pt/estgp/estgweb/services/common/SingleSearchResults.java
New file
0,0 → 1,34
package pt.estgp.estgweb.services.common;
 
import pt.estgp.estgweb.domain.UserSession;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 1:10:00
* @email machadofisher@gmail.com
*/
public abstract class SingleSearchResults implements IService, IModuleCommonServices
{
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
ISearchResults searchResults = search(search, searchType,page,maxResults,userSession);
if(searchResults == null)
return null;
List<ISearchResults> finalResults = new ArrayList<ISearchResults>();
finalResults.add(searchResults);
return finalResults;
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
ISearchResults searchResults = search(from, search, searchType, page, maxResults, userSession);
if(searchResults == null)
return null;
List<ISearchResults> finalResults = new ArrayList<ISearchResults>();
finalResults.add(searchResults);
return finalResults;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/IFacet.java
New file
0,0 → 1,14
package pt.estgp.estgweb.services.common;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:06:18
* @email machadofisher@gmail.com
*/
public interface IFacet {
public String getIndex();
public List<IFacetLabel> getLabels();
}
/impl/src/java/pt/estgp/estgweb/services/common/IFacetLabel.java
New file
0,0 → 1,12
package pt.estgp.estgweb.services.common;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:19:24
* @email machadofisher@gmail.com
*/
public interface IFacetLabel {
public String getLabel();
public int getOccurrences();
}
/impl/src/java/pt/estgp/estgweb/services/profile/ProfileCommonServices.java
28,7 → 28,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class ProfileCommonServices implements IService, IModuleCommonServices
public class ProfileCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(ProfileCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/blogs/BlogsCommonServices.java
30,7 → 30,7
* Created at 17/Out/2003 , 23:45:24
*
*/
public class BlogsCommonServices implements IService, IModuleCommonServices
public class BlogsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(BlogsCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/blogs/BlogPostsCommonServices.java
28,7 → 28,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class BlogPostsCommonServices implements IService, IModuleCommonServices
public class BlogPostsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(BlogPostsCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/announcements/TodoAnnouncementsCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class TodoAnnouncementsCommonServices implements IService, IModuleCommonServices
public class TodoAnnouncementsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(TodoAnnouncementsCommonServices.class);
/impl/src/java/pt/estgp/estgweb/services/announcements/AnnouncementsCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class AnnouncementsCommonServices implements IService, IModuleCommonServices
public class AnnouncementsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(AnnouncementsCommonServices.class);
75,6 → 75,8
return searchResults;
}
 
 
 
public int countToDo(UserSession userSession)
{
return 0; //todo To change body of implemented methods use File | Settings | File Templates.
/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,266
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.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.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;
 
/*
* @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 extends MultipleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(SruSourcesCommonServices.class);
 
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
{
return 0;
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
return searchList(moduleInternalKey, null, search, searchType, page, maxResults, userSession);
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
List<ISearchResults> searchResults = new ArrayList<ISearchResults>();
 
if(userSession.getUser() == null)
return searchResults;
 
//obtain source, in case of internal key means hat we are in the presence of a page search
List<SruSource> sruSources;
List<SruSourceView> admitedSources;
if(moduleInternalKey == null)
{
sruSources = DaoFactory.getSruSourceDaoImpl().findAll();
}
else
{
long sourceId = Long.parseLong(moduleInternalKey);
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(sourceId);
sruSources = new ArrayList<SruSource>();
sruSources.add(sruSource);
}
 
//filtering the admited sources
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)
{
for(SruSourceView sruSourceView: admitedSources)
{
DefaultSearchResults searchResultsSource = new DefaultSearchResults();
searchResultsSource.setResults(new ArrayList<IResult>());
searchResultsSource.setModuleInternalKey("" + sruSourceView.getId());
searchResultsSource.setModule(ModuleEnum.SruSource);
searchResultsSource.setDescription(sruSourceView.getName());
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*maxResults)+1) + "&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;
searchResultsSource.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();
String relativePathStr = ((Element)fileRelativePath).getText();
defaultResult.setTitle(relativePathStr);
// defaultResult.setSubTitle(courseUnit.getCourseName());
// defaultResult.setSubTitleKey(false);
// defaultResult.setText(courseUnit.getObjectives());
String urlStr = ((Element)fileUrl).getTextTrim();
String[] pathItems = relativePathStr.trim().split("\\\\");
StringBuilder pathBuidler = new StringBuilder();
for(String item: pathItems)
{
if(item.trim().length() > 0)
pathBuidler.append("/").append(URLEncoder.encode(item,"ISO-8859-1").replace("+","%20"));
}
urlStr = urlStr.substring(0,urlStr.length() - (relativePathStr.length())) + pathBuidler.toString();
 
 
defaultResult.setUrl(urlStr);
 
defaultResult.setAbsoluteUrl(true);
 
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);
if(fragments != null)
{
defaultResult.setBestFragments("");
for(Element fragment: fragments)
{
defaultResult.setBestFragments(defaultResult.getBestFragments() + " ... " + fragment.getTextTrim().replace("<em>","<b><i>").replace("</em>","</i></b>"));
}
}
searchResultsSource.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);
}
 
/*Facets*/
List<IFacet> facets = new ArrayList<IFacet>();
XPath xPathFacets = dom.createXPath("//files:facet");
xPathFacets.setNamespaceURIs(namespaces);
List<Element> facetsElems = xPathFacets.selectNodes(dom);
for(Element facetElem: facetsElems)
{
DefaultFacet defaultFacet = new DefaultFacet();
defaultFacet.setLabels(new ArrayList<IFacetLabel>());
defaultFacet.setIndex(facetElem.attribute("name").getValue());
if(!defaultFacet.getIndex().equals("dir") && !defaultFacet.getIndex().equals("facetDir"))
{
XPath xPathFacetLabel = dom.createXPath("./files:facetLabel");
xPathFacetLabel.setNamespaceURIs(namespaces);
List<Element> facetLabelElems = xPathFacetLabel.selectNodes(facetElem);
 
for(Element facetLabelElem: facetLabelElems)
{
DefaultFacetLabel facetLabel = new DefaultFacetLabel();
facetLabel.setOccurrences(Integer.parseInt(facetLabelElem.attribute("ocurr").getValue()));
facetLabel.setLabel(facetLabelElem.getTextTrim());
if(facetLabel.getOccurrences() > 0)
defaultFacet.getLabels().add(facetLabel);
}
if(defaultFacet.getLabels().size()>0)
facets.add(defaultFacet);
}
}
if(facets.size() > 0)
searchResultsSource.setFacets(facets);
}
catch (Throwable e)
{
logger.error(e,e);
}
 
if(searchResultsSource.getResults() != null && searchResultsSource.getResults().size() > 0)
searchResults.add(searchResultsSource);
}
}
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/services/srusources/DeleteSruSourceService.java
New file
0,0 → 1,26
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
 
public class DeleteSruSourceService implements IService {
 
private static final Logger logger = Logger.getLogger(DeleteSruSourceService.class);
 
 
 
public Boolean run(Serializable id, UserSession userSession)
{
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(id);
 
logger.warn("Deleting srusource view:" + sruSource.getId() + " url:" + sruSource.getUrl());
DaoFactory.getSruSourceDaoImpl().delete(sruSource);
return true;
}
}
/impl/src/java/pt/estgp/estgweb/services/srusources/LoadSruSourcesService.java
New file
0,0 → 1,34
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
 
public class LoadSruSourcesService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadSruSourcesService.class);
 
 
 
public List<SruSourceView> run(UserSession userSession)
{
List<SruSourceView> sruSourceViews = new ArrayList<SruSourceView>();
List<SruSource> sruSources = DaoFactory.getSruSourceDaoImpl().findAll();
if(sruSources == null || sruSources.size() == 0)
return sruSourceViews;
logger.debug("Loading all srusource views:");
for(SruSource sruSource: sruSources)
{
SruSourceView sruSourceView = new SruSourceView(sruSource,sruSource.getCollections());
sruSourceViews.add(sruSourceView);
}
return sruSourceViews;
}
}
/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/CourseUnitDaoImpl.java
176,7 → 176,17
.add(eq("importYear", year))
.uniqueResult();
}
public List<CourseUnit> loadBySigesCodes(String sigesCode, String courseCode)
{
return (List<CourseUnit>) createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.addOrder(Order.desc("importYear"))
.list();
}
 
 
 
public List<CourseUnit> loadCourseUnits(long courseId, String semestre, String year, boolean withTeacher, boolean withNoTeacher)
{
Criteria c = createCriteria();
/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/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/web/form/srusource/SruSourceForm.java
New file
0,0 → 1,109
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();
private long auxId;
 
 
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 long getAuxId() {
return auxId;
}
 
public void setAuxId(long auxId) {
this.auxId = auxId;
}
 
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/srusource/SruSourceController.java
New file
0,0 → 1,246
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");
 
return mapping.findForward("success");
}
 
 
 
 
public ActionForward removeCollection(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
 
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
long id = sruSourceForm.getAuxId();
if(sruSourceForm.getSruSourceView().getCollections() != null)
{
for(SruSourceCollectionView collectionView: sruSourceForm.getSruSourceView().getCollections())
{
if(collectionView.getId() == id)
{
sruSourceForm.getSruSourceView().getCollections().remove(collectionView);
sruSourceForm.setSruSourceCollectionView(collectionView);
userSession.remove(TARGET_ROLES_KEY);
userSession.serialize(request,response);
userSession.put(TARGET_ROLES_KEY,((ArrayList<String>)collectionView.getAdmitedRolesSet()));
userSession.serialize(request,response);
sruSourceForm.setSelectedRoles(collectionView.getAdmitedRolesSet());
break;
}
}
}
return mapping.getInputForward();
}
 
 
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;
}
}
 
 
 
 
public ActionForward loadSruSource(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
SruSourceView sruSourceView = loadSruSource(sruSourceForm.getSruSourceView().getId(),request,response);
sruSourceForm.setSruSourceView(sruSourceView);
 
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
userSession.remove(TARGET_ROLES_KEY);
userSession.serialize(request,response);
 
return mapping.findForward("loadSruSource");
}
 
 
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};
return (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSourceById", args, names);
}
 
 
public ActionForward delete(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
 
SruSourceForm sruSourceForm = (SruSourceForm) form;
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{sruSourceForm.getSruSourceView().getId()};
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteSruSource", args, names);
 
if (status != null && status)
addMessage(request, "srusource.deleted.sucess");
else
addMessage(request, "srusource.deleted.fail");
 
return mapping.findForward("loadSruSources");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/controllers/commons/CommonsController.java
76,7 → 76,7
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("from"), request.getParameter("query"), SearchTypeEnum.parse(request.getParameter("searchType")), ModuleEnum.parse(request.getParameter("module")), Integer.parseInt(request.getParameter("page"))};
Object[] args = new Object[]{request.getParameter("from"), request.getParameter("query"), SearchTypeEnum.parse(request.getParameter("searchType")), ModuleEnum.parse(request.getParameter("module")),request.getParameter("moduleInternalKey"), Integer.parseInt(request.getParameter("page"))};
ISearchResults searchResults = (ISearchResults) sm.execute(RequestUtils.getRequester(request, response), "CommonServicesSearchModule", args, names);
request.setAttribute("ISearchResults", searchResults);
return mapping.findForward("searchModule");
/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/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/web/imgs/lupa.gif
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/web/admin/srusource/sruSourceData.jsp
New file
0,0 → 1,173
<%@ 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="auxId"/>
<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"/>
(e.g: http://deptal.estgp.pt:8983/telHandler/Handler2)
</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>
<td>
<input type="button" class="removeButton" value="" onclick="SruSourceForm.auxId.value='${collectionView.id}';set(this.form,'removeCollection');this.form.submit();">
</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:hidden property="sruSourceCollectionView.id"/>
<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/admin/srusource/chooseSruSource.jsp
New file
0,0 → 1,45
<%@ page import="jomm.utils.MessageResources" %>
<%@ page import="pt.estgp.estgweb.domain.views.SruSourceView" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
List<SruSourceView> courseViews = (List<SruSourceView>) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSources", args, names);
request.setAttribute("SruSources", courseViews);
%>
<jsp:useBean id="SruSources" type="java.util.List" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<div class="seccao">
<h2><bean:message key="srusource.choose.srusources"/> </h2>
<table class="dataTable">
<tr>
<th><bean:message key="srusource.name"/></th>
<th><bean:message key="srusource.url"/></th>
</tr>
<%
String confirmDelete = MessageResources.getMessage(request, "srusource.confirm.delete");
request.setAttribute("confirmDelete", confirmDelete);
%>
<logic:iterate id="sruSource" name="SruSources" type="pt.estgp.estgweb.domain.views.SruSourceView">
<tr>
<td><html:link action="/user/chooseSruSourceFromServiceZone?sruSourceView.id=${sruSource.id}">${sruSource.name}</html:link></td>
<td>${sruSource.url}</td>
<td><html:link onclick="return confirm('${confirmDelete}')" action="/user/deleteSruSourceFromServiceZone?sruSourceView.id=${sruSource.id}"><bean:message key="delete"/></html:link></td>
</tr>
</logic:iterate>
</table>
</div>
/impl/src/web/css/style.css
1665,5 → 1665,20
.ects
{
background-color:#EBFCD6;
}
}
 
 
 
/*FACETS*/
.facets .title {
background-color: #8EC73F;
color: #FFFFFF;
font-size: 1.2em;
 
}
.facets
{
border-left: 1px solid #8ec73f;
border-bottom: 1px solid #8ec73f;
}
 
/impl/src/web/js/ajax.js
281,6 → 281,13
xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall);
startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module,"",stateChangedSearchCall,"",action);
}
 
function searchCall(div,query,searchType,page,module,moduleInternalKey,action)
{
searchResultsDiv = div;
xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall);
startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module + "&moduleInternalKey=" + moduleInternalKey,"",stateChangedSearchCall,"",action);
}
function stateChangedSearchCall()
{
if (xmlHttpSearch.readyState==4 || xmlHttpSearch.readyState=="complete")
/impl/src/web/layout/searchForm.jsp
New file
0,0 → 1,88
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<baco:isModuleOn module="search">
<td class="searchTab">
 
<%
String allChecked = "";
String anyChecked = "";
String phraseChecked = "";
String query = request.getParameter("query");
String searchType = request.getParameter("searchType");
if(query == null)
query = "";
 
allChecked = "checked=\"checked\"";
if(searchType == null)
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.all"))
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.any"))
anyChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.phrase"))
phraseChecked = "checked=\"checked\"";
 
 
%>
<html:form action="/search" method="post">
 
 
<input type="hidden" name="dispatch" value="search"/>
 
 
<%
if(request.getParameter("size") == null)
{
%>
<table>
<tr>
<td>
<bean:message key="search"/>
</td>
<td>
<input type="text" class="small" name="query" value="<%=query%>"/>
</td>
<td>
<input type="submit" value="<bean:message key="search"/>">
</td>
 
</tr>
<tr>
<td nowrap="nowrap" colspan="3">
<table>
<tr>
<td><input type="radio" name="searchType" value="search.type.all" <%=allChecked%>/></td>
<td><bean:message key="search.type.all"/></td>
<td><input type="radio" name="searchType" value="search.type.any" <%=anyChecked%>/></td>
<td><bean:message key="search.type.any"/></td>
<td><input type="radio" name="searchType" value="search.type.phrase" <%=phraseChecked%>/></td>
<td><bean:message key="search.type.phrase"/></td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
else if(request.getParameter("size").equals("small"))
{
%>
<table>
<tr>
<td style="vertical-align:middle; white-space:nowrap;">
<html:image page="/imgs/lupa.gif" altKey="search"/><input type="text" class="small" name="query" value="<%=query%>"/> <input type="submit" value=">>">
</td>
</tr>
</table>
<input type="hidden" name="searchType" value="search.type.all"/>
<%
}
%>
</html:form>
</td>
</baco:isModuleOn>
/impl/src/web/layout/navigationTop.jsp
81,63 → 81,7
 
 
</td>
<baco:isModuleOn module="search">
<td class="searchTab">
 
<%
String allChecked = "";
String anyChecked = "";
String phraseChecked = "";
String query = request.getParameter("query");
String searchType = request.getParameter("searchType");
if(query == null)
query = "";
 
allChecked = "checked=\"checked\"";
if(searchType == null)
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.all"))
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.any"))
anyChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.phrase"))
phraseChecked = "checked=\"checked\"";
 
 
%>
<html:form action="/search" method="post">
<input type="hidden" name="dispatch" value="search"/>
<table>
<tr>
<td>
<bean:message key="search"/>
</td>
<td>
<input type="text" class="small" name="query" value="<%=query%>"/>
</td>
<td>
<input type="submit" value="<bean:message key="search"/>">
</td>
 
</tr>
<tr>
<td nowrap="nowrap" colspan="3">
<table>
<tr>
<td><input type="radio" name="searchType" value="search.type.all" <%=allChecked%>/></td>
<td><bean:message key="search.type.all"/></td>
<td><input type="radio" name="searchType" value="search.type.any" <%=anyChecked%>/></td>
<td><bean:message key="search.type.any"/></td>
<td><input type="radio" name="searchType" value="search.type.phrase" <%=phraseChecked%>/></td>
<td><bean:message key="search.type.phrase"/></td>
</tr>
</table>
</td>
</tr>
</table>
</html:form>
</td>
</baco:isModuleOn>
<jsp:include page="searchForm.jsp"/>
</tr>
</table>
</div>
/impl/src/web/public/search/searchResults.jsp
142,10 → 142,15
type="pt.estgp.estgweb.services.common.ISearchResults">
<li>
<h1>
<bean:message key="${searchResults.module.messageKey}"/>
<b>(${searchResults.totalResults})</b>
<logic:empty name="searchResults" property="description">
<bean:message key="${searchResults.module.messageKey}"/>
</logic:empty>
<logic:notEmpty name="searchResults" property="description">
<bean:write name="searchResults" property="description"/>
</logic:notEmpty>
<b id="${searchResults.module.messageKey}_total">(${searchResults.totalResults})</b>
<a id="${searchResults.module.messageKey}SeeMore"
href="javascript:showOrHideOne('${searchResults.module.messageKey}')">
href="javascript:showOrHideOne('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}')">
<bean:message key="search.see.more"/>
</a>
</h1>
157,69 → 162,190
else
visibility = Globals.HIDDEN;
%>
<div class="module" id="<%=searchResults.getModule().getMessageKey()%>" style="<%=visibility%>">
<div id="${searchResults.module.messageKey}Results">
<logic:iterate id="result" name="searchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2>
<logic:notEmpty name="result" property="url">
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
<div class="module" id="${searchResults.module.messageKey}_${searchResults.moduleInternalKey}" style="<%=visibility%>">
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<!--RESULTS-->
<div id="${searchResults.module.messageKey}Results">
<logic:iterate id="result" name="searchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2>
<logic:notEmpty name="result" property="url">
<%
if(result.isAbsoluteUrl())
{
%>
<a href="${result.url}">${result.title}</a>
<%
}
else
{
%>
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
<%
}
%>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</logic:notEqual>
)
</logic:notEmpty>
<logic:notEmpty name="result" property="subTitlesGroup">
(
<%
String subTitleSeparator = "";
%>
<logic:iterate id="subTitleLabel" name="result" property="subTitlesGroup.labels">
<%=subTitleSeparator%>
<logic:equal value="true" name="subTitleLabel" property="key">
<bean:message key="${subTitleLabel.label}"/>
</logic:equal>
<logic:notEqual value="true" name="subTitleLabel" property="key">
${subTitleLabel.label}
</logic:notEqual>
 
<%
subTitleSeparator = ", ";
%>
</logic:iterate>
)
</logic:notEmpty>
</h2>
 
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
<p class="pages">
<bean:message key="search.pages"/>
<logic:equal value="true" name="searchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.previousPage}','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">
&lt;
<bean:message key="result.previous"/>
</a>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</logic:notEqual>
)
</logic:notEmpty>
<logic:notEmpty name="result" property="subTitlesGroup">
(
<%
String subTitleSeparator = "";
%>
<logic:iterate id="subTitleLabel" name="result" property="subTitlesGroup.labels">
<%=subTitleSeparator%>
<logic:equal value="true" name="subTitleLabel" property="key">
<bean:message key="${subTitleLabel.label}"/>
</logic:equal>
<logic:notEqual value="true" name="subTitleLabel" property="key">
${subTitleLabel.label}
</logic:notEqual>
${searchResults.page2Screen}
<logic:equal value="true" name="searchResults" property="hasNextPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.nextPage}','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">
<bean:message key="result.next"/>
&gt;</a>
</logic:equal>
</p>
</div>
</td>
<td valign="top">
<!--FACETS-->
<logic:notEmpty name="searchResults" property="facets">
<div class="facets">
<div class="title" style="white-space:nowrap;"><bean:message key="facets"/></div>
<table class="dataTable">
<logic:iterate id="facet" name="searchResults" property="facets" type="pt.estgp.estgweb.services.common.IFacet">
<tr>
<th colspan="2">
<bean:message key="facet.${facet.index}"/>
</th>
</tr>
<logic:iterate id="label" name="facet" property="labels" type="pt.estgp.estgweb.services.common.IFacetLabel">
<tr>
<td>
<%
if(facet.getIndex().equals("type") || facet.getIndex().equals("facetType"))
{
 
<%
subTitleSeparator = ", ";
%>
</logic:iterate>
)
</logic:notEmpty>
</h2>
if (label.getLabel().toLowerCase().endsWith("doc") || label.getLabel().endsWith("rtf"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/doc.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("pdf"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/pdf.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("ppt"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/ppt.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("zip") || label.getLabel().endsWith(".gz") || label.getLabel().endsWith("tgz"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/zip.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("rar"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/rar.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("html") || label.getLabel().endsWith("htm"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/html.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("xls") || label.getLabel().endsWith("xlsx"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/xls.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("txt"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/txt.gif">
<%
}
else if (label.getLabel().toLowerCase().endsWith("xml"))
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/xml.gif">
<%
}
else
{
%>
<img alt="<%=label.getLabel()%>" src="<%=request.getContextPath()%>/imgs/mime/unknown.gif">
<%
}
}
else
{
%>
${label.label}
<%
}
%>
</td>
<td align="right">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','(${searchResults.query}) AND ${facet.index}:&quot;${label.label}&quot;','${searchResults.searchType}','0','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')" onclick="getObjectById('${searchResults.module.messageKey}_total').innerHTML='(${label.occurrences})';return true;">
${label.occurrences}
</a>
</td>
</tr>
</logic:iterate>
</logic:iterate>
</table>
</div>
</logic:notEmpty>
</td>
</tr>
</table>
 
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
<p class="pages">
<bean:message key="search.pages"/>
<logic:equal value="true" name="searchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.previousPage}','${searchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">
&lt;
<bean:message key="result.previous"/>
</a>
</logic:equal>
${searchResults.page2Screen}
<logic:equal value="true" name="searchResults" property="hasNextPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.nextPage}','${searchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">
<bean:message key="result.next"/>
&gt;</a>
</logic:equal>
</p>
</div>
<h3>
<a href="javascript:hide('${searchResults.module.messageKey}','${searchResults.module.messageKey}SeeMore')">Fechar</a>
</h3>
/impl/src/web/public/search/searchResultsModule.jsp
9,7 → 9,27
<logic:iterate id="result" name="ISearchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2><a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
 
<h2>
<logic:notEmpty name="result" property="url">
<%
if(result.isAbsoluteUrl())
{
%>
<a href="${result.url}">${result.title}</a>
<%
}
else
{
%>
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
<%
}
%>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
25,13 → 45,13
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
Pages:
Pages:
<logic:equal value="true" name="ISearchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.previousPage}','${ISearchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">&lt; previous</a>
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.previousPage}','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">&lt; previous</a>
</logic:equal>
${ISearchResults.page2Screen}
<logic:equal value="true" name="ISearchResults" property="hasNextPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
</logic:equal>
 
 
/impl/src/web/public/announcements/announcementsPortalRightHome.jsp
New file
0,0 → 1,124
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="pt.estgp.estgweb.domain.views.AnnouncementView" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ 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-bean.tld" prefix="bean" %>
<%
IServiceManager sm = ServiceManager.getInstance();
String subTarget = null;
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_NEWS, subTarget};
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request, response), "LoadRoleTypeMaxAnnouncements", args, names);
request.setAttribute("Announcements", announcementViews);
 
String fromAction = "";
String user = "";
if(request.getParameter("from")!=null)
{
request.setAttribute("from","from=" + request.getParameter("from"));
user = "/user";
fromAction = "From" + request.getParameter("from");
}
else
{
request.setAttribute("from","");
}
request.setAttribute("user",user);
request.setAttribute("fromAction",fromAction);
 
%>
 
<div class="portalRightAnnouncements">
 
<table>
<baco:isAuthenticated>
<tr>
<td>
<jsp:include page="/layout/searchForm.jsp?size=small"/>
</td>
</tr>
<tr>
<td colspan="2" class="quotasImpressaoContainer">
<jsp:include page="/user/quotasImpressao/quotasImpressao.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="remindersContainer">
<jsp:include page="/user/reminders/reminders.jsp"/>
</td>
</tr>
 
<tr>
<td colspan="2" class="messagesContainer"><jsp:include page="/user/pop/messagesContainer.jsp"/></td>
</tr>
</baco:isAuthenticated>
<logic:present name="Announcements">
<logic:notEmpty name="Announcements">
<tr>
<td colspan="2">
<h1><bean:message key="announcements"/></h1>
</td>
</tr>
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<tr>
<td width="25%">
<div class="imageAnnouncementNews">
<baco:ownerImageRole name="item"/>
</div>
</td>
<td>
<div class="portalAnnouncementNews">
<div class="portalAnnouncement">
<logic:empty name="item" property="url">
<div class="portalAnnouncementTitle">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.textSummarySmall}</html:link>
</div>
</logic:empty>
<logic:notEmpty name="item" property="url">
<%
if (!item.getTextBiggerThenPermited())
{
%>
<div class="portalAnnouncementTitle">
<html:link href="${item.url}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</div>
<%
}
else
{
%>
<div class="portalAnnouncementTitle">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.textSummarySmall}</html:link>
</div>
<%}%>
</logic:notEmpty>
</div>
</div>
</td>
 
</tr>
</logic:iterate>
</logic:notEmpty>
</logic:present>
</table>
</div>
/impl/src/web/public/announcements/announcementsPortalRight.jsp
38,21 → 38,6
<div class="portalRightAnnouncements">
 
<table>
<baco:isAuthenticated>
<tr>
<td colspan="2" class="quotasImpressaoContainer">
<jsp:include page="/user/quotasImpressao/quotasImpressao.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="remindersContainer">
<jsp:include page="/user/reminders/reminders.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="messagesContainer"><jsp:include page="/user/pop/messagesContainer.jsp"/></td>
</tr>
</baco:isAuthenticated>
<logic:present name="Announcements">
<logic:notEmpty name="Announcements">
<tr>
/impl/src/web/user/courseunits/menu.jsp
1,4 → 1,9
<%@ page import="pt.estgp.estgweb.domain.views.BlogView" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.utils.DatesUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
50,7 → 55,7
<html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.put.announcement"/></html:link>
</li>
<!--<li>
<a href="<%=request.getContextPath()%>/"><bean:message key="courseunit.menu.put.question"/></a>
<a href="<%=request.getContextPath()%>/"><bean:message key="courseunit.menu.put.question"/></a>
</li>-->
<li>
<a href="<%=request.getContextPath()%>${user}/startLoadCourseUnitWorks${fromAction}.do?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.assignements"/></a>
68,18 → 73,71
<html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.students"/></html:link>
</li>
 
<baco:isAuthenticated>
<li>
<html:link action="/user/startLoadCourseUnitContentsFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.contents"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitPresencesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.presences"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitGradesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.grades"/></html:link>
</li>
</baco:isAuthenticated>
 
<li>
<html:link action="/user/startLoadCourseUnitContentsFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.contents"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitPresencesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.presences"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitGradesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.grades"/></html:link>
</li>
 
 
 
</ul>
</div>
</div>
</div>
</div>
 
 
<%
IServiceManager sm = ServiceManager.getInstance();
 
String[] names = new String[]{};
Object[] args = new Object[]{CourseUnitView.getCode(), CourseUnitView.getCourseCode()};
 
List<pt.estgp.estgweb.domain.views.CourseUnitView> courseUnitViews = (List<pt.estgp.estgweb.domain.views.CourseUnitView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseUnitsBySigesCodes", args, names);
if(courseUnitViews.size() > 1)
{
request.setAttribute("OldUnits",courseUnitViews);
}
%>
<logic:present name="OldUnits">
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle">
<%
if (CourseUnitView.getImportYear().equals(DatesUtils.getImportYear()))
{
%>
<bean:message key="courseunit.menu.unit.old.units"/>
<%
}else{
%>
<bean:message key="courseunit.menu.unit.other.units"/>
<%
}
%>
</div>
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<logic:iterate id="item" name="OldUnits">
<li>
<logic:equal value="${CourseUnitView.id}" name="item" property="id">
&gt;${item.importYear}
</logic:equal>
<logic:notEqual value="${CourseUnitView.id}" name="item" property="id">
<html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${item.id}">${item.importYear}</html:link>
</logic:notEqual>
 
</li>
</logic:iterate>
</ul>
</div>
</div>
</div>
</logic:present>
/impl/src/web/user/home.jsp
24,7 → 24,7
<%--</table>--%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=${UserSession.user.roles}&from=Home"/>
</td>
</tr>
</table>
44,7 → 44,7
<%--</table>--%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=${UserSession.user.roles}&from=Home"/>
</td>
</tr>
</table>
66,7 → 66,7
<%--</table> --%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=all&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=all&from=Home"/>
</td>
</tr>
</table>
/impl/src/web/user/serviceZone/serviceZone.jsp
210,6 → 210,23
</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>
<li>
<html:link target="_blank" action="/user/startChooseSruSourceFromServiceZone">
<bean:message key="srusource.edit.srusources"/>
</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/serviceZone/topnavChooseSruSources.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.choose.srusources");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavLoadSruSource.jsp
New file
0,0 → 1,13
<%@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("/user/startChooseSruSourceFromServiceZone.do", "srusource.edit.srusources");
topNav.addNavPlace(null, "srusource.edit.srusource");
%>
<jsp:include page="/layout/topnav.jsp"/>
/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