Skip to content

solrpl/swork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a *very* simple framework for workflow within the meaning of converting input object into
output object in several steps.

Goals:
 * simple
 * programmer-friendliness - most bugs detected on compile time
 
 Features:
 * subworkflows - workflow can be used as component in other workflow

Usage:

There are two base definitions:
 * enricher - object capable to enrich input object. For example context may be enriched by 
 information about user and his permissions.
 
 * converter - object capable to convert input object to output object. For example request object
 can be converted to response object.

 1. Automatic transition

		Collection<Stage<YourRequest, YourResponse>> enrichers = ...
		YourRequest request = ...
		
		Workflow<YourRequest, YourResponse, YourStateModel> workflow = new Workflow<YourRequest, YourResponse, YourStateModel>();

		workflow.addAllEnrichers(enrichers);
		workflow.addOutputConverter(new ConvertRequestResponseOutputConverter<YourRequest, YourResponse>());
		
		YourResponse response = workflow.enrichAndConvert(request);


 2. SemiAutomatic
 
 		Collection<Stage<YourRequest, YourResponse>> enrichers = ...
		YourRequest request = ...
		
		Workflow<YourRequest, YourResponse, YourStateModel> workflow = new Workflow<YourRequest, YourResponse, YourStateModel>();

		workflow.addAllEnrichers(enrichers);
		workflow.addOutputConverter(new ConvertRequestResponseOutputConverter<YourRequest, YourResponse>());
		
		Collection<YourStateModel> state = workflow.enrich(request);
		// check state and contiuue processing
		...
		Collection<YourStateModel> state = workflow.enrich(request, YourStateModel.STATE_X);
		
		// check state - should be final state
		...
        YourResponse response = workflow.convert(request);
		
Todo:
 * branches
 * state achieved when all contributors were executed

About

Simple Workflow: enrich & convert your model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published