Navigation Menu

Skip to content

Commit

Permalink
Removed increment operation
Browse files Browse the repository at this point in the history
  • Loading branch information
alienscience committed Feb 9, 2011
1 parent 4116017 commit a201fa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -89,8 +89,7 @@ a map in the form:
:attribute-e [value1 value2]}
:replace
{:attibute-d value
:attribute-e [value1 value2]}
:increment [:attribute-f attribute-g]}
:attribute-e [value1 value2]}}

All the keys in the map are optional e.g:

Expand Down
16 changes: 3 additions & 13 deletions src/clj_ldap/client.clj
Expand Up @@ -155,24 +155,15 @@
(for [[k v] modify-map]
(create-modification modify-op (name k) v)))

(defn- modify-incs
"Returns a sequence of Modification objects that increment the given
attribute(s)"
[attributes]
(if attributes
(if (coll? attributes)
(map #(Modification. ModificationType/INCREMENT %) attributes)
[(Modification. ModificationType/INCREMENT attributes)])))

(defn- get-modify-request
"Sets up a ModifyRequest object using the contents of the given map"
[dn modifications]
(let [adds (modify-ops ModificationType/ADD (modifications :add))
deletes (modify-ops ModificationType/DELETE (modifications :delete))
replacements (modify-ops ModificationType/REPLACE
(modifications :replace))
incs (modify-incs (modifications :increment))]
(ModifyRequest. dn (into-array (concat adds deletes replacements incs)))))
(modifications :replace))]
(ModifyRequest. dn (into-array (concat adds deletes replacements)))))

;;=========== API ==============================================================

Expand Down Expand Up @@ -234,8 +225,7 @@
:attribute-e [value1 value2]}
:replace
{:attibute-d value
:attribute-e [value1 value2]}
:increment [:attribute-f attribute-g]}
:attribute-e [value1 value2]}}
"
[connection dn modifications]
(let [modify-obj (get-modify-request dn modifications)]
Expand Down

0 comments on commit a201fa6

Please sign in to comment.