source: branches/new-datamodel/src/atom/fragments.lisp

Last change on this file was 90, checked in by lgiessmann, 15 years ago

isidorus (core): reimplemented the threading module -> all private function of hunchentoot are replaced by public functions of the package bordeaux-threads which is internally used by hunchentoot; the macors with-reader-lock and witrh-writer-lock are mostly used at the "top-layer" of all calls, e.g. RESTful-interface - with one exception the xml-im/exporter. In this module are with locks used in the main import-calls, e.g. init-isidorus, importer-xtm1.0, import-only-topics, importer, export-xtm, export-xtm-to-string and export-xtm-fragment; ajax-client: fixed a problem when creating a associaitons in the section "create topics"

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1;;+-----------------------------------------------------------------------------
2;;+  Isidorus
3;;+  (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
4;;+
5;;+  Isidorus is freely distributable under the LGPL license.
6;;+  You can find a detailed description in trunk/docs/LGPL-LICENSE.txt.
7;;+-----------------------------------------------------------------------------
8
9
10(in-package :atom)
11
12(defclass fragment-entry (entry)
13  ((summary :accessor summary :initarg :summary)
14   (psi :accessor psi :initarg :psi))
15  (:documentation "a fragment in a fragment feed"))
16
17(defclass fragments-feed (feed)
18  ((source-locator-prefix :accessor source-locator-prefix
19                          :initarg :source-locator-prefix
20                          :type string)
21   (tm-id :accessor tm-id
22          :initarg :tm-id
23          :type string)))
24
25(defmethod entry-to-elem ((entry fragment-entry))
26  (to-link (link entry) "alternate" "application/x-tm+xml;version=1.0")
27  (to-elem "a:summary" (summary entry))
28  (to-elem "e:TopicSI" (psi entry)))
29
30(defmethod feed-to-elem ((feed fragments-feed))
31  (setf (updated feed) (get-most-recent-datetime-for-tm (tm-id feed)))
32  (to-elem "e:ServerSrcLocatorPrefix" (source-locator-prefix feed)))
33
34(defmethod entries ((feed fragments-feed))
35  "Unlike for the other feed types, entries can be calculated"
36  (remove 
37   nil
38   (with-writer-lock
39     (loop for fragment in 
40          (mapcan #'d:get-fragments (rest (d:get-all-revisions)))
41        collect 
42          (let
43              ((tm (d:get-item-by-item-identifier (tm-id feed) :revision 0))
44               (xtm-link (format nil "~a/~a" 
45                                 (link feed) (d:unique-id fragment)))
46               (psi (d:uri (first (d:psis (d:topic fragment))))))
47            (when (d:in-topicmap tm (d:topic fragment))
48              (make-instance 'fragment-entry
49                             :id xtm-link
50                             :title psi
51                             :psi psi
52                             :path (format nil "~a/~a" (path feed) (d:unique-id fragment))
53                             :updated (datetime-in-iso-format (d:revision fragment))
54                             :link xtm-link
55                             :summary (format nil "Fragment for topic ~a" psi))))))))
56
57
58;; (defun build-fragments-feed (tm-id)
59;;   "Build a feed of changes for the Topic Map identified by tm-id from the revisions in the engine"
60;;   (loop for fragment in
61;;        (mapcan #'d:get-fragments (rest (d:get-all-revisions)))
62;;      collect
63;;        (register-entry
64;;         *testtm-fragments-feed*
65;;         (let
66;;             ((xtm-link (format nil "~a~a"
67;;                                (link *testtm-fragments-feed*) (d:unique-id fragment)))
68;;           (psi (d:uri (first (d:psis (d:topic fragment))))))
69             
70;;           (make-instance 'fragment-entry
71;;                          :title psi
72;;                          :psi psi
73;;                       :path (format nil "~a" (d:unique-id fragment))
74;;                          :updated (datetime-in-iso-format (d:revision fragment))
75;;                          :xtm-link xtm-link
76;;                          :description (format nil "Fragment for topic with psi~a" psi)))))
77;;   (feed-to-elem *testtm-fragments-feed*))
Note: See TracBrowser for help on using the repository browser.