public class EntityToMultiDeviceIdIndex extends DeviceIndex
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ConcurrentHashMap<IndexedEntity,java.util.Collection<java.lang.Long>> |
index
The index
|
keyFields| Constructor and Description |
|---|
EntityToMultiDeviceIdIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
Construct a new device index using the provided key fields.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Iterator<java.lang.Long> |
getAll()
Gets all device keys in the index.
|
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.
|
void |
removeEntity(Entity entity)
Removes the entry for the given entity.
|
void |
removeEntity(Entity entity,
java.lang.Long deviceKey)
Removes the given device key from the index for the given entity.
|
boolean |
updateIndex(Device device,
java.lang.Long deviceKey)
Attempts to update an index with the entities in the provided
Device. |
void |
updateIndex(Entity entity,
java.lang.Long deviceKey)
Adds a mapping from the given entity to the given device key.
|
removeEntityIfNeededprivate java.util.concurrent.ConcurrentHashMap<IndexedEntity,java.util.Collection<java.lang.Long>> index
public EntityToMultiDeviceIdIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
keyFields - public java.util.Iterator<java.lang.Long> queryByEntity(Entity entity)
DeviceIndexqueryByEntity in class DeviceIndexentity - the entity to search forpublic java.util.Iterator<java.lang.Long> getAll()
DeviceIndexgetAll in class DeviceIndexpublic boolean updateIndex(Device device, java.lang.Long deviceKey)
DeviceIndexDevice. If the update fails because of a concurrent update,
will return false.updateIndex in class DeviceIndexdevice - the device to updatedeviceKey - the device key for the devicepublic void updateIndex(Entity entity, java.lang.Long deviceKey)
DeviceIndexupdateIndex in class DeviceIndexentity - the entity to updatedeviceKey - the device key for the devicepublic void removeEntity(Entity entity)
DeviceIndexremoveEntity in class DeviceIndexentity - the entity to removepublic void removeEntity(Entity entity, java.lang.Long deviceKey)
DeviceIndexremoveEntity in class DeviceIndexentity - the entity to search fordeviceKey - the key to remove