Skip to content
Snippets Groups Projects
Commit 499f4db0 authored by juanf's avatar juanf
Browse files

SSDM-1285 : ELN - Peter Lab Migration

SVN: 33049
parent c481894a
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ tmScriptName= "TM" ...@@ -28,7 +28,7 @@ tmScriptName= "TM"
# #
# Storage # Storage
# #
numberOfStorageGroups = 15 numberOfStorageGroups = 65
def getStorageGroupPropertyCodes(): def getStorageGroupPropertyCodes():
propertyCodes = []; propertyCodes = [];
......
...@@ -18,14 +18,17 @@ def process(tr): ...@@ -18,14 +18,17 @@ def process(tr):
print "START!" print "START!"
createDataHierarchy(tr) createDataHierarchy(tr)
for adaptor in adaptors: for adaptor in adaptors:
print "- ADAPTOR [" + adaptor.__class__.__name__ + "] START"
while adaptor.next(): while adaptor.next():
entity = adaptor.getEntity() entity = adaptor.getEntity()
print "* ENTITY [" + str(entity.getIdentifier(tr)) + "]"
if not entity.isInOpenBIS(tr): if not entity.isInOpenBIS(tr):
entity.write(tr) entity.write(tr)
#print entity.getIdentifier(tr) + " - Updated" #print entity.getIdentifier(tr) + " - Updated"
else: else:
pass pass
#print entity.getIdentifier(tr) + " - Already up to date" #print entity.getIdentifier(tr) + " - Already up to date"
print "- ADAPTOR [" + adaptor.__class__.__name__ + "] FINISH"
print "FINISH!" print "FINISH!"
## ##
...@@ -137,7 +140,7 @@ def getExperimentForUpdate(experimentIdentifier, experimentType, tr): ...@@ -137,7 +140,7 @@ def getExperimentForUpdate(experimentIdentifier, experimentType, tr):
def getSampleForUpdate(sampleIdentifier, sampleType, tr): def getSampleForUpdate(sampleIdentifier, sampleType, tr):
if sampleIdentifier not in sampleCache: if sampleIdentifier not in sampleCache:
print "Cache failed " + sampleIdentifier + ":" + str(sampleType) #print "Cache failed " + sampleIdentifier + ":" + str(sampleType)
sample = tr.getSampleForUpdate(sampleIdentifier) sample = tr.getSampleForUpdate(sampleIdentifier)
if sample is None and sampleType is not None: if sample is None and sampleType is not None:
#print "Cache Create " + sampleIdentifier + ":" + str(sampleType) #print "Cache Create " + sampleIdentifier + ":" + str(sampleType)
...@@ -194,7 +197,7 @@ class FMPeterOpenBISDTO(OpenBISDTO): ...@@ -194,7 +197,7 @@ class FMPeterOpenBISDTO(OpenBISDTO):
else : else :
return False return False
else: else:
print "Invalid Code found '" + str(code) + "' for '" + self.__class__.__name__ + "'" print "* ERROR [" + str(code) + "] - Invalid Code found for '" + self.__class__.__name__ + "'"
return True return True
class FMPeterBoxAdaptor(FileMakerEntityAdaptor): class FMPeterBoxAdaptor(FileMakerEntityAdaptor):
...@@ -206,7 +209,7 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor): ...@@ -206,7 +209,7 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor):
self.entities.append(FMPeterEntityBoxOpenBISDTO(values, self.definition)) self.entities.append(FMPeterEntityBoxOpenBISDTO(values, self.definition))
def init(self): def init(self):
print "Reading boxes for: " + self.__class__.__name__ #print "Reading boxes for: " + self.__class__.__name__
emptyBox = 0 emptyBox = 0
boxes = {} boxes = {}
EntityAdaptor.init(self) EntityAdaptor.init(self)
...@@ -239,7 +242,7 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor): ...@@ -239,7 +242,7 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor):
#The antibody is not there. What the *#%$& #The antibody is not there. What the *#%$&
emptyBox += 1 emptyBox += 1
print "Boxes positions with empty entityId for " + self.__class__.__name__ + ":" + str(emptyBox) print "- ADAPTOR Boxes positions with empty entityId for " + self.__class__.__name__ + ":" + str(emptyBox)
for entiyCode, allBoxes in boxes.iteritems(): for entiyCode, allBoxes in boxes.iteritems():
self.addEntity({ self.addEntity({
...@@ -251,10 +254,12 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor): ...@@ -251,10 +254,12 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor):
preparedStatement.close() preparedStatement.close()
class FMPeterEntityBoxOpenBISDTO(OpenBISDTO): class FMPeterEntityBoxOpenBISDTO(OpenBISDTO):
def getIdentifier(self, tr):
return self.values["*CODE"]
def write(self, tr): def write(self, tr):
sample = getSampleForUpdate("/INVENTORY/"+self.values["*CODE"], None, tr) sample = getSampleForUpdate("/INVENTORY/"+self.values["*CODE"], None, tr)
print "BOXES SIZE: " + self.values["*CODE"] + " " + str(len(self.values["*BOXESLIST"])) print "* INFO Boxes size: " + str(len(self.values["*BOXESLIST"]))
#Delete old boxes #Delete old boxes
for boxNum in range(1, definitions.numberOfStorageGroups+1): for boxNum in range(1, definitions.numberOfStorageGroups+1):
for propertyCode in definitions.getStorageGroupPropertyCodes(): for propertyCode in definitions.getStorageGroupPropertyCodes():
...@@ -524,7 +529,7 @@ class DocumentOpenBISDTO(OpenBISDTO): ...@@ -524,7 +529,7 @@ class DocumentOpenBISDTO(OpenBISDTO):
#incoming = tr.getIncoming() #incoming = tr.getIncoming()
#tr.moveFile(incoming.getAbsolutePath(), dataSet) #tr.moveFile(incoming.getAbsolutePath(), dataSet)
else: else:
print "Document missing something SERIAL: " + self.values["SERIAL"] print "* ERROR Document missing something SERIAL: " + self.values["SERIAL"]
def getIdentifier(self, tr): def getIdentifier(self, tr):
return self.values["SERIAL"] return self.values["SERIAL"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment