Skip to content

Commit

Permalink
Provide a hook to initialize clj namespaces from Spring
Browse files Browse the repository at this point in the history
  • Loading branch information
skuro committed Sep 27, 2011
1 parent 99eb2fa commit 79e7c64
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
25 changes: 17 additions & 8 deletions alfrescobox/src/main/clojure/alfrescobox.clj
@@ -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 []
Expand All @@ -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")
9 changes: 9 additions & 0 deletions alfrescobox/src/main/config/context/service-context.xml
Expand Up @@ -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.