if (user == null) {
log.error("No user given for rest call.");
throw new IllegalArgumentException("No user given for the rest call: authenticate/getToken.");
}
final UserObject userObject = PFUserDOConverter.getUserObject(user);
final ServerInfo info = new ServerInfo(AppVersion.VERSION.toString());
info.setUser(userObject);
Version clientVersion = null;
if (clientVersionString != null) {
clientVersion = new Version(clientVersionString);
}
if (clientVersion == null) {
info.setStatus(ServerInfo.STATUS_UNKNOWN);
} else if (clientVersion.compareTo(new Version("5.0")) < 0) {
info.setStatus(ServerInfo.STATUS_CLIENT_TO_OLD);
} else if (clientVersion.compareTo(AppVersion.VERSION) > 0) {
info.setStatus(ServerInfo.STATUS_CLIENT_NEWER_THAN_SERVER);
} else {
info.setStatus(ServerInfo.STATUS_OK);
}
final String json = JsonUtils.toJson(info);
return Response.ok(json).build();
}