Subversion Repositories bacoAlunos

Rev

Rev 457 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
163 jmachado 1
package pt.estgp.estgweb.services.common;
2
 
3
import pt.utl.ist.berserk.logic.serviceManager.IService;
4
import pt.estgp.estgweb.domain.UserSession;
5
import pt.estgp.estgweb.services.expceptions.ServiceException;
6
import org.apache.log4j.Logger;
7
 
8
import java.util.List;
9
 
10
/**
11
 * @author Jorge Machado
12
 * @date 22/Mai/2008
13
 * @see pt.estgp.estgweb.services.common
14
 */
15
public class CommonServicesService implements IService
16
{
17
    private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(CommonServicesService.class);
18
 
165 jmachado 19
    public ICommonSearchResults search(1.5.0/docs/api/java/lang/String.html">String from, 1.5.0/docs/api/java/lang/String.html">String query, SearchTypeEnum searchTypeEnum, UserSession userSession) throws ServiceException
163 jmachado 20
    {
21
        try
22
        {
165 jmachado 23
            return CommonServicesManager.getInstance().search(userSession, query, searchTypeEnum, from);
163 jmachado 24
        }
25
        catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable throwable)
26
        {
27
            logger.error(throwable,throwable);
28
            throw new ServiceException("", throwable);
29
        }
30
    }
31
 
457 jmachado 32
    public ISearchResults searchModule(1.5.0/docs/api/java/lang/String.html">String from, 1.5.0/docs/api/java/lang/String.html">String query, SearchTypeEnum searchType, ModuleEnum moduleKey, 1.5.0/docs/api/java/lang/String.html">String moduleInternalKey, int page,UserSession userSession) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable
163 jmachado 33
    {
34
        try
35
        {
457 jmachado 36
            //In this case we are allays invoking one specific search source (in MultipleSearchResults services internalKey will be filled and the results come from one
37
            // and one only source)
38
            List<ISearchResults> results = CommonServicesManager.getInstance().search(userSession, query, searchType,moduleKey,moduleInternalKey, page, from);
39
            if(results == null)
40
                return null;
41
            return results.get(0);
163 jmachado 42
        }
43
        catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable throwable)
44
        {
45
            logger.error(throwable,throwable);
46
            throw new ServiceException("", throwable);
47
        }
48
    }
49
 
50
    public List<IToDoCat> getAllToDosCats(UserSession userSession) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable
51
    {
52
        return CommonServicesManager.getInstance().getAllToDosCats(userSession);
53
    }
54
 
55
}