Class ScoreOperationChainHandler
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.operation.handler.ScoreOperationChainHandler
-
- All Implemented Interfaces:
OperationHandler<ScoreOperationChain>,OutputOperationHandler<ScoreOperationChain,Integer>
public class ScoreOperationChainHandler extends Object implements OutputOperationHandler<ScoreOperationChain,Integer>
Operation Handler for ScoreOperationChain
-
-
Constructor Summary
Constructors Constructor Description ScoreOperationChainHandler(String namedOperationCacheNameSuffix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegerdoOperation(ScoreOperationChain operation, Context context, Store store)Returns the OperationChainLimiter score for the OperationChain provided.Map<String,Integer>getAuthScores()intgetChainScore(Operations<?> operations, User user)Map<Class<? extends Operation>,ScoreResolver>getDefaultScoreResolvers()intgetMaxUserAuthScore(Set<String> opAuths)Iterates through each of the users operation authorisations listed in the config file and returns the highest score associated with those auths.Map<Class<? extends Operation>,Integer>getOpScores()Map<String,Integer>getOpScoresAsStrings()Map<Class<? extends Operation>,ScoreResolver>getScoreResolvers()StringgetSuffixNamedOperationCacheName()voidsetAuthScores(Map<String,Integer> authScores)voidsetOpScores(Map<Class<? extends Operation>,Integer> opScores)voidsetOpScoresFromStrings(Map<String,Integer> opScores)voidsetScoreResolvers(Map<Class<? extends Operation>,ScoreResolver> resolvers)voidvalidateOpScores()
-
-
-
Constructor Detail
-
ScoreOperationChainHandler
public ScoreOperationChainHandler(String namedOperationCacheNameSuffix)
-
-
Method Detail
-
getSuffixNamedOperationCacheName
public String getSuffixNamedOperationCacheName()
-
doOperation
public Integer doOperation(ScoreOperationChain operation, Context context, Store store) throws OperationException
Returns the OperationChainLimiter score for the OperationChain provided.- Specified by:
doOperationin interfaceOperationHandler<ScoreOperationChain>- Specified by:
doOperationin interfaceOutputOperationHandler<ScoreOperationChain,Integer>- Parameters:
operation- theOperationto be executedcontext- the operation chain context, containing the user who executed the operationstore- theStorethe operation should be run on- Returns:
- an Integer containing the score
- Throws:
OperationException- thrown if the property keys have not been set
-
getChainScore
public int getChainScore(Operations<?> operations, User user)
-
getMaxUserAuthScore
public int getMaxUserAuthScore(Set<String> opAuths)
Iterates through each of the users operation authorisations listed in the config file and returns the highest score associated with those auths.Defaults to 0.
- Parameters:
opAuths- a set of operation authorisations- Returns:
- maxUserScore the highest score associated with any of the supplied user auths
-
setOpScoresFromStrings
public void setOpScoresFromStrings(Map<String,Integer> opScores) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
getScoreResolvers
public Map<Class<? extends Operation>,ScoreResolver> getScoreResolvers()
-
setScoreResolvers
public void setScoreResolvers(Map<Class<? extends Operation>,ScoreResolver> resolvers)
-
validateOpScores
public void validateOpScores()
-
getDefaultScoreResolvers
public Map<Class<? extends Operation>,ScoreResolver> getDefaultScoreResolvers()
-
-