Interface IndexAlternativeAction
public interface IndexAlternativeAction
-
Method Summary
Modifier and TypeMethodDescriptionrun(ModelEntity modelEntity, ModelIndex modelIndex, DatabaseUtil dbUtil) This method is used to perform alternative actions on index before it is created.booleanshouldRun(ModelEntity modelEntity, ModelIndex modelIndex, DatabaseUtil dbUtil) This method flags if alternative action should be invoked.
-
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: seeDatabaseUtil.createDeclaredIndex(ModelEntity, ModelIndex)to experience ofBiz index creation.- Parameters:
modelEntity- model of entity containing indexmodelIndex- model of index we want to handle alternativelydbUtil- database helper class to handle many scenarios- Returns:
- null on success or error string on failure.
- Throws:
SQLExceptionGenericEntityException
-
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 indexmodelIndex- model of index we want to handle alternativelydbUtil- 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:
SQLExceptionGenericEntityException
-