From 2515570b9f35bf2fff84bbaec1cc5bffbae68b36 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 24 Nov 2014 15:32:44 +0000
Subject: [PATCH] Antibody Type (ongoing work)

SVN: 32917
---
 .../drop-boxes/petermigration/migration.py    | 69 ++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

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 970dfe78ef3..e366bc4fcd4 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
-- 
GitLab