getProperty method

Danger<Property, PropertyTableExceptionB> getProperty(
  1. PropertyName propertyName
)

Implementation

Danger<Property, PropertyTableExceptionB> getProperty(PropertyName propertyName) {

    final log = Log(classLocation: runtimeType, functionLocation: 'getProperty');

    final permanentlyResult = permanentlyPropertyRoster.getByPrimaryKey(propertyName);
    log.add(permanentlyResult);
    if (permanentlyResult is Success<PermanentlyProperty, RosterPatternExceptionB>) return Success(permanentlyResult.wrapped, log);

    final temporaryResult = temporaryPropertyRoster.getByPrimaryKey(propertyName);
    log.add(temporaryResult);
    if (temporaryResult is Success<TemporaryProperty, RosterPatternExceptionB>) return Success(temporaryResult.wrapped, log);

    final listResult = listPropertyRoster.getByPrimaryKey(propertyName);
    log.add(listResult);
    if (listResult is Success<ListProperty, RosterPatternExceptionB>) return Success(listResult.wrapped, log);

    final fragmentResult = fragmentPropertyRoster.getByPrimaryKey(propertyName);
    log.add(fragmentResult);
    if (fragmentResult is Success<FragmentProperty, RosterPatternExceptionB>) return Success(fragmentResult.wrapped, log);

    return Failure(PropertyTableExceptionB(), log.monitor({
        'not exist proerty': propertyName.value,
        'exist property name list': propertyNameList.toPrimitive(),
    }));

}