Skip to content

Commit 89e570a

Browse files
committed
EasyWorkflow - alpha
1 parent e90b2d2 commit 89e570a

6 files changed

Lines changed: 231 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Collections.Generic;
2+
using OptimaJet.Workflow.Core.Model;
3+
using System.Xml.Linq;
4+
5+
namespace OptimaJet.EasyWorkflow.Core
6+
{
7+
public static class Converter
8+
{
9+
public static ProcessDefinition ToProcessDefinition(string schemeCode, List<WorkflowBlock> blocks)
10+
{
11+
var pd = new ProcessDefinition { Name = schemeCode };
12+
13+
foreach (var block in blocks)
14+
{
15+
block.Register(pd,blocks);
16+
}
17+
18+
foreach (var block in blocks)
19+
{
20+
block.RegisterFinal(pd, blocks);
21+
}
22+
23+
return pd;
24+
}
25+
26+
public static string ToString(string schemeCode, List<WorkflowBlock> blocks)
27+
{
28+
var pd = ToProcessDefinition(schemeCode, blocks);
29+
return pd.Serialize();
30+
}
31+
32+
public static XElement ToXElement(string schemeCode, List<WorkflowBlock> blocks)
33+
{
34+
return XElement.Parse(ToString(schemeCode, blocks));
35+
}
36+
}
37+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{CBB89BF3-7FE9-4B8B-88D8-987128AFAAA0}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>OptimaJet.EasyWorkflow.Core</RootNamespace>
11+
<AssemblyName>OptimaJet.EasyWorkflow.Core</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="OptimaJet.Workflow.Core, Version=1.4.1.2, Culture=neutral, PublicKeyToken=3d29392dccd464d7, processorArchitecture=MSIL">
34+
<SpecificVersion>False</SpecificVersion>
35+
<HintPath>..\packages\WorkflowEngine.NET-Core.1.4.1.2\lib\net40\OptimaJet.Workflow.Core.dll</HintPath>
36+
</Reference>
37+
<Reference Include="ServiceStack.Text, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43, processorArchitecture=MSIL">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>..\packages\ServiceStack.Text.Signed.4.0.36\lib\net40\ServiceStack.Text.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<Reference Include="System.Data" />
47+
<Reference Include="System.Xml" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="Properties\AssemblyInfo.cs" />
51+
<Compile Include="Converter.cs" />
52+
<Compile Include="WorkflowBlock.cs" />
53+
<Compile Include="WorkflowBlockParameter.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="packages.config" />
57+
</ItemGroup>
58+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
60+
Other similar extension points exist, see Microsoft.Common.targets.
61+
<Target Name="BeforeBuild">
62+
</Target>
63+
<Target Name="AfterBuild">
64+
</Target>
65+
-->
66+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("OptimaJet.EasyWorkflow.Core")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("OptimaJet.EasyWorkflow.Core")]
13+
[assembly: AssemblyCopyright("Copyright © 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("7a7381ab-ca17-40b2-96c3-d1caf8a6c979")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.4.0.0")]
36+
[assembly: AssemblyFileVersion("1.4.0.0")]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using OptimaJet.Workflow.Core;
7+
using OptimaJet.Workflow.Core.Model;
8+
9+
namespace OptimaJet.EasyWorkflow.Core
10+
{
11+
public abstract class WorkflowBlock
12+
{
13+
public string Name { get; set; }
14+
public string Type { get; set; }
15+
public Dictionary<string, object> Parameters { get; private set; }
16+
17+
public WorkflowBlock(string name, string type, Dictionary<string, object> parameters)
18+
{
19+
Name = name;
20+
Type = type;
21+
Parameters = parameters;
22+
}
23+
24+
public object this[string parameterName]
25+
{
26+
get
27+
{
28+
return Parameters.ContainsKey(parameterName) ? Parameters[parameterName] : null;
29+
}
30+
set
31+
{
32+
if (Parameters.ContainsKey(parameterName))
33+
Parameters[parameterName] = value;
34+
else
35+
Parameters.Add(parameterName, value);
36+
}
37+
}
38+
39+
public T TryCast<T>(string parameterName, T defaultValue)
40+
{
41+
if (this[parameterName] != null && this[parameterName] is T)
42+
return (T)this[parameterName];
43+
return defaultValue;
44+
}
45+
46+
public virtual void Register(ProcessDefinition pd, List<WorkflowBlock> blocks)
47+
{
48+
49+
}
50+
51+
public virtual void RegisterFinal(ProcessDefinition pd, List<WorkflowBlock> blocks)
52+
{
53+
54+
}
55+
56+
public virtual bool Validate(Dictionary<string, object> parameters, out string message)
57+
{
58+
message = string.Empty;
59+
return true;
60+
}
61+
}
62+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace OptimaJet.EasyWorkflow.Core
9+
{
10+
public class WorkflowBlockParameter
11+
{
12+
public WorkflowBlockParameter(string name, string visibleName, bool required = false)
13+
{
14+
Name = name;
15+
VisibleName = visibleName;
16+
Required = required;
17+
}
18+
19+
public string Name { get; set; }
20+
21+
public string VisibleName { get; set; }
22+
23+
public bool Required { get; set; }
24+
}
25+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="ServiceStack.Text.Signed" version="4.0.36" targetFramework="net45" />
4+
<package id="WorkflowEngine.NET-Core" version="1.4.1.2" targetFramework="net45" />
5+
</packages>

0 commit comments

Comments
 (0)