use of de.vitero.schema.mtom.CompleteAvatarWrapper in project OpenOLAT by OpenOLAT.
the class ViteroManager method storePortrait.
protected boolean storePortrait(Identity identity, int userId) throws VmsNotAvailableException {
try {
File portrait = DisplayPortraitManager.getInstance().getBigPortrait(identity.getName());
if (portrait != null && portrait.exists()) {
Mtom mtomWs = getMtomWebService();
CompleteAvatarWrapper avatar = new CompleteAvatarWrapper();
avatar.setType(BigInteger.ZERO);
avatar.setUserid(BigInteger.valueOf(userId));
avatar.setFilename(portrait.getName());
DataHandler portraitHandler = new DataHandler(new FileDataSource(portrait));
avatar.setFile(portraitHandler);
mtomWs.storeAvatar(avatar);
return true;
}
return false;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot store the portrait of " + userId, f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot store the portrait of " + userId, e);
return false;
}
}
use of de.vitero.schema.mtom.CompleteAvatarWrapper in project openolat by klemens.
the class ViteroManager method storePortrait.
protected boolean storePortrait(Identity identity, int userId) throws VmsNotAvailableException {
try {
File portrait = DisplayPortraitManager.getInstance().getBigPortrait(identity.getName());
if (portrait != null && portrait.exists()) {
Mtom mtomWs = getMtomWebService();
CompleteAvatarWrapper avatar = new CompleteAvatarWrapper();
avatar.setType(BigInteger.ZERO);
avatar.setUserid(BigInteger.valueOf(userId));
avatar.setFilename(portrait.getName());
DataHandler portraitHandler = new DataHandler(new FileDataSource(portrait));
avatar.setFile(portraitHandler);
mtomWs.storeAvatar(avatar);
return true;
}
return false;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot store the portrait of " + userId, f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot store the portrait of " + userId, e);
return false;
}
}
Aggregations