CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
python.tagInventory.tagInventory Class Reference
Inheritance diagram for python.tagInventory.tagInventory:

Public Member Functions

def __init__
 
def addEntriesReplaceService
 
def addEntry
 
def bulkInsertEntries
 
def cloneEntry
 
def createInventoryTable
 
def deleteAllEntries
 
def deleteEntryByName
 
def dropme
 
def existInventoryTable
 
def getAllEntries
 
def getEntryById
 
def getEntryByName
 
def getIDsByName
 
def modifyEntriesReplaceService
 
def replaceTagLabel
 

Private Attributes

 __session
 
 __tagInventoryIDName
 
 __tagInventoryTableColumns
 
 __tagInventoryTableHandle
 
 __tagInventoryTableName
 
 __tagInventoryTableNotNullColumns
 
 __tagInventoryTablePK
 

Detailed Description

Class manages tag inventory 

Definition at line 3 of file tagInventory.py.

Constructor & Destructor Documentation

def python.tagInventory.tagInventory.__init__ (   self,
  session 
)
Input: coral session handle

Definition at line 6 of file tagInventory.py.

6 
7  def __init__( self , session ):
8  """Input: coral session handle
9  """
10  self.__session = session
11  self.__tagInventoryTableName=CommonUtils.inventoryTableName()
12  self.__tagInventoryIDName=CommonUtils.inventoryIDTableName()
13  self.__tagInventoryTableColumns = {'tagid':'unsigned long', 'tagname':'string', 'pfn':'string','recordname':'string', 'objectname':'string', 'labelname':'string'}
14  self.__tagInventoryTableNotNullColumns = ['tagname','pfn','recordname','objectname']
15  #self.__tagInventoryTableUniqueColumns = ['tagname']
self.__tagInventoryTablePK = ('tagid')

Member Function Documentation

def python.tagInventory.tagInventory.addEntriesReplaceService (   self,
  newservicename 
)
clone all existing entries only servicename in pfn are different
return collection of new (oldtagid,newtagid) pair 

Definition at line 122 of file tagInventory.py.

References python.tagInventory.tagInventory.__session, python.entryComment.entryComment.__session, python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, data, and join().

123  def addEntriesReplaceService( self, newservicename ):
124  """ clone all existing entries only servicename in pfn are different
125  return collection of new (oldtagid,newtagid) pair
126  """
127  newtaglinks=[]
128  transaction=self.__session.transaction()
129  try:
130  results=[]
131  transaction.start(True)
132  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
133  for columnName in self.__tagInventoryTableColumns:
134  query.addToOutputList(columnName)
135  cursor=query.execute()
136  while cursor.next():
137  tagid=cursor.currentRow()['tagid'].data()
138  tagname=cursor.currentRow()['tagname'].data()
139  pfn=cursor.currentRow()['pfn'].data()
140  (servicename,schemaname)=pfn.rsplit('/',1)
141  newpfn=('/').join([newservicename,schemaname])
142  #k=(' ').join([tagname,newpfn])
143  objname=cursor.currentRow()['objectname'].data()
144  redname=cursor.currentRow()['recordname'].data()
145  labname=cursor.currentRow()['labelname'].data()
146  #return a tuple
147  r=(tagid,tagname,newpfn,objname,redname,labname)
148  results.append(r)
149  transaction.commit()
150  del query
151  except Exception, er:
152  transaction.rollback()
153  raise Exception, str(er)
154 
155  inv=tagInventory(self.__session)
156  try:
157  for r in results:
158  nd=Node.LeafNode()
159  oldtagid=r[0]
160  nd.tagname=r[1]
161  nd.pfn=r[2]
162  nd.objectname=r[3]
163  nd.recordname=r[4]
164  #if not r.items()[1][2] is None:
165  nd.labelname=r[5]
166  n=inv.addEntry(nd)
167  if n==0:
168  raise "addEntry returns 0"
169  newtaglinks.append((oldtagid,n))
170  return newtaglinks
171  except Exception, e:
172  print str(e)
173  raise Exception, str(e)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.addEntry (   self,
  leafNode 
)
Add entry into the inventory.\n
Input: base tag info. If identical data found already exists, do nothing
Output: tagid. if tagid=0, there's no new entry added, i.e.no new tagid

Definition at line 75 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryIDName, python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, and data.

