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.expceptions.ServiceException;
import org.apache.log4j.Logger;
import java.util.List;
/**
* @author Jorge Machado
* @date 22/Mai/2008
* @see pt.estgp.estgweb.services.common
*/
public class CommonServicesService
implements IService
{
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);
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
{
try
{
return CommonServicesManager.
getInstance().
search(userSession, query, searchTypeEnum, from
);
}
catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable throwable
)
{
logger.
error(throwable,throwable
);
throw new ServiceException
("", throwable
);
}
}
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
{
try
{
//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 (1.5.0/docs/api/java/lang/Throwable.html">Throwable throwable
)
{
logger.
error(throwable,throwable
);
throw new ServiceException
("", throwable
);
}
}
public List
<IToDoCat
> getAllToDosCats
(UserSession userSession
) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable
{
return CommonServicesManager.
getInstance().
getAllToDosCats(userSession
);
}
}