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

fixed vocabulary and materialType for property_type

parent 113d95db
No related branches found
No related tags found
No related merge requests found
......@@ -97,24 +97,45 @@ o.get_tags()
## create plugins and property types
```
pl = o.new_plugin(
name ='my_new_entry_validation_plugin',
pluginType ='ENTITY_VALIDATION', # or 'DYNAMIC_PROPERTY' or 'MANAGED_PROPERTY',
entityKind = None, # or 'SAMPLE', 'MATERIAL', 'EXPERIMENT', 'DATA_SET'
script = 'def calculate(): pass' # a JYTHON script
name ='my_new_entry_validation_plugin',
pluginType ='ENTITY_VALIDATION', # or 'DYNAMIC_PROPERTY' or 'MANAGED_PROPERTY',
entityKind = None, # or 'SAMPLE', 'MATERIAL', 'EXPERIMENT', 'DATA_SET'
script = 'def calculate(): pass' # a JYTHON script
)
pl.save()
pt = o.new_property_type(
code='MY_NEW_PROPERTY_TYPE',
label='yet another property type',
description='my first property',
dataType='VARCHAR'
code = 'MY_NEW_PROPERTY_TYPE',
label = 'yet another property type',
description = 'my first property',
dataType = 'VARCHAR'
)
# dataType can be any of ['INTEGER', 'VARCHAR', 'MULTILINE_VARCHAR', 'REAL', 'TIMESTAMP', 'BOOLEAN', 'CONTROLLEDVOCABULARY', 'MATERIAL', 'HYPERLINK', 'XML']
pt2 = o.new_property_type(
code = 'MY_CONTROLLED_VOCABULARY',
label = 'label me',
description = 'give me a description',
dataType = 'CONTROLLEDVOCABULARY',
vocabulary = 'STORAGE'
)
```
The `dataType` attribute can contain any of these values:
* `INTEGER`
* `VARCHAR`
* `MULTILINE_VARCHAR`
* `REAL`
* `TIMESTAMP`
* `BOOLEAN`
* `HYPERLINK`
* `XML`
* `CONTROLLEDVOCABULARY`
* `MATERIAL`
When choosing `CONTROLLEDVOCABULARY`, you must specify a `vocabulary` attribute (see example). Likewise, when choosing `MATERIAL`, a `materialType` attribute must be provided.
## Users, Groups and RoleAssignments
```
......
......@@ -466,6 +466,19 @@ class AttrHolder():
elif name in ["users"]:
self.set_users(value)
elif name in ["vocabulary"]:
self.__dict__['_vocabulary'] = {
"@type": "as.dto.vocabulary.id.VocabularyPermId",
"permId": value.upper()
}
elif name in ["materialType"]:
self.__dict__['_materialType'] = {
"@type": "as.dto.entitytype.id.EntityTypePermId",
"permId": value.upper(),
"entityKind": "MATERIAL"
}
elif name in ["attachments"]:
if isinstance(value, list):
for item in value:
......
......@@ -146,7 +146,7 @@ def openbis_definitions(entity):
},
"propertyType": {
"attrs": "code label description managedInternally internalNameSpace dataType vocabulary materialType schema transformation semanticAnnotations registrator registrationDate".split(),
"attrs_new": "code label description managedInternally internalNameSpace dataType vocabularyId materialTypeId schema transformation metaData".split(),
"attrs_new": "code label description managedInternally internalNameSpace dataType vocabulary materialType schema transformation metaData".split(),
"attrs_up": "label description schema transformation metaData".split(),
"search": {
"@type": "as.dto.property.search.PropertyTypeSearchCriteria"
......@@ -274,6 +274,7 @@ def openbis_definitions(entity):
"experiments": "experimentIds",
"material": "materialId",
"materials": "materialIds",
"materialType": "materialTypeId",
"container": "containerId",
"containers": "containerIds",
"component": "componentId",
......
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