Class NamedOperationCache

    • Field Detail

      • NAMED_OPERATION_CACHE_WAS_MADE_WITH_NULL_OR_EMPTY_SUFFIX

        public static final String NAMED_OPERATION_CACHE_WAS_MADE_WITH_NULL_OR_EMPTY_SUFFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • NamedOperationCache

        public NamedOperationCache​(String suffixNamedOperationCacheName)
    • Method Detail

      • getCacheNameFrom

        public static String getCacheNameFrom​(String suffixNamedOperationCacheName)
      • getSuffixCacheName

        public String getSuffixCacheName()
      • addNamedOperation

        public void addNamedOperation​(NamedOperationDetail namedOperation,
                                      boolean overwrite,
                                      User user)
                               throws CacheOperationException
        If the user is just adding to the cache, ie the overwrite flag is set to false, then no security is added. However if the user is overwriting the named operation stored in the cache, then their opAuths must be checked against the write roles associated with the NamedOperationDetail. If it turns out the user is overwriting a non-existent NamedOperationDetail, then the users NamedOperationDetail will be added normally.
        Parameters:
        namedOperation - The NamedOperationDetail that the user wants to store.
        overwrite - Flag relating to whether the user is adding (false) or updating/overwriting (true).
        user - The user making the request.
        Throws:
        CacheOperationException - thrown if the user doesn't have write access to the NamedOperationDetail requested, or if the add operation fails for some reason.
      • deleteNamedOperation

        public void deleteNamedOperation​(String name,
                                         User user)
                                  throws CacheOperationException
        Checks whether a User has write access to the cache. If they do then the NamedOperationDetail and name is removed from the cache. If they don't or the NamedOperationDetail doesn't exist then an Exception is thrown.
        Parameters:
        name - The name of the NamedOperationDetail a user would like to delete.
        user - A User object that can optionally be used for checking permissions.
        Throws:
        CacheOperationException - Thrown when the NamedOperationDetail doesn't exist or the User doesn't have write permission on the NamedOperationDetail.
      • getNamedOperation

        public NamedOperationDetail getNamedOperation​(String name,
                                                      User user)
                                               throws CacheOperationException
        First gets the NamedOperationDetail in question and checks whether the user has read access before returning the value. If the NamedOperationDetail doesn't exist or the User doesn't have permission to read this NamedOperationDetail, then an exception is thrown.
        Parameters:
        name - The name of the NamedOperationDetail held in the cache.
        user - The User object that is used for checking read permissions.
        Returns:
        NamedOperationDetail.
        Throws:
        CacheOperationException - thrown if the NamedOperationDetail doesn't exist or the User doesn't have permission to read it.
      • getAllNamedOperations

        public Iterable<NamedOperationDetail> getAllNamedOperations​(User user)
        Get all the named operations held in the cache.
        Parameters:
        user - The User object that is used for checking read permissions.
        Returns:
        a Iterable containing the named operation details
      • addNamedOperation

        public void addNamedOperation​(NamedOperationDetail namedOperation,
                                      boolean overwrite,
                                      User user,
                                      String adminAuth)
                               throws CacheOperationException
        If the user is just adding to the cache, ie the overwrite flag is set to false, then no security is added. However if the user is overwriting the named operation stored in the cache, then their opAuths must be checked against the write roles associated with the NamedOperationDetail. If it turns out the user is overwriting a non-existent NamedOperationDetail, then the users NamedOperationDetail will be added normally.
        Parameters:
        namedOperation - The NamedOperationDetail that the user wants to store.
        overwrite - Flag relating to whether the user is adding (false) or updating/overwriting (true).
        user - The user making the request.
        adminAuth - The admin auth supplied for permissions.
        Throws:
        CacheOperationException - thrown if the user doesn't have write access to the NamedOperationDetail requested, or if the add operation fails for some reason.
      • deleteNamedOperation

        public void deleteNamedOperation​(String name,
                                         User user,
                                         String adminAuth)
                                  throws CacheOperationException
        Checks whether a User has write access to the cache. If they do then the NamedOperationDetail and name is removed from the cache. If they don't or the NamedOperationDetail doesn't exist then an Exception is thrown.
        Parameters:
        name - The name of the NamedOperationDetail a user would like to delete.
        user - A User object that can optionally be used for checking permissions.
        adminAuth - The admin auth supplied for permissions.
        Throws:
        CacheOperationException - Thrown when the NamedOperationDetail doesn't exist or the User doesn't have write permission on the NamedOperationDetail.
      • getNamedOperation

        public NamedOperationDetail getNamedOperation​(String name,
                                                      User user,
                                                      String adminAuth)
                                               throws CacheOperationException
        First gets the NamedOperationDetail in question and checks whether the user has read access before returning the value. If the NamedOperationDetail doesn't exist or the User doesn't have permission to read this NamedOperationDetail, then an exception is thrown.
        Parameters:
        name - The name of the NamedOperationDetail held in the cache.
        user - The User object that is used for checking read permissions.
        adminAuth - The admin auth supplied for permissions.
        Returns:
        NamedOperationDetail.
        Throws:
        CacheOperationException - thrown if the NamedOperationDetail doesn't exist or the User doesn't have permission to read it.
      • getAllNamedOperations

        public Iterable<NamedOperationDetail> getAllNamedOperations​(User user,
                                                                    String adminAuth)
        Get all the named operations held in the cache.
        Parameters:
        user - The User object that is used for checking read permissions.
        adminAuth - The admin auth supplied for permissions.
        Returns:
        a Iterable containing the named operation details