@Override
  public void constraintImmutable(
      String repositoryId, Document document, TypeDefinition typeDefinition) {
    Boolean defaultVal =
        (Boolean)
            typeManager.getSingleDefaultValue(
                PropertyIds.IS_IMMUTABLE, typeDefinition.getId(), repositoryId);

    boolean flag = false;
    if (document.isImmutable() == null) {
      if (defaultVal != null && defaultVal) {
        flag = true;
      }
    } else {
      if (document.isImmutable()) {
        flag = true;
      }
    }

    if (flag) {
      constraint(document.getId(), "Immutable document cannot be updated/deleted");
    }
  }