1 |
from DataStructures import *
|
2 |
from SqlGenerator import *
|
3 |
class StatusDAO:
|
4 |
"""
|
5 |
All the APIs for Service Type entity
|
6 |
"""
|
7 |
def __init__(self, config):
|
8 |
self.config= config
|
9 |
self.objType = 'status'
|
10 |
self.sqlGenerator = SqlGenerator()
|
11 |
def addStatus(self, object):
|
12 |
"""
|
13 |
Add a status to the database
|
14 |
"""
|
15 |
validate(self.objType, object)
|
16 |
sql = self.sqlGenerator.getInsertSql(self.objType, object)
|
17 |
self.config.debug(sql)
|
18 |
self.config.dbi.processData(sql, object)
|
19 |
return self.listStatus(object)
|
20 |
|
21 |
def listStatus(self, object):
|
22 |
"""
|
23 |
List status types known to RegSvc according to the specific conditions
|
24 |
"""
|
25 |
fillInWildCards(self.objType, object)
|
26 |
sql = self.sqlGenerator.getSelectSql(self.objType, object)
|
27 |
self.config.debug(sql)
|
28 |
result = self.config.dbi.processData(sql, object)
|
29 |
result = self.config.formatDict(result)
|
30 |
for i in range(len(result)): format(self.objType, result[i])
|
31 |
return result
|
32 |
|
33 |
|
34 |
|