Skip to main content

%pkg.isc.rest.model.singleton

abstract class %pkg.isc.rest.model.singleton extends %pkg.isc.rest.model.resource, %pkg.isc.json.adaptor

Provide REST access to a persistent class which represents a singleton i.e. a persistent class which has a single record.
@API.Extensible

Method Inventory

Parameters

parameter JSONMAPPING;
The JSON mapping of the related JSON-enabled class to use. Defaults to empty (the default mapping for the associated class).
parameter SingletonClass;
The class to which this class provides REST access. It must adhere to the following (validated during compilation): Subclasses MUST override this parameter.
@API.Overrideable

Methods

classmethod GetCollection(ByRef params, selectMode As %Integer)
Inherited description: Called by the handler when serving plural get requests.

In the simplest case, the Resource is a Proxy and params are just query parameters for querying a table. Note: This method should handle exporting JSON to the current device.
classmethod GetModelInstance(args...) as %pkg.isc.rest.model.resource
Inherited description: Returns an instance of this model, based on the arguments supplied.
final method JSONExport() as %Status
Serialize a JSON enabled class as a JSON document and write it to the current device.
final method JSONExportToStream(ByRef export As %Stream.Object) as %Status
Serialize a JSON enabled class as a JSON document and write it to a stream.
final method JSONExportToString(ByRef %export As %String) as %Status
Serialize a JSON enabled class as a JSON document and return it as a string.
final method JSONImport(input) as %Status
JSONImport imports JSON or dynamic object input into this object.
The input argument is either JSON as a string or stream, or a subclass of %DynamicAbstractObject.
method SaveModelInstance(pUserContext As %RegisteredObject)
Saves the model instance.
final classmethod Supports(pOperation As %String, pType As %String(VALUELIST=",instance,class"), pRequest As %CSP.Request = $$$NULLOREF) as %Boolean
Inherited description: Checks if the particular operation is supported for this resource.
Look at documentation of SupportsDefault() for default behavior of this method.
If the method returns 0, the corresponding dispatch class will return a 404 Not Found status when the operation is invoked.
NOTE: This method runs on EVERY request so should be quick, lightweight checks to prevent performance bottlenecks.
pOperation may be one of the macros of the form $$$Operation* present in %pkg.isc.rest.general.inc.
pType is the type of the operation (instance-level on a particular record or class-level).
pRequest is the request object in an HTTP context. NOTE: MUST check that this is an object before using it as it may be passed as a NULL OREF in some cases.
classmethod SupportsAction(pOperation As %String, pRequest As %CSP.Request = $$$NULLOREF) as %Boolean
Returns 1 if the provided class-level action is supported. Look at Supports() for argument documentation.
By default, all actions supported.

Inherited Members

Inherited Methods

Subclasses

FeedbackOpens in a new tab