Interface IndexAlternativeAction


public interface IndexAlternativeAction
  • Method Details

    • run

      String run(ModelEntity modelEntity, ModelIndex modelIndex, DatabaseUtil dbUtil) throws SQLException, GenericEntityException
      This method is used to perform alternative actions on index before it is created. Mostly to create the index yourself depending on the database type. You have to notice that alternative action can only happen if index is not created.

      CONTRACT: Run MUST handle index creation AND persist its original name OR ofBiz will attain to recreate it every time JIRA starts.

      HINT: see DatabaseUtil.createDeclaredIndex(ModelEntity, ModelIndex) to experience ofBiz index creation.
      Parameters:
      modelEntity - model of entity containing index
      modelIndex - model of index we want to handle alternatively
      dbUtil - database helper class to handle many scenarios
      Returns:
      null on success or error string on failure.
      Throws:
      SQLException
      GenericEntityException
    • shouldRun

      boolean shouldRun(ModelEntity modelEntity, ModelIndex modelIndex, DatabaseUtil dbUtil) throws SQLException, GenericEntityException
      This method flags if alternative action should be invoked. This method is only run if index was not created before.

      CONTRACT: This function shouldn't have any side effects as it may get rerun.

      CONTRACT: Only one alternative action in a entity definition can return true for shouldRun OR IllegalStateException will be thrown.

      Parameters:
      modelEntity - model of entity containing index
      modelIndex - model of index we want to handle alternatively
      dbUtil - database helper class to handle many scenarios
      Returns:
      true if index creation will be handled and ofBiz should not attempt to create index by itself.
      Throws:
      SQLException
      GenericEntityException