use of org.compiere.model.I_C_Region in project metasfresh-webui-api by metasfresh.
the class AddressRegionLookupDescriptor method retrieveLookupValueById.
@Override
public LookupValue retrieveLookupValueById(final LookupDataSourceContext evalCtx) {
final int id = evalCtx.getIdToFilterAsInt(-1);
if (id <= 0) {
throw new IllegalStateException("No ID provided in " + evalCtx);
}
final LookupValue region = regionsByCountryId.values().stream().map(regions -> regions.getById(id)).filter(r -> r != null).findFirst().orElse(null);
if (region != null) {
return region;
}
final I_C_Region regionRecord = InterfaceWrapperHelper.create(Env.getCtx(), id, I_C_Region.class, ITrx.TRXNAME_None);
if (regionRecord == null) {
return LOOKUPVALUE_NULL;
}
return createLookupValue(regionRecord);
}
Aggregations