User Defined Workflows Implementation - airflow

As part of our product requirements, we need to support a dynamic workflow configuration that will be set by the product's administrations.
Below is an example from Monday's system of this concept.
Meaning that the user can define the custom flow of event --> conditions / branches --> actions that will set the workflow.
Need to support events that are based on schedule and also on system configurations changes (an object changed it's state)
What is the best way to implement this on the back-end side? what module/tool should be used in order to execute the workflows?
We thought of the following design:
Create a workflow object for the whole workflow tree saving it as a hierarchical JSON object that contains the defined user hierarchy of the different objects (event, conditions, actions) and storing it in the database.
Use Apache Workflow as an orchestrator and create DAG dynamically based on the defined workflows and update them accordingly.
Is there a better tool to implement the following design? (saw some posts relating to this, but with no answer: 1, 2)
Thanks!

Related

How to attach contract code as attachment so that the contract can run during verify?

Good examples of how attachments are meant to be used include:
Calendar data
Fixes (e.g. LIBOR)
Smart contract code
In what way can I leverage on attachment to parameterise values or even codify custom agreement rules so contract can validate using it?
i.e
"Custom contract code must pass." using openAttachment(hashId).run == true
I want to be able to create a state that has a template of rules, but at the same time, able to handle custom (any) new rules proposed by initiator, and accepted by counterparties.
Contract code is attached automatically. These are the contracts that are assigned to a state when adding state as an output within a transaction.
These would be the standard "template of rules" that everyone has pre-agreed to in the development of the CorDapp and are run by everyone to reach consensus.
In theory, you could add a custom contract in an attachment, have counterparties upload the contract class to their nodes and then run verify against them by calling verify explicitly against the class within the flow. I suspect you'd have to have counterparty nodes stop and restart to load the class dynamically onto the classpath though.

Reason to integrate Spring Web-flow with Spring MVC

Why(In what scenarios) do we need to integrate Spring Webflow with Spring MVC? Both these frameworks are used to create web-app and I do not see any point why we would integrate them. I would appreciate if someone could clarify me about it.
This is really late but I don't see a satisfactory answer to this question and would like to share an approach I had tried in a recent project which I feel is better than the spring web flow approach which is strictly tied down to spring views and unnecessarily adds to the already existing xml load . I created a SPA(Single Page Application) using angular js with Spring MVC. In angular js I did not use routers or state, rather I created a div within the controller like below
On the server side to capture all possible transitions from one frame(I am referring to a particular screen in the SPA) to another I created a tree of rules using MVEL . So in the database I had a structure which stored a tree of rules for every frame . The data in the MVEL expressions were being set by the various services each action invoked. Thus on any action the following steps were followed.
1) Validate the action.
2) Invoke various services.
3) Capture the data from these services and merge it with the existing data of the user.
4) Feed this captured data into collection of rules for each frame along with the details of the current frame.
5) Run the rules of the tree w.r.t to current frame and fetch its output.
6) If there is only one transition then that is the final transition. If there are 2 transitions and one is default then ignore the default transition and use the other transition.
7) Return the template name of the transition to the angular controller and set the value of the page variable in the scope of the controller.
Using this approach all my services had to do was store data in different data fields w.r.t a particular action. All the complex if-else conditions for Web Flows or any complex process definitions(like the one defined in Spring-Web Flow) were not required. The MVEL rule engine managed all that and since it was all in the database it could be changed without needing a server re-start.
I believe this generic approach with MVEL is a flexible approach which comprehensively handles the problem of a convoluted flow without making the application code a mess or adding additional unnecessary xml files.
We combine both. Web Flow for the multi-step activities, where it doesn't make sense to jump into the middle of a process, and plain-MVC Controllers for the single-step activities. Things you might bookmark individually.
For example, an appointment-scheduling application, "find my appointment" might be a single Controller that accepts identifying information. "Make a new appointment" is a flow, with multiple steps of selecting a location, date, time, confirm the appointment, etc.
If your application have complex Flow pages, events which need to be defined as Finite state machine then use Webflow. It would be justified to use webflow for website where you buy Insurance, Flight Tickets. Web Flow conditions are like:
There is a clear start and an end point.
The user must go through a set of screens in a specific order.
The changes are not finalized until the last step.
Once complete it shouldn't be possible to repeat a transaction accidentally

