Package com.bitheads.braincloud.services
Class EntityService
java.lang.Object
com.bitheads.braincloud.services.EntityService
public class EntityService extends Object
-
Constructor Summary
Constructors Constructor Description EntityService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidcreateEntity(String entityType, String jsonEntityData, String jsonEntityAcl, IServerCallback callback)Method creates a new entity on the server.voiddeleteEntity(String entityId, int version, IServerCallback callback)Method deletes the given entity on the server.voiddeleteSingleton(String entityType, int version, IServerCallback callback)Method deletes the given singleton on the server.voidgetEntitiesByType(String entityType, IServerCallback callback)Method returns all player entities that match the given type.voidgetEntity(String entityId, IServerCallback callback)Method to get a specific entity.voidgetList(String whereJson, String orderByJson, int maxReturn, IServerCallback callback)Method gets list of entities from the server base on type and/or where clause Service Name - Entity Service Operation - GET_LISTvoidgetListCount(String whereJson, IServerCallback callback)Method gets a count of entities based on the where clause Service Name - Entity Service Operation - GET_LIST_COUNTvoidgetPage(String jsonContext, IServerCallback callback)Method uses a paging system to iterate through user entities After retrieving a page of entities with this method, use GetPageOffset() to retrieve previous or next pages.voidgetPageOffset(String context, int pageOffset, IServerCallback callback)Method to retrieve previous or next pages after having called the GetPage method.voidgetSharedEntitiesForProfileId(String profileId, IServerCallback callback)Method returns all shared entities for the given profile id.voidgetSharedEntitiesListForProfileId(String profileId, String whereJson, String orderByJson, int maxReturn, IServerCallback callback)Method gets list of shared entities for the specified profile based on type and/or where clause Service Name - Entity Service Operation - READ_SHARED_ENTITIES_LISTvoidgetSharedEntityForProfileId(String profileId, String entityId, IServerCallback callback)Method returns a shared entity for the given profile and entity ID.voidgetSingleton(String entityType, IServerCallback callback)Method retrieves a singleton entity on the server.voidincrementSharedUserEntityData(String entityId, String targetProfileId, String jsonData, IServerCallback callback)Partial increment of entity data field items.voidincrementUserEntityData(String entityId, String jsonData, IServerCallback callback)Partial increment of entity data field items.voidupdateEntity(String entityId, String entityType, String jsonEntityData, String jsonEntityAcl, int version, IServerCallback callback)Method updates a new entity on the server.voidupdateSharedEntity(String targetProfileId, String entityId, String entityType, String jsonEntityData, int version, IServerCallback callback)Method updates a shared entity owned by another user.voidupdateSingleton(String entityType, String jsonEntityData, String jsonAclData, int version, IServerCallback callback)Method updates a singleton entity on the server.
-
Constructor Details
-
EntityService
-
-
Method Details
-
createEntity
public void createEntity(String entityType, String jsonEntityData, String jsonEntityAcl, IServerCallback callback)Method creates a new entity on the server.- Parameters:
entityType- The entity type as defined by the userjsonEntityData- The entity's data as a json StringjsonEntityAcl- The entity's access control list as json. A null acl implies default permissions which make the entity readable/writeable by only the player.callback- Callback.
-
deleteEntity
Method deletes the given entity on the server.- Parameters:
entityId- The id of the entity to updateversion- 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.callback- Callback.
-
deleteSingleton
Method deletes the given singleton on the server. Note that if there are multiple entities with the same entityType, this call will only delete the first one found.- Parameters:
entityType- The entity type as defined by the userversion- 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.callback- The callback handler
-
getEntitiesByType
Method returns all player entities that match the given type.- Parameters:
entityType- The entity type to search forcallback- The callback
-
getEntity
Method to get a specific entity.- Parameters:
entityId- The id of the entitycallback- The callback handler
-
getSingleton
Method retrieves a singleton entity on the server. If the entity doesn't exist, null is returned.- Parameters:
entityType- The entity type as defined by the usercallback- The callback handler
-
updateEntity
public void updateEntity(String entityId, String entityType, String jsonEntityData, String jsonEntityAcl, int version, IServerCallback callback)Method updates a new entity on the server. This operation results in the entity data being completely replaced by the passed in JSON String.- Parameters:
entityId- The id of the entity to updateentityType- The entity type as defined by the userjsonEntityData- The entity's data as a json String.jsonEntityAcl- The entity's access control list as json. A null acl implies default permissions which make the entity readable/writeable by only the player.version- 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.callback- Callback.
-
updateSingleton
public void updateSingleton(String entityType, String jsonEntityData, String jsonAclData, int version, IServerCallback callback)Method updates a singleton entity on the server. This operation results in the entity data being completely replaced by the passed in JSON string. If the entity doesn't exist it is created.- Parameters:
entityType- The entity type as defined by the userjsonEntityData- The entity's data as a json stringjsonAclData- The entity's access control list as json. A null acl implies default permissions which make the entity readable/writeable by only the player.version- 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.callback- The callback handler
-
getList
Method gets list of entities from the server base on type and/or where clause Service Name - Entity Service Operation - GET_LIST- Parameters:
whereJson- Mongo style query stringorderByJson- Sort ordermaxReturn- The maximum number of entities to returncallback- The callback object
-
getListCount
Method gets a count of entities based on the where clause Service Name - Entity Service Operation - GET_LIST_COUNT- Parameters:
whereJson- Mongo style query stringcallback- The callback object
-
getPage
Method uses a paging system to iterate through user entities After retrieving a page of entities with this method, use GetPageOffset() to retrieve previous or next pages. Service Name - Entity Service Operation - GET_PAGE- Parameters:
jsonContext- The json context for the page request. See the portal appendix documentation for format.callback- The callback object
-
getPageOffset
Method to retrieve previous or next pages after having called the GetPage method. Service Name - Entity Service Operation - GET_PAGE_BY_OFFSET- Parameters:
context- The context string returned from the server from a previous call to GetPage or GetPageOffsetpageOffset- The positive or negative page offset to fetch. Uses the last page retrieved using the context string to determine a starting point.callback- The callback object
-
incrementUserEntityData
Partial increment of entity data field items. Partial set of items incremented as specified. Service Name - entity Service Operation - INCREMENT_USER_ENTITY_DATA- Parameters:
entityId- The id of the entity to updatejsonData- The entity's data objectcallback- The callback object
-