Package com.orchestranetworks.schema.businessObjects

# Interface MainEntity

All Superinterfaces:
  `Entity`, `ValidationReportItemSubject`, `ValueContext`

public interface MainEntity extends Entity
Provides a facade to the main record of a business object. Since version 6.1.1, this facade is no longer read-only, as it is possible to delete the business object from it.

Since:
  6.1.1
See Also:
  - `BusinessObjectModel`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `doDelete(ProcedureContext aContext)`
  Deletes the entire business object.
  `ValidationReport`
  `getValidationReport()`
  Returns an up-to-date validation report of this business object.
  `ValidationReport`
  `getValidationReport(boolean ensureActivation, boolean upToDateValidationReport)`
  Returns the validation report of this business object.
  `ValidationReport`
  `getValidationReport(ValidationSpec aValidationSpec)`
  Returns the validation report of this business object according to the specified properties.

  ### Methods inherited from interface com.orchestranetworks.schema.businessObjects.Entity

  `getBusinessObjectModel, getChildEntities, getChildEntities, getChildEntity, getChildEntity, getRecord, getSessionOrNull`

  ### Methods inherited from interface com.orchestranetworks.service.ValidationReportItemSubject

  `isDatasetOrRecordSubject, isTableSubject`

  ### Methods inherited from interface com.orchestranetworks.instance.ValueContext

  `getAdaptationInstance, getAdaptationTable, getHome, getNode, getNode, getValue, getValue, getValue`

- ## Method Details

  - ### doDelete

    void doDelete(ProcedureContext aContext) throws OperationException, ConstraintViolationException
    Deletes the entire business object. This method performs a cascading delete of the records that compose the business object (records from the main and child entities).

    #### Warning

    Access rights on the table node for the current session are not checked when calling this method, even in a context which is not with "all privileges". `SessionPermissions.getNodeAccessPermission(SchemaNode, Adaptation)` should be used before executing this method to explicitly perform this check if required. If the business object is composed of a foreign key defined without a uniqueness constraint, the operation will fail and throw an error.

    Throws:
      `OperationException` - if an error occurs during the operation.
      `ConstraintViolationException` - if one of the records that compose the business object is being referenced by a foreign key constraint (`osd:tableRef`) in blocking mode.
    See Also:
      - `ProcedureContext.doDelete(com.onwbp.adaptation.AdaptationName, boolean)`

  - ### getValidationReport

    ValidationReport getValidationReport()
    Returns an up-to-date validation report of this business object.

    This method is equivalent to:

    > `MainEntity.getValidationReport(true, true);`

    See Also:
      - `getValidationReport(boolean, boolean)`

  - ### getValidationReport

    ValidationReport getValidationReport(boolean ensureActivation, boolean upToDateValidationReport)
    Returns the validation report of this business object.

    This method is equivalent to:

         ValidationSpec spec = new ValidationSpec();
         spec.setActivationEnsured(ensureActivation);
         spec.setRefreshPolicy(updateValidationReport ? RefreshPolicy.UP_TO_DATE : RefreshPolicy.AS_IS);

         MainEntity.getValidationReport(spec);

    See Also:
      - `getValidationReport(ValidationSpec)`
      - `ValidationSpec`

  - ### getValidationReport

    ValidationReport getValidationReport(ValidationSpec aValidationSpec)
    Returns the validation report of this business object according to the specified properties.
    See Also:
      - `ValidationSpec`