75 
76  def addEntry( self, leafNode ):
77  """Add entry into the inventory.\n
78  Input: base tag info. If identical data found already exists, do nothing
79  Output: tagid. if tagid=0, there's no new entry added, i.e.no new tagid
80 
81  """
82  tagid=0
83  transaction=self.__session.transaction()
84  duplicate=False
85  try:
86  transaction.start(True)
87  schema = self.__session.nominalSchema()
88  query = schema.tableHandle(self.__tagInventoryTableName).newQuery()
89  condition='tagname=:tagname'
90  conditionbindDict=coral.AttributeList()
91  conditionbindDict.extend('tagname','string')
92  conditionbindDict['tagname'].setData(leafNode.tagname)
93  if len(leafNode.pfn)!=0:
94  condition+=' AND pfn=:pfn'
95  conditionbindDict.extend('pfn','string')
96  conditionbindDict['pfn'].setData(leafNode.pfn)
97  query.setCondition(condition,conditionbindDict)
98  #duplicate=dbop.existRow(self.__tagInventoryTableName,condition,conditionbindDict)
99  cursor=query.execute()
100  while( cursor.next() ):
101  duplicate=True
102  tagid=cursor.currentRow()['tagid'].data()
103  cursor.close()
104  transaction.commit()
105  del query
106  #transaction.commit()
107  if duplicate is False:
108  transaction.start(False)
109  generator=IdGenerator.IdGenerator(schema)
110  tagid=generator.getNewID(self.__tagInventoryIDName)
111  tabrowValueDict={'tagid':tagid,'tagname':leafNode.tagname,'objectname':leafNode.objectname,'pfn':leafNode.pfn,'labelname':leafNode.labelname,'recordname':leafNode.recordname}
112  dbop=DBImpl.DBImpl(schema)
113  dbop.insertOneRow(self.__tagInventoryTableName,
115  tabrowValueDict)
116  generator.incrementNextID(self.__tagInventoryIDName)
117  transaction.commit()
118  return tagid
119  except Exception, er:
120  transaction.rollback()
121  raise Exception, str(er)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.bulkInsertEntries (   self,
  entries 
)
insert a chunk of entries.
Input: entries [{tagid:unsigned long, tagname:string , pfn:string , recordname:string , objectname:string, labelname:string }]
Output: {oldtagid:newtagid} of the inserted entries. If tag already exists, old tagid is returned

Definition at line 420 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryIDName, python.tagInventory.tagInventory.__tagInventoryTableName, python.tagInventory.tagInventory.createInventoryTable(), data, python.tagInventory.tagInventory.existInventoryTable(), and python.tagInventory.tagInventory.getAllEntries().

421  def bulkInsertEntries( self, entries ):
422  """insert a chunk of entries.
423  Input: entries [{tagid:unsigned long, tagname:string , pfn:string , recordname:string , objectname:string, labelname:string }]
424  Output: {oldtagid:newtagid} of the inserted entries. If tag already exists, old tagid is returned
425  """
426  transaction=self.__session.transaction()
427  results={}
428  ihad=[]
429  try:
430  if self.existInventoryTable():
431  ihad=self.getAllEntries()
432  else:
433  self.createInventoryTable()
434  #clean input list removing duplicates
435  for e in entries:
436  for n in ihad:
437  if n.tagname==e['tagname'] and n.pfn==e['pfn']:
438  results[n.tagid]=n.tagid
439  entries.remove(e)
440  transaction.start(False)
441  query=self.__session.nominalSchema().tableHandle(self.__tagInventoryIDName).newQuery()
442  query.addToOutputList('nextID')
443  query.setForUpdate()
444  cursor = query.execute()
445  nextid=0
446  while cursor.next():
447  nextid=cursor.currentRow()[0].data()
448  idEditor = self.__session.nominalSchema().tableHandle(self.__tagInventoryIDName).dataEditor()
449  inputData = coral.AttributeList()
450  inputData.extend( 'delta', 'unsigned long' )
451 
452  delta=len(entries)
453  if nextid==0:
454  nextid=1
455  delta=1
456 
457  inputData['delta'].setData(delta)
458  idEditor.updateRows('nextID = nextID + :delta','',inputData)
459 
460  dataEditor=self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).dataEditor()
461  insertdata=coral.AttributeList()
462  insertdata.extend('tagid','unsigned long')
463  insertdata.extend('tagname','string')
464  insertdata.extend('pfn','string')
465  insertdata.extend('recordname','string')
466  insertdata.extend('objectname','string')
467  insertdata.extend('labelname','string')
468  bulkOperation=dataEditor.bulkInsert(insertdata,delta)
469  for entry in entries:
470  insertdata['tagid'].setData(nextid)
471  insertdata['tagname'].setData(entry['tagname'])
472  insertdata['pfn'].setData(entry['pfn'])
473  insertdata['recordname'].setData(entry['recordname'])
474  insertdata['objectname'].setData(entry['objectname'])
475  insertdata['labelname'].setData(entry['labelname'])
476  bulkOperation.processNextIteration()
477  results[entry['tagid']]=nextid
478  nextid=nextid+1
479  bulkOperation.flush()
480  transaction.commit()
481  del bulkOperation
482  del query
483  return results
484  except Exception, e:
485  transaction.rollback()
486  raise Exception, str(e)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.cloneEntry (   self,
  sourcetagid,
  pfn 
)
clone an existing entry with different pfn parameter
Input: sourcetagid, pfn.
Output: tagid of the new entry. Return 0 in case no new entry created or required entry already exists. 

