display method

void display({
  1. String prefix = '',
  2. bool withOid = true,
  3. bool withChildren = true,
  4. bool withInternalChildren = true,
})

Displays (prints) an entity with its attributes, parents and children.

Implementation

void display(
    {String prefix = '',
    bool withOid = true,
    bool withChildren = true,
    bool withInternalChildren = true}) {
  if (_concept == null) {
    throw new ConceptException('Entity concept is not defined.');
  }

  var s = prefix;
  if (!(_concept!.entry) ||
      ((_concept!.entry) && _concept!.parents.isNotEmpty)) {
    s = '$prefix  ';
  }
  print('$s------------------------------------');
  print('$s${toString()}                       ');
  print('$s------------------------------------');
  s = '$s  ';
  if (withOid) {
    print('${s}oid: $_oid');
  }
  print('${s}code: $_code');
  print('${s}id: $id');
  print('${s}whenAdded: $_whenAdded');
  print('${s}whenSet: $_whenSet');
  print('${s}whenRemoved: $_whenRemoved');

  _attributeMap.forEach((k, v) {
    if (_concept!.isAttributeSensitive(k)) {
      print('$s$k: **********');
    } else {
      print('$s$k: $v');
    }
  });

  _parentMap.forEach((k, v) {
    if (_concept!.isParentSensitive(k)) {
      print('$s$k: **********');
    } else {
      print('$s$k: ${v.toString()}');
    }
  });

  if (withChildren) {
    if (withInternalChildren) {
      _internalChildMap.forEach((k, v) {
        print('$s$k:');
        if (_concept!.isChildSensitive(k)) {
          print('**********');
        } else {
          (v as Entities).display(
              title: '$s$k',
              prefix: '$s  ',
              withOid: withOid,
              withChildren: withChildren,
              withInternalChildren: withInternalChildren);
        }
      });
    } else {
      _childMap.forEach((k, v) {
        print('$s$k:');
        if (_concept!.isChildSensitive(k)) {
          print('**********');
        } else {
          (v as Entities).display(
              title: '$s$k',
              prefix: '$s  ',
              withOid: withOid,
              withChildren: withChildren,
              withInternalChildren: withInternalChildren);
        }
      });
    }
  }

  print('');
}