Search in sources :

Example 1 with I_C_Region

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);
}
Also used : CCache(org.compiere.util.CCache) IntegerLookupValue(de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue) ITrx(org.adempiere.ad.trx.api.ITrx) Env(org.compiere.util.Env) CtxName(org.compiere.util.CtxName) CtxNames(org.compiere.util.CtxNames) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) ImmutableList(com.google.common.collect.ImmutableList) I_C_Region(org.compiere.model.I_C_Region) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) LookupValue(de.metas.ui.web.window.datatypes.LookupValue) ImmutableSet(com.google.common.collect.ImmutableSet) Builder(de.metas.ui.web.window.model.lookup.LookupDataSourceContext.Builder) LookupSource(de.metas.ui.web.window.descriptor.DocumentLayoutElementFieldDescriptor.LookupSource) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) Set(java.util.Set) WindowId(de.metas.ui.web.window.datatypes.WindowId) CCacheStats(org.compiere.util.CCache.CCacheStats) ICountryDAO(de.metas.adempiere.service.ICountryDAO) Services(org.adempiere.util.Services) List(java.util.List) Check(org.adempiere.util.Check) I_C_Location(org.compiere.model.I_C_Location) Optional(java.util.Optional) LookupDataSourceFetcher(de.metas.ui.web.window.model.lookup.LookupDataSourceFetcher) I_C_Region(org.compiere.model.I_C_Region) IntegerLookupValue(de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue) LookupValue(de.metas.ui.web.window.datatypes.LookupValue)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ICountryDAO (de.metas.adempiere.service.ICountryDAO)1 LookupValue (de.metas.ui.web.window.datatypes.LookupValue)1 IntegerLookupValue (de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue)1 LookupValuesList (de.metas.ui.web.window.datatypes.LookupValuesList)1 WindowId (de.metas.ui.web.window.datatypes.WindowId)1 LookupSource (de.metas.ui.web.window.descriptor.DocumentLayoutElementFieldDescriptor.LookupSource)1 LookupDescriptor (de.metas.ui.web.window.descriptor.LookupDescriptor)1 LookupDataSourceContext (de.metas.ui.web.window.model.lookup.LookupDataSourceContext)1 Builder (de.metas.ui.web.window.model.lookup.LookupDataSourceContext.Builder)1 LookupDataSourceFetcher (de.metas.ui.web.window.model.lookup.LookupDataSourceFetcher)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 ITrx (org.adempiere.ad.trx.api.ITrx)1 InterfaceWrapperHelper (org.adempiere.model.InterfaceWrapperHelper)1 Check (org.adempiere.util.Check)1 Services (org.adempiere.util.Services)1 I_C_Location (org.compiere.model.I_C_Location)1