use of de.vitero.schema.user.Usertype in project OpenOLAT by OpenOLAT.
the class ViteroManager method getVmsUsersByGroup.
protected List<Usertype> getVmsUsersByGroup(int groupId) throws VmsNotAvailableException {
try {
GetUserListByGroupRequest listRequest = new GetUserListByGroupRequest();
listRequest.setGroupid(groupId);
Userlist userList = getUserWebService().getUserListByGroup(listRequest);
List<Usertype> userTypes = userList.getUser();
return userTypes;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get the list of users in group: " + groupId, f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot get the list of users in group: " + groupId, e);
return null;
}
}
use of de.vitero.schema.user.Usertype in project OpenOLAT by OpenOLAT.
the class ViteroManager method getGroupRoles.
/**
* @param id The group id
* @return
* @throws VmsNotAvailableException
*/
public ViteroGroupRoles getGroupRoles(int id) throws VmsNotAvailableException {
try {
Group groupWs = getGroupWebService();
Groupid groupId = new Groupid();
groupId.setGroupid(id);
Group_Type group = groupWs.getGroup(groupId);
Completegrouptype groupType = group.getGroup();
List<Completegrouptype.Participant> participants = groupType.getParticipant();
int numOfParticipants = participants == null ? 0 : participants.size();
ViteroGroupRoles groupRoles = new ViteroGroupRoles();
if (numOfParticipants > 0) {
Map<Integer, String> idToEmails = new HashMap<Integer, String>();
List<Usertype> vmsUsers = getVmsUsersByGroup(id);
if (vmsUsers != null) {
for (Usertype vmsUser : vmsUsers) {
Integer userId = new Integer(vmsUser.getId());
String email = vmsUser.getEmail();
groupRoles.getEmailsOfParticipants().add(email);
idToEmails.put(userId, email);
}
}
for (int i = 0; i < numOfParticipants; i++) {
Completegrouptype.Participant participant = participants.get(i);
Integer userId = new Integer(participant.getUserid());
String email = idToEmails.get(userId);
if (email != null) {
GroupRole role = GroupRole.valueOf(participant.getRole());
groupRoles.getEmailsToRole().put(email, role);
groupRoles.getEmailsToVmsUserId().put(email, userId);
}
}
}
return groupRoles;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get group roles", f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
return null;
}
}
use of de.vitero.schema.user.Usertype in project OpenOLAT by OpenOLAT.
the class ViteroManager method isUserOf.
public boolean isUserOf(ViteroBooking booking, Identity identity) throws VmsNotAvailableException {
boolean member = false;
GetUserInfo userInfo = getVmsUserId(identity, false);
int userId = userInfo.getUserId();
if (userId > 0) {
List<Usertype> users = getVmsUsersByGroup(booking.getGroupId());
if (users != null) {
for (Usertype user : users) {
if (userId == user.getId()) {
member = true;
}
}
}
}
return member;
}
use of de.vitero.schema.user.Usertype in project openolat by klemens.
the class ViteroManager method getVmsUsersByGroup.
protected List<Usertype> getVmsUsersByGroup(int groupId) throws VmsNotAvailableException {
try {
GetUserListByGroupRequest listRequest = new GetUserListByGroupRequest();
listRequest.setGroupid(groupId);
Userlist userList = getUserWebService().getUserListByGroup(listRequest);
List<Usertype> userTypes = userList.getUser();
return userTypes;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get the list of users in group: " + groupId, f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot get the list of users in group: " + groupId, e);
return null;
}
}
use of de.vitero.schema.user.Usertype in project openolat by klemens.
the class ViteroManager method isUserOf.
public boolean isUserOf(ViteroBooking booking, Identity identity) throws VmsNotAvailableException {
boolean member = false;
GetUserInfo userInfo = getVmsUserId(identity, false);
int userId = userInfo.getUserId();
if (userId > 0) {
List<Usertype> users = getVmsUsersByGroup(booking.getGroupId());
if (users != null) {
for (Usertype user : users) {
if (userId == user.getId()) {
member = true;
}
}
}
}
return member;
}
Aggregations