From 9cebdb0a23dd429a2db0d3520d81a0d533b151c8 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Fri, 7 Nov 2014 15:55:53 +0000
Subject: [PATCH] SSDM-1069 : PAPER - Widget for Comments

SVN: 32759
---
 .../newbrowser/1/as/initialize-master-data.py | 439 ++++++++++--------
 .../newbrowser/1/compatibility/comments.py    | 174 +++++++
 .../newbrowser/1/compatibility/managed.py     |  17 +-
 3 files changed, 422 insertions(+), 208 deletions(-)
 create mode 100644 plasmid/source/core-plugins/newbrowser/1/compatibility/comments.py

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py b/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py
index aebbcc59419..3bb007802c8 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py
+++ b/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py
@@ -14,7 +14,14 @@
 # limitations under the License.
 #
 
+##
+## Configuration
+##
+#PATH_TO_MANAGE_PROPERTIES_SCRIPTS = "/Users/juanf/Documents/workspace/openbis/source/core-plugins/newbrowser/1/compatibility/";
+PATH_TO_MANAGE_PROPERTIES_SCRIPTS = None;
+
 # MasterDataRegistrationTransaction Class
+import os
 import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.DataType as DataType
 
 ##
@@ -68,9 +75,9 @@ def addPropertiesToSamples(sampleTypeCodes, properties):
 	
 def addProperties(entity, properties):
 	for property in properties:
-		addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5]);
+		addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5], property[6]);
 	
-def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription):
+def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription, managedScript):
 	property = None;
 	
 	if propertyCode in propertiesCache:
@@ -80,6 +87,9 @@ def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabula
 	
 	propertyAssignment = tr.assignPropertyType(entity, property);
 	propertyAssignment.setSection(section);
+	if managedScript != None:
+		propertyAssignment.setManaged(True);
+		propertyAssignment.setScriptName(managedScript);
 
 def createProperty(propertyCode, dataType, propertyLabel, propertyDescription, vocabularyCode):
 	property = tr.getOrCreateNewPropertyType(propertyCode, dataType);
