All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.adapter.odata.v4.metadata.provider.EdmxProviderConfiguration Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/**************************************************************************
 * (C) 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
 **************************************************************************/
package com.sap.cds.adapter.odata.v4.metadata.provider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sap.cds.services.runtime.CdsRuntimeConfiguration;
import com.sap.cds.services.runtime.CdsRuntimeConfigurer;
import com.sap.cds.services.utils.model.DynamicModelUtils;

public class EdmxProviderConfiguration implements CdsRuntimeConfiguration {

	private static Logger logger = LoggerFactory.getLogger(EdmxProviderConfiguration.class);

	@Override
	public void providers(CdsRuntimeConfigurer configurer) {
		DefaultEdmxProvider defaultProvider = new DefaultEdmxProvider(configurer.getCdsRuntime());
		configurer.provider(defaultProvider);

		DynamicModelUtils utils = new DynamicModelUtils(configurer.getCdsRuntime());
		if (utils.isModelProviderEnabled()) {
			configurer.provider(new DynamicEdmxProvider(configurer.getCdsRuntime(), utils, defaultProvider));
			logger.info("Initialized Dynamic EDMX V4 Provider");
		} else {
			logger.info("Initialized Default EDMX V4 Provider");
		}

		if (configurer.getCdsRuntime().getEnvironment().getCdsProperties().getOdataV4().getLazyI18n().isEnabled()) {
			DefaultEdmxI18nProvider defaultI18nProvider = DefaultEdmxI18nProvider.create();
			configurer.provider(defaultI18nProvider);
			if (utils.isModelProviderEnabled()) {
				configurer.provider(new DynamicEdmxI18nProvider(configurer.getCdsRuntime(), utils, defaultI18nProvider));
				logger.info("Initialized Dynamic EDMX I18n Provider");
			} else {
				logger.info("Initialized Default EDMX I18n Provider");
			}
		}
	}

	@Override
	public int order() {
		return Integer.MIN_VALUE;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy