public abstract class DeviceIndex
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.EnumSet<IDeviceService.DeviceField> |
keyFields
The key fields for this index
|
Constructor and Description |
---|
DeviceIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
Constructs a new device index using the provided key fields.
|
Modifier and Type | Method and Description |
---|---|
abstract java.util.Iterator<java.lang.Long> |
getAll()
Gets all device keys in the index.
|
abstract java.util.Iterator<java.lang.Long> |
queryByEntity(Entity entity)
Finds all device keys in the index that match the given entity
on all the key fields for this index.
|
abstract void |
removeEntity(Entity entity)
Removes the entry for the given entity.
|
abstract void |
removeEntity(Entity entity,
java.lang.Long deviceKey)
Removes the given device key from the index for the given entity.
|
void |
removeEntityIfNeeded(Entity entity,
java.lang.Long deviceKey,
java.util.Collection<Entity> others)
Removes the give device from the index only if this the collection
of others does not contain an entity that is identical on all the key
fields for this index.
|
abstract boolean |
updateIndex(Device device,
java.lang.Long deviceKey)
Attempts to update an index with the entities in the provided
Device . |
abstract void |
updateIndex(Entity entity,
java.lang.Long deviceKey)
Adds a mapping from the given entity to the given device key.
|
protected java.util.EnumSet<IDeviceService.DeviceField> keyFields
public DeviceIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
keyFields
- the key fields to usepublic abstract java.util.Iterator<java.lang.Long> queryByEntity(Entity entity)
entity
- the entity to search forpublic abstract java.util.Iterator<java.lang.Long> getAll()
public abstract boolean updateIndex(Device device, java.lang.Long deviceKey)
Device
. If the update fails because of a concurrent update,
will return false.device
- the device to updatedeviceKey
- the device key for the devicepublic abstract void updateIndex(Entity entity, java.lang.Long deviceKey)
entity
- the entity to updatedeviceKey
- the device key for the devicepublic abstract void removeEntity(Entity entity)
entity
- the entity to removepublic abstract void removeEntity(Entity entity, java.lang.Long deviceKey)
entity
- the entity to search fordeviceKey
- the key to removepublic void removeEntityIfNeeded(Entity entity, java.lang.Long deviceKey, java.util.Collection<Entity> others)
entity
- the entity to search fordeviceKey
- the key to removeothers
- the others against which to check