@@ -90,6 +100,31 @@ def createProperty(propertyCode, dataType, propertyLabel, propertyDescription, v
 		property.setVocabulary(vocabulariesCache[vocabularyCode]);
 	return property;
 
+##
+## Manage properties scripts
+##
+annotationsScriptName = None;
+commentsScriptName = None;
+
+if PATH_TO_MANAGE_PROPERTIES_SCRIPTS != None:
+	annotationsScriptName = "ANNOTATIONS";
+	annotationsScriptAsString = open(PATH_TO_MANAGE_PROPERTIES_SCRIPTS + "managed.py", 'r').read();
+	annotationsScript = tr.getOrCreateNewScript(annotationsScriptName);
+	annotationsScript.setName("Annotations");
+	annotationsScript.setDescription("Annotations Handler");
+	annotationsScript.setScript(annotationsScriptAsString);
+	annotationsScript.setScriptType("MANAGED_PROPERTY");
+	annotationsScript.setEntityForScript("SAMPLE");
+	
+	commentsScriptName = "COMMENTS";
+	commentsScriptAsString = open(PATH_TO_MANAGE_PROPERTIES_SCRIPTS + "comments.py", 'r').read();
+	commentsScript = tr.getOrCreateNewScript(commentsScriptName);
+	commentsScript.setName("Comments");
+	commentsScript.setDescription("Comments Handler");
+	commentsScript.setScript(commentsScriptAsString);
+	commentsScript.setScriptType("MANAGED_PROPERTY");
+	commentsScript.setEntityForScript("SAMPLE");
+
 ##
 ## Vocabulary Types
 ##
@@ -384,11 +419,11 @@ createProperty("PLASMID_RELATIONSHIP", DataType.CONTROLLEDVOCABULARY, "Plasmid r
 createDataSetTypeWithProperties("ELN_PREVIEW", "PHYSICAL", "ELN Preview image", []);
 
 createDataSetTypeWithProperties("SEQ_FILE", "PHYSICAL", "", [
-	["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset"],
+	["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None],
 ]);
 
 createDataSetTypeWithProperties("RAW_DATA", "PHYSICAL", "", [
-	["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset"],
+	["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None],
 ]);
 
 ##
@@ -412,13 +447,13 @@ createExperimentTypeWithProperties("PCR_PROTOCOL", "BOX TO HOLD SAMPLES OF THIS
 createExperimentTypeWithProperties("WESTERN_BLOTTING_PROTOCOL", "BOX TO HOLD SAMPLES OF THIS TYPE FOR ORGANIZATIONAL PURPOSES", []);
 
 createExperimentTypeWithProperties("DEFAULT_EXPERIMENT", "Default Experiment", [
-	["NAME", 				"General", "Name", 					DataType.VARCHAR, 			None,	"Name"],
-	["EXPERIMENTAL_GOALS", 	"General", "Experimental goals", 	DataType.MULTILINE_VARCHAR, None,	"Goal of the experiment"],
-	["GRANT", 				"General", "Grant", 				DataType.VARCHAR,			None,	"grant name"],
-	["START_DATE", 			"General", "Start Date", 			DataType.TIMESTAMP, 		None,	"Start Date"],
-	["END_DATE", 			"General", "End Date", 				DataType.TIMESTAMP,			None,	"End Date"],
-	["EXPERIMENTAL_RESULTS","General", "Experimental results", 	DataType.MULTILINE_VARCHAR, None,	"Brief summary of the results obtained"],
-	["XMLCOMMENTS",			"Comments","Comments List",			DataType.XML,				None,	"Several comments can be added by different users"]
+	["NAME", 				"General", "Name", 					DataType.VARCHAR, 			None,	"Name", None],
+	["EXPERIMENTAL_GOALS", 	"General", "Experimental goals", 	DataType.MULTILINE_VARCHAR, None,	"Goal of the experiment", None],
+	["GRANT", 				"General", "Grant", 				DataType.VARCHAR,			None,	"grant name", None],
+	["START_DATE", 			"General", "Start Date", 			DataType.TIMESTAMP, 		None,	"Start Date", None],
+	["END_DATE", 			"General", "End Date", 				DataType.TIMESTAMP,			None,	"End Date", None],
+	["EXPERIMENTAL_RESULTS","General", "Experimental results", 	DataType.MULTILINE_VARCHAR, None,	"Brief summary of the results obtained", None],
+	["XMLCOMMENTS",			"Comments","Comments List",			DataType.XML,				None,	"Several comments can be added by different users", commentsScriptName]
 ]);
 
 ##
@@ -426,183 +461,183 @@ createExperimentTypeWithProperties("DEFAULT_EXPERIMENT", "Default Experiment", [
 ##
 
 createSampleTypeWithProperties("ANTIBODY", "", [
-	["NAME", 				"General", 				"Name", 				DataType.VARCHAR,				None,		"Name"],
-	["HOST", 				"General", 				"Host", 				DataType.CONTROLLEDVOCABULARY,	"HOST", 	"Host used to produce the antibody"],
-	["FOR_WHAT", 			"General", 				"For what", 			DataType.MULTILINE_VARCHAR,		None, 		"For what kind of experimental application/readout this sample is used in the lab"],
-	["DETECTION", 			"General", 				"Detection",			DataType.CONTROLLEDVOCABULARY,	"DETECTION","Protein detection system (fill in this information only for secondary antibodies)"],
-	["EPITOPE", 			"General", 				"Epitope",				DataType.MULTILINE_VARCHAR,		None, 		"Epitope of the antibody"],
-	["CLONALITY", 			"General", 				"Clonality",			DataType.CONTROLLEDVOCABULARY,	"CLONALITY","Clonality of the antibody"],
-	["ISOTYPE", 			"General", 				"Isotype", 				DataType.MULTILINE_VARCHAR,		None, 		"Isotype of the antibody"],
-	["SUPPLIER", 			"Supplier and storage", "Supplier",				DataType.MULTILINE_VARCHAR,		None, 		"Supplier of the product"],
-	["ARTICLE_NUMBER", 		"Supplier and storage", "Art. Number", 			DataType.MULTILINE_VARCHAR,		None, 		"Article number of the product"],
-	["STORAGE", 			"Supplier and storage", "Storage", 				DataType.CONTROLLEDVOCABULARY,	"STORAGE", 	"Storage conditions of the product"],
-	["STOCK_CONCENTRATION", "Supplier and storage", "Stock concentration", 	DataType.VARCHAR,				None, 		"Stock concentration of the solution where the product is kept in the lab"],
-	["PUBLICATION", 		"Comments", 			"Publication", 			DataType.MULTILINE_VARCHAR,		None, 		"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 				"Comments", 			"Notes", 				DataType.MULTILINE_VARCHAR,		None, 		"Notes"],
-	["XMLCOMMENTS",			"Comments",				"Comments List",		DataType.XML,					None,		"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State"]
+	["NAME", 				"General", 				"Name", 				DataType.VARCHAR,				None,		"Name", None],
+	["HOST", 				"General", 				"Host", 				DataType.CONTROLLEDVOCABULARY,	"HOST", 	"Host used to produce the antibody", None],
+	["FOR_WHAT", 			"General", 				"For what", 			DataType.MULTILINE_VARCHAR,		None, 		"For what kind of experimental application/readout this sample is used in the lab", None],
+	["DETECTION", 			"General", 				"Detection",			DataType.CONTROLLEDVOCABULARY,	"DETECTION","Protein detection system (fill in this information only for secondary antibodies)", None],
+	["EPITOPE", 			"General", 				"Epitope",				DataType.MULTILINE_VARCHAR,		None, 		"Epitope of the antibody", None],
+	["CLONALITY", 			"General", 				"Clonality",			DataType.CONTROLLEDVOCABULARY,	"CLONALITY","Clonality of the antibody", None],
+	["ISOTYPE", 			"General", 				"Isotype", 				DataType.MULTILINE_VARCHAR,		None, 		"Isotype of the antibody", None],
+	["SUPPLIER", 			"Supplier and storage", "Supplier",				DataType.MULTILINE_VARCHAR,		None, 		"Supplier of the product", None],
+	["ARTICLE_NUMBER", 		"Supplier and storage", "Art. Number", 			DataType.MULTILINE_VARCHAR,		None, 		"Article number of the product", None],
+	["STORAGE", 			"Supplier and storage", "Storage", 				DataType.CONTROLLEDVOCABULARY,	"STORAGE", 	"Storage conditions of the product", None],
+	["STOCK_CONCENTRATION", "Supplier and storage", "Stock concentration", 	DataType.VARCHAR,				None, 		"Stock concentration of the solution where the product is kept in the lab", None],
+	["PUBLICATION", 		"Comments", 			"Publication", 			DataType.MULTILINE_VARCHAR,		None, 		"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 				"Comments", 			"Notes", 				DataType.MULTILINE_VARCHAR,		None, 		"Notes", None],
+	["XMLCOMMENTS",			"Comments",				"Comments List",		DataType.XML,					None,		"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("CHEMICAL", "", [
-	["NAME", 				"General", 				"Name", 				DataType.MULTILINE_VARCHAR,		None,		"Name"],
-	["SUPPLIER", 			"Supplier and storage", "Supplier", 			DataType.MULTILINE_VARCHAR,		None,		"Supplier of the product"],
-	["ARTICLE_NUMBER", 		"Supplier and storage", "Art. Number",			DataType.MULTILINE_VARCHAR,		None,		"Article number of the product"],
-	["STORAGE", 			"Supplier and storage", "Storage", 				DataType.CONTROLLEDVOCABULARY,	"STORAGE",	"Storage conditions of the product"],
-	["XMLCOMMENTS", 		"Comments", 			"Comments List", 		DataType.XML,					None,		"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State"]
+	["NAME", 				"General", 				"Name", 				DataType.MULTILINE_VARCHAR,		None,		"Name", None],
+	["SUPPLIER", 			"Supplier and storage", "Supplier", 			DataType.MULTILINE_VARCHAR,		None,		"Supplier of the product", None],
+	["ARTICLE_NUMBER", 		"Supplier and storage", "Art. Number",			DataType.MULTILINE_VARCHAR,		None,		"Article number of the product", None],
+	["STORAGE", 			"Supplier and storage", "Storage", 				DataType.CONTROLLEDVOCABULARY,	"STORAGE",	"Storage conditions of the product", None],
+	["XMLCOMMENTS", 		"Comments", 			"Comments List", 		DataType.XML,					None,		"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("ENZYME", "", [
-	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,		"Name"],
-	["SUPPLIER", 			"Supplier and storage",	"Supplier",				DataType.MULTILINE_VARCHAR,		None,		"Supplier of the product"],
-	["ARTICLE_NUMBER", 		"Supplier and storage",	"Art. Number",			DataType.MULTILINE_VARCHAR,		None,		"Article number of the product"],
-	["KIT", 				"Supplier and storage",	"Kit including",		DataType.MULTILINE_VARCHAR,		None,		"What the company includes with the enzyme"],
-	["STORAGE",				"Supplier and storage",	"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",	"Storage conditions of the product"],
-	["XMLCOMMENTS",			"Comments",				"Comments List",		DataType.XML,					None,		"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State"]
+	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,		"Name", None],
+	["SUPPLIER", 			"Supplier and storage",	"Supplier",				DataType.MULTILINE_VARCHAR,		None,		"Supplier of the product", None],
+	["ARTICLE_NUMBER", 		"Supplier and storage",	"Art. Number",			DataType.MULTILINE_VARCHAR,		None,		"Article number of the product", None],
+	["KIT", 				"Supplier and storage",	"Kit including",		DataType.MULTILINE_VARCHAR,		None,		"What the company includes with the enzyme", None],
+	["STORAGE",				"Supplier and storage",	"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",	"Storage conditions of the product", None],
+	["XMLCOMMENTS",			"Comments",				"Comments List",		DataType.XML,					None,		"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,		"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("MEDIA", "", [
-	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,			"Name"],
-	["FOR_WHAT", 			"General",				"For what",				DataType.MULTILINE_VARCHAR,		None,			"For what kind of experimental application/readout this sample is used in the lab"],
-	["ORGANISM", 			"General",				"Organism",				DataType.CONTROLLEDVOCABULARY,	"ORGANISM",		"For what organism this medium is used"],
-	["STORAGE", 			"Storage",				"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",		"Storage conditions of the product"],
-	["STOCK_CONCENTRATION", "Storage",				"Stock concentration",	DataType.VARCHAR,				None,			"Stock concentration of the solution where the product is kept in the lab"],
-	["STERILIZATION", 		"Storage",				"Sterilization",		DataType.CONTROLLEDVOCABULARY,	"STERILIZATION","How the solution/buffer is sterilized when prepared"],
-	["PUBLICATION", 		"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,			"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 				"Comments",				"Notes",				DataType.MULTILINE_VARCHAR,		None,			"Deatails for solution/buffer preparation"],
-	["XMLCOMMENTS", 		"Comments",				"Comments List",		DataType.XML,					None,			"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,			"Annotations State"]
+	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,			"Name", None],
+	["FOR_WHAT", 			"General",				"For what",				DataType.MULTILINE_VARCHAR,		None,			"For what kind of experimental application/readout this sample is used in the lab", None],
+	["ORGANISM", 			"General",				"Organism",				DataType.CONTROLLEDVOCABULARY,	"ORGANISM",		"For what organism this medium is used", None],
+	["STORAGE", 			"Storage",				"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",		"Storage conditions of the product", None],
+	["STOCK_CONCENTRATION", "Storage",				"Stock concentration",	DataType.VARCHAR,				None,			"Stock concentration of the solution where the product is kept in the lab", None],
+	["STERILIZATION", 		"Storage",				"Sterilization",		DataType.CONTROLLEDVOCABULARY,	"STERILIZATION","How the solution/buffer is sterilized when prepared", None],
+	["PUBLICATION", 		"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,			"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 				"Comments",				"Notes",				DataType.MULTILINE_VARCHAR,		None,			"Deatails for solution/buffer preparation", None],
+	["XMLCOMMENTS", 		"Comments",				"Comments List",		DataType.XML,					None,			"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,			"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("SOLUTION_BUFFER", "", [
-	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,			"Name"],
-	["FOR_WHAT", 			"General",				"For what",				DataType.MULTILINE_VARCHAR,		None,			"For what kind of experimental application/readout this sample is used in the lab"],
-	["DETAILS", 			"Recipe",				"Details",				DataType.MULTILINE_VARCHAR,		None,			"Details and tips about how to prepare the solution/buffer"],
-	["STORAGE", 			"Storage",				"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",		"Storage conditions of the product"],
-	["STOCK_CONCENTRATION", "Storage",				"Stock concentration",	DataType.VARCHAR,				None,			"Stock concentration of the solution where the product is kept in the lab"],
-	["STERILIZATION", 		"Storage",				"Sterilization",		DataType.CONTROLLEDVOCABULARY,	"STERILIZATION","How the solution/buffer is sterilized when prepared"],
-	["PUBLICATION", 		"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,			"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 				"Comments",				"Notes",				DataType.MULTILINE_VARCHAR,		None,			"Notes"],
-	["XMLCOMMENTS", 		"Comments",				"Comments List",		DataType.XML,					None,			"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,			"Annotations State"]
+	["NAME", 				"General",				"Name",					DataType.MULTILINE_VARCHAR,		None,			"Name", None],
+	["FOR_WHAT", 			"General",				"For what",				DataType.MULTILINE_VARCHAR,		None,			"For what kind of experimental application/readout this sample is used in the lab", None],
+	["DETAILS", 			"Recipe",				"Details",				DataType.MULTILINE_VARCHAR,		None,			"Details and tips about how to prepare the solution/buffer", None],
+	["STORAGE", 			"Storage",				"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",		"Storage conditions of the product", None],
+	["STOCK_CONCENTRATION", "Storage",				"Stock concentration",	DataType.VARCHAR,				None,			"Stock concentration of the solution where the product is kept in the lab", None],
+	["STERILIZATION", 		"Storage",				"Sterilization",		DataType.CONTROLLEDVOCABULARY,	"STERILIZATION","How the solution/buffer is sterilized when prepared", None],
+	["PUBLICATION", 		"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,			"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 				"Comments",				"Notes",				DataType.MULTILINE_VARCHAR,		None,			"Notes", None],
+	["XMLCOMMENTS", 		"Comments",				"Comments List",		DataType.XML,					None,			"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",	"Comments",				"Annotations State",	DataType.XML,					None,			"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("OLIGO", "", [
-	["TARGET", 					"General",			"Target",					DataType.MULTILINE_VARCHAR,		None,				"Target of the oligonucleotide"],
-	["DIRECTION", 				"Details",			"Direction",				DataType.CONTROLLEDVOCABULARY, "DIRECTION",			"Direction of the oligonucleotide"],
-	["RESTRICTION_ENZYME", 		"Details",			"Restriction Enzyme",		DataType.MULTILINE_VARCHAR,		None,				"Restriction sites in the oligonucleotide"],
-	["MODIFICATIONS", 			"Details",			"Modifications",			DataType.MULTILINE_VARCHAR,		None,				"Modifications of the ordered oligonucleotide"],
-	["SEQUENC", 				"Details",			"Sequence",					DataType.MULTILINE_VARCHAR,		None,				"Sequence of the oligonucleotide"],
-	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State"]
+	["TARGET", 					"General",			"Target",					DataType.MULTILINE_VARCHAR,		None,				"Target of the oligonucleotide", None],
+	["DIRECTION", 				"Details",			"Direction",				DataType.CONTROLLEDVOCABULARY, "DIRECTION",			"Direction of the oligonucleotide", None],
+	["RESTRICTION_ENZYME", 		"Details",			"Restriction Enzyme",		DataType.MULTILINE_VARCHAR,		None,				"Restriction sites in the oligonucleotide", None],
+	["MODIFICATIONS", 			"Details",			"Modifications",			DataType.MULTILINE_VARCHAR,		None,				"Modifications of the ordered oligonucleotide", None],
+	["SEQUENC", 				"Details",			"Sequence",					DataType.MULTILINE_VARCHAR,		None,				"Sequence of the oligonucleotide", None],
+	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("RNA", "", [
-	["RNA_NAME", 				"General",				"Name of RNA",			DataType.VARCHAR,				None,				"Name of the RNA: species/number/strand"],
-	["TARGET", 					"General",				"Target of the RNA",	DataType.VARCHAR,				None,				"Target of the oligonucleotide"],
-	["TYPE", 					"General",				"Type of RNA",			DataType.CONTROLLEDVOCABULARY,	"RNA_TYPE",			"Type of RNA in terms of function: mimic of RNAi or inhibitor of RNAi"],
-	["STRAND", 					"Details",				"Strand",				DataType.CONTROLLEDVOCABULARY,	"STRAND",			"Double or single strand RNA"],
-	["BACKBONE_TYPE", 			"Details",				"Backbone type",		DataType.CONTROLLEDVOCABULARY,	"RNA_BACKBONE",		"Type of backbone, modifications in the backbone"],
-	["MODIFICATIONS", 			"Details",				"Modifications",		DataType.VARCHAR,				None,				"Modifications of the ordered oligonucleotide"],
-	["SEQUENCE", 				"Details",				"Sequence",				DataType.MULTILINE_VARCHAR,		None,				"Sequence of the oligonucleotide"],
-	["SUPPLIER", 				"Supplier and storage",	"Supplier",				DataType.MULTILINE_VARCHAR,		None,				"Supplier of the product"],
-	["ARTICLE_NUMBER", 			"Supplier and storage",	"Art. Number",			DataType.MULTILINE_VARCHAR,		None,				"Article number of the product"],
-	["STORAGE", 				"Supplier and storage",	"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",			"Storage conditions of the product"],
-	["PUBLICATION", 			"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["XMLCOMMENTS", 			"Comments",				"Comments List",		DataType.XML,					None,				"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",		"Comments",				"Annotations State",	DataType.XML,					None,				"Annotations State"]
+	["RNA_NAME", 				"General",				"Name of RNA",			DataType.VARCHAR,				None,				"Name of the RNA: species/number/strand", None],
+	["TARGET", 					"General",				"Target of the RNA",	DataType.VARCHAR,				None,				"Target of the oligonucleotide", None],
+	["TYPE", 					"General",				"Type of RNA",			DataType.CONTROLLEDVOCABULARY,	"RNA_TYPE",			"Type of RNA in terms of function: mimic of RNAi or inhibitor of RNAi", None],
+	["STRAND", 					"Details",				"Strand",				DataType.CONTROLLEDVOCABULARY,	"STRAND",			"Double or single strand RNA", None],
+	["BACKBONE_TYPE", 			"Details",				"Backbone type",		DataType.CONTROLLEDVOCABULARY,	"RNA_BACKBONE",		"Type of backbone, modifications in the backbone", None],
+	["MODIFICATIONS", 			"Details",				"Modifications",		DataType.VARCHAR,				None,				"Modifications of the ordered oligonucleotide", None],
+	["SEQUENCE", 				"Details",				"Sequence",				DataType.MULTILINE_VARCHAR,		None,				"Sequence of the oligonucleotide", None],
+	["SUPPLIER", 				"Supplier and storage",	"Supplier",				DataType.MULTILINE_VARCHAR,		None,				"Supplier of the product", None],
+	["ARTICLE_NUMBER", 			"Supplier and storage",	"Art. Number",			DataType.MULTILINE_VARCHAR,		None,				"Article number of the product", None],
+	["STORAGE", 				"Supplier and storage",	"Storage",				DataType.CONTROLLEDVOCABULARY,	"STORAGE",			"Storage conditions of the product", None],
+	["PUBLICATION", 			"Comments",				"Publication",			DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["XMLCOMMENTS", 			"Comments",				"Comments List",		DataType.XML,					None,				"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",		"Comments",				"Annotations State",	DataType.XML,					None,				"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("PLASMID", "", [
-	["PLASMID_NAME", 					"General",				"Plasmid",							DataType.VARCHAR,				None,								"Plasmid name"],
-	["OWNER", 							"General",				"Owner",							DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["OWNER_NUMBER", 					"General",				"Owner number",						DataType.MULTILINE_VARCHAR,		None,								"Owner number"],
-	["BACKBONE", 						"Details",				"Backbone",							DataType.CONTROLLEDVOCABULARY,	"BACKBONE",							"Backbone of the plasmid"],
-	["BACTERIAL_ANTIBIOTIC_RESISTANCE", "Details",				"Bacterial Antibiotic Resistance",	DataType.CONTROLLEDVOCABULARY,	"BACTERIAL_ANTIBIOTIC_RESISTANCE",	"Bacterial antibiotic resistance"],
-	["MARKER", 							"Details",				"Marke",							DataType.CONTROLLEDVOCABULARY,	"MARKER",							"Marker to select the strain/cell line after transformation/transfection"],
-	["OTHER_MARKER", 					"Details",				"Other Marker",						DataType.VARCHAR,				None,								"Other marker useful for selection"],
-	["FLANKING_RESTRICTION_ENZYMES", 	"Details",				"Flanking Restriction Enzymes",		DataType.VARCHAR,				None,								"Restriction enzymes sites flanking the insert of the plasmid"],
-	["OLIGOS_TEMPLATE", 				"Details",				"Oligos and template",				DataType.MULTILINE_VARCHAR,		None,								"Oligos and template used to clone the single parts of the plasmid"],
-	["SOURCE", 							"Origin",				"Source",							DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab"],
-	["PUBLICATION", 					"Comments",				"Publication",						DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 							"Comments", 			"Notes",							DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",					DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",				DataType.XML,					None,								"Annotations State"]
+	["PLASMID_NAME", 					"General",				"Plasmid",							DataType.VARCHAR,				None,								"Plasmid name", None],
+	["OWNER", 							"General",				"Owner",							DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["OWNER_NUMBER", 					"General",				"Owner number",						DataType.MULTILINE_VARCHAR,		None,								"Owner number", None],
+	["BACKBONE", 						"Details",				"Backbone",							DataType.CONTROLLEDVOCABULARY,	"BACKBONE",							"Backbone of the plasmid", None],
+	["BACTERIAL_ANTIBIOTIC_RESISTANCE", "Details",				"Bacterial Antibiotic Resistance",	DataType.CONTROLLEDVOCABULARY,	"BACTERIAL_ANTIBIOTIC_RESISTANCE",	"Bacterial antibiotic resistance", None],
+	["MARKER", 							"Details",				"Marke",							DataType.CONTROLLEDVOCABULARY,	"MARKER",							"Marker to select the strain/cell line after transformation/transfection", None],
+	["OTHER_MARKER", 					"Details",				"Other Marker",						DataType.VARCHAR,				None,								"Other marker useful for selection", None],
+	["FLANKING_RESTRICTION_ENZYMES", 	"Details",				"Flanking Restriction Enzymes",		DataType.VARCHAR,				None,								"Restriction enzymes sites flanking the insert of the plasmid", None],
+	["OLIGOS_TEMPLATE", 				"Details",				"Oligos and template",				DataType.MULTILINE_VARCHAR,		None,								"Oligos and template used to clone the single parts of the plasmid", None],
+	["SOURCE", 							"Origin",				"Source",							DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab", None],
+	["PUBLICATION", 					"Comments",				"Publication",						DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 							"Comments", 			"Notes",							DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",					DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",				DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("BACTERIA", "", [
-	["BACTERIA_STRAIN_NAME", 			"General",				"Bacteria strain name",				DataType.VARCHAR,				None,								"Bacterial strain name"],
-	["OWNER", 							"General",				"Owner",							DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["OWNER_NUMBER", 					"General",				"Owner number",						DataType.MULTILINE_VARCHAR,		None,								"Owner number"],
-	["BACTERIA_GENOTYPE", 				"Genotype",				"Bacteria genotype",				DataType.MULTILINE_VARCHAR,		None,								"Bacterial genotype"],
-	["MARKERS", 						"Genotype",				"Markers",							DataType.MULTILINE_VARCHAR,		None,								"Markers available in the strain for further genetic modifications"],
-	["ORIGIN", 							"Origin",				"Origin",							DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced"],
-	["STRAIN_CHECK", 					"Origin",				"Strain Check",						DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain"],
-	["SOURCE", 							"Origin",				"Source",							DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab"],
-	["PUBLICATION", 					"Comments",				"Publication",						DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 							"Comments", 			"Notes",							DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",					DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",				DataType.XML,					None,								"Annotations State"]
+	["BACTERIA_STRAIN_NAME", 			"General",				"Bacteria strain name",				DataType.VARCHAR,				None,								"Bacterial strain name", None],
+	["OWNER", 							"General",				"Owner",							DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["OWNER_NUMBER", 					"General",				"Owner number",						DataType.MULTILINE_VARCHAR,		None,								"Owner number", None],
+	["BACTERIA_GENOTYPE", 				"Genotype",				"Bacteria genotype",				DataType.MULTILINE_VARCHAR,		None,								"Bacterial genotype", None],
+	["MARKERS", 						"Genotype",				"Markers",							DataType.MULTILINE_VARCHAR,		None,								"Markers available in the strain for further genetic modifications", None],
+	["ORIGIN", 							"Origin",				"Origin",							DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced", None],
+	["STRAIN_CHECK", 					"Origin",				"Strain Check",						DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain", None],
+	["SOURCE", 							"Origin",				"Source",							DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab", None],
+	["PUBLICATION", 					"Comments",				"Publication",						DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 							"Comments", 			"Notes",							DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",					DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",				DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("YEAST", "", [
-	["YEAST_STRAIN_NAME", 				"General",				"Yeast strain name",					DataType.MULTILINE_VARCHAR,		None,								"Yeast strain name"],
-	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number"],
-	["GENETIC_BACKGROUND", 				"Genotype",				"Genetic Background",					DataType.CONTROLLEDVOCABULARY,	"GENETIC_BACKGROUND",				"Genetic background of the yeast strain"],
-	["MATING_TYPE", 					"Genotype",				"Mating Type",							DataType.CONTROLLEDVOCABULARY,	"MATING_TYPE",						"Mating type or ploidy of the yeast strain"],
-	["BACKGROUND-SPECIFIC_MARKERS", 	"Genotype",				"Background-specific markers",			DataType.CONTROLLEDVOCABULARY,	"BACKGROUND_SPECIFIC_MARKERS",		"Background-specific markers available in the strain for further genetic modifications"],
-	["COMMON_MARKERS", 					"Genotype",				"Common markers",						DataType.CONTROLLEDVOCABULARY,	"COMMON_MARKERS",					"Common markers available in the strain for further genetic modifications"],
-	["ENDOGENOUS_PLASMID", 				"Genotype",				"Endogenous 2micron plasmid in yeast",	DataType.CONTROLLEDVOCABULARY,	"ENDOGENOUS_PLASMID",				"Presence of an endogenous cir 2micron plasmid"],
-	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced"],
-	["STRAIN_CHECK", 					"Origin",				"Strain Check",							DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain"],
-	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab"],
-	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				None,					"Annotations State",					DataType.XML,					None,								"Annotations State"]
+	["YEAST_STRAIN_NAME", 				"General",				"Yeast strain name",					DataType.MULTILINE_VARCHAR,		None,								"Yeast strain name", None],
+	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number", None],
+	["GENETIC_BACKGROUND", 				"Genotype",				"Genetic Background",					DataType.CONTROLLEDVOCABULARY,	"GENETIC_BACKGROUND",				"Genetic background of the yeast strain", None],
+	["MATING_TYPE", 					"Genotype",				"Mating Type",							DataType.CONTROLLEDVOCABULARY,	"MATING_TYPE",						"Mating type or ploidy of the yeast strain", None],
+	["BACKGROUND-SPECIFIC_MARKERS", 	"Genotype",				"Background-specific markers",			DataType.CONTROLLEDVOCABULARY,	"BACKGROUND_SPECIFIC_MARKERS",		"Background-specific markers available in the strain for further genetic modifications", None],
+	["COMMON_MARKERS", 					"Genotype",				"Common markers",						DataType.CONTROLLEDVOCABULARY,	"COMMON_MARKERS",					"Common markers available in the strain for further genetic modifications", None],
+	["ENDOGENOUS_PLASMID", 				"Genotype",				"Endogenous 2micron plasmid in yeast",	DataType.CONTROLLEDVOCABULARY,	"ENDOGENOUS_PLASMID",				"Presence of an endogenous cir 2micron plasmid", None],
+	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced", None],
+	["STRAIN_CHECK", 					"Origin",				"Strain Check",							DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain", None],
+	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab", None],
+	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				None,					"Annotations State",					DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("CELL_LINE", "", [
-	["CELL_LINE_NAME", 					"General",				"Cell line name",						DataType.VARCHAR,				None,								"Name of the cell line"],
-	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number"],
-	["SPECIES", 						"Genotype",				"Species",								DataType.CONTROLLEDVOCABULARY,	"SPECIES",							"Species to which the cell line belongs"],
-	["CELL_TYPE", 						"Genotype",				"Cell type",							DataType.CONTROLLEDVOCABULARY,	"CELL_TYPE",						"Cell type of the cell line"],
-	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced"],
-	["CLONE_NO", 						"Origin",				"Clone #",								DataType.INTEGER,				None,								"Clone number"],
-	["CHECK", 							"Origin",				"Check",								DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the cell line"],
-	["CREATION_DATE", 					"Origin",				"Creation date",						DataType.TIMESTAMP,				None,								"Creation date of the cell line"],
-	["MODIFICATION_DATE", 				"Origin",				"Modification date",					DataType.TIMESTAMP,				None,								"Modification date of the cell line"],
-	["FREEZING_DATE", 					"Origin",				"Freezing date",						DataType.TIMESTAMP,				None,								"Freezing date (if more than one, add the latest)"],
-	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab"],
-	["MEDIUM", 							"Cultivation",			"Medium",								DataType.CONTROLLEDVOCABULARY,	"CELL_MEDIUM",						"Medium used to cultivate or manipulate the cell line"],
-	["GROWTH_TEMP", 					"Cultivation",			"Growth temp. ( &deg;C)",				DataType.INTEGER,				None,								"Growth temperature of the cell line"],
-	["CELL_CO2", 						"Cultivation",			"% CO2",								DataType.INTEGER,				None,								"Percentage of CO2 needed for the cultivation of the cell line"],
-	["SELECTION_MARKER", 				"Cultivation",			"Selection marker",						DataType.VARCHAR,				None,								"Special medium components or selection needed for the cell line"],
-	["MYCOPLASM", 						"Cultivation",			"Mycoplasm tested",						DataType.CONTROLLEDVOCABULARY,	"YES_NO",							"Mycoplasm tested"],
-	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State"]
+	["CELL_LINE_NAME", 					"General",				"Cell line name",						DataType.VARCHAR,				None,								"Name of the cell line", None],
+	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number", None],
+	["SPECIES", 						"Genotype",				"Species",								DataType.CONTROLLEDVOCABULARY,	"SPECIES",							"Species to which the cell line belongs", None],
+	["CELL_TYPE", 						"Genotype",				"Cell type",							DataType.CONTROLLEDVOCABULARY,	"CELL_TYPE",						"Cell type of the cell line", None],
+	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced", None],
+	["CLONE_NO", 						"Origin",				"Clone #",								DataType.INTEGER,				None,								"Clone number", None],
+	["CHECK", 							"Origin",				"Check",								DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the cell line", None],
+	["CREATION_DATE", 					"Origin",				"Creation date",						DataType.TIMESTAMP,				None,								"Creation date of the cell line", None],
+	["MODIFICATION_DATE", 				"Origin",				"Modification date",					DataType.TIMESTAMP,				None,								"Modification date of the cell line", None],
+	["FREEZING_DATE", 					"Origin",				"Freezing date",						DataType.TIMESTAMP,				None,								"Freezing date (if more than one, add the latest)", None],
+	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab", None],
+	["MEDIUM", 							"Cultivation",			"Medium",								DataType.CONTROLLEDVOCABULARY,	"CELL_MEDIUM",						"Medium used to cultivate or manipulate the cell line", None],
+	["GROWTH_TEMP", 					"Cultivation",			"Growth temp. ( &deg;C)",				DataType.INTEGER,				None,								"Growth temperature of the cell line", None],
+	["CELL_CO2", 						"Cultivation",			"% CO2",								DataType.INTEGER,				None,								"Percentage of CO2 needed for the cultivation of the cell line", None],
+	["SELECTION_MARKER", 				"Cultivation",			"Selection marker",						DataType.VARCHAR,				None,								"Special medium components or selection needed for the cell line", None],
+	["MYCOPLASM", 						"Cultivation",			"Mycoplasm tested",						DataType.CONTROLLEDVOCABULARY,	"YES_NO",							"Mycoplasm tested", None],
+	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("FLY", "", [
-	["FLY_STRAIN_NAME", 				"General",				"Fly strain name",						DataType.VARCHAR,				None,								"Fly strain name"],
-	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number"],
-	["FLY_GENOTYPE", 					"Genotype",				"Genotype",								DataType.VARCHAR,				None,								"Genotype of the fly"],
-	["ASSOCIATED_GENE", 				"Genotype",				"Associated gene",						DataType.VARCHAR,				None,								"The transgene may contain regulatory or coding sequences from an endogenous gene"],
-	["MARKERS", 						"Genotype",				"Markers",								DataType.VARCHAR,				None,								"Markers available in the strain for further genetic modifications"],
-	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced"],
-	["STRAIN_CHECK", 					"Origin",				"Strain Check",							DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain"],
-	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab"],
-	["MATING_PARTNERS", 				"Comments",				"Mating partners",						DataType.MULTILINE_VARCHAR,		None,								"Features needed for the mating partners"],
-	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State"]
+	["FLY_STRAIN_NAME", 				"General",				"Fly strain name",						DataType.VARCHAR,				None,								"Fly strain name", None],
+	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["OWNER_NUMBER", 					"General",				"Owner number",							DataType.MULTILINE_VARCHAR,		None,								"Owner number", None],
+	["FLY_GENOTYPE", 					"Genotype",				"Genotype",								DataType.VARCHAR,				None,								"Genotype of the fly", None],
+	["ASSOCIATED_GENE", 				"Genotype",				"Associated gene",						DataType.VARCHAR,				None,								"The transgene may contain regulatory or coding sequences from an endogenous gene", None],
+	["MARKERS", 						"Genotype",				"Markers",								DataType.VARCHAR,				None,								"Markers available in the strain for further genetic modifications", None],
+	["ORIGIN", 							"Origin",				"Origin",								DataType.CONTROLLEDVOCABULARY,	"ORIGIN",							"How the strain/cell line was produced", None],
+	["STRAIN_CHECK", 					"Origin",				"Strain Check",							DataType.CONTROLLEDVOCABULARY,	"CHECK",							"Check done to verify the modifications introduced in the strain", None],
+	["SOURCE", 							"Origin",				"Source",								DataType.VARCHAR,				None,								"Source from where the construct/strain/cell line obtained or purchased, if it was not produced in the lab", None],
+	["MATING_PARTNERS", 				"Comments",				"Mating partners",						DataType.MULTILINE_VARCHAR,		None,								"Features needed for the mating partners", None],
+	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 addPropertiesToSamples([
@@ -619,11 +654,11 @@ addPropertiesToSamples([
 	"SOLUTION_BUFFER",
 	"RNA"
 	],[
-	["STORAGE_NAMES",		"Physical Storage",		"Storage Name",			DataType.CONTROLLEDVOCABULARY,		"STORAGE_NAMES",	"Storage Name"],
-	["STORAGE_ROW",			"Physical Storage",		"Storage Row",			DataType.INTEGER,					None,				"Storage Row"],
-	["STORAGE_COLUMN",		"Physical Storage",		"Storage Column",		DataType.INTEGER,					None,				"Storage Column"],
-	["STORAGE_BOX_NAME",	"Physical Storage",		"Storage Box Name",		DataType.VARCHAR,					None,				"Storage Box Name"],
-	["STORAGE_USER",		"Physical Storage",		"Storage User Id",		DataType.VARCHAR,					None,				"Storage User Id"]
+	["STORAGE_NAMES",		"Physical Storage",		"Storage Name",			DataType.CONTROLLEDVOCABULARY,		"STORAGE_NAMES",	"Storage Name", None],
+	["STORAGE_ROW",			"Physical Storage",		"Storage Row",			DataType.INTEGER,					None,				"Storage Row", None],
+	["STORAGE_COLUMN",		"Physical Storage",		"Storage Column",		DataType.INTEGER,					None,				"Storage Column", None],
+	["STORAGE_BOX_NAME",	"Physical Storage",		"Storage Box Name",		DataType.VARCHAR,					None,				"Storage Box Name", None],
+	["STORAGE_USER",		"Physical Storage",		"Storage User Id",		DataType.VARCHAR,					None,				"Storage User Id", None]
 ]);
 
 ##
@@ -631,55 +666,55 @@ addPropertiesToSamples([
 ##
 
 createSampleTypeWithProperties("EXPERIMENTAL_STEP", "", [
-	["NAME", 							"General",				"Name",									DataType.MULTILINE_VARCHAR,		None,								"Name"],
-	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample"],
-	["EXPERIMENTAL_GOALS", 				"General",				"Experimental goals",					DataType.MULTILINE_VARCHAR,		None,								"Goal of the experiment"],
-	["EXPERIMENTAL_RESULTS", 			"General",				"Experimental results",					DataType.MULTILINE_VARCHAR,		None,								"Brief summary of the results obtained"],
-	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes"],
-	["EXPERIMENTAL_READOUT", 			"Readout details",		"Experimental readout",					DataType.CONTROLLEDVOCABULARY,	"EXPERIMENTAL_READOUT",				"Experimental readout used in the experiment"],
-	["MACHINE", 						"Readout details",		"Machine",								DataType.CONTROLLEDVOCABULARY,	"MACHINE",							"Machine used to perform the experiment"],
-	["FREEFORM_TABLE_STATE", 			"Readout details",		"Freeform Table State",					DataType.MULTILINE_VARCHAR,		None,								"Table describing how the order of samples measured in the experiments"],
-	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State"]
+	["NAME", 							"General",				"Name",									DataType.MULTILINE_VARCHAR,		None,								"Name", None],
+	["OWNER", 							"General",				"Owner",								DataType.CONTROLLEDVOCABULARY,	"OWNER",							"Who produced/owned the sample", None],
+	["EXPERIMENTAL_GOALS", 				"General",				"Experimental goals",					DataType.MULTILINE_VARCHAR,		None,								"Goal of the experiment", None],
+	["EXPERIMENTAL_RESULTS", 			"General",				"Experimental results",					DataType.MULTILINE_VARCHAR,		None,								"Brief summary of the results obtained", None],
+	["NOTES", 							"Comments", 			"Notes",								DataType.MULTILINE_VARCHAR,		None,								"Notes", None],
+	["EXPERIMENTAL_READOUT", 			"Readout details",		"Experimental readout",					DataType.CONTROLLEDVOCABULARY,	"EXPERIMENTAL_READOUT",				"Experimental readout used in the experiment", None],
+	["MACHINE", 						"Readout details",		"Machine",								DataType.CONTROLLEDVOCABULARY,	"MACHINE",							"Machine used to perform the experiment", None],
+	["FREEFORM_TABLE_STATE", 			"Readout details",		"Freeform Table State",					DataType.MULTILINE_VARCHAR,		None,								"Table describing how the order of samples measured in the experiments", None],
+	["PUBLICATION", 					"Comments",				"Publication",							DataType.MULTILINE_VARCHAR,		None,								"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["XMLCOMMENTS", 					"Comments",				"Comments List",						DataType.XML,					None,								"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",				"Comments",				"Annotations State",					DataType.XML,					None,								"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("GENERAL_PROTOCOL", "", [
-	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name"],
-	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab"],
-	["PROTOCOL_TYPE", 			"General",			"Protocol type",			DataType.CONTROLLEDVOCABULARY,	"PROTOCOL_TYPE",	"Category a protocol belongs"],
-	["MATERIALS", 				"Materials",		"Materials",				DataType.MULTILINE_VARCHAR,		None,				"Machines (and relative set up), special labware required for the protocol."],
-	["TIME_REQUIREMENT", 		"Method",			"Time requirement",			DataType.MULTILINE_VARCHAR,		None,				"Time required to complete a protocol"],
-	["PROCEDURE",				"Method", 			"Procedure",				DataType.MULTILINE_VARCHAR,		None,				"Procedure required by the protocol by points (1,2,3,...)"],
-	["PROTOCOL_EVALUATION", 	"Method",			"Protocol evaluation",		DataType.MULTILINE_VARCHAR,		None,				"Parameters and observations to meet the minimal efficiency of the protocol"],
-	["SUGGESTIONS", 			"Comments",			"Suggestions",				DataType.MULTILINE_VARCHAR,		None,				"Suggestions for the protocol"],
-	["PROTOCOL_MODIFICATIONS", 	"Comments",			"Protocol modifications",	DataType.MULTILINE_VARCHAR,		None,				"Alternative procedures used to make protocol variations"],
-	["PUBLICATION", 			"Comments",			"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State"]
+	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name", None],
+	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab", None],
+	["PROTOCOL_TYPE", 			"General",			"Protocol type",			DataType.CONTROLLEDVOCABULARY,	"PROTOCOL_TYPE",	"Category a protocol belongs", None],
+	["MATERIALS", 				"Materials",		"Materials",				DataType.MULTILINE_VARCHAR,		None,				"Machines (and relative set up), special labware required for the protocol.", None],
+	["TIME_REQUIREMENT", 		"Method",			"Time requirement",			DataType.MULTILINE_VARCHAR,		None,				"Time required to complete a protocol", None],
+	["PROCEDURE",				"Method", 			"Procedure",				DataType.MULTILINE_VARCHAR,		None,				"Procedure required by the protocol by points (1,2,3,...)", None],
+	["PROTOCOL_EVALUATION", 	"Method",			"Protocol evaluation",		DataType.MULTILINE_VARCHAR,		None,				"Parameters and observations to meet the minimal efficiency of the protocol", None],
+	["SUGGESTIONS", 			"Comments",			"Suggestions",				DataType.MULTILINE_VARCHAR,		None,				"Suggestions for the protocol", None],
+	["PROTOCOL_MODIFICATIONS", 	"Comments",			"Protocol modifications",	DataType.MULTILINE_VARCHAR,		None,				"Alternative procedures used to make protocol variations", None],
+	["PUBLICATION", 			"Comments",			"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("PCR_PROTOCOL", "", [
-	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name"],
-	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab"],
-	["TEMPLATE", 				"General",			"Template",					DataType.CONTROLLEDVOCABULARY,	"TEMPLATE",			"Type of template used in the PCR protocol"],
-	["REACTION_MIX", 			"Materials",		"Reaction mix",				DataType.MULTILINE_VARCHAR,		None,				"Reaction mix recipe for the PCR"],
-	["THERMOCYCLER_PROTOCOL", 	"Method",			"Thermocycler protocol",	DataType.MULTILINE_VARCHAR,		None,				"Thermocycler protocol for PCR"],
-	["PROTOCOL_EVALUATION", 	"Method",			"Protocol evaluation",		DataType.MULTILINE_VARCHAR,		None,				"Parameters and observations to meet the minimal efficiency of the protocol"],
-	["SUGGESTIONS", 			"Comments",			"Suggestions",				DataType.MULTILINE_VARCHAR,		None,				"Suggestions for the protocol"],
-	["PROTOCOL_MODIFICATIONS", 	"Comments",			"Protocol modifications",	DataType.MULTILINE_VARCHAR,		None,				"Alternative procedures used to make protocol variations"],
-	["PUBLICATION", 			"Comments",			"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State"]
+	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name", None],
+	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab", None],
+	["TEMPLATE", 				"General",			"Template",					DataType.CONTROLLEDVOCABULARY,	"TEMPLATE",			"Type of template used in the PCR protocol", None],
+	["REACTION_MIX", 			"Materials",		"Reaction mix",				DataType.MULTILINE_VARCHAR,		None,				"Reaction mix recipe for the PCR", None],
+	["THERMOCYCLER_PROTOCOL", 	"Method",			"Thermocycler protocol",	DataType.MULTILINE_VARCHAR,		None,				"Thermocycler protocol for PCR", None],
+	["PROTOCOL_EVALUATION", 	"Method",			"Protocol evaluation",		DataType.MULTILINE_VARCHAR,		None,				"Parameters and observations to meet the minimal efficiency of the protocol", None],
+	["SUGGESTIONS", 			"Comments",			"Suggestions",				DataType.MULTILINE_VARCHAR,		None,				"Suggestions for the protocol", None],
+	["PROTOCOL_MODIFICATIONS", 	"Comments",			"Protocol modifications",	DataType.MULTILINE_VARCHAR,		None,				"Alternative procedures used to make protocol variations", None],
+	["PUBLICATION", 			"Comments",			"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State", annotationsScriptName]
 ]);
 
 createSampleTypeWithProperties("WESTERN_BLOTTING_PROTOCOL", "", [
-	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name"],
-	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab"],
-	["STORAGE", 				"General", 			"Storage",					DataType.CONTROLLEDVOCABULARY,	"STORAGE",			"Storage conditions of the product"],
-	["MEMBRANE", 				"Materials", 		"Membrane",					DataType.CONTROLLEDVOCABULARY,	"MEMBRANE",			"Membrane used for western blotting"],
-	["PUBLICATION", 			"Comments", 		"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer"],
-	["NOTES", 					"Comments", 		"Notes",					DataType.MULTILINE_VARCHAR,		None,				"Notes"],
-	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users"],
-	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State"]
+	["NAME", 					"General",			"Name",						DataType.MULTILINE_VARCHAR,		None,				"Name", None],
+	["FOR_WHAT", 				"General",			"For what",					DataType.MULTILINE_VARCHAR,		None,				"For what kind of experimental application/readout this sample is used in the lab", None],
+	["STORAGE", 				"General", 			"Storage",					DataType.CONTROLLEDVOCABULARY,	"STORAGE",			"Storage conditions of the product", None],
+	["MEMBRANE", 				"Materials", 		"Membrane",					DataType.CONTROLLEDVOCABULARY,	"MEMBRANE",			"Membrane used for western blotting", None],
+	["PUBLICATION", 			"Comments", 		"Publication",				DataType.MULTILINE_VARCHAR,		None,				"Publication from where the information was first found OR technical sheet given by the manufacturer", None],
+	["NOTES", 					"Comments", 		"Notes",					DataType.MULTILINE_VARCHAR,		None,				"Notes", None],
+	["XMLCOMMENTS", 			"Comments",			"Comments List",			DataType.XML,					None,				"Several comments can be added by different users", commentsScriptName],
+	["ANNOTATIONS_STATE",		"Comments",			"Annotations State",		DataType.XML,					None,				"Annotations State", annotationsScriptName]
 ]);
\ No newline at end of file
diff --git a/plasmid/source/core-plugins/newbrowser/1/compatibility/comments.py b/plasmid/source/core-plugins/newbrowser/1/compatibility/comments.py
new file mode 100644
index 00000000000..02c50d2364a
--- /dev/null
+++ b/plasmid/source/core-plugins/newbrowser/1/compatibility/comments.py
@@ -0,0 +1,174 @@
+from java.util import Date
+
+"""
+Example XML property value handled by this script:
+<root>
+  <commentEntry date="2011-02-20 14:15:28 GMT+01:00" person="buczekp">Here is the 1st  entry text.<commentEntry>
+  <commentEntry date="2011-02-20 14:16:28 GMT+01:00" person="kohleman">Here is the 2nd  entry text - a warning!<commentEntry>
+  <commentEntry date="2011-02-20 14:17:28 GMT+01:00" person="tpylak">Here is the 3rd  entry text - an error!!!<commentEntry>
+  <commentEntry date="2011-02-20 14:18:28 GMT+01:00" person="brinn">Here is the 4th  entry text - an error!!!<commentEntry>
+  <commentEntry date="2011-02-20 14:19:28 GMT+01:00" person="felmer">Here is the 5th  entry text - a warning!<commentEntry>
+</root>
+"""
+  
+COMMENT_ENTRY_ELEMENT_LABEL = 'commentEntry'
+
+""" labels of table columns and corresponding input fields """
+DATE_LABEL = 'Date'
+PERSON_LABEL = 'Person'
+COMMENT_TEXT_LABEL = 'Comment Text'
+  
+""" names of attributes of XML elements for comment entries """
+DATE_ATTRIBUTE = 'date'
+PERSON_ATTRIBUTE = 'person'
+  
+""" action labels (shown as button labels in UI) """
+ADD_ACTION_LABEL = 'Add Comment Entry'
+EDIT_ACTION_LABEL = 'Edit'
+DELETE_ACTION_LABEL = 'Delete'
+  
+  
+def configureUI():
+    """Create table builder and add headers of columns."""
+    builder = createTableBuilder()
+    builder.addHeader(DATE_LABEL, 250) # date and comment text values are long, override default width (150)
+    builder.addHeader(PERSON_LABEL)
+    builder.addHeader(COMMENT_TEXT_LABEL, 400)
+      
+    """
+       Extract XML elements from property value to a Python list.
+       For each element (comment entry) add add a row to the table.  
+    """
+    elements = list(propertyConverter().convertToElements(property))
+    for commentEntry in elements:
+        row = builder.addRow()
+        row.setCell(DATE_LABEL, Date(long(commentEntry.getAttribute(DATE_ATTRIBUTE))))
+        row.setCell(PERSON_LABEL, commentEntry.getAttribute(PERSON_ATTRIBUTE))
+        row.setCell(COMMENT_TEXT_LABEL, commentEntry.getData())
+  
+    """Specify that the property should be shown in a tab and set the table output."""
+    property.setOwnTab(True)
+    uiDescription = property.getUiDescription()
+    uiDescription.useTableOutput(builder.getTableModel())
+  
+    """
+       Define and add actions with input fields used to:
+       1. specify attributes of new comment entry,
+    """
+    addAction = uiDescription.addTableAction(ADD_ACTION_LABEL)\
+                             .setDescription('Add a new comment entry:')
+    widgets = [
+        inputWidgetFactory().createMultilineTextInputField(COMMENT_TEXT_LABEL)\
+                            .setMandatory(True)
+    ]
+    addAction.addInputWidgets(widgets)
+      
+    """
+       2. modify attributes of a selected comment entry,
+    """
+    editAction = uiDescription.addTableAction(EDIT_ACTION_LABEL)\
+                              .setDescription('Edit selected comment entry:')
+    # Exactly 1 row needs to be selected to enable action.
+    editAction.setRowSelectionRequiredSingle()            
+    widgets = [
+        inputWidgetFactory().createMultilineTextInputField(COMMENT_TEXT_LABEL).setMandatory(True)
+    ]
+    editAction.addInputWidgets(widgets)
+    # Bind field name with column name.
+    editAction.addBinding(COMMENT_TEXT_LABEL, COMMENT_TEXT_LABEL)
+  
+    """
+       3. delete selected comment entries.
+    """
+    deleteAction = uiDescription.addTableAction(DELETE_ACTION_LABEL)\
+                                .setDescription('Are you sure you want to delete selected comment entry?')
+    # Delete is enabled when at least 1 row is selected.
+    deleteAction.setRowSelectionRequired()
+    
+  
+def updateFromUI(action):
+    """Extract list of elements from old value of the property."""
+    converter = propertyConverter()
+    elements = list(converter.convertToElements(property))
+  
+    """Implement behaviour of user actions."""
+    if action.name == ADD_ACTION_LABEL:
+        """
+           For 'add' action create new comment entry element with values from input fields
+           and add it to existing elements.
+        """
+        element = elementFactory().createElement(COMMENT_ENTRY_ELEMENT_LABEL)
+        """Fill element attributes with appropriate values."""
+        element.addAttribute(DATE_ATTRIBUTE, str(Date().getTime()))            # current date
+        element.addAttribute(PERSON_ATTRIBUTE, action.getPerson().getUserId()) # invoker the action
+        """Retrieve values from input fields filled by user on the client side."""
+
+        """Set comment text as a text element, not an attribute."""
+        element.setData(action.getInputValue(COMMENT_TEXT_LABEL))
+        """Add the new entry to the end of the element list."""
+        elements.append(element)
+    elif action.name == EDIT_ACTION_LABEL:
+        """
+           For 'edit' action find the comment entry element corresponding to selected row
+           and replace it with an element with values from input fields.
+        """
+        
+        selectedRowId = action.getSelectedRows()[0]
+        xmlUser = elements[selectedRowId].getAttribute(PERSON_ATTRIBUTE)
+        if action.getPerson().getUserId() == xmlUser:
+          elements[selectedRowId].setData(action.getInputValue(COMMENT_TEXT_LABEL))
+        else:
+          raise ValidationException('Comment creator and current user differ:\n' + str(xmlUser) + "!=" + str(action.getPerson().getUserId()) )
+    elif action.name == DELETE_ACTION_LABEL:
+        """
+           For 'delete' action delete the entries that correspond to selected rows.
+           NOTE: As many rows can be deleted at once it is easier to delete them in reversed order.
+        """
+        rowIds = list(action.getSelectedRows())
+        rowIds.reverse()       
+        for rowId in rowIds:
+              xmlUser = elements[rowId].getAttribute(PERSON_ATTRIBUTE)
+              if action.getPerson().getUserId() == xmlUser:
+                elements.pop(rowId)
+              else:
+                raise ValidationException('Comment creator and current user differ:\n' +  str(xmlUser) + "!=" + str(action.getPerson().getUserId()) )
+    else:
+        raise ValidationException('action not supported')
+      
+    """Update value of the managed property to XML string created from modified list of elements."""
+    property.value = converter.convertToString(elements)
+
+def _createCommentEntry(comment_text_list):
+    #if comment_text_list is not None:
+    commentEntry = elementFactory().createElement(COMMENT_ENTRY_ELEMENT_LABEL)
+                     
+    commentEntry.addAttribute(PERSON_ATTRIBUTE, person.getUserId())
+    commentEntry.addAttribute(DATE_ATTRIBUTE,str(Date().getTime()))
+    commentEntry.setData(comment_text_list)
+    return commentEntry   
+
+def showRawValueInForms():
+    return False
+ 
+def batchColumnNames():
+    return [COMMENT_ENTRY_ELEMENT_LABEL]
+ 
+def updateFromRegistrationForm(bindings):
+    elements = []
+    for item in bindings:
+        comment_text_list = item.get('COMMENTENTRY')
+        sampleLink = _createCommentEntry(comment_text_list)
+        elements.append(sampleLink)
+            
+    property.value = propertyConverter().convertToString(elements)
+
+
+
+        
+def updateFromBatchInput(bindings):
+    elements = []
+    input = bindings.get('')
+    if input is not None:
+        commentEntry = _createCommentEntry(input)
+        elements.append(commentEntry)
+        property.value = propertyConverter().convertToString(elements)
diff --git a/plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py b/plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py
index 118c87ffec6..eb26c1d5b52 100644
--- a/plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py
+++ b/plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py
@@ -3,13 +3,16 @@ from ch.systemsx.cisd.openbis.generic.server import CommonServiceProvider
 # Configuration
 # This needs to be edited for each sample type to match the Profile.js ANNOTATION_PROPERTIES map.
 configuration = {}
-configuration["PROTEIN"] = { "PHOSPHO" : True, "ISOTYPE" : False }
+#configuration["CHEMICAL"] = { "QUANTITY" : False, "COMMENTS" : False }
 
 #Global Variables
 server = CommonServiceProvider.getCommonServer()
 contextOrNull = server.tryToAuthenticateAsSystem()
 propertyTypes = server.listPropertyTypes(contextOrNull.getSessionToken(), False)
-    
+
+##
+## Help Methods
+##
 def getPropertyType(propertyTypeCode):
     print "Searching property type: " + propertyTypeCode
     for propertyType in propertyTypes:
@@ -39,6 +42,12 @@ def getWidgetForAdd(sampleTypeCode):
         widgets.append(widget)
     return widgets;
 
+def isValid(dataType, value):
+    print "isValid"
+    return True
+##
+## Help Methods
+##
 def configureUI():
     print "All property types: " + str(propertyTypes)
     # Add Headers
@@ -71,10 +80,6 @@ def configureUI():
                                 .setDescription('Are you sure you want to delete selected annotation?')
     deleteAction.setRowSelectionRequired() # Delete is enabled when at least 1 row is selected.
 
-def isValid(dataType, value):
-    print "isValid"
-    return True
-
 def updateFromUI(action):
     converter = propertyConverter()
     elements = list(converter.convertToElements(property))
-- 
GitLab