Persistence

Persistent Variables

When a flow chart is scheduled, the triggers and actions in the flow chart may require job-specific data. For example, a series of actions that use a database might all need access to the same database URL and table name. In such cases, it is often useful to store this shared data using flow chart variables so it can be easily referenced throughout the flow chart.

Any variable that is stored to the database (such as a flow chart variable) is called a "persistent variable". Flux automatically stores and retrieves flow chart variables as they are needed by triggers and actions.

For more information on how variables can be created, stored, and retrieved, see Variable Managers.

Rules for Persistent Variables

To store a variable to the database, it must conform to the following rules (these rules are listed in the order in which Flux applies them). If your persistent variable does not follow these rules, Flux will encounter an error and the variable will not be persisted to the database (and, if the variable that caused the error is used in a flow chart, the flow chart itself may encounter an error).

  1. Your variable can be any of the following basic data types (or an instance of the listed Java class). Note that "serialized data" refers to any instance of a class that implements java.io.Serializable.
    1. boolean
    2. byte
    3. byte[]
    4. char
    5. char[]
    6. double
    7. float
    8. int
    9. long
    10. short
    11. java.lang.Boolean
    12. java.lang.Character
    13. java.lang.Character[]
    14. java.lang.Float
    15. java.lang.Integer
    16. java.lang.Long
    17. java.lang.Short
    18. java.lang.String
    19. java.math.BigDecimal
    20. java.math.BigInteger
    21. java.sql.Date
    22. java.sql.Time
    23. java.sql.Timestamp
    24. java.util.Date
    25. serialized data
    26. null
  2. Your persistent variable may be a Java collection from the java.util package (including ListMapSetSortedMap, or SortedSet). However, each item stored in the collection must also follow the rules for persistent variables (in effect, the rules are applied recursively to each item in the collection).
  3. Your persistent variable may be an array. If the variable is an array type that is not explicitly mentioned in rule #1, it will be treated as a List and must therefore follow the same rules as other collections (see rule #2 above).
  4. Your persistent variable may be a complex user-defined type. In this case, rules for persistence are applied recursively to each field on the variable, so any fields used in the custom variable must also follow the rules for persistence.

Because Flux variables are persisted to the database as XML, they do not support circular references (ObjectA contains ObjectB, which contains ObjectA, etc.).
If your variable contains a circular reference you may see an error like:

java.lang.StackOverflowError
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:147)
at java.beans.Introspector.getBeanInfo(Introspector.java:183)
at fluximpl.x7.a(x7.java:6)
at fluximpl.mcb.a(mcb.java:113)
at fluximpl.mcb.a(mcb.java:120)
at fluximpl.mcb.a(mcb.java:137)

Pre-defined Persistent Variables

flux.FlowChart objects are persistent variables. They can be stored in any location that a persistent variable can.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.