package pt.estgp.estgweb.services.surveys;
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.DomainObject;
import pt.estgp.estgweb.domain.SurveyResponseImpl;
import pt.estgp.estgweb.domain.SurveyStructuralNode;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.SurveyResponseView;
import pt.estgp.estgweb.domain.views.SurveyStructuralNodeView;
import pt.estgp.estgweb.services.common.*;
import pt.estgp.estgweb.services.common.impl.DefaultToDo;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.utl.ist.berserk.logic.serviceManager.IService;
import java.util.ArrayList;
import java.util.List;
/**
* @author: Duarte Santos
* @date: 04-08-2011
* @time: 0:23
* @email: a12564 [at] estgp [dot] pt
*/
public class SurveysCommonServices
extends SingleSearchResults
implements IService, IModuleCommonServices
{
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(SurveysCommonServices.
class);
public int countSearch
(1.5.0/docs/api/java/lang/String.html">String search, SearchTypeEnum searchType, UserSession userSession
)
{
return 0;
}
public ISearchResults search
(1.5.0/docs/api/java/lang/String.html">String search, SearchTypeEnum searchType,
int page,
int maxResults, UserSession userSession
)
{
return search
(null,search,searchType,page,maxResults,userSession
);
}
public ISearchResults search
(1.5.0/docs/api/java/lang/String.html">String from,
1.5.0/docs/api/java/lang/String.html">String search, SearchTypeEnum searchType,
int page,
int maxResults, UserSession userSession
)
{
return null;
}
public int countToDo
(UserSession userSession
)
{
return 0;
}
public IToDoCat getToDo
(UserSession userSession
)
{
return null;
}
public List
<IToDo
> getAllToDos
(UserSession userSession
)
{
List
<IToDo
> todos =
new ArrayList
<IToDo
>();
List
<SurveyResponseImpl
> surveyResponses = DaoFactory.
getSurveyResponseDaoImpl().
loadByUserId(userSession.
getUser().
getId());
for(SurveyResponseImpl sr: surveyResponses
)
{
1.5.0/docs/api/java/lang/String.html">String surveyOwner = sr.
getStructuralNode().
getSurvey().
getOwner().
getUsername();
DefaultToDo defaultToDo =
new DefaultToDo
(sr.
getStructuralNode().
getMsg(),
null,surveyOwner,
"survey.type.todo",
"/user/startSurveyResponseFromHome.do?resp="+sr.
getId());
todos.
add(defaultToDo
);
}
return todos
;
}
public void adviseNew
(DomainObject object
)
{}
public void adviseUpdate
(DomainObject object
)
{}
}