Skip to content
Snippets Groups Projects
Commit c81c5eed authored by Swen Vermeul's avatar Swen Vermeul
Browse files

creating entity entity types, ongoing work

parent ee16f191
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,9 @@ class EntityType: ...@@ -97,6 +97,9 @@ class EntityType:
""" """
pas = self.__dict__['_propertyAssignments'] pas = self.__dict__['_propertyAssignments']
# assign property type
property_type = self.openbis.get_property_type(property)
new_assignment = { new_assignment = {
"section": section, "section": section,
"ordinal": ordinal, "ordinal": ordinal,
...@@ -104,26 +107,16 @@ class EntityType: ...@@ -104,26 +107,16 @@ class EntityType:
"initialValueForExistingEntities": initialValueForExistingEntities, "initialValueForExistingEntities": initialValueForExistingEntities,
"showInEditView": showInEditView, "showInEditView": showInEditView,
"showRawValueInForms": showRawValueInForms, "showRawValueInForms": showRawValueInForms,
"propertyType" : { "propertyType": property_type.data,
"permId": property.upper(),
"@type": "as.dto.property.id.PropertyTypePermId"
},
"@type": "as.dto.property.create.PropertyAssignmentCreation", "@type": "as.dto.property.create.PropertyAssignmentCreation",
} }
if plugin is not None:
new_assignment['pluginId'] = {
"permId": plugin.upper(),
"@type": "as.dto.plugin.id.PluginPermId"
}
pas.append(new_assignment)
@property # assign plugin
def validationPlugin(self): if plugin is not None:
try: plugin_obj = self.openbis.get_plugin(plugin)
return self.openbis.get_plugin(self._validationPlugin['name']) new_assignment['plugin'] = plugin_obj.data
except Exception:
pass
pas.append(new_assignment)
def revoke_property(self, def revoke_property(self,
property, property,
...@@ -138,6 +131,16 @@ class EntityType: ...@@ -138,6 +131,16 @@ class EntityType:
raise ValueError("not implemented yet") raise ValueError("not implemented yet")
@property
def validationPlugin(self):
"""Returns a validation plugin object when called.
Returns None when no validation plugin is defined.
"""
try:
return self.openbis.get_plugin(self._validationPlugin['name'])
except Exception:
pass
def codes(self): def codes(self):
codes = [] codes = []
for pa in self.data['propertyAssignments']: for pa in self.data['propertyAssignments']:
......
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