public abstract class Item extends EventProvider
Modifier and Type | Class and Description |
---|---|
static class |
Item.accessFlag
ACL flags constants
|
static class |
Item.dataFlag
Data flags constants
|
static class |
Item.events
Events
|
static class |
Item.ItemType |
static class |
Item.logMessageAction
Log message action constants
|
static class |
Item.measureUnitsFlag
Measure units flags constants
|
static class |
Item.measureUnitsType
Measure units types constants
|
static interface |
Item.UpdateItemProperty |
Modifier and Type | Field and Description |
---|---|
protected Item.ItemType |
itemType |
Constructor and Description |
---|
Item() |
Modifier and Type | Method and Description |
---|---|
void |
addLogRecord(java.lang.String action,
java.lang.String newValue,
java.lang.String oldValue,
ResponseHandler callback)
Add item log record
|
void |
fireItemPropertyEvent(java.lang.Enum event,
java.lang.Object oldData,
java.lang.Object newData) |
java.lang.Long |
getAccountId()
This item billing account ID
|
ItemProperties |
getAdminFieldsPlugin() |
java.lang.Long |
getCreatorId()
This item user-creator ID
|
ItemProperties |
getCustomFieldsPlugin() |
java.lang.String |
getCustomProperty(java.lang.String propName,
java.lang.String defaultVal)
Get custom property
|
java.lang.Long |
getDataFlags()
Current item data flags, e.g.
|
java.lang.Long |
getId()
Get item id
|
Item.ItemType |
getItemType()
Get item type
|
java.lang.Integer |
getMeasureUnits()
Get item measure units
|
java.lang.String |
getName()
Get item name
|
protected ResponseHandler |
getOnUpdatePropertiesCallback(ResponseHandler callback) |
java.lang.Long |
getUserAccess()
Current user access level to this item
|
void |
handleMessage(Message message)
Handle new message from server for this item.
|
protected void |
onUpdateProperties(java.lang.String result,
ResponseHandler callback)
Handle result of some remote properties update method
|
void |
registerItemPropertyHandler(java.lang.String propName,
Item.UpdateItemProperty function)
Register item property handler of given name
|
void |
setDataFlags(java.lang.Long dataFlags) |
void |
updateCustomProperty(java.lang.String propName,
java.lang.String propValue,
ResponseHandler callback)
Update custom property, require ACL bit Item.accessFlag.editOther over item
|
boolean |
updateItemData(java.lang.String key,
com.google.gson.JsonElement data) |
void |
updateMeasureUnits(int type,
int flags,
ResponseHandler callback)
Update measure units used in item
|
void |
updateName(java.lang.String name,
ResponseHandler callback)
Update item name, require ACL bit Item.accessFlag.editName over item
|
addListener, clearListeners, fireEvent, removeListener, removeListeners
protected Item.ItemType itemType
public ItemProperties getCustomFieldsPlugin()
public ItemProperties getAdminFieldsPlugin()
public void registerItemPropertyHandler(java.lang.String propName, Item.UpdateItemProperty function)
propName
- Property namefunction
- functionpublic Item.ItemType getItemType()
public java.lang.String getName()
public java.lang.Integer getMeasureUnits()
public java.lang.Long getId()
public java.lang.Long getAccountId()
public java.lang.Long getCreatorId()
public java.lang.Long getDataFlags()
public java.lang.Long getUserAccess()
public java.lang.String getCustomProperty(java.lang.String propName, java.lang.String defaultVal)
propName
- property namedefaultVal
- default value if property not definedpublic void setDataFlags(java.lang.Long dataFlags)
public void handleMessage(Message message)
message
- Message datapublic void updateCustomProperty(java.lang.String propName, java.lang.String propValue, ResponseHandler callback)
propName
- property namepropValue
- value propertycallback
- callback that will receive information about property updatepublic void updateMeasureUnits(int type, int flags, ResponseHandler callback)
type
- {Number} units of measure type, see wialon.item.measureUnitsType for possible typesflags
- {Number} set or convert all item settings, see wialon.item.measureUnitsFlag for possible flagscallback
- {Function?null} callback that will receive information about convertation: callback(code), zero code is successpublic void updateName(java.lang.String name, ResponseHandler callback)
name
- new name valuecallback
- callback that will receive information about updatepublic void addLogRecord(java.lang.String action, java.lang.String newValue, java.lang.String oldValue, ResponseHandler callback)
action
- type of action (for unit described in Unit.logMessageAction)newValue
- log record action new value (can be empty)oldValue
- log record action old value (can be empty)callback
- callback that get result of server operationprotected void onUpdateProperties(java.lang.String result, ResponseHandler callback)
result
- properties data in form {pname1: pvalue1, pname2: pvalue2}callback
- user-defined callbackpublic void fireItemPropertyEvent(java.lang.Enum event, java.lang.Object oldData, java.lang.Object newData)
protected ResponseHandler getOnUpdatePropertiesCallback(ResponseHandler callback)
public boolean updateItemData(java.lang.String key, com.google.gson.JsonElement data)