Definition at line 211 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryIDName, python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, and python.tagInventory.tagInventory.getEntryById().

212  def cloneEntry( self, sourcetagid, pfn ):
213  """ clone an existing entry with different pfn parameter
214  Input: sourcetagid, pfn.
215  Output: tagid of the new entry. Return 0 in case no new entry created or required entry already exists.
216  """
217  newtagid=sourcetagid
218  if len(pfn)==0:
219  return newtagid
220  try:
221  nd=self.getEntryById(sourcetagid)
222  if nd.tagid==0:
223  return newtagid
224  oldpfn=nd.pfn
225  if oldpfn==pfn:
226  return nd.tagid
227  transaction=self.__session.transaction()
228  transaction.start(False)
229  schema = self.__session.nominalSchema()
230  generator=IdGenerator.IdGenerator(schema)
231  newtagid=generator.getNewID(self.__tagInventoryIDName)
232  tabrowValueDict={'tagid':newtagid,'tagname':nd.tagname,'objectname':nd.objectname,'pfn':pfn,'labelname':nd.labelname,'recordname':nd.recordname}
233  dbop=DBImpl.DBImpl(schema)
234  dbop.insertOneRow(self.__tagInventoryTableName,
236  tabrowValueDict)
237  generator.incrementNextID(self.__tagInventoryIDName)
238  transaction.commit()
239  return newtagid
240  except Exception, er:
241  transaction.rollback()
242  raise Exception, str(er)
def python.tagInventory.tagInventory.createInventoryTable (   self)
Create tag inventory table. Existing table will be deleted. 

Definition at line 45 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName, python.tagInventory.tagInventory.__tagInventoryTableNotNullColumns, and python.tagInventory.tagInventory.__tagInventoryTablePK.

Referenced by python.tagInventory.tagInventory.bulkInsertEntries().

45 
46  def createInventoryTable( self ):
47  """Create tag inventory table. Existing table will be deleted.
48  """
49  try:
50  transaction=self.__session.transaction()
51  transaction.start()
52  schema = self.__session.nominalSchema()
53  schema.dropIfExistsTable( self.__tagInventoryTableName )
54  description = coral.TableDescription();
55  description.setName( self.__tagInventoryTableName )
56  for columnName, columnType in self.__tagInventoryTableColumns.items():
57  description.insertColumn(columnName, columnType)
58  for columnName in self.__tagInventoryTableNotNullColumns :
59  description.setNotNullConstraint(columnName,True)
60  #for columnName in self.__tagInventoryTableUniqueColumns :
61  #description.setUniqueConstraint(columnName)
62  #combinedunique1=('pfn','recordname','objectname','labelname')
63  #description.setUniqueConstraint(combinedunique1)
64  #combinedunique2=('tagname','pfn')
65  #description.setUniqueConstraint(combinedunique2)
66  description.setPrimaryKey( self.__tagInventoryTablePK )
67  self.__tagInventoryTableHandle = schema.createTable( description )
68  self.__tagInventoryTableHandle.privilegeManager().grantToPublic( coral.privilege_Select )
69  #create also the associated id table
70  generator=IdGenerator.IdGenerator(schema)
71  generator.createIDTable(self.__tagInventoryIDName,True)
72  transaction.commit()
73  except Exception, er:
74  transaction.rollback()
raise Exception, str(er)
def python.tagInventory.tagInventory.deleteAllEntries (   self)
Delete all entries in the inventory

