Interface IThingService

All Superinterfaces:
IComponent, IInitializable, IMetaComponent

public interface IThingService extends IMetaComponent
Create/delete of things Management of thing cache deprecated methods may not be supported in future versions
See Also:
  • Field Details

    • ROOTFOLDER_DBID

      static final int ROOTFOLDER_DBID
      db ID of root folder (/meta/pmDB/folder/000000002)
      See Also:
    • ROOTTOPIC_DBID

      static final int ROOTTOPIC_DBID
      db ID of root topic (/meta/pmDB/topic/0000000003)
      See Also:
  • Method Details

    • getThingFromID

      @Deprecated IThing getThingFromID(IThingID thingID, boolean noArchive)
      Deprecated.
      Get an IThing object based on its ID. This is a factory method for objects implementing the IThing interface. Objects are instantiated based on a thing's xtypeID. This call is cached. When a thing is first instantiated, we make a DB call to check state, which is then cached. internal use only
      Parameters:
      thingID - ID of object
      noArchive - don't return an archived object
      Returns:
      object
    • getThingFromIDForUpdate

      IThing getThingFromIDForUpdate(IThingID thingID)
    • getThingIDFromDbID

      @Deprecated IThingID getThingIDFromDbID(int dbID)
      Deprecated.
      tries to find a cached thingID based on dbID returns null if not found in cache
      See Also:
    • cacheThingID

      @Deprecated void cacheThingID(IThingID thingID)
      Deprecated.
      puts a thingID in the cache
      Parameters:
      thingID -
    • flushCache

      void flushCache(IThingID thingID)
      Remove an object from the internal thing cache, if the cache is enabled.
    • flushCacheAll

      void flushCacheAll(boolean flushRemote)
      flushes (removes) all objects from internal thing cache
    • flushCacheForClasses

      void flushCacheForClasses(String[] classNames, boolean flushRemote)
      Flushes objects from thing cache which names match to those specified
      Parameters:
      classNames -
      flushRemote -
    • flushRemoteCaches

      void flushRemoteCaches(IThingID thingID)
      Remove an object from remote, synced up thing caches.
    • undeleteAllUndestroyed

      IThingIDList undeleteAllUndestroyed() throws MetaException
      Attempts to undelete all things that are in the "undestroyed" state. This state is set for a thing whenever it fails to be purged from database, usually happens because of some untracked FK's. Then manual intervention is needed in that case better to simply undelete a thing
      Throws:
      MetaException
    • refreshThing

      void refreshThing(IThingID thingID, boolean refreshLocal)
      sends a refresh message to thingID. Should cause thing data to reload at next DB call
      Parameters:
      thingID - id of thing to refresh
      refreshLocal - true if local cache should be updated
    • refreshLocalThingOnly

      void refreshLocalThingOnly(IThingID thingID)
    • createThing

      IThingID createThing(int xtypeID, IThingID parentID, IThingID ownerID) throws MetaException
      Create a Thing. When this method is called, the thing type is looked up, and the create() method is called on the factory class associated with the xtypeID.
      Parameters:
      xtypeID - xtype of new object
      parentID - parent of new type. Optional for some types, required for others
      ownerID - Owner (generally principal) of object. Can be ignored for some types.
      Returns:
      ID of newly created thing
      Throws:
      MetaException - for a variety of reasons:
      • Parent doesn't exist
      • Owner doesn't exist
      • parent or owner is an invalid type or null
      • general database errors
      See Also:
    • createThingForMigration

      IThingID createThingForMigration(int xtypeID, Integer thingID, IThingID parentID, IThingID ownerID) throws MetaException
      Create a Thing. This should only be used for side-by-side migration so that the old thingId can be reused. When this method is called, the thing type is looked up, and the create() method is called on the factory class associated with the xtypeID.
      Parameters:
      xtypeID - xtype of new object
      thingID - thingID of the old thing
      parentID - parent of new type. Optional for some types, required for others
      ownerID - Owner (generally principal) of object. Can be ignored for some types.
      Returns:
      ID of newly created thing
      Throws:
      MetaException - for a variety of reasons:
      • Parent doesn't exist
      • Owner doesn't exist
      • parent or owner is an invalid type or null
      • general database errors
      See Also:
    • createThing

      IThingID createThing(String xtypeName, IThingID parentID, IThingID ownerID) throws MetaException
      Create a Thing. When this method is called, the thing type is looked up, and the create() method is called on the factory class associated with the xtype name.
      Parameters:
      xtypeName - xtype of new object
      parentID - parent of new type. Optional for some types, required for others
      ownerID - Owner (generally principal) of object. Can be ignored for some types.
      Returns:
      ID of newly created thing
      Throws:
      MetaException - for a variety of reasons:
      • Parent doesn't exist
      • Owner doesn't exist
      • parent or owner is an invalid type or null
      • general database errors
      See Also:
    • createThingProtected

      IThingID createThingProtected(int xtypeID, IThingID parentID, IThingID ownerID) throws MetaException
      creates an object in "protected" ID space so the object can never be inadvertently deleted (below base ID) internal use only
      Throws:
      MetaException
    • createVersionedThing

      IThingID createVersionedThing(IThingID thingID, String resourceID, String versionID, int updateType, String updateID, IThingID serviceID) throws MetaException
      Creates an IVersionInfo object and attaches it to thingID
      Parameters:
      thingID - ID of thing to version
      resourceID - Resource
      versionID - Version
      Returns:
      new thingID of thing
      Throws:
      MetaException - if thing is already versioned, thing doesn't exist,or other error
    • exists

      boolean exists(IThingID thingID)
      Goes into the DB and verifies that this item still exists. Useful for detecting stale cached items. Unless you are in a transaction, this doesn't guarantee that any operation with this ID will succeed. Even in a transaction, you may get blocked.
      Parameters:
      thingID - id of thing to check. Only uses dbID part
      Returns:
      true if thing exists regardless of thing state
    • getThingState

      @Deprecated int getThingState(IThingID thingID)
      Deprecated.
      use IThingID#getDBState
      goes into the DB and gets thing state for ID (ignores bits in ID) guaranteed to call DB
      Parameters:
      thingID - ID of thing to check. Only uses dbID
      Returns:
      IThingState.UNKNOWN on error
      See Also:
    • getRootFolder

      IFolder getRootFolder()
      Get the root Folder.
    • getRootFolderID

      IThingID getRootFolderID()
      Get the root Folder ID.
    • getRootTopic

      ITopic getRootTopic()
      Get the root Topic.
    • getRootTopicID

      IThingID getRootTopicID()
      Get the root Topic ID.
    • loadThings

      void loadThings(int xtypeID) throws MetaException
      Bulks loads data for all things of a given xtype
      Parameters:
      xtypeID -
      Throws:
      MetaException
    • getDbIdBase

      int getDbIdBase()
      the base value for user-created DB objects