We are in the process of seeing how our existing product would be represented in the Cuba platform. Currently a lot of our tables are stateful, meaning that they can have different states such as what you would see in a state machine of sorts (see picture). Different states will drive different permissions/validation, UI changes such as making fields read-only or required, different notifications to go out, etc. Cuba is a very open platform so we could code in different directions and create all of this logic manually. We are planning on having our available states to be in a stand-alone table with inheritance to describe the states for each of the different stateful entities. I will populate a custom datasource of states to represent valid states that can be transitioned to for the UI for each entity. Coded rules and actions will just reside in code in the controller and middleware. What I am asking for is if there are abilities in Cuba I haven’t considered or a best practice for doing this approach or what other users have done. We want to standardize our approach as much as possible. Our current challenges that we are seeing is as follows:
- Repeating a lot of code in both the GENERIC UI and the MIDDLEWARE to represent our coded business rules, with different behavior because of the different tiers. (e.g. a rule may need the UI to have a field read-only at the same time adding a validator in the Middleware).
- Our customers can change logic / behavior / design of the business rules. We need smooth options for them to override the business logic. (e.g. customers may want to add an additional state or make other fields read-only).
- Any suggestions on the business model? Our stateful entities will probably inherit from a mapped superclass, but It looks like I have to add their relationship to the state table manually as each will have their own child class of that table to represent their states. I’m not sure if this gives me anything.
- External systems that integrate with our system may or may not be subject to certain rules, or may have their own business logic that needs to fire. We generally have a lot of interfaces. These of course will need to be different code in the middleware, any thoughts on how best to manage this though or am I missing something?
Any input on anything above or about stateful entities in the system would be helpful. Thanks!