com.sap.cloud.sdk.s4hana.connectivity.CachingErpCommand Maven / Gradle / Ivy
/*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.sap.cloud.sdk.s4hana.connectivity;
import javax.annotation.Nonnull;
import com.sap.cloud.sdk.cloudplatform.cache.CacheKey;
import com.sap.cloud.sdk.frameworks.hystrix.CachingCommand;
import com.sap.cloud.sdk.frameworks.hystrix.HystrixUtil;
import lombok.Getter;
/**
* Extends the {@link CachingCommand} to enable resilient execution and caching of results of S/4HANA queries.
* Introduces a member for the {@link ErpConfigContext} to be used inside the command.
*/
public abstract class CachingErpCommand extends CachingCommand implements WithErpConfigContext
{
/**
* {@inheritDoc}
*/
@Getter
@Nonnull
private final ErpConfigContext configContext;
protected CachingErpCommand( @Nonnull final Setter setter )
{
this(setter, new ErpConfigContext());
}
protected CachingErpCommand( @Nonnull final Setter setter, @Nonnull final ErpConfigContext configContext )
{
super(setter);
this.configContext = configContext;
}
protected CachingErpCommand( @Nonnull final Class> commandType )
{
this(HystrixUtil.getDefaultErpCommandSetter(commandType));
}
protected CachingErpCommand( @Nonnull final Class> commandType, @Nonnull final ErpConfigContext erpConfigContext )
{
this(HystrixUtil.getDefaultErpCommandSetter(commandType), erpConfigContext);
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
protected CacheKey getCommandCacheKey()
{
return super.getCommandCacheKey().append(getConfigContext());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy