User Context

API Interface

//Retreives a UserGroup of this User
UserGroupContext group(long groupId);

//Retreive the User
User get();

//Create/Update a UserGroup for this User
UserGroupContext createGroup(long groupId, String name);

//Change the logged in user's password
void changePassword(String myPassword);

//Change another user's password, you need to be a domain-admin or admin
void changePassword(String userId, String password);

//Create/Update a AssetGroup for this User
UserAssetGroupContext createAssetGroup(int groupId, String name);

//Retreives a AssetGroup of this User
UserAssetGroupContext assetGroup(long groupId);

//Create/Update a DeviceGroup for this User
UserDeviceGroupContext createDeviceGroup(long groupId, String name);

//Retreives a DeviceGroup of this User
UserDeviceGroupContext deviceGroup(long groupId);

//Send an email to this User
void sendEmail(String subject, String content);

//Send an SMS to this User's primary phone
boolean sendSms(String content);

//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);