Giter Site home page Giter Site logo

bubdm / flowengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vincentnacar02/flowengine

0.0 0.0 0.0 167 KB

A simple and extensible workflow automation engine

Home Page: https://github.com/vincentnacar02/FlowEngine

License: MIT License

C# 99.89% ASP 0.11%

flowengine's Introduction

FlowEngine

FlowEngine v1

This is a hobby project only!

Example workflow:

This example is getting a list of files in a directory and logging each filename.

<Workflow id="ABC3C391-B1FE-416E-A606-B2C42BD49EB9"
	name="demo workflow 2" flow-engine-version="1.0"
	author="Vincent Nacar" date-published="11/02/2019">

  <!-- Activity -->
  <Activities>
	
	<Activity id="ListFiles1" name="ListFiles" assembly="Activity.ListFiles.dll">
	  <Property name="DirectoryPath" value="C:\VINCE FILES\Source Codes\flow-project\FlowEngine\FlowEngine\bin\Debug\Workflows\Workflow2TestDir\Input" />
	</Activity>
	
	<Activity id="FileInfoCheck" name="FileInfo" assembly="Activity.FileInfo.dll">
	  <Property name="FilePath" value="" />
	</Activity>

  </Activities>

  <!-- Execution flow -->
  <Execution>
	<!-- variable declaration -->
	<Variable name="OutputPathWithFileName" type="String" value="" />
	
	<Activity id="ListFiles1" return="Files" return-type="List" />
	<ForEach activityId="ListFiles1" as="File" >
		<Do>
			<Assign type="Property" to="FileInfoCheck.FilePath" from="@File@" />
			<Activity id="FileInfoCheck" return="FileName" return-type="String" />
			
			<Assign type="Variable" to="OutputPathWithFileName" from="[FileInfoCheck]" />
			
			<Logger type="Info" value="[FileInfoCheck]" />
			<Logger type="Info" value="@OutputPathWithFileName@" />
		</Do>
	</ForEach>
  </Execution>
  
</Workflow>

Activity code sample

This is the code behind FileInfo activity.

public class FileInfo : Activity
    {
        public FileInfo(object Id, IProperties props)
            : base(Id, props)
        {

        }

        public override IResult run()
        {
            IDictionary<string, object> result = new Dictionary<string, object>();
            try
            {
                var filePathProp = this.getProperties().getProperty("FilePath");
                if (filePathProp != null)
                {
                    String filePath = (String)filePathProp.getValue();
                    Boolean isExist = File.Exists(filePath);
                    if (isExist)
                    {
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
                        result.Add("FileName", fileInfo.Name);
                        result.Add("Directory", fileInfo.DirectoryName);
                        result.Add("Extension", fileInfo.Extension);
                        result.Add("FilePath", fileInfo.FullName);
                    }
                    result.Add("IsExist", isExist);
                }
            }
            catch (Exception ex)
            {
                return new ActivityResult(null, ResultStatus.HAS_ERROR, ex);
            }
            return new ActivityResult(result, ResultStatus.SUCCESS);
        }
    }

Control Flow Elements

  • If/Else

  • ForEach

  • Repeat

  • While

  • Switch

  • Do

Input Elements

  • Assign

Output Elements

  • Logger

Container

  • Variable

Activities

  • File System Activities

    • CopyFile
    • DeleteFile
    • FileExist
    • FileInfo
    • ListFiles
    • MoveFile

flowengine's People

Contributors

vincentnacar02 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.