HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
ftests_dbi_insert_on_update.DemoResourcesManager Class Reference
Inheritance diagram for ftests_dbi_insert_on_update.DemoResourcesManager:
Collaboration diagram for ftests_dbi_insert_on_update.DemoResourcesManager:

Public Member Functions

def __init__ (self, config_dic)
 
def updateResourcesData (self, resource)
 

Public Attributes

 dbi
 

Detailed Description

Definition at line 23 of file ftests_dbi_insert_on_update.py.

Constructor & Destructor Documentation

◆ __init__()

def ftests_dbi_insert_on_update.DemoResourcesManager.__init__ (   self,
  config_dic 
)

Definition at line 26 of file ftests_dbi_insert_on_update.py.

26  def __init__(self, config_dic):
27  # create dbi instance
28  self.dbi = DBI(config_dic)
29 
30 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ updateResourcesData()

def ftests_dbi_insert_on_update.DemoResourcesManager.updateResourcesData (   self,
  resource 
)

Definition at line 31 of file ftests_dbi_insert_on_update.py.

31  def updateResourcesData(self, resource):
32  # insert object
33  original_resource = dbResources(resource)
34  self.dbi.insert(original_resource)
35  if self.dbi.getErrorCode() != CONSTANTS.DBI_SUCCESS_CODE:
36  # handle insertion's error
37  print "insert original resource error!"
38  return
39  else:
40  # do ptocessing after insertion
41  print "original resource: %s" % original_resource
42  pass
43 
44 
45  # fetch object
46  fetched_resource = dbResources(resource)
47  fetched_original_resource = self.dbi.fetch(fetched_resource, "nodeId=%s"%fetched_resource.nodeId)
48  if self.dbi.getErrorCode()!=CONSTANTS.DBI_SUCCESS_CODE and fetched_original_resource!=original_resource:
49  # handle fetch's error
50  print "fetch original resource error!"
51  return
52  else:
53  # do ptocessing after insertion
54  pass
55  print "fetched original resource: %s" % fetched_original_resource
56 
57 
58 
59  # update otiginal resource
60  updated_resource = dbResources(resource)
61  updated_resource.name = "updated"
62  print "updated resource: %s" % fetched_original_resource
63  returned_updated_resource = self.dbi.insertOnUpdate(updated_resource, "nodeId=%s"%updated_resource.nodeId)
64  if self.dbi.getErrorCode() != CONSTANTS.DBI_SUCCESS_CODE:
65  # handle fetch's error
66  print "insert on update error!"
67  return
68  else:
69  # do ptocessing after insertion
70  pass
71  print "returned updated resource: %s" % returned_updated_resource
72 
73 
74 
75  # fetch updated object
76  fetched_resource = dbResources(resource)
77  fetched_updated_resource = self.dbi.fetch(fetched_resource, "nodeId=%s"%fetched_resource.nodeId)
78  if self.dbi.getErrorCode() != CONSTANTS.DBI_SUCCESS_CODE:
79  # handle update's error
80  print "delete one object error!"
81  return
82  else:
83  # do ptocessing after insertion
84  pass
85  print "fetched updated resource: %s" % fetched_updated_resource
86 
87 
88 
89 
90 
91 

Member Data Documentation

◆ dbi

ftests_dbi_insert_on_update.DemoResourcesManager.dbi

Definition at line 28 of file ftests_dbi_insert_on_update.py.


The documentation for this class was generated from the following file: