6,6 → 6,7 |
import org.json.JSONException; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.UserSessionImpl; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
|
21,11 → 22,13 |
|
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.getStudentDaoImpl().createCriteria(); |
c.setProjection(Projections.projectionList() |
.add(Projections.distinct(Projections.property("id"))) |
.add(Projections.groupProperty("id")) |
.add(Projections.property("username")) |
.add(Projections.property("sigesCode")) |
.add(Projections.property("name")) |
36,7 → 39,9 |
.add(Projections.property("tipoAlunoErasmus")) |
.add(Projections.property("c.name")) |
.add(Projections.property("s.name")) |
.add(Projections.property("s.institutionalCode"))); |
.add(Projections.property("s.institutionalCode")) |
.add(Projections.max("cu.importYear"))); |
|
c.createAlias("subscribedUnits","cu"); |
c.createAlias("cu.course","c"); |
c.createAlias("c.department","d"); |
60,6 → 65,15 |
user.put("courseName",resultObj[9]); |
user.put("schoolName",resultObj[10]); |
user.put("schoolCode",resultObj[11]); |
user.put("lastYear",resultObj[12]); |
if(resultObj[12].equals(nowYear)) |
{ |
user.put("inscritoAnoCorrente",true); |
} |
else |
{ |
user.put("inscritoAnoCorrente",false); |
} |
} |
return result; |
} |
69,18 → 83,29 |
|
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.getStudentDaoImpl().createCriteria(); |
Criteria c = DaoFactory.getTeacherDaoImpl().createCriteria(); |
c.setProjection(Projections.projectionList() |
.add(Projections.distinct(Projections.property("id"))) |
.add(Projections.groupProperty("id")) |
.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("preferrefEmail")) |
.add(Projections.property("c.name")) |
.add(Projections.property("s.name")) |
.add(Projections.property("s.institutionalCode")) |
.add(Projections.max("cu.importYear"))); |
|
c.createAlias("teachedUnits","cu"); |
c.createAlias("cu.course","c"); |
c.createAlias("c.department","d"); |
c.createAlias("d.courseSchool","s"); |
|
List<Object[]> results = c.list(); |
|
|
94,6 → 119,18 |
user.put("email",resultObj[4]); |
user.put("outEmail",resultObj[5]); |
user.put("preferrefEmail",resultObj[6]); |
user.put("courseName",resultObj[7]); |
user.put("schoolName",resultObj[8]); |
user.put("schoolCode",resultObj[9]); |
user.put("lastYear",resultObj[10]); |
if(resultObj[10].equals(nowYear)) |
{ |
user.put("leccionaAnoCorrente",true); |
} |
else |
{ |
user.put("leccionaAnoCorrente",false); |
} |
} |
return result; |
} |