 ;;;; Helpers for sessions and requests
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(def transaction-modes
-  "Mapping of keywords for valid Session transaction modes (per
-  https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/Session.TransactionMode.html)."
-  {:auto Session$TransactionMode/AUTO
-   :query Session$TransactionMode/QUERY
-   :update Session$TransactionMode/UPDATE
-   :update-auto-commit Session$TransactionMode/UPDATE_AUTO_COMMIT})
-
 (def valid-request-options
   "Set of valid request options for Request objects. Can also be
   passed to Sessions as :default-request-options. See

                                       (reduce (fn [permissions permission]
                                                 (conj permissions
                                                       (ContentPermission.
                                                        (case (val (first permission))
                                                          :execute ContentCapability/EXECUTE
                                                          :insert  ContentCapability/INSERT
                                                          :read    ContentCapability/READ
                                                          :update  ContentCapability/UPDATE)
                                                        (key (first permission)))))
                                               []
                                               perms))))

    (when-let [pk (:placement-keys options)]
      (.setPlaceKeys cco pk)) ;; FIXME bigint and long array casts?
    (when-let [q (:quality options)]
      (.setQuality cco q))
    (when-let [rl (:repair-level options)]
      (.setRepairLevel cco (repair-level rl)))
    (when-let [rbs (:resolve-buffer-size options)]
      (.setResolveBufferSize cco rbs))
    (when-let [re (:resolve-entities options)]

  (when-let [uo (:user-object options)]
    (.setUserObject session uo))
  (when-let [tm (:transaction-mode options)]
    (.setTransactionMode session (transaction-mode tm)))
  (when-let [tt (:transaction-timeout options)]
    (.setTransactionTimeout session tt))
  session)
