Search in sources :

Example 1 with ISysConfigBL

use of org.adempiere.service.ISysConfigBL in project metasfresh-webui-api by metasfresh.

the class ProductLookupDescriptor method isAvailableStockQueryActivatedInSysConfig.

private boolean isAvailableStockQueryActivatedInSysConfig() {
    final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
    final int clientId = Env.getAD_Client_ID(Env.getCtx());
    final int orgId = Env.getAD_Org_ID(Env.getCtx());
    final boolean stockQueryActivated = sysConfigBL.getBooleanValue(SYSCONFIG_ATP_QUERY_ENABLED, false, clientId, orgId);
    return stockQueryActivated;
}
Also used : ISysConfigBL(org.adempiere.service.ISysConfigBL)

Example 2 with ISysConfigBL

use of org.adempiere.service.ISysConfigBL in project metasfresh-webui-api by metasfresh.

the class WEBUI_ProcessHelper method retrieveHUPIItemProductRecords.

public List<I_M_HU_PI_Item_Product> retrieveHUPIItemProductRecords(@NonNull final Properties ctx, @NonNull final I_M_Product product, @Nullable final I_C_BPartner bPartner, final boolean includeVirtualItem) {
    final IHUPIItemProductDAO hupiItemProductDAO = Services.get(IHUPIItemProductDAO.class);
    final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
    final boolean allowInfiniteCapacity = sysConfigBL.getBooleanValue(SYSCONFIG_ALLOW_INFINIT_CAPACITY_TUS, true, Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx));
    final List<I_M_HU_PI_Item_Product> list = hupiItemProductDAO.retrieveTUs(ctx, product, bPartner, allowInfiniteCapacity);
    if (includeVirtualItem) {
        list.add(hupiItemProductDAO.retrieveVirtualPIMaterialItemProduct(ctx));
    }
    return list;
}
Also used : ISysConfigBL(org.adempiere.service.ISysConfigBL) I_M_HU_PI_Item_Product(de.metas.handlingunits.model.I_M_HU_PI_Item_Product) IHUPIItemProductDAO(de.metas.handlingunits.IHUPIItemProductDAO)

Example 3 with ISysConfigBL

use of org.adempiere.service.ISysConfigBL in project metasfresh-webui-api by metasfresh.

the class ProductLookupDescriptor method addStorageAttributeKeysToQueryBuilder.

private void addStorageAttributeKeysToQueryBuilder(@NonNull final AvailableToPromiseQueryBuilder stockQueryBuilder) {
    final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
    final int clientId = Env.getAD_Client_ID(Env.getCtx());
    final int orgId = Env.getAD_Org_ID(Env.getCtx());
    final String storageAttributesKeys = sysConfigBL.getValue(SYSCONFIG_ATP_ATTRIBUTES_KEYS, AttributesKey.ALL.getAsString(), clientId, orgId);
    final Splitter splitter = Splitter.on(",").trimResults(CharMatcher.whitespace()).omitEmptyStrings();
    for (final String storageAttributesKey : splitter.splitToList(storageAttributesKeys)) {
        if ("<ALL_STORAGE_ATTRIBUTES_KEYS>".equals(storageAttributesKey)) {
            stockQueryBuilder.storageAttributesKey(AttributesKey.ALL);
        } else if ("<OTHER_STORAGE_ATTRIBUTES_KEYS>".equals(storageAttributesKey)) {
            stockQueryBuilder.storageAttributesKey(AttributesKey.OTHER);
        } else {
            stockQueryBuilder.storageAttributesKey(AttributesKey.ofString(storageAttributesKey));
        }
    }
}
Also used : Splitter(com.google.common.base.Splitter) ISysConfigBL(org.adempiere.service.ISysConfigBL) ITranslatableString(de.metas.i18n.ITranslatableString) NumberTranslatableString(de.metas.i18n.NumberTranslatableString)

Example 4 with ISysConfigBL

use of org.adempiere.service.ISysConfigBL in project metasfresh-webui-api by metasfresh.

the class HostKeyConfig method setupHostKeyStorage.

@PostConstruct
public void setupHostKeyStorage() {
    Services.registerService(IHttpSessionProvider.class, new SpringHttpSessionProvider());
    final IHostKeyBL hostKeyBL = Services.get(IHostKeyBL.class);
    // when this method is called, there is not DB connection yet.
    // so provide the storage implementation as a supplier when it's actually needed and when (hopefully)
    // the system is ready
    hostKeyBL.setHostKeyStorage(() -> {
        final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
        final IHostKeyStorage hostKeyStorageImpl;
        final String hostKeyStorage = sysConfigBL.getValue(PRINTING_WEBUI_HOST_KEY_STORAGE_MODE, "cookies");
        if (hostKeyStorage.toLowerCase().startsWith("cookie".toLowerCase())) {
            hostKeyStorageImpl = new HttpCookieHostKeyStorage();
        } else {
            // https://github.com/metasfresh/metasfresh/issues/1274
            hostKeyStorageImpl = new SessionRemoteHostStorage();
        }
        return hostKeyStorageImpl;
    });
}
Also used : SessionRemoteHostStorage(de.metas.hostkey.spi.impl.SessionRemoteHostStorage) IHostKeyStorage(de.metas.hostkey.spi.IHostKeyStorage) ISysConfigBL(org.adempiere.service.ISysConfigBL) HttpCookieHostKeyStorage(de.metas.hostkey.spi.impl.HttpCookieHostKeyStorage) IHostKeyBL(de.metas.hostkey.api.IHostKeyBL) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ISysConfigBL (org.adempiere.service.ISysConfigBL)4 Splitter (com.google.common.base.Splitter)1 IHUPIItemProductDAO (de.metas.handlingunits.IHUPIItemProductDAO)1 I_M_HU_PI_Item_Product (de.metas.handlingunits.model.I_M_HU_PI_Item_Product)1 IHostKeyBL (de.metas.hostkey.api.IHostKeyBL)1 IHostKeyStorage (de.metas.hostkey.spi.IHostKeyStorage)1 HttpCookieHostKeyStorage (de.metas.hostkey.spi.impl.HttpCookieHostKeyStorage)1 SessionRemoteHostStorage (de.metas.hostkey.spi.impl.SessionRemoteHostStorage)1 ITranslatableString (de.metas.i18n.ITranslatableString)1 NumberTranslatableString (de.metas.i18n.NumberTranslatableString)1 PostConstruct (javax.annotation.PostConstruct)1