Skip to content

Commit 030f12d

Browse files
committed
Implemented the Initialization object for Functional Service Jobs.
1 parent 1be2d90 commit 030f12d

5 files changed

Lines changed: 51 additions & 6 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2017 Systemic Pty Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
namespace Sif.Framework.Model.Infrastructure
19+
{
20+
21+
/// <summary>
22+
/// Job initialisation object.
23+
/// </summary>
24+
public class Initialization
25+
{
26+
27+
/// <summary>
28+
/// Payload.
29+
/// </summary>
30+
public virtual object Payload { get; set; }
31+
32+
/// <summary>
33+
/// Phase name.
34+
/// </summary>
35+
public virtual string PhaseName { get; set; }
36+
37+
}
38+
39+
}

Code/Sif3Framework/Sif.Framework/Model/Infrastructure/Job.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Crown Copyright © Department for Education (UK) 2016
3+
* Copyright 2017 Systemic Pty Ltd
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
56
* you may not use this file except in compliance with the License.
@@ -14,12 +15,10 @@
1415
* limitations under the License.
1516
*/
1617

17-
using Sif.Framework.Model.DataModels;
1818
using Sif.Framework.Model.Persistence;
1919
using Sif.Framework.Utils;
2020
using System;
2121
using System.Collections.Generic;
22-
using System.Xml.Serialization;
2322

2423
namespace Sif.Framework.Model.Infrastructure
2524
{
@@ -76,6 +75,11 @@ public class Job : IPersistable<Guid>
7675
/// </summary>
7776
public virtual IDictionary<string, Phase> Phases { get; set; }
7877

78+
/// <summary>
79+
/// Initialisation object associated with the job.
80+
/// </summary>
81+
public virtual Initialization Initialization { get; set; }
82+
7983
/// <summary>
8084
/// Basic constructor that sets logical default values
8185
/// </summary>

Code/Sif3Framework/Sif.Framework/Service/Mapper/MapperFactory.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 Systemic Pty Ltd
2+
* Copyright 2017 Systemic Pty Ltd
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
using Sif.Framework.Model.Requests;
2020
using Sif.Framework.Model.Responses;
2121
using Sif.Specification.Infrastructure;
22-
using System;
2322
using System.Collections.Generic;
2423
using System.Xml;
2524
using Environment = Sif.Framework.Model.Infrastructure.Environment;
@@ -221,13 +220,15 @@ static MapperFactory()
221220
AutoMapper.Mapper.CreateMap<phaseType[], IDictionary<string, Phase>>()
222221
.ConvertUsing<PhasesConverter>();
223222

223+
AutoMapper.Mapper.CreateMap<Initialization, initializationType>();
224+
AutoMapper.Mapper.CreateMap<initializationType, Initialization>();
225+
224226
AutoMapper.Mapper.CreateMap<Job, jobType>()
225227
.ForMember(dest => dest.phases, opt => opt.MapFrom(src => src.Phases.Values))
226228
.ForMember(dest => dest.createdSpecified, opt => opt.MapFrom(src => src.Created != null))
227229
.ForMember(dest => dest.lastModifiedSpecified, opt => opt.MapFrom(src => src.LastModified != null))
228230
.ForMember(dest => dest.stateSpecified, opt => opt.MapFrom(src => src.State != null))
229-
.ForMember(dest => dest.timeout, opt => opt.MapFrom(src => XmlConvert.ToString(src.Timeout)))
230-
.ForMember(dest => dest.initialization, opt => opt.Ignore());
231+
.ForMember(dest => dest.timeout, opt => opt.MapFrom(src => XmlConvert.ToString(src.Timeout)));
231232
AutoMapper.Mapper.CreateMap<jobType, Job>()
232233
.ForMember(dest => dest.Timeout, opt => opt.MapFrom(src => XmlConvert.ToTimeSpan(src.timeout)));
233234

Code/Sif3Framework/Sif.Framework/Sif.Framework.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Compile Include="Model\Authentication\AuthenticationMethod.cs" />
9191
<Compile Include="Model\Authentication\AuthorisationToken.cs" />
9292
<Compile Include="Model\Exceptions\InvalidAuthorisationTokenException.cs" />
93+
<Compile Include="Model\Infrastructure\Initialization.cs" />
9394
<Compile Include="Model\Infrastructure\SifObjectBinding.cs" />
9495
<Compile Include="Providers\FunctionalServiceProvider.cs" />
9596
<Compile Include="Model\DataModels\ServiceClassInfo.cs" />
512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)