本文整理汇总了Python中com.googlecode.fascinator.common.JsonObject.writeJSONString方法的典型用法代码示例。如果您正苦于以下问题:Python JsonObject.writeJSONString方法的具体用法?Python JsonObject.writeJSONString怎么用?Python JsonObject.writeJSONString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.fascinator.common.JsonObject
的用法示例。
在下文中一共展示了JsonObject.writeJSONString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __activate__
# 需要导入模块: from com.googlecode.fascinator.common import JsonObject [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonObject import writeJSONString [as 别名]
def __activate__(self, context):
self.auth = context["page"].authentication
self.errorMsg = ""
self.request = context["request"]
self.response = context["response"]
self.formData = context["formData"]
self.log = context["log"]
self.reportManager = context["Services"].getService("reportManager")
self.reportName = None
if (self.auth.is_logged_in()):
if (self.auth.is_admin()==True):
pass
else:
self.errorMsg = "Requires Admin / Librarian / Reviewer access."
else:
self.errorMsg = "Please login."
if self.errorMsg == "":
self.reportName = self.formData.get("reportName")
if (self.reportName):
self.report = self.reportManager.getReport(self.reportName)
self.func = self.formData.get("func", "")
if self.func == "" and self.request.getParameter("func"):
self.func = self.request.getParameter("func")
if self.func == "action":
self.action = self.request.getParameter("action")
if self.action == "create":
self.createReport()
out = self.response.getPrintWriter("text/plain; charset=UTF-8")
out.println("{\"id\":\""+self.report.getReportName()+"\"}")
out.close()
return
if self.action == "edit":
self.editReport()
out = self.response.getPrintWriter("text/plain; charset=UTF-8")
out.println("{\"id\":\""+self.report.getReportName()+"\"}")
out.close()
return
if self.action == "options":
out = self.response.getPrintWriter("text/plain; charset=UTF-8")
out.println(FileUtils.readFileToString(File(FascinatorHome.getPath("reports")+"/reportCriteriaOptions.json")))
out.close()
return
if self.action == "get-json":
out = self.response.getPrintWriter("text/plain; charset=UTF-8")
report = self.reportManager.getReports().get(self.request.getParameter("reportName"))
queryFilters = report.config.getObject("query", "filter")
jsonMap = HashMap()
elementIds = ArrayList()
for elementId in queryFilters:
elementIds.add(elementId)
Collections.sort(elementIds)
for elementId in elementIds:
jsonMap.put(elementId,queryFilters.get(elementId).get("value"))
jsonMap.put("reportName",report.getLabel())
JsonObject.writeJSONString(jsonMap,out)
out.close()
return