Filter api model properties by user permission level in ASP.NET Core

We want to filter / hide / clear specific api model properties based on the user permission level.
The model itself will not differ. Just no return for those.
I found a lot of different ideas online:
switch(userrole) and call different logic methods
pass user role to logic
reflection to clear properties in the response (I hate this idea)
middleware to redirect the user to different actions
What is the recommended way to filter api model properties for specific roles?
It's hard to give any real specifics with what you've provided, but generally, I'd say this should go into your mapping logic. Utilize view models/DTOs to accept data from client requests. Then map that data from the view model/DTO to your entity instance. During this process, you can make decisions based on the user's role/permission set about what properties should or should not be mapped over. All of this logic can be factored out into a separate class or library of classes. Ultimately it doesn't really matter what the client sends. You can't control that anyway. You just need to ensure that they ultimately can't set any properties they don't have "access" to, and mapping logic is a great place for that.

Saving object as variable inside activiti

We are revamping a big enterprise application which has more business workflows. We are using activiti bpm with spring MVC. Currently we are saving the required variables for workflow inside execution individually. My idea is to create object for each workflow and save the object as variable inside activiti execution instead of individual variables.
For example for the job application workflow I will have JobRequest object which have all the requested details like approvers, interviewers, candidate profiles, current status, etc., I will save this object as variable inside activiti. Whenever I need I will just get the object back and show the needed info on the web page. It will be hassle free than maintaining all those information on separate tables and getting the reference alone from activiti.
Is this good approach?
Still I have some concerns on my approach.
If suppose later we add additional fields to the Class. Then how to
handle the history object variables. (In the above example we are
adding additional field under JobRequest.class).
In our current approach if some values really needs to be verified I
can connect to the activiti database and able to see. Because the
variables are saved individually.
Any valuable suggestion?

Flex PureMVC: Can proxy keep reference of a View component in following case?

I am learning pureMVC and trying to implement the framework into one of my application. I have follwing case:
My main application has Canvas which is used to add different kind of custom components. One of the custom component is a "Search Component" (multiple instances are created on page). My search component has a textfiled and a search button and initiate search in following steps:
1-Clicking search button dispatches a custom event, that custom event keeps reference of search component as a property.
2-My AppMediator listens the custom event and get the reference of current search component along with search text.
3-Mediator send a notification (sentNotification(AppConstants.SEARCH_CLICKED, component)).
4-I have registered a command with SEARCH_CLICKED notification.
5-Command retrieve a WebserviceProxy and invokes its Search(text) method.
6-WebserviceProxy talks to remote webservice and uses asyncToken to get results.
My Questions is:
My Command has the reference to the custom search component when it start search but search webservice takes some time and get the result. How can i handle the results back to custom search component that initiated the search. Since i have multiple instances of search component. What is the best place to keep the reference of that component, should i add a variables in WebserviceProxy to keep that reference and hand the results over to it, or i have to create a Global Proxy to keep references of such components?
Thanks
I have been using PureMVC for some years and I like it!
I think you have not yet understood roles and collaboration of main components.
You should not have any dependencies between Commands and UI-elements. Your Mediator has to get the concrete value from your UI-component and send it through the Notification. In this case the Command and the Proxy will get only a text value and it is no matter, what is the source of it! Suppose you will change your UI after some time and you will have another components on the user side to determine the search value. In your case you would have to change the Proxy and the Command. It would be bad.
Proxy may not have any information about Commands and Mediators. It can only offer its functions to let another components interact with it AND it sends Notifications with new information after getting it without knowing who is interesting in it.
Read the description of the framework once more and write your questions.
I had some problems with understanding the stuff too, I see your problem.
Based on Anton's answer, i re-think and tried to separate dependencis. As a result, i tried to mediate each instance of Search Widget with "SearchMediator" separately by providing different ID to the constructor of Mediator. Now, when search widget intiates a new search, it's mediator invokes the Command, Command invokes a method of Proxy to do actual search and fetch results from DB and sends a Notification. SearchMediator takes care about that notification and hands over the results to appropriate UI.

Resources