@Override /** {@inheritDoc} */ public ContentStream getRenditionStream(String identifier, String type) { try { String nodeIdentifier = identifier; if (NodeRefUtils.isVersionIdentifier(identifier) || NodeRefUtils.isIdentifier(identifier)) { nodeIdentifier = NodeRefUtils.createNodeRefByIdentifier(identifier); } UrlBuilder url = getRenditionUrl(nodeIdentifier, type); Response resp = getHttpInvoker().invokeGET(url, getSessionHttp()); org.alfresco.mobile.android.api.model.ContentStream cf; if (resp.getResponseCode() == HttpStatus.SC_NOT_FOUND) { cf = null; } else if (resp.getResponseCode() != HttpStatus.SC_OK) { convertStatusCode(resp, ErrorCodeRegistry.DOCFOLDER_GENERIC); cf = null; } else { cf = new ContentStreamImpl( resp.getStream(), resp.getContentTypeHeader() + ";" + resp.getCharset(), resp.getContentLength().longValue()); } return cf; } catch (Exception e) { convertException(e); } return null; }
@Override public boolean isFavorite(Node node) { String link = PublicAPIUrlRegistry.getUserFavouriteUrl( session, session.getPersonIdentifier(), NodeRefUtils.getCleanIdentifier(node.getIdentifier())); UrlBuilder url = new UrlBuilder(link); Response resp = getHttpInvoker().invokeGET(url, getSessionHttp()); if (resp.getResponseCode() == HttpStatus.SC_OK) { return true; } return false; }