Definition at line 365 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName.

366  def deleteAllEntries( self ):
367  """Delete all entries in the inventory
368  """
369  transaction=self.__session.transaction()
370  try:
371  transaction.start(False)
372  schema = self.__session.nominalSchema()
373  dbop=DBImpl.DBImpl(schema)
374  inputData = coral.AttributeList()
375  dbop.deleteRows(self.__tagInventoryTableName,
376  '',
377  inputData)
378  transaction.commit()
379  except Exception, e:
380  transaction.rollback()
381  raise Exception, str(e)
def python.tagInventory.tagInventory.deleteEntryByName (   self,
  tagname 
)
Delete entry with given tag name

Definition at line 382 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName.

383  def deleteEntryByName( self, tagname ):
384  """Delete entry with given tag name
385  """
386  try:
387  transaction=self.__session.transaction()
388  transaction.start(False)
389  schema = self.__session.nominalSchema()
390  dbop=DBImpl.DBImpl(schema)
391  inputData = coral.AttributeList()
392  inputData.extend( "tagname","string" )
393  inputData[0].setData(tagname)
394  dbop.deleteRows(self.__tagInventoryTableName,
395  'tagname=:tagname',
396  inputData)
397  transaction.commit()
398  except Exception, e:
399  transaction.rollback()
400  raise Exception, str(e)
def python.tagInventory.tagInventory.dropme (   self)
Drop inventory related tables

Definition at line 16 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryIDName, and python.tagInventory.tagInventory.__tagInventoryTableName.

16 
17  def dropme( self ):
18  """Drop inventory related tables
19  """
20  try:
21  transaction=self.__session.transaction()
22  transaction.start(False)
23  schema = self.__session.nominalSchema()
24  schema.dropIfExistsTable( self.__tagInventoryIDName )
25  schema.dropIfExistsTable( self.__tagInventoryTableName )
26  transaction.commit()
27  except Exception, er:
28  transaction.rollback()
29  raise Exception, str(er)
30  return
def python.tagInventory.tagInventory.existInventoryTable (   self)
Check if inventory table exists

Definition at line 31 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName.

Referenced by python.tagInventory.tagInventory.bulkInsertEntries().

31 
32  def existInventoryTable( self ):
33  """Check if inventory table exists
34  """
35  try:
36  transaction=self.__session.transaction()
37  transaction.start(True)
38  schema = self.__session.nominalSchema()
39  result=schema.existsTable(self.__tagInventoryTableName)
40  transaction.commit()
41  #print result
42  except Exception, er:
43  transaction.rollback()
44  raise Exception, str(er)
return result
def python.tagInventory.tagInventory.getAllEntries (   self)
Get all entries in the inventory
Output: list of leafNode objects

Definition at line 315 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, and data.

Referenced by python.tagInventory.tagInventory.bulkInsertEntries().

316  def getAllEntries( self ):
317  """Get all entries in the inventory
318  Output: list of leafNode objects
319  """
320  result=[]
321  transaction=self.__session.transaction()
322  try:
323  transaction.start(True)
324  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
325  for columnName in self.__tagInventoryTableColumns:
326  query.addToOutputList(columnName)
327  cursor = query.execute()
328  while ( cursor.next() ):
329  leafnode = Node.LeafNode()
330  leafnode.tagid=cursor.currentRow()['tagid'].data()
331  leafnode.tagname=cursor.currentRow()['tagname'].data()
332  leafnode.objectname=cursor.currentRow()['objectname'].data()
333  leafnode.pfn=cursor.currentRow()['pfn'].data()
334  leafnode.recordname=cursor.currentRow()['recordname'].data()
335  leafnode.labelname=cursor.currentRow()['labelname'].data()
336  result.append(leafnode)
337  transaction.commit()
338  del query
339  return result
340  except Exception, e:
341  transaction.rollback()
raise Exception, str(e)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.getEntryById (   self,
  tagId 
)
Get basic tag from inventory by id.\n
Input: tagid
Output: leafNode

Definition at line 283 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, and data.

Referenced by python.tagInventory.tagInventory.cloneEntry().

