Class EssCubeImpl

java.lang.Object
com.appliedolap.essbase.AbstractEssObject
com.appliedolap.essbase.impl.EssCubeImpl
All Implemented Interfaces:
EssCube, EssObject

public class EssCubeImpl extends AbstractEssObject implements EssCube
Represents an Essbase cube on the server.
  • Constructor Details

    • EssCubeImpl

      public EssCubeImpl(ApiContext api, EssApplication application, com.appliedolap.essbase.client.model.Cube cube)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: EssObject
      Gets the name of this object. This will generally be the "nice" and "unique" name of this object, such as the application name, cube, member, variable, or whatever.
      Specified by:
      getName in interface EssObject
      Returns:
      the simple name of this object
    • getType

      public EssObject.Type getType()
      Description copied from interface: EssObject
      Gets the type of this object.
      Specified by:
      getType in interface EssObject
      Returns:
      the object type
    • getCalcScripts

      public List<EssScript> getCalcScripts()
      Description copied from interface: EssCube
      Get the list of scripts associated with this cube.
      Specified by:
      getCalcScripts in interface EssCube
      Returns:
      the scripts on this cube
    • getMdxScripts

      public List<EssScript> getMdxScripts()
      Description copied from interface: EssCube
      The MDX scripts on this cube. Same endpoints as the calc scripts, told apart by a type parameter - see EssScript.ScriptType.
      Specified by:
      getMdxScripts in interface EssCube
      Returns:
      the MDX scripts
    • getScripts

      public List<EssScript> getScripts(EssScript.ScriptType scriptType)
      Lists the scripts of one kind.

      Not through the generated client: the type has to travel on every scripts call and the generated signature makes it optional, which produces the server's least helpful error. See EssScripts.

      Specified by:
      getScripts in interface EssCube
      Parameters:
      scriptType - which kind
      Returns:
      the scripts
    • createScript

      public EssScript createScript(EssScript.ScriptType scriptType, String name, String content)
      Description copied from interface: EssCube
      Creates a script on this cube.
      Specified by:
      createScript in interface EssCube
      Parameters:
      scriptType - which kind
      name - the script name, without an extension
      content - the script text
      Returns:
      the script as created
    • getApplication

      public EssApplication getApplication()
      Description copied from interface: EssCube
      Gets the parent application of this cube.
      Specified by:
      getApplication in interface EssCube
      Returns:
      the parent application
    • getSessions

      public List<EssSession> getSessions()
      Description copied from interface: EssCube
      Gets the list of sessions on this cube.
      Specified by:
      getSessions in interface EssCube
      Returns:
      the current cube sessions
    • killSessions

      public void killSessions(boolean logoff)
      Description copied from interface: EssCube
      Ends every session on this cube, leaving the rest of the application's alone.

      What you want before restructuring: the server takes the application and database as filters, so this is one call rather than a walk over EssCube.getSessions() killing each.

      Specified by:
      killSessions in interface EssCube
      Parameters:
      logoff - true to disconnect the users as well as ending their requests
    • createVariable

      public EssCubeVariable createVariable(String name, String value)
      Description copied from interface: EssCube
      Defines a new variable on this cube, shadowing any application or server variable of the same name for anything running against it.
      Specified by:
      createVariable in interface EssCube
      Parameters:
      name - the variable name
      value - its value
      Returns:
      the created variable
    • getEffectiveVariables

      public List<EssEffectiveVariable> getEffectiveVariables()
      Description copied from interface: EssCube
      Every variable this cube can actually see, with the definition that wins and the ones it hides.

      Three requests, merged here, because the server will not do it: each variable endpoint reports only its own level, so nothing on the server can tell you which definition of a name a query against this cube would resolve to. Nearest wins - cube over application over server.

      Specified by:
      getEffectiveVariables in interface EssCube
      Returns:
      one entry per distinct name, ordered by name
    • getVariables

      public List<EssCubeVariable> getVariables()
      Specified by:
      getVariables in interface EssCube
    • getOutline

      public EssOutline getOutline()
      Description copied from interface: EssCube
      Gets an outline object for this cube.
      Specified by:
      getOutline in interface EssCube
      Returns:
      an outline object
    • isScenariosEnabled

      public boolean isScenariosEnabled()
      Description copied from interface: EssCube
      Checks if this cube has scenarios enabled.
      Specified by:
      isScenariosEnabled in interface EssCube
      Returns:
      true if scenarios are enabled, false otherwise
    • createDrillthroughDataSource

      public EssDrillthrough createDrillthroughDataSource(String name, String dataSourceName, List<String> columns, Map<String,EssDrillthroughColumnMapping> columnMappings, List<String> drillRegions)
      Description copied from interface: EssCube
      Creates a drill-through report that reads its detail from a data source.

      The other half of EssCube.createDrillthroughURL(java.lang.String, java.lang.String, java.util.List<java.lang.String>): where that one records a URL for a client to open, this one Essbase can execute itself, returning the rows behind a cell - see EssDrillthrough.execute(java.util.Map).

      The data source must already exist; naming one that does not is refused outright with No datasource exists with name '...'.

      Specified by:
      createDrillthroughDataSource in interface EssCube
      Parameters:
      name - the report name
      dataSourceName - the data source holding the detail
      columns - the source columns to return, in order
      columnMappings - which column is filtered by which dimension, keyed by column name
      drillRegions - the regions whose cells may be drilled
      Returns:
      the created report
    • createDrillthroughURL

      public EssDrillthrough createDrillthroughURL(String urlName, String urlLink, List<String> drillRegions)
      Description copied from interface: EssCube
      Creates a URL-type drill-through on the cube,
      Specified by:
      createDrillthroughURL in interface EssCube
      Parameters:
      urlName - the name (no spaces?!)
      urlLink - the drill-through link
      drillRegions - the drillable regions
      Returns:
      a new drill-through object
    • getDrillthroughs

      public List<EssDrillthrough> getDrillthroughs()
      Description copied from interface: EssCube
      Get list of drill-through reports on the cube.
      Specified by:
      getDrillthroughs in interface EssCube
      Returns:
      the list of cube drill-through reports
    • getDrillthrough

      public EssDrillthrough getDrillthrough(String drillthroughName)
      Description copied from interface: EssCube
      Gets a drill-through report with a specific name. Note that the current implementation of this method hits the drill-through report list endpoint and filters based on the name, so you will likely end up with two trips to the server: one to get the list, and one to get the details of the report, which will happen when you access most detailed properties in the drill-through report.
      Specified by:
      getDrillthrough in interface EssCube
      Parameters:
      drillthroughName - the name of the drill-through report
      Returns:
      a drill-through report object
    • getScenarios

      public List<EssScenario> getScenarios()
      Description copied from interface: EssCube
      Gets the list of scenarios on the cube, if any.
      Specified by:
      getScenarios in interface EssCube
      Returns:
      the cube's scenarios
    • getMember

      public EssMember getMember(String memberName)
      Description copied from interface: EssCube
      Gets a reference to a particular member in the cube outline. This method is likely to change in the future as the outline management and other classes come in to focus, to say nothing of how member IDs and unique members and such will need to be handled.
      Specified by:
      getMember in interface EssCube
      Parameters:
      memberName - the name of the member
      Returns:
      the member
    • getDimensions

      public List<EssDimension> getDimensions()
      Description copied from interface: EssCube
      Gets the list of dimensions on the cube, if any.
      Specified by:
      getDimensions in interface EssCube
      Returns:
      the cube's dimensions
    • getLockedObjects

      public List<EssLock> getLockedObjects(Integer offset, Integer limit)
      Description copied from interface: EssCube
      List Locked Objects Returns all the locked objects from the specified application and database
      Specified by:
      getLockedObjects in interface EssCube
      Parameters:
      offset - Number of items to omit from the start of the result set. Default value is 0
      limit - Maximum number of objects to return. Default is 50
      Returns:
      LockObjectLis
    • unlockObject

      public void unlockObject(EssLock lockedObject)
      Description copied from interface: EssCube
      Unlock Object Unlocks the object in the specified application and database
      Specified by:
      unlockObject in interface EssCube
      Parameters:
      lockedObject - Details about object to be unlocked
    • lockObject

      public void lockObject(EssLock unlockedObject)
      Description copied from interface: EssCube
      Lock Object Locks the object in the specified application and database and returns the details of the locked object
      Specified by:
      lockObject in interface EssCube
      Parameters:
      unlockedObject - Object details to be locked (required)
    • exportExcel

      public String exportExcel()
      Runs the Excel export job and waits for it.

      buildMethod is required and has to be GENERATION, which makes no sense for an export and is not in any documentation - the job simply fails without it:

       An argument buildMethod in parameters cannot be null or empty
       
      and rejects every other value (LEVEL, PARENT_CHILD, ...) with "Invalid value of build method". The export job evidently shares a parameter validator with dimension build. This was true on both 21.7 and 26.1, so it has never worked without it.

      Waits rather than returning the job, because the caller wants the workbook and the workbook does not exist until the job is done. The job is submitted synchronously but runs in the background: a fresh submit comes back IN_PROGRESS and turns into a real status a few seconds later.

      Specified by:
      exportExcel in interface EssCube
      Returns:
      the catalogue path of the workbook, e.g. /applications/Sample/Basic/Basic.xlsx
    • calculate

      public void calculate()
      CALC ALL is what "the default calculation" means for a block storage cube.
      Specified by:
      calculate in interface EssCube
    • calculate

      public void calculate(String script)
      Description copied from interface: EssCube
      Runs a calculation given as script text rather than a stored script.

      EssScript.execute() runs one that exists on the cube; this runs one that does not have to. The two are parameterised differently and neither is guessable - a stored calculation goes in the job's file parameter by bare name, while script text goes in script with isScriptContent set.

      Specified by:
      calculate in interface EssCube
      Parameters:
      script - the calculation, e.g. CALC ALL;
    • importExcel

      public void importExcel(String path, String filename)
      Description copied from interface: EssCube
      Updates this cube using an Excel workbook. This API is likely to change soon to take an EssFile reference
      Specified by:
      importExcel in interface EssCube
      Parameters:
      path - the path
      filename - the filename
    • importFile

      public void importFile(File file)
      Description copied from interface: EssCube
      Acts as a convenience function for uploading a file to a cube's storage folder. The Essbase server maps the file location /applications/AppName/CubeName, which contains the cube files such as calc scripts, load rules, and whatnot.
      Specified by:
      importFile in interface EssCube
      Parameters:
      file - the file to upload to the cube
    • executeMdx

      @Deprecated(since="2.1.0") public void executeMdx(String query, EssCube.MdxOutputType outputType, EssCubeImpl.MdxOptions mdxOptions, OutputStream outputStream)
      Deprecated.
      Description copied from interface: EssCube
      Runs an MDX query and writes the server's answer, in the given format, to a stream.
      Specified by:
      executeMdx in interface EssCube
      Parameters:
      query - the query
      outputType - the format to write
      mdxOptions - ignored: this class never sent its options to the server
      outputStream - where to write the result; not closed
    • executeMdx

      public void executeMdx(String query, EssMdxOptions options, EssCube.MdxOutputType outputType, OutputStream outputStream)
      Description copied from interface: EssCube
      Runs an MDX query and writes the server's answer, in the given format, to a stream. JSON is the format EssCube.executeMdx(String, EssMdxOptions) reads; the others are for handing on as they are.

      The options come second, unlike the deprecated method's, so that a call passing null for those still compiles against the deprecated method rather than matching both.

      Specified by:
      executeMdx in interface EssCube
      Parameters:
      query - the query
      options - how to present the result; EssMdxOptions.defaults() for the server's defaults
      outputType - the format to write
      outputStream - where to write the result; not closed
    • getStatus

      public EssApplication.Status getStatus()
      Description copied from interface: EssCube
      Whether this cube is started.

      A cube has a state of its own and does not simply inherit its application's: an application can be started with a cube inside it stopped, and only a started cube answers queries. Shares EssApplication.Status because the server reports both with the same vocabulary.

      Specified by:
      getStatus in interface EssCube
      Returns:
      the cube's status, EssApplication.Status.UNKNOWN for a state this doesn't name
    • refreshStatus

      public EssApplication.Status refreshStatus()
      Description copied from interface: EssCube
      Asks the server for this cube's status again, and updates this object with the answer.

      Same reason as EssApplication.refreshStatus(): a cube's status is a snapshot, and browsing into a cube starts the application that owns it, so the snapshot goes stale through ordinary use.

      Specified by:
      refreshStatus in interface EssCube
      Returns:
      the status as of now
    • getAi

      public EssCubeAi getAi()
      Description copied from interface: EssCube
      The generative-AI features this cube offers - notably turning a question asked in English into an MDX query.

      Returns a handle whether or not the server supports or has been set up for any of this; ask the handle's EssCubeAi.getReadiness() rather than expecting this to fail or return null, since "can this cube use AI" is a question with several different answers and several different people who can fix them.

      Specified by:
      getAi in interface EssCube
      Returns:
      the cube's AI features, never null
    • executeMdx

      public EssGrid executeMdx(String query)
      Description copied from interface: EssCube
      Runs an MDX query and returns its cells.

      The grid is an EssMdxGrid, though declared as the plainer type for compatibility. Use EssCube.executeMdx(String, EssMdxOptions) to have it typed as one.

      Specified by:
      executeMdx in interface EssCube
      Parameters:
      query - the query
      Returns:
      the result
    • executeMdx

      public EssMdxGrid executeMdx(String query, EssMdxOptions options)
      Description copied from interface: EssCube
      Runs an MDX query and returns its cells along with the dimensions on each axis.
      Specified by:
      executeMdx in interface EssCube
      Parameters:
      query - the query
      options - how to present the result; EssMdxOptions.defaults() for the server's defaults
      Returns:
      the result
    • openCubeView

      public EssCubeView openCubeView()
      Description copied from interface: EssCube
      Opens a live, ad hoc grid view on this cube using its default layout - the REST analog of the Java API's IEssCube.openCubeView.
      Specified by:
      openCubeView in interface EssCube
      Returns:
      a navigable cube view
    • openCubeView

      public EssCubeView openCubeView(String layoutName)
      Description copied from interface: EssCube
      Opens a live, ad hoc grid view on this cube using a specific saved layout by name, rather than whatever is currently saved as "Default".
      Specified by:
      openCubeView in interface EssCube
      Parameters:
      layoutName - the name of the saved layout to open
      Returns:
      a navigable cube view
    • resetDefaultView

      public void resetDefaultView()
      The layout to delete is named after the current user, so this needs to know who that is.

      It asks the authentication strategy first and only falls back to GET /session when the strategy doesn't know - which is a strategy carrying a session or token rather than a name. That ordering is not just to save a round trip: GET /session answers 500 on Essbase 26.1, so asking it first made this method, and therefore every fresh ad hoc grid, fail outright there.

      Specified by:
      resetDefaultView in interface EssCube
    • getMdxFunctions

      public List<EssMdxFunctionGroup> getMdxFunctions()
      Description copied from interface: EssCube
      The MDX functions this server understands, in the server's own groups.

      Reference material rather than anything about this cube: the endpoint is cube-scoped, but a given server answers identically for every cube, and for a stopped application too. Offered here because this is where the path lives, and on EssServer.getMdxFunctions() because that is what it actually describes.

      Specified by:
      getMdxFunctions in interface EssCube
      Returns:
      the function groups, in the order the server listed them
    • start

      public void start()
      Description copied from interface: EssCube
      Starts this cube, and with it the application that owns it - a cube cannot run in a stopped application, so the server starts both.
      Specified by:
      start in interface EssCube
    • stop

      public void stop()
      Description copied from interface: EssCube
      Stops this cube, leaving its application running.

      Not the mirror of EssCube.start(), and verified against a live server: starting a cube starts its application, but stopping one leaves the application started with its other cubes untouched. To stop the application as well, stop the application.

      Specified by:
      stop in interface EssCube
    • batchOutlineEdit

      public EssBatchOutlineEditResult batchOutlineEdit(String xml)
      Posts a batch outline edit document and reads the server's log back.

      By hand rather than through the generated BatchOutlineEditingApi, which cannot send a usable document. Its OtlEditMain models editActions as JAXB's own name/value/nil wrapper rather than as the twenty-six action elements the schema actually defines, so there is no way to express an action through it; and its restructOption enum is spelled ALL_DATA where the server accepts only allData - sending the documented value answers HTTP 500.

      Accept: application/json because the response is the one part the generated model has right: a single-property object whose messages is the log. Read as text and handed to EssBatchOutlineEditResult rather than deserialized, so a server that answers in XML, or with a bare log, still produces a readable result instead of a parse failure.

      Specified by:
      batchOutlineEdit in interface EssCube
      Parameters:
      xml - the document, with otlEditMain as its root element
      Returns:
      what the server said it did
    • batchOutlineEdit

      public EssBatchOutlineEditResult batchOutlineEdit(EssBatchOutlineEdit edit)
      Description copied from interface: EssCube
      Applies a batch outline edit built with EssBatchOutlineEdit.

      The same call as EssCube.batchOutlineEdit(String) - and the same warning about reading the result - with the document written for you.

      Specified by:
      batchOutlineEdit in interface EssCube
      Parameters:
      edit - the actions to apply, in order
      Returns:
      what the server said it did
    • getAliasTables

      public List<String> getAliasTables()
      Description copied from interface: EssCube
      Gets the names of this cube's alias tables.

      Always at least Default, which is the table a cube has whether or not anyone has added others, and the one members are labelled from when none is asked for.

      Specified by:
      getAliasTables in interface EssCube
      Returns:
      the alias table names