Class CFSAction<T extends Help>

Object
Action
CFSAction<T>
All Implemented Interfaces:
Help

public class CFSAction<T extends Help> extends Action
This action starts calculation of selected Calculated Field Set (CFS). It's a programmatic version of the same action available in UI. As such it allows user to schedule the action in calculation flow formula.

Obtain it with CalculationFlowActionBuilder.addCalculatedFieldSetAction(String). The action calculates the CFS that has this label. It starts the job only when the logic calls setCalculate(true). If no CFS matches the label, no job starts and the Calculation Flow does not report an error.

Example:


 actionBuilder.addCalculatedFieldSetAction('CFS 1')
     .setPriority(5)
     .setCalculate(true)
 
See Also:
  • Constructor Details

    • CFSAction

      public CFSAction(T backLink, Invocations<MethodInvocationRecord> invocations, String cfsLabel)
      Not intended for public use. An action created with this constructor is not added to the Calculation Flow, so it never runs. Use actionBuilder.addCalculatedFieldSetAction() instead.
      See Also:
  • Method Details

    • setCalculate

      public CFSAction<T> setCalculate(Boolean calculate)
      Whether the action is valid and should be triggered or not.
      Parameters:
      calculate -
      • true - calculation of the CFS is started as background process
      • false - calculation of the CFS is NOT started at all
      Returns:
      this action, for further configuration
    • setPriority

      public CFSAction<T> setPriority(int priority)
      Sets the priority of the calculation job that this action starts. A value outside the range from 0 to 9 is replaced with 0.
      Parameters:
      priority - Default is 0 (lowest user-definable priority). Max value is 9.
      Returns:
      this action, for further configuration
    • setDistributedCalculationThreshold

      public CFSAction<T> setDistributedCalculationThreshold(int threshold)
      Sets a job-individual threshold to start a distributed calculation. Please note: Any values below 1000 may very well be counter-productive and make the job slower!

      If you do not set it, or set 0, the job uses the threshold of the partition.

      Parameters:
      threshold - The number of items that need to be part of the job in order to execute it in distributed mode.
      Returns:
      this action, for further configuration
    • back

      public T back()
      Returns the builder that added this action, so that the logic can add the next action in the same chain.
      Returns:
      the actionBuilder that added this action
      See Also:
    • getObjectName

      public String getObjectName()
      Not intended for public use.
      Returns:
      the name of the builder that added this action, followed by ".CFSAction"
    • setNextJobs

      public CFSAction<T> setNextJobs(List<ChainedJobInfo> jobs)
      Defines subsequent follow-on jobs. A next job starts when the calculation job of this action has finished. If that job fails, a next job starts only when its executeOnError is true. Each next job can have next jobs of its own.

      Example, recalculating a Live Price Grid after the CFS:

      
       import net.pricefx.common.dto.ChainedJobInfo
      
       def nextJob = new ChainedJobInfo()
       nextJob.setTargetObject('155.PG')
       nextJob.setExecuteOnError(false)
      
       actionBuilder.addCalculatedFieldSetAction('CFS 1')
           .setNextJobs([nextJob])
           .setCalculate(true)
       
      Parameters:
      jobs - List of ChainedJobInfo objects
      Returns:
      this action, for further configuration
      See Also:
    • getCfsLabel

      public String getCfsLabel()
      Gets the label of the CFS that this action calculates.
      Returns:
      the label passed to CalculationFlowActionBuilder.addCalculatedFieldSetAction(String)
    • getCalculate

      public Boolean getCalculate()
      Gets whether this action starts the calculation of the CFS.
      Returns:
      true after setCalculate(true), otherwise false
      See Also:
    • getDistributedCalculationThreshold

      public int getDistributedCalculationThreshold()
      Gets the threshold set with setDistributedCalculationThreshold(int).
      Returns:
      the threshold, 0 if it was not set
    • getPriority

      public int getPriority()
      Gets the priority set with setPriority(int).
      Returns:
      the priority, 0 if it was not set
    • getNextJobs

      public List<ChainedJobInfo> getNextJobs()
      Gets the follow-on jobs set with setNextJobs(List).
      Returns:
      the follow-on jobs
    • toString

      public String toString()
      Returns a text representation of this action for debugging.
      Overrides:
      toString in class Object
      Returns:
      a text that contains the label of the CFS and the calculate flag of this action