use of org.olat.modules.edubase.BookDetails in project OpenOLAT by OpenOLAT.
the class EdubaseBookSectionListController method setBookIdsAndCovers.
private void setBookIdsAndCovers() {
for (BookSectionWrapper wrapper : bookSectionWrappers) {
String bookId = setParsedBookId(wrapper);
BookDetails bookDetails = edubaseManager.fetchBookDetails(bookId);
setCoverUrl(wrapper, bookDetails);
}
}
use of org.olat.modules.edubase.BookDetails in project openolat by klemens.
the class EdubaseBookSectionListController method setBookIdsAndCovers.
private void setBookIdsAndCovers() {
for (BookSectionWrapper wrapper : bookSectionWrappers) {
String bookId = setParsedBookId(wrapper);
BookDetails bookDetails = edubaseManager.fetchBookDetails(bookId);
setCoverUrl(wrapper, bookDetails);
}
}
use of org.olat.modules.edubase.BookDetails in project openolat by klemens.
the class EdubaseManagerImpl method fetchBookDetails.
@Override
public BookDetails fetchBookDetails(String bookId) {
BookDetails infoReponse = new BookDetailsImpl();
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(TIMEOUT_5000_MILLIS).setConnectTimeout(TIMEOUT_5000_MILLIS).setConnectionRequestTimeout(TIMEOUT_5000_MILLIS).build();
String url = String.format(edubaseModule.getInfoverUrl(), bookId);
HttpGet request = new HttpGet(url);
request.setConfig(requestConfig);
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse httpResponse = httpClient.execute(request)) {
String json = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
infoReponse = objectMapper.readValue(json, BookDetailsImpl.class);
} catch (SocketTimeoutException socketTimeoutException) {
log.warn("Socket Timeout while requesting informations of the Edubase book with the id " + bookId);
} catch (JsonParseException | EOFException noesNotExitsException) {
log.debug("Error while requesting informations for the Edubase book with the id " + bookId + ": Book does not exist.");
} catch (Exception e) {
log.error("", e);
}
return infoReponse;
}
use of org.olat.modules.edubase.BookDetails in project OpenOLAT by OpenOLAT.
the class EdubaseBookSectionListController method showDetails.
private void showDetails(UserRequest ureq, BookSectionWrapper wrapper) {
String bookId = setParsedBookId(wrapper);
BookDetails bookDetails = edubaseManager.fetchBookDetails(bookId);
setCoverUrl(wrapper, bookDetails);
detailsController = new EdubaseBookSectionDetailsController(ureq, getWindowControl(), wrapper, bookDetails);
listenTo(detailsController);
closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), detailsController.getInitialComponent(), true, translate("edubase.book.section.details.form.title"));
listenTo(closeableModalController);
closeableModalController.activate();
}
use of org.olat.modules.edubase.BookDetails in project OpenOLAT by OpenOLAT.
the class EdubaseManagerImpl method fetchBookDetails.
@Override
public BookDetails fetchBookDetails(String bookId) {
BookDetails infoReponse = new BookDetailsImpl();
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(TIMEOUT_5000_MILLIS).setConnectTimeout(TIMEOUT_5000_MILLIS).setConnectionRequestTimeout(TIMEOUT_5000_MILLIS).build();
String url = String.format(edubaseModule.getInfoverUrl(), bookId);
HttpGet request = new HttpGet(url);
request.setConfig(requestConfig);
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse httpResponse = httpClient.execute(request)) {
String json = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
infoReponse = objectMapper.readValue(json, BookDetailsImpl.class);
} catch (SocketTimeoutException socketTimeoutException) {
log.warn("Socket Timeout while requesting informations of the Edubase book with the id " + bookId);
} catch (JsonParseException | EOFException noesNotExitsException) {
log.debug("Error while requesting informations for the Edubase book with the id " + bookId + ": Book does not exist.");
} catch (Exception e) {
log.error("", e);
}
return infoReponse;
}
Aggregations