284  def getEntryById( self, tagId ):
285  """Get basic tag from inventory by id.\n
286  Input: tagid
287  Output: leafNode
288  """
289  leafnode = Node.LeafNode()
290  transaction=self.__session.transaction()
291  try:
292  transaction.start(True)
293  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
294  for columnName in self.__tagInventoryTableColumns:
295  query.addToOutputList(columnName)
296  condition = "tagid=:tagid"
297  conditionData = coral.AttributeList()
298  conditionData.extend( 'tagid','unsigned long' )
299  conditionData['tagid'].setData(tagId)
300  query.setCondition( condition, conditionData)
301  cursor = query.execute()
302  while ( cursor.next() ):
303  #print 'got it'
304  leafnode.tagid=cursor.currentRow()['tagid'].data()
305  leafnode.tagname=cursor.currentRow()['tagname'].data()
306  leafnode.objectname=cursor.currentRow()['objectname'].data()
307  leafnode.pfn=cursor.currentRow()['pfn'].data()
308  leafnode.labelname=cursor.currentRow()['labelname'].data()
309  leafnode.recordname=cursor.currentRow()['recordname'].data()
310  transaction.commit()
311  del query
312  return leafnode
313  except Exception, e:
314  transaction.rollback()
raise Exception, str(e)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.getEntryByName (   self,
  tagName,
  pfn 
)
Get basic tag from inventory by tagName+pfn. pfn can be empty\n
Input: tagname,pfn
Output: leafNode
throw if more than one entry is found.

Definition at line 243 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableColumns, python.tagInventory.tagInventory.__tagInventoryTableName, and data.

244  def getEntryByName( self, tagName, pfn ):
245  """Get basic tag from inventory by tagName+pfn. pfn can be empty\n
246  Input: tagname,pfn
247  Output: leafNode
248  throw if more than one entry is found.
249  """
250  leafnode = Node.LeafNode()
251  transaction=self.__session.transaction()
252  try:
253  transaction.start(True)
254  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
255  for columnName in self.__tagInventoryTableColumns:
256  query.addToOutputList(columnName)
257  conditionData = coral.AttributeList()
258  condition = "tagname=:tagname"
259  conditionData.extend( 'tagname','string' )
260  conditionData['tagname'].setData(tagName)
261  if len(pfn)!=0 :
262  condition += " AND pfn=:pfn"
263  conditionData.extend( 'pfn','string' )
264  conditionData['pfn'].setData(pfn)
265  query.setCondition(condition,conditionData)
266  cursor = query.execute()
267  counter=0
268  while ( cursor.next() ):
269  if counter > 0 :
270  raise ValueError, "tagName "+tagName+" is not unique, please further specify parameter pfn"
271  counter+=1
272  leafnode.tagid=cursor.currentRow()['tagid'].data()
273  leafnode.tagname=cursor.currentRow()['tagname'].data()
274  leafnode.objectname=cursor.currentRow()['objectname'].data()
275  leafnode.pfn=cursor.currentRow()['pfn'].data()
276  leafnode.labelname=cursor.currentRow()['labelname'].data()
277  leafnode.recordname=cursor.currentRow()['recordname'].data()
278  transaction.commit()
279  del query
280  return leafnode
281  except Exception, e:
282  transaction.rollback()
raise Exception, str(e)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.getIDsByName (   self,
  name 
)
get tagids correspond to a given tag name

Definition at line 342 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName, and data.

343  def getIDsByName( self, name ):
344  """get tagids correspond to a given tag name
345  """
346  transaction=self.__session.transaction()
347  ids=[]
348  try:
349  transaction.start(True)
350  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
351  condition='tagname = :tagname'
352  conditionBindData=coral.AttributeList()
353  conditionBindData.extend('tagname','string')
354  conditionBindData['tagname'].setData(name)
355  query.addToOutputList(tagid)
356  query.setCondition(condition,conditionBindData)
357  cursor = query.execute()
358  while ( cursor.next() ):
359  tagid=cursor.currentRow()['tagid'].data()
360  ids.append(tagid)
361  transaction.commit()
362  except Exception, e:
363  transaction.rollback()
364  raise Exception, str(e)
return ids
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.modifyEntriesReplaceService (   self,
  newservicename 
)
replace all existing entries replace service name in pfn
no change in other parameters

Definition at line 174 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName, data, and join().

