Source tree pruned and flattened.
[clldap.git] / convert.lisp
blobba721e5fc81c042b87a4dbd35d66d3b3a8937e76
1 (in-package :ldif)
3 (defun record->add-record (record)
4 "Returns a change record with the ADD change type designed to create RECORD."
5 (destructuring-bind (distinguished-name object-classes attributes)
6 record
7 (list distinguished-name
8 'add
9 (fold-object-classes-and-attributes object-classes attributes))))
11 (defun record->replace-record (record)
12 "Returns a change record with the MODIFY change type designed to replace all attributes in RECORD."
13 (destructuring-bind (distinguished-name object-classes attributes)
14 record
15 (list distinguished-name
16 'modify
17 (mapcar (lambda (attribute)
18 (apply 'list
19 (car attribute) 'replace (cdr attribute)))
20 (fold-object-classes-and-attributes object-classes attributes)))))