Class Graph


  • public final class Graph
    extends Object

    The Graph separates the user from the Store. It holds an instance of the Store and acts as a proxy for the store, delegating Operations to the store.

    The Graph provides users with a single point of entry for executing operations on a store. This allows the underlying store to be swapped and the same operations can still be applied.

    Graphs also provides a view of the data with a instance of View. The view filters out unwanted information and can transform Properties into transient properties such as averages.

    When executing operations on a graph, an operation view would override the graph view.

    See Also:
    Graph.Builder
    • Method Detail

      • execute

        public void execute​(Operation operation,
                            User user)
                     throws OperationException
        Performs the given operation on the store. If the operation does not have a view then the graph view is used.
        Parameters:
        operation - the operation to be executed.
        user - the user executing the operation.
        Throws:
        OperationException - if an operation fails
      • execute

        public void execute​(Operation operation,
                            Context context)
                     throws OperationException
        Performs the given operation on the store. If the operation does not have a view then the graph view is used. The context will be cloned and a new jobId will be created.
        Parameters:
        operation - the operation to be executed.
        context - the user context for the execution of the operation
        Throws:
        OperationException - if an operation fails
      • execute

        public <O> O execute​(Output<O> operation,
                             User user)
                      throws OperationException
        Performs the given output operation on the store. If the operation does not have a view then the graph view is used.
        Type Parameters:
        O - the operation chain output type.
        Parameters:
        operation - the output operation to be executed.
        user - the user executing the operation.
        Returns:
        the operation result.
        Throws:
        OperationException - if an operation fails
      • execute

        public <O> O execute​(Output<O> operation,
                             Context context)
                      throws OperationException
        Performs the given output operation on the store. If the operation does not have a view then the graph view is used. The context will be cloned and a new jobId will be created.
        Type Parameters:
        O - the operation chain output type.
        Parameters:
        operation - the output operation to be executed.
        context - the user context for the execution of the operation.
        Returns:
        the operation result.
        Throws:
        OperationException - if an operation fails
      • executeJob

        public JobDetail executeJob​(Operation operation,
                                    User user)
                             throws OperationException
        Performs the given operation job on the store. If the operation does not have a view then the graph view is used.
        Parameters:
        operation - the operation to be executed.
        user - the user executing the job.
        Returns:
        the job details
        Throws:
        OperationException - thrown if the job fails to run.
      • executeJob

        public JobDetail executeJob​(Operation operation,
                                    Context context)
                             throws OperationException
        Performs the given operation job on the store. If the operation does not have a view then the graph view is used. The context will be cloned and a new jobId will be created.
        Parameters:
        operation - the operation to be executed.
        context - the user context for the execution of the operation
        Returns:
        the job details
        Throws:
        OperationException - thrown if the job fails to run.
      • executeJob

        public JobDetail executeJob​(Job job,
                                    User user)
                             throws OperationException
        Performs the given Job on the store. This should be used for Scheduled Jobs, although if no repeat is set it will act as a normal Job.
        Parameters:
        job - the Job to execute, which contains the OperationChain and the Repeat
        user - the user running the Job.
        Returns:
        the job detail.
        Throws:
        OperationException - thrown if the job fails to run.
      • executeJob

        public JobDetail executeJob​(Job job,
                                    Context context)
                             throws OperationException
        Performs the given Job on the store. This should be used for Scheduled Jobs, although if no repeat is set it will act as a normal Job.
        Parameters:
        job - the Job to execute, which contains the OperationChain and the Repeat
        context - the user context for the execution of the operation
        Returns:
        the job detail
        Throws:
        OperationException - thrown if the job fails to run.
      • isSupported

        public boolean isSupported​(Class<? extends Operation> operationClass)
        Parameters:
        operationClass - the operation class to check
        Returns:
        true if the provided operation is supported.
      • getConfig

        public GraphConfig getConfig()
        Returns the current GraphConfig that holds the configuration for the graph.
        Returns:
        The graph config.
      • getView

        public View getView()
        Returns the graph view from the GraphConfig.
        Returns:
        the graph view.
      • getDescription

        public String getDescription()
        Returns the description held in the GraphConfig.
        Returns:
        the description
      • getSupportedOperations

        public Set<Class<? extends Operation>> getSupportedOperations()
        Returns:
        a collection of all the supported Operations.
      • getNextOperations

        public Set<Class<? extends Operation>> getNextOperations​(Class<? extends Operation> operation)
        Parameters:
        operation - the class of the operation to check
        Returns:
        a collection of all the compatible Operations that could be added to an operation chain after the provided operation.
      • getGraphId

        public String getGraphId()
        Returns:
        the graphId for this Graph.
      • getStoreProperties

        public StoreProperties getStoreProperties()
        Returns:
        the StoreProperties for this Graph.
      • getCaches

        public List<Cache<?,​?>> getCaches()
      • getCreatedTime

        public String getCreatedTime()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object