Namespace LABKEY.Domain
Domain static class to retrieve and edit domain definitions.
A domain is a collection of fields. Each data type (e.g., Assays, Lists, Datasets, Sample Sets and Custom Protein Lists) provides specialized handling for the domains it defines. The number of domains defined by a data type varies; for example, Assays define multiple domains (batch, run, etc.), while Lists and Datasets define only one domain each.
Additional Documentation:
Defined in: Domain.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
LABKEY.Domain.create(config)
Create a new domain with the given kind, domainDesign, and options or
specify a domain template to use for the domain creation.
|
<static> |
LABKEY.Domain.drop(config, config)
Delete a domain.
|
<static> |
LABKEY.Domain.get(config)
Gets a domain design.
|
<static> |
LABKEY.Domain.save(config)
Saves the provided domain design
|
Method Detail
<static>
LABKEY.Domain.create(config)
Create a new domain with the given kind, domainDesign, and options or
specify a domain template to use for the domain creation.
Not all domain kinds can be created through this API. Currently supported domain kinds are:
"IntList", "VarList", "SampleSet", and "DataClass".
Create domain:LABKEY.Domain.create({ kind: "IntList", domainDesign: { name: "LookupCodes", description: "integer key list", fields: [{ name: "id", rangeURI: "int" },{ name: "code", rangeURI: "string", scale: 4 }] }, options: { keyName: "id" } });
Create domain from a domain template:LABKEY.Domain.create({ module: "mymodule", domainGroup: "codes", domainTemplate: "LookupCodes", importData: false });
Import the initial data from the domain template of a previously created domain:LABKEY.Domain.create({ module: "mymodule", domainGroup: "codes", domainTemplate: "LookupCodes", createDomain: false, importData: true });
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required success callback.
- {Function} config.failure Optional
- Failure callback.
- {String} config.kind
- The domain kind to create. One of "IntList", "VarList", "SampleSet", or "DataClass".
- {String} config.domainName
- The name of the domain to create.
- {String} config.module
- The name of a module that contains the domain template group.
- {String} config.domainGroup
- The name of a domain template group.
- {String} config.domainTemplate
- The name of a domain template within the domain group.
- {Boolean} config.createDomain
- When using a domain template, create the domain. Defaults to true.
- {Boolean} config.importData
- When using a domain template, import initial data associated in the template. Defaults to true.
- {LABKEY.Domain.DomainDesign} config.domainDesign
- The domain design to save.
- {Object} config.options Optional
- Arguments used to create the specific domain type.
- {String} config.containerPath Optional
- The container path in which to create the domain.
<static>
LABKEY.Domain.drop(config, config)
Delete a domain.
- Parameters:
- config
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success.
- {Function} config.failure Optional
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
<static>
LABKEY.Domain.get(config)
Gets a domain design.
Example:<script type="text/javascript"> function successHandler(domainDesign) { var html = ''; html += '<b>' + domainDesign.name + ':</b><br> '; for (var i in domainDesign.fields) { html += ' ' + domainDesign.fields[i].name + '<br>'; } document.getElementById('testDiv').innerHTML = html; } function errorHandler(error) { alert('An error occurred retrieving data: ' + error); } LABKEY.Domain.get(successHandler, errorHandler, 'study', 'StudyProperties'); </script> <div id='testDiv'>Loading...</div>
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required. Function called if the "get" function executes successfully. Will be called with the argument LABKEY.Domain.DomainDesign, which describes the fields of a domain.
- {Function} config.failure Optional
- Function called if execution of the "get" function fails.
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
<static>
LABKEY.Domain.save(config)
Saves the provided domain design
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required. Function called if this function executes successfully. No parameters will be passed to the success callback.
- {Function} config.failure Optional
- Function called if execution of this function fails.
- {LABKEY.Domain.DomainDesign} config.domainDesign
- The domain design to save.
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.