Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1846 → Rev 1847

/branches/v3/impl/conf/WEB-INF/struts/struts-json-ws.xml
44,13 → 44,15
 
<action path="/startGenerateChaveApps" forward="page.gen.chave.apps.password.pae"/>
 
 
<action path="/ws-authenticate" forward="/authenticateWidget.do?dispatch=executeService&amp;serviceJson=authenticateApp"/>
<!--SERVICOS SEGUROS AO NIVEL DO BERSERK-->
<action path="/secure/ws-login-challenge" forward="/user/jsonModel.do?dispatch=executeSimpleServiceOkFail&amp;serviceJson=wsLoginMobileChallenge"/>
<action path="/secure/ws-student-list" forward="/user/jsonModel.do?dispatch=executeService&amp;serviceJson=wsListStudents"/>
<action path="/secure/ws-teacher-list" forward="/user/jsonModel.do?dispatch=executeService&amp;serviceJson=wsListTeachers"/>
<action path="/secure/ws-coordinators-list" forward="/user/jsonModel.do?dispatch=executeService&amp;serviceJson=wsListCoordinators"/>
 
 
 
<!--SERVICOS ABERTOS POR ENQUANTO-->
<!--<action path="/ws-units-report-list" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=getCourseUnitsEvaluations"/>-->
<action path="/ws-course-pedagogic-results-list" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=findPedagogicReport4Period"/>
<action path="/ws-units-dtp-stats" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=getCourseUnitDtpStats"/>
/branches/v3/impl/conf/berserk/sd.xml
74,6 → 74,18
<chain name="MobileApps"/>
</filterChains>
</service>
<service>
<name>WSAPIListCoordinators</name>
<implementationClass>pt.estgp.estgweb.services.profile.ListUsersService</implementationClass>
<description>Authenticates a User</description>
<isTransactional>true</isTransactional>
<defaultMethod>listCoordinatorTeachersService</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="MobileApps"/>
</filterChains>
</service>
 
<service>
<name>AuthenticateApp</name>
/branches/v3/impl/src/java/pt/estgp/estgweb/services/profile/ListUsersService.java
12,6 → 12,9
 
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.eq;
import static org.hibernate.criterion.Restrictions.isNotNull;
 
/**
* Created by jorgemachado on 07/04/17.
*/
134,4 → 137,66
}
return result;
}
 
 
public JSONObject listCoordinatorTeachersService(UserSession sess) throws JSONException
{
 
JSONObject result = new JSONObject();
JSONArray usersArray = new JSONArray();
String nowYear = ((UserSessionImpl)sess).getNowConfiguration().getInterfaceImportYear();
result.put("nowYear",nowYear);
result.put("results",usersArray);
 
Criteria c = DaoFactory.getTeacherDaoImpl().createCriteria();
c.setProjection(Projections.projectionList()
.add(Projections.property("username"))
.add(Projections.property("sigesCode"))
.add(Projections.property("name"))
.add(Projections.property("email"))
.add(Projections.property("outEmail"))
.add(Projections.property("preferrefEmail"))
.add(Projections.property("cc.name"))
.add(Projections.property("cc.code"))
.add(Projections.property("cc.degree"))
.add(Projections.property("d.name"))
.add(Projections.property("s.name"))
.add(Projections.property("s.institutionalCode"))
);
 
 
c.createAlias("coordinatorCourses","cc");
c.createAlias("cc.department","d");
c.createAlias("d.courseSchool","s");
 
c
.add(isNotNull("cc.name"))
.add(eq("cc.status", true))
.add(eq("cc.importYear", ((UserSessionImpl) sess).getNowConfiguration().getInterfaceImportYear()));
 
List<Object[]> results = c.list();
 
 
for(Object[] resultObj: results)
{
JSONObject user = new JSONObject();
usersArray.put(user);
user.put("username",resultObj[0]);
user.put("sigesCode",resultObj[1]);
user.put("name",resultObj[2]);
user.put("email",resultObj[3]);
user.put("outEmail",resultObj[4]);
user.put("preferrefEmail",resultObj[5]);
user.put("courseName",resultObj[6]);
user.put("courseCode",resultObj[7]);
user.put("courseType",resultObj[8]);
user.put("departmentName",resultObj[9]);
user.put("schoolName",resultObj[10]);
user.put("schoolCode",resultObj[11]);
 
}
return result;
}
 
 
}
/branches/v3/impl/src/java/pt/estgp/estgweb/web/controllers/widgetmodel/ModelWidgetController.java
250,6 → 250,24
}
 
/**
*
* @param form
* @param request
* @param response
* @return
* @throws Throwable
*/
public JSONObject wsListCoordinators(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
JSONObject result = (JSONObject) sm.execute(RequestUtils.getRequester(request, response), "WSAPIListCoordinators", args, names);
return result;
}
 
 
/**
* * For Json Services
* @param form
* @param request
293,11 → 311,19
wsLoginListTeachers.put("descricao","usa o certificado para garantir autenticidade da APP e devolve a lista total de professores do sistema no parametro response");
wsLoginListTeachers.put("return1","devolve a lista total de professores do sistema no parametro response");
 
JSONObject wsLoginListCoordinators = new JSONObject();
wsLoginListCoordinators.put("service","/wsjson/api/app/secure/ws-coordinators-list");
wsLoginListCoordinators.put("parameter","certificate");
wsLoginListCoordinators.put("descricao","usa o certificado para garantir autenticidade da APP e devolve a lista total de professores do sistema no parametro response");
wsLoginListCoordinators.put("return1","devolve a lista total de professores do sistema no parametro response");
 
 
JSONArray services = new JSONArray();
services.put(wsAuthenticate);
services.put(wsLoginChallenge);
services.put(wsLoginListStudents);
services.put(wsLoginListTeachers);
services.put(wsLoginListCoordinators);
wsServices.put("services",services);
 
return result;