mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
39 lines
880 B
Python
39 lines
880 B
Python
|
import re
|
||
|
|
||
|
class OcbMapping:
|
||
|
def __init__(self, entityId, entityType, attributeName, attributeType):
|
||
|
self.entityId = entityId
|
||
|
self.entityType = entityType
|
||
|
self.attributeName = attributeName
|
||
|
self.attributeType = attributeType
|
||
|
|
||
|
@classmethod
|
||
|
def parse(self, lines):
|
||
|
m = re.match('([a-z]+)\(([a-z]+)\)\.([a-z]+).\(([a-z]+)\)', re.I)
|
||
|
return OcbMapping(m.group(1), m.group(2), m.group(3), m.group(4))
|
||
|
|
||
|
@classMethod
|
||
|
def parseFile(self, file):
|
||
|
|
||
|
class OcbEntity:
|
||
|
|
||
|
class OcbAttribute:
|
||
|
|
||
|
class OcbResponse:
|
||
|
def __init__(self, mapping):
|
||
|
self.mapping = mapping
|
||
|
|
||
|
def getJson(self, msg):
|
||
|
json = { "contextResponses" : [ ] }
|
||
|
|
||
|
for (value in msg.values):
|
||
|
json["contextResponses"].append({
|
||
|
"statusCode" : { "code" : 200, "reasonPhrase" : "OK" }
|
||
|
"contextElement" : {
|
||
|
"attributes" = [ ],
|
||
|
"id" : "",
|
||
|
"isPattern" : false,
|
||
|
"type"
|
||
|
}
|
||
|
})
|