Permalink
Browse files

Provide a hook to initialize clj namespaces from Spring

  • Loading branch information...
1 parent 99eb2fa commit 79e7c642c99e38c6d08eac8d5b7e8f8649a1b83e @skuro committed Sep 27, 2011
@@ -1,12 +1,15 @@
(ns alfrescobox
- (:require [alfresco.actions :as a])
+ (:require [alfresco.actions :as a]
+ [alfresco.nodes :as n]
+ [clojure.pprint :as p])
(:import [alfresco.actions Action]
[java.util HashMap]))
(defn email-action-impl [_ action node]
- (println "Recipients are:")
- (println (str "xxxx" (bean action)))
- (map println (seq (.getParameterValue action "to"))))
+ (println (str "Acting upon " (:id node)))
+ (let [recipients (n/property node "abx:recipients")]
+ (println "Recipients are:")
+ (map println recipients)))
;; Define a new Action class that can be used in Spring initialization
(defrecord EmailTicketAction []
@@ -28,20 +31,26 @@
(defn tkt-getJSPPath
"Routes to the correct JSP"
- []
+ [this]
"/jsp/alfrescobox-action.jsp")
(defn tkt-prepareForSave
"Copies user provided params into to-be-saved props"
- [^HashMap act-props ^HashMap repo-props]
+ [this ^HashMap act-props ^HashMap repo-props]
(. repo-props put "tkt-recipients" (. get act-props "tkt-recipients")))
(defn tkt-prepareForEdit
"Initializes the action form with the currently stored props"
- [^HashMap act-props ^HashMap repo-props]
+ [this ^HashMap act-props ^HashMap repo-props]
+ (println "-----act-props--->")
+ (p/pprint act-props)
+ (println "<----------------")
+ (println "---repo-props--->")
+ (clojure.pprint/pprint repo-props)
+ (println "<----------------")
(. act-props put "tkt-recipients" (. repo-props get "tkt-recipients")))
(defn tkt-generateSummary
- [context wizard act-props]
+ [this context wizard act-props]
(println "test")
"TBD")
@@ -33,4 +33,13 @@
</bean>
<bean id="bootstrap_alfrescobox" class="alfrescobox.Startup" init-method="boot"/>
+
+ <bean id="bootstrap_namespaces" parent="initClojureNs">
+ <property name="namespaces">
+ <list>
+ <value>/alfrescobox</value>
+ </list>
+ </property>
+ </bean>
+
</beans>

0 comments on commit 79e7c64

Please sign in to comment.