Package com.bitheads.braincloud.services
Class GlobalEntityService
java.lang.Object
com.bitheads.braincloud.services.GlobalEntityService
public class GlobalEntityService extends Object
-
Constructor Summary
Constructors Constructor Description GlobalEntityService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidcreateEntity(String entityType, long timeToLive, String jsonEntityAcl, String jsonEntityData, IServerCallback callback)Method creates a new entity on the server.voidcreateEntityWithIndexedId(String entityType, String indexedId, long timeToLive, String jsonEntityAcl, String jsonEntityData, IServerCallback callback)Method creates a new entity on the server with an indexed id.voiddeleteEntity(String entityId, int version, IServerCallback callback)Method deletes an existing entity on the server.voidgetList(String where, String orderBy, int maxReturn, IServerCallback callback)Method gets list of entities from the server base on type and/or where clausevoidgetListByIndexedId(String entityIndexedId, int maxReturn, IServerCallback callback)Method gets list of entities from the server base on indexed idvoidgetListCount(String where, IServerCallback callback)Method gets a count of entities based on the where clausevoidgetPage(String jsonContext, IServerCallback callback)Method uses a paging system to iterate through Global Entities.voidgetPageOffset(String context, int pageOffset, IServerCallback callback)Method to retrieve previous or next pages after having called the GetPage method.voidgetRandomEntitiesMatching(String where, int maxReturn, IServerCallback callback)Gets a list of up to randomCount randomly selected entities from the server based on the where condition and specified maximum return count.voidincrementGlobalEntityData(String entityId, String jsonData, IServerCallback callback)Partial increment of entity data field items.voidmakeSystemEntity(String entityId, int version, String jsonEntityAcl, IServerCallback callback)Method clears the owner id of an existing entity and sets the ACL on the server.voidreadEntity(String entityId, IServerCallback callback)Method reads an existing entity from the server.voidupdateEntity(String entityId, int version, String jsonEntityData, IServerCallback callback)Method updates an existing entity on the server.voidupdateEntityAcl(String entityId, int version, String jsonEntityAcl, IServerCallback callback)Method updates an existing entity's Acl on the server.voidupdateEntityIndexedId(String entityId, int version, String entityIndexedId, IServerCallback callback)Method updates an existing entity's Indexed ID.voidupdateEntityOwnerAndAcl(String entityId, int version, String ownerId, String jsonEntityAcl, IServerCallback callback)Method updates an existing entity's Owner and ACL on the server.voidupdateEntityTimeToLive(String entityId, int version, long timeToLive, IServerCallback callback)Method updates an existing entity's time to live on the server.
-
Constructor Details
-
GlobalEntityService
-
-
Method Details
-
createEntity
public void createEntity(String entityType, long timeToLive, String jsonEntityAcl, String jsonEntityData, IServerCallback callback)Method creates a new entity on the server.- Parameters:
entityType- The entity type as defined by the usertimeToLive- Sets expiry time in millis for entity if greater than 0jsonEntityAcl- The entity's access control list as json. A null acl implies defaultjsonEntityData- The entity's data as a json Stringcallback- Callback.
-
createEntityWithIndexedId
public void createEntityWithIndexedId(String entityType, String indexedId, long timeToLive, String jsonEntityAcl, String jsonEntityData, IServerCallback callback)Method creates a new entity on the server with an indexed id.- Parameters:
entityType- The entity type as defined by the userindexedId- A secondary ID that will be indexedtimeToLive- Sets expiry time in millis for entity if greater than 0jsonEntityAcl- The entity's access control list as json. A null acl implies defaultjsonEntityData- The entity's data as a json Stringcallback- Callback.
-
updateEntity
public void updateEntity(String entityId, int version, String jsonEntityData, IServerCallback callback)Method updates an existing entity on the server.- Parameters:
entityId- The entity IDversion- Current version of the entity. If the version of the entity on the server does not match the version passed in, the server operation will fail. Use -1 to skip version checking.jsonEntityData- The entity's data as a json Stringcallback- Callback.
-
updateEntityAcl
public void updateEntityAcl(String entityId, int version, String jsonEntityAcl, IServerCallback callback)Method updates an existing entity's Acl on the server.- Parameters:
entityId- The entity IDversion- Current version of the entity. If the version of the entity on the server does not match the version passed in, the server operation will fail. Use -1 to skip version checking.jsonEntityAcl- The entity's access control list as json.callback- Callback.
-
updateEntityTimeToLive
public void updateEntityTimeToLive(String entityId, int version, long timeToLive, IServerCallback callback)Method updates an existing entity's time to live on the server.- Parameters:
entityId- The entity idversion- Current version of the entity. If the version of the entity on the server does not match the version passed in, the server operation will fail. Use -1 to skip version checking.timeToLive- Sets expiry time in millis for entity if greater than 0callback- Callback
-
deleteEntity
Method deletes an existing entity on the server.- Parameters:
entityId- The entity IDversion- The version of the entity to deletecallback- Callback.
-
readEntity
Method reads an existing entity from the server.- Parameters:
entityId- The entity IDcallback- Callback.
-
getList
Method gets list of entities from the server base on type and/or where clause- Parameters:
where- Mongo style query stringorderBy- Specifies the order in which the query returns matching documents. The sort parameter consists of a field followed by an ascending(1)/descending flag(-1). eg. { name : 1} sorts by name in ascending ordermaxReturn- The maximum number of entities to returncallback- Callback.
-
getListByIndexedId
Method gets list of entities from the server base on indexed id- Parameters:
entityIndexedId- The entity indexed IdmaxReturn- The maximum number of entities to returncallback- Callback.
-
getListCount
Method gets a count of entities based on the where clause- Parameters:
where- Mongo style query stringcallback- Callback.
-
getPage
Method uses a paging system to iterate through Global Entities. After retrieving a page of Global Entities with this method, use GetPageOffset() to retrieve previous or next pages. Service Name - GlobalEntity Service Operation - GetPage- Parameters:
jsonContext- The json context for the page request. See the portal appendix documentation for formatcallback- Callback.
-
getPageOffset
Method to retrieve previous or next pages after having called the GetPage method. Service Name - GlobalEntity Service Operation - GetPageOffset- Parameters:
context- The context string returned from the server from a previous callpageOffset- The positive or negative page offset to fetch. Uses the last page retrieved using the context string to determine a starting point.callback- Callback.
-
incrementGlobalEntityData
Partial increment of entity data field items. Partial set of items incremented as specified. Service Name - globalEntity Service Operation - INCREMENT_GLOBAL_ENTITY_DATA- Parameters:
entityId- The id of the entity to updatejsonData- The entity's data objectcallback- The callback object
-
getRandomEntitiesMatching
Gets a list of up to randomCount randomly selected entities from the server based on the where condition and specified maximum return count. Service Name - globalEntity Service Operation - GET_RANDOM_ENTITIES_MATCHING- Parameters:
where- Mongo style query stringmaxReturn- The maximum number of entities to returncallback- The callback object
-
updateEntityIndexedId
public void updateEntityIndexedId(String entityId, int version, String entityIndexedId, IServerCallback callback)Method updates an existing entity's Indexed ID. Service Name - globalEntity Service Operation - UPDATE_INDEXED_ID- Parameters:
entityId- The entity IDversion- The version of the entity to updateentityIndexedId- the id index of the entitycallback- The callback object
-
updateEntityOwnerAndAcl
public void updateEntityOwnerAndAcl(String entityId, int version, String ownerId, String jsonEntityAcl, IServerCallback callback)Method updates an existing entity's Owner and ACL on the server. Service Name - globalEntity Service Operation - UPDATE_ENTITY_OWNER_AND_ACL- Parameters:
entityId- The entity IDversion- The version of the entity to updateownerId- The owner IDjsonEntityAcl- The entity's access control list as JSON.callback- The callback object
-
makeSystemEntity
public void makeSystemEntity(String entityId, int version, String jsonEntityAcl, IServerCallback callback)Method clears the owner id of an existing entity and sets the ACL on the server. Service Name - globalEntity Service Operation - MAKE_SYSTEM_ENTITY- Parameters:
entityId- The entity IDversion- The version of the entity to updatejsonEntityAcl- The entity's access control list as JSON.callback- The callback object
-