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

SSDM-2015 : New version with new master data script that adds just what is...

SSDM-2015 : New version with new master data script that adds just what is missing on current installation

SVN: 34571
parent 621705d1
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ def getStorageGroupDefinition():
["STORAGE_COLUMN", "Physical Storage", "Storage Column", DataType.INTEGER, None, "Storage Column", None, None, False],
["STORAGE_BOX_NAME", "Physical Storage", "box label", DataType.VARCHAR, None, "Storage Box Name", None, None, False],
["STORAGE_BOX_SIZE", "Physical Storage", "box size", DataType.CONTROLLEDVOCABULARY, "STORAGE_BOX_SIZE", "Storage Box size", None, None, False],
["STORAGE_USER", "Physical Storage", "frozen by", DataType.CONTROLLEDVOCABULARY, "ALL_LAB_MEMBERS", "Storage User Id", None, None, False],
["STORAGE_USER", "Physical Storage", "frozen by", DataType.VARCHAR, None, "Storage User Id", None, None, False],
["STORAGE_BOX_POSITION", "Physical Storage", "position", DataType.VARCHAR, None, "Storage Box Position", None, None, False]
];
......
......@@ -265,8 +265,8 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor):
if antibodyNumber is not None:
values = {}
values["STORAGE_NAME"] = result.getString("location")
values["STORAGE_ROW"] = None
values["STORAGE_COLUMN"] = None
values["STORAGE_ROW"] = "1"
values["STORAGE_COLUMN"] = "1"
values["STORAGE_BOX_NAME"] = result.getString("box label")
values["STORAGE_BOX_SIZE"] = result.getString("box size")
values["STORAGE_USER"] = result.getString("frozen by")
......
......@@ -67,19 +67,25 @@ def createExperimentTypeWithProperties(experimentTypeCode, description, properti
newExperiment.setDescription(description);
addProperties(newExperiment, properties);
def getSampleType(sampleTypeCode):
sampleType = None
if sampleTypeCode in samplesCache:
sampleType = samplesCache[sampleTypeCode];
else:
sampleType = tr.getSampleType(sampleTypeCode)
samplesCache[sampleTypeCode] = sampleType;
return sampleType;
def addPropertiesToSamples(sampleTypeCodes, properties):
for sampleTypeCode in sampleTypeCodes:
if sampleTypeCode in samplesCache:
sampleType = samplesCache[sampleTypeCode];
else:
sampleType = tr.getSampleType(sampleTypeCode)
sampleType = getSampleType(sampleTypeCodes);
addProperties(sampleType, properties);
def addProperties(entity, properties):
for property in properties:
addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8]);
addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8], None);
def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription, managedScript, dynamicScript, isMandatory):
def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription, managedScript, dynamicScript, isMandatory, position):
property = None;
if propertyCode in propertiesCache:
......@@ -90,6 +96,8 @@ def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabula
propertyAssignment = tr.assignPropertyType(entity, property);
propertyAssignment.setSection(section);
propertyAssignment.setMandatory(isMandatory);
if position is not None:
propertyAssignment.setPositionInForms(position);
if managedScript != None:
propertyAssignment.setManaged(True);
propertyAssignment.setShownEdit(True);
......@@ -117,13 +125,30 @@ def addStorageGroups(numGroups, sampleType):
property[5] = property[5] + "_" + str(storageIdx);
addPropertiesToSamples([sampleType], storageGroup);
def addBoxSizeProperty(numGroups, sampleType):
def findAssignment(entityType, propertyType):
for assignment in tr.listPropertyAssignments():
if assignment.getEntityKind().equals(entityType.getEntityKind()) and assignment.getEntityTypeCode() == entityType.getCode() and assignment.getPropertyTypeCode() == propertyType.getCode():
return assignment;
return None;
def addBoxSizeProperty(numGroups, sampleTypeCode):
sampleType = getSampleType(sampleTypeCode)
for storageIdx in range(1,(numGroups + 1)):
property = ["STORAGE_BOX_SIZE", "Physical Storage", "box size", DataType.CONTROLLEDVOCABULARY, "STORAGE_BOX_SIZE", "Storage Box size", None, None, False];
property[0] = property[0] + "_" + str(storageIdx);
property[1] = property[1] + "_" + str(storageIdx);
property[5] = property[5] + "_" + str(storageIdx);
addPropertiesToSamples([sampleType], [property]);
#Resolve Position
position = None
propertyTypeCode = "STORAGE_USER" + "_" + str(storageIdx);
propertyType = tr.getPropertyType(propertyTypeCode);
assigments = tr.listPropertyAssignments();
assigment = findAssignment(sampleType, propertyType);
if storageIdx == 1:
position = assigment.getPositionInForms();
else:
position = assigment.getPositionInForms() + storageIdx - 1;
addProperty(sampleType, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8], position);
#Valid Script Types: DYNAMIC_PROPERTY, MANAGED_PROPERTY, ENTITY_VALIDATION
def createScript(path, name, description, scriptType, entityType):
......
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