Class IxbusDocumentMapper

java.lang.Object
org.exoplatform.addons.ixbus.util.IxbusDocumentMapper

public final class IxbusDocumentMapper extends Object
Maps the folders returned by the ixbus parapheur API to DocumentEntity. A folder the API returns without one of the optional fields is mapped without it, and a folder that cannot be mapped at all is skipped, so one malformed folder never empties a whole list.
  • Method Details

    • toDocumentEntities

      public static List<DocumentEntity> toDocumentEntities(org.json.JSONArray folders, String serverUrl, Predicate<org.json.JSONObject> filter)
      Maps every folder of the payload accepted by the filter, most recent first (the API returns them oldest first).
      Parameters:
      folders - the API payload
      serverUrl - the ixbus server url, used to build each folder's link
      filter - which folders to keep, read on the raw JSON object
      Returns:
      the mapped folders, never null
    • toDocumentEntity

      public static DocumentEntity toDocumentEntity(org.json.JSONObject folder, String serverUrl)
      Maps one folder. Only identifiant is required.
      Parameters:
      folder - the folder as returned by the API
      serverUrl - the ixbus server url
      Returns:
      the mapped folder