-
Notifications
You must be signed in to change notification settings - Fork 24
/
Recipe.cs
75 lines (61 loc) · 1.83 KB
/
Recipe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0
using System;
namespace Moryx.AbstractionLayer.Recipes
{
/// <summary>
/// Base class for all recipes
/// </summary>
public abstract class Recipe : IRecipe, ICloneable
{
/// <summary>
/// Default constructor to create a new recipe
/// </summary>
protected Recipe()
{
}
/// <summary>
/// Create recipe clone from source
/// </summary>
protected Recipe(Recipe source)
{
Name = source.Name;
Revision = source.Revision;
State = source.State;
Origin = source.Origin;
TemplateId = source.Id;
Classification = source.Classification | RecipeClassification.Clone;
}
/// <inheritdoc />
public long Id { get; set; }
/// <summary>
/// Optional reference
/// </summary>
public long TemplateId { get; set; }
/// <inheritdoc />
public string Name { get; set; }
/// <inheritdoc />
public int Revision { get; set; }
/// <inheritdoc />
public RecipeState State { get; set; }
/// <inheritdoc />
public RecipeClassification Classification { get; set; }
/// <inheritdoc />
public IRecipeProvider Origin { get; set; }
/// <inheritdoc />
public virtual IProcess CreateProcess()
{
return new Process { Recipe = this };
}
/// <inheritdoc />
public abstract IRecipe Clone();
/// <summary>
/// Implement ICloneable explicit, maybe we need it later
/// </summary>
/// <returns></returns>
object ICloneable.Clone()
{
return Clone();
}
}
}