Class GlobalEntityService

java.lang.Object
com.bitheads.braincloud.services.GlobalEntityService

public class GlobalEntityService
extends Object
  • Constructor Details

  • 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 user
      timeToLive - Sets expiry time in millis for entity if greater than 0
      jsonEntityAcl - The entity's access control list as json. A null acl implies default
      jsonEntityData - The entity's data as a json String
      callback - 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 user
      indexedId - A secondary ID that will be indexed
      timeToLive - Sets expiry time in millis for entity if greater than 0
      jsonEntityAcl - The entity's access control list as json. A null acl implies default
      jsonEntityData - The entity's data as a json String
      callback - 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 ID
      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.
      jsonEntityData - The entity's data as a json String
      callback - 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 ID
      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.
      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 id
      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.
      timeToLive - Sets expiry time in millis for entity if greater than 0
      callback - Callback
    • deleteEntity

      public void deleteEntity​(String entityId, int version, IServerCallback callback)
      Method deletes an existing entity on the server.
      Parameters:
      entityId - The entity ID
      version - The version of the entity to delete
      callback - Callback.
    • readEntity

      public void readEntity​(String entityId, IServerCallback callback)
      Method reads an existing entity from the server.
      Parameters:
      entityId - The entity ID
      callback - Callback.
    • getList

      public void getList​(String where, String orderBy, int maxReturn, IServerCallback callback)
      Method gets list of entities from the server base on type and/or where clause
      Parameters:
      where - Mongo style query string
      orderBy - 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 order
      maxReturn - The maximum number of entities to return
      callback - Callback.
    • getListByIndexedId

      public void getListByIndexedId​(String entityIndexedId, int maxReturn, IServerCallback callback)
      Method gets list of entities from the server base on indexed id
      Parameters:
      entityIndexedId - The entity indexed Id
      maxReturn - The maximum number of entities to return
      callback - Callback.
    • getListCount

      public void getListCount​(String where, IServerCallback callback)
      Method gets a count of entities based on the where clause
      Parameters:
      where - Mongo style query string
      callback - Callback.
    • getPage

      public void getPage​(String jsonContext, IServerCallback callback)
      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 format
      callback - Callback.
    • getPageOffset

      public void getPageOffset​(String context, int pageOffset, IServerCallback callback)
      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 call
      pageOffset - 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

      public void incrementGlobalEntityData​(String entityId, String jsonData, IServerCallback callback)
      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 update
      jsonData - The entity's data object
      callback - The callback object
    • getRandomEntitiesMatching

      public void getRandomEntitiesMatching​(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. Service Name - globalEntity Service Operation - GET_RANDOM_ENTITIES_MATCHING
      Parameters:
      where - Mongo style query string
      maxReturn - The maximum number of entities to return
      callback - 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 ID
      version - The version of the entity to update
      entityIndexedId - the id index of the entity
      callback - 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 ID
      version - The version of the entity to update
      ownerId - The owner ID
      jsonEntityAcl - 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 ID
      version - The version of the entity to update
      jsonEntityAcl - The entity's access control list as JSON.
      callback - The callback object