new ApplicationApi()
Common functions for accessing SanteDB application processes
- Source:
Methods
encodeReferenceExtension(type, key) → {string}
Encode an extension reference
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The type of reference being created |
key |
guid | The key of the reference or the object |
- Source:
Returns:
- Type
- string
resolveReferenceExtensionAsync(extensionValue) → {IdentifiedData}
Resolves the object which is referenced in the extension
Parameters:
Name | Type | Description |
---|---|---|
extensionValue |
string | The value of the reference extension |
- Source:
Returns:
- Type
- IdentifiedData
(static) addIdentifierClassifier(domain, regexClassification)
Adds a new classification map for an identifier
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain which is being classified |
regexClassification |
RegExp | The classification regex |
(static) addIdentifierGenerator(domain, generatorCallback)
Adds a new identifier generator
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain which the generator will create identifiers for |
generatorCallback |
function | A function for the generator which returns the new identifier and (optionally) takes the entity for which the identifier is being generated |
- Source:
(static) addIdentifierParser(domain, parserCallback)
Adds a new identifier parser
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain to which the parser belongs |
parserCallback |
function | The callback function used to parse the identifier |
- Source:
- See:
Example
SanteDB.application.addIdentifierParser("DLN", function(dln, context) {
return dln.subString(0, 10);
});
(static) addIdentifierValidator(algorithmName, validator)
Adds a new check digit validator. Note that this can be either a validator for the entire identifier or a check digit
Parameters:
Name | Type | Description |
---|---|---|
algorithmName |
* | The name of the algorithm |
validator |
* | The validator callback |
- Source:
(static) addResourceViewer(resourceType, redirectCallback)
Adds a new resource state to let other apps know where to go to view a resource
Parameters:
Name | Type | Description |
---|---|---|
resourceType |
string | The type of resource which the redirectCallback should be called for |
redirectCallback |
function | A function that directs to the appropriate state. Shoudl return true |
- Source:
Example
Viewer for patients with no gender only
SanteDB.app.addResourceViewer("Patient",
function(state, parms) {
if(!parms.genderConcept || parms.genderConcept == NullReasonKeys.NoInformation) {
state.go("my-view.patient". parms);
return true;
}
return false;
});
(static) calculatePasswordStrength(password) → {number}
Calculates the strength of the supplied password
Parameters:
Name | Type | Description |
---|---|---|
password |
* | The password |
- Source:
Returns:
- Type
- number
(static) callResourceViewer(resourceType, parms, state) → {boolean}
Call the resource viewer(s) which are registered for the specified type
Parameters:
Name | Type | Description |
---|---|---|
resourceType |
* | The type of resource to call the viewers for |
parms |
* | The parameters to pass to the viewer (testing if they can handle the resource) |
state |
* | The AngularJS state service to user |
- Source:
Returns:
- Type
- boolean
Example
Redirect to appropriate resource handler for entity
async viewEntity(id) {
try {
var entity = await SanteDB.resources.entity.getAsync(id);
if(SanteDB.application.callResourceViewer(entity.$type, $state, entity))
{
console.info("Redirect successful!");
}
else {
console.warn("Can't find a resource handler", entity);
}
}
catch(e) {
console.error(e);
}
}
(static) classifyIdentifier(value) → {Array}
Attempts to guess the identifier domains to which an identifier belongs based on its format
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The value of the identifier |
- Source:
- See:
Returns:
- Type
- Array
(static) close()
Closes the application or restarts it in the case of the mobile
- Source:
(static) compactAsync(takeBackup) → {Promise}
Instructs the back-end service to perform a compact
Parameters:
Name | Type | Description |
---|---|---|
takeBackup |
boolean | When true, instructs the back end to take a backup of data |
- Source:
Returns:
- Type
- Promise
(static) createBackupAsync(makePublic) → {Promise}
Create a backup of current assets on the dCDR (databases, applets, etc.)
Parameters:
Name | Type | Description |
---|---|---|
makePublic |
boolean | Instruct the API to store the back in an unsecured, public location (for example, when migrating to another tablet) |
- Source:
Returns:
- Type
- Promise
(static) doUpdateAsync() → {Promise}
Instructs the back-end service to perform a system upgrade
- Source:
Returns:
- Type
- Promise
(static) generatePassword() → {string}
Generates a new random password
- Source:
Returns:
- Type
- string
(static) getAppInfoAsync(settings) → {Promise}
Get application version information
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
settings |
any | The settings to use for the server diagnostic report
Properties
|
- Source:
Returns:
- Type
- Promise
(static) getAppSolutionsAsync()
Gets solutions that can be installed on this appliccation
- Source:
(static) getAppletAssetAsync(appletId, assetPath) → {Promise}
Gets an applet manifest object from the server
Parameters:
Name | Type | Description |
---|---|---|
appletId |
string | The identifier of the applet from which you want to fetch something |
assetPath |
string | The path within that asset to the content |
- Source:
Returns:
- Type
- Promise
(static) getBackupAsync() → {Promise}
Get all backups and backup information
- Source:
Returns:
- Type
- Promise
(static) getIdentifierGenerator(domain)
Gets a generator if one is registered for the specified domain
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain to get the generator for |
- Source:
(static) getIdentifierParser(domain) → {function}
Retrieve identifier parser for the specified domain
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain to which the parser belongs |
- Source:
Returns:
- Type
- function
(static) getIdentifierValidator(algorithmName)
Get the specified identifier validator
Parameters:
Name | Type | Description |
---|---|---|
algorithmName |
* | The name of the algorithm |
- Source:
(static) getLogInfoAsync(_id, query) → {Promise}
Gets a list of all logs and their information from the server
Parameters:
Name | Type | Description |
---|---|---|
_id |
string | The id of the log file to fetch contents of |
query |
any | The query filters to use / apply |
- Source:
Returns:
- Type
- Promise
(static) getMenusAsync(contextName) → {any}
Get all available user interface menus for the current user
Parameters:
Name | Type | Description |
---|---|---|
contextName |
string | The name of the context to retrieve |
- Source:
Returns:
- Type
- any
(static) getOnlineState() → {boolean}
Get the online status of the application
- Source:
Returns:
- Type
- boolean
(static) getResourceViewer(resourceType)
Gets a generator if one is registered for the specified domain
Parameters:
Name | Type | Description |
---|---|---|
resourceType |
string | The type of resource to retrieve the viewer for |
- Source:
Example
Redirect to any resource returned by the Entity API
async viewEntity(id) {
try {
var entity = await SanteDB.resources.entity.getAsync(id);
var viewer = SanteDB.application.getResourceViewer(entity.$type);
if(viewer) {
// we have a viewer so call it
viewer($state, entity)
}
else {
console.warn("Cannot find a viewer for this type of data");
}
}
catch(e) {
console.error(e);
}
}
(async, static) getSubTemplates(collection, parms)
Fetches sub-templates
Parameters:
Name | Type | Description |
---|---|---|
collection |
* | The participation or relationship property to be fetched |
parms |
* | The parameters to fill the template with |
- Source:
(static) getTemplateContentAsync(templateId, parms) → {any}
Get a list of all installed template definitions
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The ID of the template to fetch |
parms |
any | The parameters to pass to the template |
- Source:
Returns:
- Type
- any
(static) getTemplateDefinitionsAsync(query) → {Array.<string>}
Get a list of all installed template definitions
Parameters:
Name | Type | Description |
---|---|---|
query |
any | The filter to apply to templates |
- Source:
Returns:
- Type
- Array.<string>
(static) getTemplateMetadata(templateId) → {object}
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The template mnemonic to fetch data for |
- Source:
Returns:
- Type
- object
(static) getVersion() → {string}
Get the version of the application host
- Source:
Returns:
- Type
- string
(static) getWidgetsAsync(context, type)
Get the specified widgets for the specified context
Parameters:
Name | Type | Description |
---|---|---|
context |
The context to fetch widgets for | |
type |
The type of widget to fetch registration information for (panel or tab) |
- Source:
- See:
(static) isAdminAvailable() → {boolean}
Indicates whether the server's AMI is available
- Source:
Returns:
- Type
- boolean
(static) isClinicalAvailable() → {boolean}
Indicates whether the HDSI is available
- Source:
Returns:
- Type
- boolean
(static) loadDataAsset(dataId) → {string}
Load a data asset from an applet's Data/ directory
Parameters:
Name | Type | Description |
---|---|---|
dataId |
string | The identifier of the data asset to load |
- Source:
Returns:
- Type
- string
(static) newGuid() → {string}
Create a new UUID
- Source:
Returns:
- Type
- string
(static) parseException(exceptionString)
Parses an exception string into a Exception object
Parameters:
Name | Type | Description |
---|---|---|
exceptionString |
string | The exception string to be parsed |
- Source:
(static) purgeAsync(takeBackup) → {Promise}
Instructs the back-end service to perform a purge of all data
Parameters:
Name | Type | Description |
---|---|---|
takeBackup |
boolean | True if the back-end should take a backup before purge |
- Source:
Returns:
- Type
- Promise
(static) resolveTemplateForm(templateId) → {string}
Resolves the HTML input form for the specified template
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The id of the template for which HTML input should be gathered |
- Source:
Returns:
- Type
- string
(static) resolveTemplateForm(templateId) → {string}
Resolves the HTML input form for the specified template
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The id of the template for which HTML input should be gathered |
- Source:
Returns:
- Type
- string
(static) resolveTemplateSummary(templateId) → {string}
Resolves the HTML summary view for the specified template
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The id of the template for which HTML summary should be gathered |
- Source:
Returns:
- Type
- string
(static) resolveTemplateView(templateId) → {string}
Resolves the HTML view for the specified template
Parameters:
Name | Type | Description |
---|---|---|
templateId |
string | The id of the template for which HTML view should be gathered |
- Source:
Returns:
- Type
- string
(static) restoreAsync() → {Promise}
Instructs the backend to restore the data from the most recent backup
- Source:
Returns:
- Type
- Promise
(static) scanBarcode() → {string}
Launches the camera on the device to take a picture of a barcode
- Source:
Returns:
- Type
- string
(static) scanIdentifierAsync() → {string}
Scans a barcode using scanBarcodeAsync however interprets the identifier rather than returning the raw data
- Source:
- See:
Returns:
- Type
- string
(static) searchByBarcodeAsync(qrCodeData, noValidate, upstream, noExec)
Performs a search using barcode data
Parameters:
Name | Type | Description |
---|---|---|
qrCodeData |
* | The QR Code data already scanned |
noValidate |
* | True if the barcode should not be validated |
upstream |
* | True if search upstream |
noExec |
bool | When true, don't execute the search just return the search parameters |
- Source:
(static) submitBugReportAsync(bugReport) → {Promise}
Submits a user entered bug report
Parameters:
Name | Type | Description |
---|---|---|
bugReport |
any | The structured bug report to be submitted |
- Source:
Returns:
- Type
- Promise
(static) this.printView()
Wraps native printing functionality for the host operating system
- Source:
(static) this.ptrSearchAsync(jwsData, validateSignature, upstream)
Perform a search operation on a signed codified search.
Parameters:
Name | Type | Description |
---|---|---|
jwsData |
* | The JSON Web Signature data to search |
validateSignature |
boolean | True if the service should validate the data |
upstream |
boolean | True if the search should be performed against the upstream server |
- Source:
- See:
(static) this.showToast(text)
Show a toast to the user
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text of the toast |
- Source:
(async, inner) _extractJwsData(jwsData) → {object}
Attempts to parse te JWS data contained in a scanned barcode into logical identifier structure
Parameters:
Name | Type | Description |
---|---|---|
jwsData |
* | The data to be parsed in SVRP format |
- Source:
Returns:
- Type
- object
(inner) copyValues(toObject, fromObject, overwrite)
Copies objects from @fromObject to @toObject stripping any identification data
Parameters:
Name | Type | Description |
---|---|---|
toObject |
any | The object to which the values are copied |
fromObject |
any | The object from which the values are to be copied |
overwrite |
bool | When true overwrite existing values in @toObject |
- Source: