Domain Context
-
API to interface with the domain objects and entities
-
Context Variable: domain
API Interface
//Retreive the Domain
Domain get();
//Retrieves the file under the domain's shared folder
OSFile getFile(String path, String fileName);
//Retrieves the file under the domain's shared folder
OSFile getFile(String fileName);
//Retreives the UserContext of the given userId/email
UserContext user(String userId);
//Creates a new file under the domain's shared folder
OSFile createFile(String fileName);
//Creates a new file under the domain's shared folder
OSFile createFile(String path, String fileName);
//Switch the rules engine context to another domain
boolean switchTo(String domainKey);
//Switch back the rules engine context to original domain
void switchBack();
//Create/Update message specification
void defineMessage(String name, int messageId, Map<String, String> fields);
//Drop a message specification
void dropMessage(long messageId);
//Create/Update record specification
void defineRecord(String name, long messageId, Map<String, String> fields);
//Drop a record specification
void dropRecord(long messageId);
//Retreives the DomainAssetGroupContext of the given groupId
DomainAssetGroupContext assetGroup(long groupId);
//Create/Update a DomainAssetGroup with the given groupId and name
DomainAssetGroupContext createAssetGroup(long groupId, String name);
//Retreives the DomainDeviceGroupContext of the given groupId
DomainDeviceGroupContext deviceGroup(long groupId);
//Create/Update a DomainDeviceGroup with the given groupId and name
DomainDeviceGroupContext createDeviceGroup(long groupId, String name);
//Retreives the DomainUserGroupContext of the given groupId
DomainUserGroupContext userGroup(long groupId);
//Create/Update a DomainUserGroup with the given groupId and name
DomainDeviceGroupContext createUserGroup(long groupId, String name);
//Get an Organization if exists in this domain
OrganizationContext getOrganization(long orgId);
//Retreives the AssetContext of the given assetId
AssetContext asset(String assetId);
//Create/Update an Asset
AssetContext createAsset(String assetId, String name, String desc);
//List assets
List<AssetContext> listAssets(int pageSize);
//List next page of assets
List<AssetContext> listNextAssets(String lastAssetId, int pageSize);
//List previous page of assets
List<AssetContext> listPrevAssets(String firstAssetId, int pageSize);
//Retreives the DeviceContext of the given deviceId
DeviceContext device(String deviceId);
//Create/Update a Device
DeviceContext createDevice(String deviceId, String name, String desc);
//List devices
List<DeviceContext> listDevices(int pageSize);
//List next page of devices
List<DeviceContext> listNextDevices(String lastDeviceId, int pageSize);
//List previous page of devices
List<DeviceContext> listPrevDevices(String firstDeviceId, int pageSize);
//Creates a Domain user
void createUser(String email, String password, String firstName, String lastName, String primaryPhone);
//List users
List<UserContext> listUsers(int pageSize);
//List next page of users
List<UserContext> listNextUsers(String lastUserId, int pageSize);
//List previous page of users
List<UserContext> listPrevUsers(String firstUserId, int pageSize);
//Create/Update roles
void createRoles(List<String> roles);
//Check if this domain has this role
boolean hasRole(String roleId);
//List all roles of this domain
List<String> listRoles();
//Retreive a stored lookup value in its original format
Object get(String name);
//Retreive a stored lookup value in its original format, if not found returns the passed def value
Object get(String name, Object def);
//Store a String value in the lookup table
BaseLookupContext put(String name, String value);
//Store a long value in the lookup table
BaseLookupContext put(String name, long value);
//Store a double value in the lookup table
BaseLookupContext put(String name, double value);
//Store a float value in the lookup table
BaseLookupContext put(String name, float value);
//Store a UUID value in the lookup table
BaseLookupContext put(String name, UUID value);
//Store a byte[] value in the lookup table
BaseLookupContext put(String name, byte[] value);
//Store a Map<String,Object> value in the lookup table
BaseLookupContext put(String name, Map<String,Object> value);
//Store a boolean value in the lookup table
BaseLookupContext put(String name, boolean value);
//Store a byte value in the lookup table
BaseLookupContext put(String name, byte value);
//Store a short value in the lookup table
BaseLookupContext put(String name, short value);
//Store a integer value in the lookup table
BaseLookupContext put(String name, int value);
//Retreive a stored property, return data is formatted if a format is specified while storing
Object getProperty(String name, String def);
//Store a named property
void property(String name, String value);
//Retreive a stored property, return data is formatted if a format is specified while storing
Object property(String name);
//Store a named property as JSON
void property(String name, Map<String, Object> value);
//Store a named property with one of the formats <JSON, HEX, BASE64>. Upon retreival
JSON properties are returned as Map<String,Object>
HEX properties a hex decoded and returned as byte[]
BASE64 properties a base64 decoded and returned as byte[]
void property(String format, String name, String value);
APIs Inherited From
Related REST APIs
Updated over 3 years ago