diff --git a/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py b/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py index 970dfe78ef3266f911aff31c9455eb24e9578a44..e366bc4fcd4afd7576fe5422ce540c0037c4726e 100644 --- a/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py +++ b/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py @@ -2,5 +2,72 @@ import sys import definitions +## +## Generic Adaptor Pattern +## +class EntityAdaptor: + entities = None + entitiesIdx = None + + def init(self): + self.entities = []; + self.entitiesIdx = -1; + pass + + def next(self): + if self.entities is None and self.entitiesIdx is None: + self.init() + self.entitiesIdx += 1 + if len(self.entities) < self.entitiesIdx: + return True + else: + return False + + def getEntity(self): + return self.entities[self.entitiesIdx] + +class DTO: + values = {} + openBISTransaction = None + + def __init__(self, values, openBISTransaction): + self.values = values + self.openBISTransaction = openBISTransaction + + def isInOpenBIS(self): + pass + + def write(self): + pass + +## +## Costumer specific logic +## + +class FileMakerEntityAdaptor(EntityAdaptor): + fileMakerConnString = None + fileMakerUser = None + fileMakerPass = None + + def __init__(self, fileMakerConnString, fileMakerUser, fileMakerPass): + self.fileMakerConnString = fileMakerConnString + self.fileMakerUser = fileMakerUser + self.fileMakerPass = fileMakerPass + +class AntibodyAdaptor(FileMakerEntityAdaptor): + def init(self): + self.entities = []; + self.entitiesIdx = -1; + pass + +adaptors = [AntibodyAdaptor(None, None, None)] +## +## Generic Process Method +## def process(tr): - print "ALIVE!" \ No newline at end of file + for adaptor in adaptors: + if adaptor.next(): + entity = adaptor.getEntity() + if not entity.isInOpenBIS(): + entity.write() + print "FINISH!" \ No newline at end of file