Skip to content

Commit

Permalink
Issue #5 - Adds missing library dependency
Browse files Browse the repository at this point in the history
* Adds gdata-core to dependencies
* Use get-domain to unifying the `uploadUrl` parameter
  • Loading branch information
iperdomo committed Jun 19, 2013
1 parent 579def7 commit 7609c5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[org.apache.ant/ant-compress "1.2"]
[org.slf4j/slf4j-api "1.7.3"]
[org.slf4j/slf4j-simple "1.7.3"]
[com.google.gdata/core "1.47.1"]
; Akvo FLOW dependencies
[exporterapplet "1.1.0"]
[org.json/json "20090211"]]
Expand Down
3 changes: 2 additions & 1 deletion src/akvo/flow_services/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
(defn get-criteria
"Returns a map of upload configuration criteria"
[upload-domain surveyId]
(let [config (@configs upload-domain)]
(let [domain (get-domain upload-domain)
config (@configs domain)]
{"uploadBase" (config "uploadUrl")
"awsId" (config "s3Id")
"dataPolicy" (config "surveyDataS3Policy")
Expand Down
13 changes: 9 additions & 4 deletions src/akvo/flow_services/exporter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
; The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>..

(ns akvo.flow-services.exporter
(:require [clojure.java.io :as io])
(:require [clojure.java.io :as io]
[akvo.flow-services.config :as config])
(:import java.io.File
java.util.UUID
org.waterforpeople.mapping.dataexport.SurveyDataImportExportFactory))
Expand All @@ -31,8 +32,12 @@
(.mkdirs (io/file path))
(io/file (format "%s/%s-%s.%s" path et id (get-file-extension et)))))

(defn ^File export-report [type base id options]
(defn ^File export-report
"Exports a report using SurveyDataImportExportFactory based on the report type.
Returns the reference to the saved file."
[type base id options]
(let [exporter (.getExporter (SurveyDataImportExportFactory.) type)
file (get-file type id)]
(.export exporter {"surveyId" id} file base options)
file (get-file type id)
criteria (config/get-criteria (options "uploadUrl") id)]
(.export exporter criteria file base options)
file))

0 comments on commit 7609c5e

Please # to comment.