175  def modifyEntriesReplaceService( self, newservicename ):
176  """ replace all existing entries replace service name in pfn
177  no change in other parameters
178  """
179  transaction=self.__session.transaction()
180  try:
181  allpfns=[]
182  transaction.start(True)
183  query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
184  query.addToOutputList('pfn')
185  cursor=query.execute()
186  while cursor.next():
187  pfn=cursor.currentRow()['pfn'].data()
188  allpfns.append(pfn)
189  transaction.commit()
190  del query
191  except Exception, er:
192  transaction.rollback()
193  del query
194  raise Exception, str(er)
195  try:
196  transaction.start(False)
197  editor = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).dataEditor()
198  inputData = coral.AttributeList()
199  inputData.extend('newpfn','string')
200  inputData.extend('oldpfn','string')
201  for pfn in allpfns:
202  (servicename,schemaname)=pfn.rsplit('/',1)
203  newpfn=('/').join([newservicename,schemaname])
204  inputData['newpfn'].setData(newpfn)
205  inputData['oldpfn'].setData(pfn)
206  editor.updateRows( "pfn = :newpfn", "pfn = :oldpfn", inputData )
207  transaction.commit()
208  except Exception, e:
209  transaction.rollback()
210  raise Exception, str(e)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.tagInventory.tagInventory.replaceTagLabel (   self,
  tagname,
  label 
)
Replace the run time label of the given tag

Definition at line 401 of file tagInventory.py.

References python.tagInventory.tagInventory.__tagInventoryTableName.

402  def replaceTagLabel( self, tagname, label ):
403  """Replace the run time label of the given tag
404  """
405  try:
406  transaction=self.__session.transaction()
407  transaction.start(False)
408  schema = self.__session.nominalSchema()
409  inputData = coral.AttributeList()
410  inputData.extend( "labelname","string" )
411  inputData.extend( "tagname", "string" )
412  inputData[0].setData(label)
413  inputData[1].setData(tagname)
414  editor = schema.tableHandle(self.__tagInventoryTableName).dataEditor()
415  editor.updateRows( "labelname=:labelname", "tagname=:tagname", inputData )
416  transaction.commit()
417  except Exception, e:
418  transaction.rollback()
419  raise Exception, str(e)

Member Data Documentation

python.tagInventory.tagInventory.__session
private

Definition at line 9 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.addEntriesReplaceService().

python.tagInventory.tagInventory.__tagInventoryIDName
private

Definition at line 11 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.addEntry(), python.tagInventory.tagInventory.bulkInsertEntries(), python.tagInventory.tagInventory.cloneEntry(), and python.tagInventory.tagInventory.dropme().

python.tagInventory.tagInventory.__tagInventoryTableColumns
private

Definition at line 12 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.addEntriesReplaceService(), python.tagInventory.tagInventory.addEntry(), python.tagInventory.tagInventory.cloneEntry(), python.tagInventory.tagInventory.getAllEntries(), python.tagInventory.tagInventory.getEntryById(), and python.tagInventory.tagInventory.getEntryByName().

python.tagInventory.tagInventory.__tagInventoryTableHandle
private

Definition at line 66 of file tagInventory.py.

python.tagInventory.tagInventory.__tagInventoryTableName
private

Definition at line 10 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.addEntriesReplaceService(), python.tagInventory.tagInventory.addEntry(), python.tagInventory.tagInventory.bulkInsertEntries(), python.tagInventory.tagInventory.cloneEntry(), python.tagInventory.tagInventory.createInventoryTable(), python.tagInventory.tagInventory.deleteAllEntries(), python.tagInventory.tagInventory.deleteEntryByName(), python.tagInventory.tagInventory.dropme(), python.tagInventory.tagInventory.existInventoryTable(), python.tagInventory.tagInventory.getAllEntries(), python.tagInventory.tagInventory.getEntryById(), python.tagInventory.tagInventory.getEntryByName(), python.tagInventory.tagInventory.getIDsByName(), python.tagInventory.tagInventory.modifyEntriesReplaceService(), and python.tagInventory.tagInventory.replaceTagLabel().

python.tagInventory.tagInventory.__tagInventoryTableNotNullColumns
private

Definition at line 13 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.createInventoryTable().

python.tagInventory.tagInventory.__tagInventoryTablePK
private

Definition at line 15 of file tagInventory.py.

Referenced by python.tagInventory.tagInventory.createInventoryTable().