本文整理汇总了Python中au.edu.usq.fascinator.common.JsonConfigHelper.getMap方法的典型用法代码示例。如果您正苦于以下问题:Python JsonConfigHelper.getMap方法的具体用法?Python JsonConfigHelper.getMap怎么用?Python JsonConfigHelper.getMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类au.edu.usq.fascinator.common.JsonConfigHelper
的用法示例。
在下文中一共展示了JsonConfigHelper.getMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getPackageTypes
# 需要导入模块: from au.edu.usq.fascinator.common import JsonConfigHelper [as 别名]
# 或者: from au.edu.usq.fascinator.common.JsonConfigHelper import getMap [as 别名]
def __getPackageTypes(self):
json = JsonConfigHelper(JsonConfig.getSystemFile())
packageTypes = json.getMap("portal/packageTypes")
packageTypes = dict(packageTypes)
if packageTypes=={}:
packageTypes["default"] = {"jsonconfig":"packaging-config.json"}
return packageTypes
示例2: __metadata
# 需要导入模块: from au.edu.usq.fascinator.common import JsonConfigHelper [as 别名]
# 或者: from au.edu.usq.fascinator.common.JsonConfigHelper import getMap [as 别名]
def __metadata(self):
ISOCode = self.params.getProperty("ISOcode")
print "*** Processing: ", ISOCode
#Index the country metadata
metadataPayload = self.object.getPayload("%s.json" % ISOCode)
json = JsonConfigHelper(metadataPayload.open())
allMeta = json.getMap(".")
self.utils.add(self.index, "recordType", "country")
for key in allMeta.keySet():
self.utils.add(self.index, key, allMeta.get(key));
metadataPayload.close()
#Index the country detail
geoNamePayload = self.object.getPayload("%s.txt" % ISOCode)
countryName = self.params.getProperty("countryName")
countryAreaStream = geoNamePayload.open()
reader = BufferedReader(InputStreamReader(countryAreaStream, "UTF-8"));
line = reader.readLine()
headerList = ["geonameid", "name", "asciiname", "alternatenames", "latitude", "longitude", \
"feature class", "feature code", "country code", "cc2", "admin1 code", "admin2 code", \
"admin3 code", "admin4 code", "population", "elevation", "gtopo30", "timezone", "modification date"]
while (line != None):
arraySplit = line.split("\t")
geonamesId = arraySplit[0]
oid = DigestUtils.md5Hex("http://geonames.org/" + geonamesId)
if oid == self.oid:
extraIndex = self.index
else:
extraIndex = HashMap()
self.utils.add(extraIndex, "recordType", "area")
self.utils.add(extraIndex, "item_type", self.itemType)
self.utils.add(extraIndex, "dc_identifier", oid)
self.utils.add(extraIndex, "id", oid)
self.utils.add(extraIndex, "storage_id", self.oid) #Use parent object
self.utils.add(extraIndex, "last_modified", time.strftime("%Y-%m-%dT%H:%M:%SZ"))
self.utils.add(extraIndex, "display_type", "geonames")
self.utils.add(extraIndex, "countryName", countryName)
self.utils.add(extraIndex, "repository_name", self.params["repository.name"])
self.utils.add(extraIndex, "repository_type", self.params["repository.type"])
self.utils.add(extraIndex, "security_filter", "guest")
self.utils.add(extraIndex, "dc_title", arraySplit[1])
# The rest of the metadata
count = 0
for array in arraySplit:
if headerList[count] !="alternatenames" and array:
self.utils.add(extraIndex, headerList[count], array)
count +=1
self.indexer.sendIndexToBuffer(oid, extraIndex)
line = reader.readLine()
geoNamePayload.close()
示例3: __getPackageTypeAndJsonConfigFile
# 需要导入模块: from au.edu.usq.fascinator.common import JsonConfigHelper [as 别名]
# 或者: from au.edu.usq.fascinator.common.JsonConfigHelper import getMap [as 别名]
def __getPackageTypeAndJsonConfigFile(self):
try:
packageType = self.vc("formData").get("packageType", "default")
if packageType == "":
packageType = "default"
json = JsonConfigHelper(JsonConfig.getSystemFile())
pt = json.getMap("portal/packageTypes/" + packageType)
jsonConfigFile = pt.get("jsonconfig")
if jsonConfigFile is None:
jsonConfigFile = "packaging-config.json"
except Exception, e:
jsonConfigFile = "packaging-config.json"
示例4: __init__
# 需要导入模块: from au.edu.usq.fascinator.common import JsonConfigHelper [as 别名]
# 或者: from au.edu.usq.fascinator.common.JsonConfigHelper import getMap [as 别名]
#.........这里部分代码省略.........
def getMetadataMap(self):
return self.__metadataMap
def getObject(self):
return self.__object
def getOid(self):
return self.__oid
def getPreview(self):
return self.__metadata.get("preview")
def getPreviewPid(self):
return self.__previewPid
def getProperty(self, field):
return self.getObject().getMetadata().getProperty(field)
def getUserAgreement(self):
if not self.uaActivated:
self.userAgreement.__activate__(self.velocityContext, self.getMetadata())
self.uaActivated = True
return self.userAgreement
def hasLocalFile(self):
# get original file.path from object properties
filePath = self.getProperty("file.path")
return filePath and os.path.exists(filePath)
def hasPid(self):
return self.__hasPid
def isAccessDenied(self):
myRoles = self.page.authentication.get_roles_list()
allowedRoles = self.getAllowedRoles()
for role in myRoles:
if role in allowedRoles:
return False
return True
def isDetail(self):
return not (self.request.isXHR() or self.__isPreview)
def isIndexed(self):
return self.__getNumFound() == 1
def isPending(self):
meta = self.getObject().getMetadata()
status = meta.get("render-pending")
return Boolean.parseBoolean(status)
def setStatus(self, status):
self.response.setStatus(status)
def __getNumFound(self):
return int(self.__solrData.get("response/numFound"))
def __getObject(self, oid):
obj = None
try:
storage = self.services.getStorage()
try:
obj = storage.getObject(oid)
except StorageException:
sid = self.__getStorageId(oid)
if sid is not None:
obj = storage.getObject(sid)
print "Object not found: oid='%s', trying sid='%s'" % (oid, sid)
except StorageException:
print "Object not found: oid='%s'" % oid
return obj
def __getStorageId(self, oid):
return self.__metadata.get("storage_id")
def __loadSolrData(self, oid):
portal = self.page.getPortal()
query = 'id:"%s"' % oid
if self.isDetail() and portal.getSearchQuery():
query += " AND " + portal.getSearchQuery()
req = SearchRequest(query)
req.addParam("fq", 'item_type:"object"')
if self.isDetail():
req.addParam("fq", portal.getQuery())
out = ByteArrayOutputStream()
self.services.getIndexer().search(req, out)
self.__solrData = JsonConfigHelper(ByteArrayInputStream(out.toByteArray()))
def __readMetadata(self, oid):
self.__loadSolrData(oid)
if self.isIndexed():
self.__metadata = self.__solrData.getJsonList("response/docs").get(0)
if self.__object is None:
# Try again, indexed records might have a special storage_id
self.__object = self.__getObject(oid)
# Just a more usable instance of metadata
self.__json = JsonConfigHelper(self.__solrData.getList("response/docs").get(0))
self.__metadataMap = TreeMap(self.__json.getMap("/"))
else:
self.__metadata.set("id", oid)