-
Notifications
You must be signed in to change notification settings - Fork 2
/
PageParameterMapping.cs
103 lines (86 loc) · 3.48 KB
/
PageParameterMapping.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#region license
/*
Copyright 2005 - 2021 Advantage Solutions, s. r. o.
This file is part of ORIGAM (http://www.origam.org).
ORIGAM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ORIGAM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
using Origam.DA.Common;
using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Origam.DA.ObjectPersistence;
using Origam.Schema.EntityModel;
namespace Origam.Schema.GuiModel
{
[SchemaItemDescription("Parameter Mapping", "Parameter Mappings", "file-mapping.png")]
[HelpTopic("Parameter+Mapping")]
[XmlModelRoot(CategoryConst)]
[ClassMetaVersion("6.0.1")]
public class PageParameterMapping : AbstractSchemaItem
{
public const string CategoryConst = "PageParameterMapping";
public PageParameterMapping() : base() {Init();}
public PageParameterMapping(Guid schemaExtensionId) : base(schemaExtensionId) {Init();}
public PageParameterMapping(Key primaryKey) : base(primaryKey) {Init();}
private void Init()
{
}
#region Properties
[Category("Mapping")]
[Description("Name of url query string parameter, e.g. in case http://my-api/my-page?searchstring=value the mapped parametr should be 'searchstring'")]
[XmlAttribute ("mappedParameter")]
public string MappedParameter { get; set; } = "";
[Category("Mapping")]
[Description("Name of a datastructure entity in a mapped context "
+ "store's datastructure. If defined, the incoming json body is "
+ "wrapped by a new object with the given name. So that way, the"
+ " original input json object is expected as just datastructure "
+ "entity object itself or a list of datastructure entity objects"
+ " on json top level.")]
[DefaultValue("")]
[XmlAttribute("entityName")]
public string DatastructureEntityName { get; set; } = "";
public Guid DataConstantId;
[Category("Mapping")]
[TypeConverter(typeof(DataConstantConverter))]
[RefreshProperties(RefreshProperties.Repaint)]
[XmlReference("defaultValue", "DataConstantId")]
public DataConstant DefaultValue
{
get => (AbstractSchemaItem)this.PersistenceProvider.RetrieveInstance(typeof(AbstractSchemaItem), new ModelElementKey(this.DataConstantId)) as DataConstant;
set
{
this.DataConstantId = (value == null ? Guid.Empty : (Guid)value.PrimaryKey["Id"]);
}
}
[Category("Lists")]
[DefaultValue(false)]
[XmlAttribute ("isList")]
public bool IsList { get; set; } = false;
public Guid SeparatorDataConstantId;
[Category("Lists")]
[TypeConverter(typeof(DataConstantConverter))]
[RefreshProperties(RefreshProperties.Repaint)]
[XmlReference("listSeparator", "SeparatorDataConstantId")]
public DataConstant ListSeparator
{
get => (AbstractSchemaItem)this.PersistenceProvider.RetrieveInstance(typeof(AbstractSchemaItem), new ModelElementKey(this.SeparatorDataConstantId)) as DataConstant;
set
{
this.SeparatorDataConstantId = (value == null ? Guid.Empty : (Guid)value.PrimaryKey["Id"]);
}
}
public override string ItemType => CategoryConst;
#endregion
}
}