@Override
 public PagingResult<Node> getFavoriteNodes(ListingContext listingContext) {
   String link = PublicAPIUrlRegistry.getUserFavouritesUrl(session, session.getPersonIdentifier());
   UrlBuilder url = new UrlBuilder(link);
   if (listingContext != null) {
     url.addParameter(PublicAPIConstant.MAX_ITEMS_VALUE, listingContext.getMaxItems());
     url.addParameter(PublicAPIConstant.SKIP_COUNT_VALUE, listingContext.getSkipCount());
   }
   return computeFavorites(url);
 }
 @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;
 }
  @Override
  public void removeFavorite(Node node) {
    if (isObjectNull(node)) {
      throw new IllegalArgumentException(
          String.format(
              Messagesl18n.getString("ErrorCodeRegistry.GENERAL_INVALID_ARG_NULL"), "node"));
    }

    try {
      String link =
          PublicAPIUrlRegistry.getUserFavouriteUrl(
              session, session.getPersonIdentifier(), node.getIdentifier());
      delete(new UrlBuilder(link), ErrorCodeRegistry.DOCFOLDER_GENERIC);
    } catch (Exception e) {
      convertException(e);
    }
  }
  @Override
  public void addFavorite(Node node) {
    if (isObjectNull(node)) {
      throw new IllegalArgumentException(
          String.format(
              Messagesl18n.getString("ErrorCodeRegistry.GENERAL_INVALID_ARG_NULL"), "node"));
    }
    try {
      String link =
          PublicAPIUrlRegistry.getUserPreferenceUrl(session, session.getPersonIdentifier());
      UrlBuilder url = new UrlBuilder(link);

      // prepare json data
      String preferenceFilter = "target.file";
      if (node.isFolder()) {
        preferenceFilter = "target.folder";
      }

      String[] filter = preferenceFilter.split("\\.");

      JSONObject jroot = new JSONObject();
      JSONObject jt = null;
      JSONObject jp = jroot;
      for (int i = 0; i < filter.length; i++) {
        jt = new JSONObject();
        jp.put(filter[i], jt);
        jp = jt;
      }
      jt.put(PublicAPIConstant.GUID_VALUE, NodeRefUtils.getCleanIdentifier(node.getIdentifier()));

      final JsonDataWriter formDataM = new JsonDataWriter(jroot);

      // send
      post(
          url,
          formDataM.getContentType(),
          new Output() {
            public void write(OutputStream out) throws IOException {
              formDataM.write(out);
            }
          },
          ErrorCodeRegistry.DOCFOLDER_GENERIC);
    } catch (Exception e) {
      convertException(e);
    }
  }