Skip to content

Commit 50f2b07

Browse files
committed
Fixed issue whereby matrix parameters of the Provider implementation were incorrectly named zone and context instead of zoneId and contextId.
1 parent 1469e47 commit 50f2b07

9 files changed

Lines changed: 114 additions & 115 deletions

File tree

Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,18 @@ public Consumer(string applicationKey, string instanceId = null, string userToke
116116
/// <param name="zone">Zone associated with a request.</param>
117117
/// <param name="context">Zone context.</param>
118118
/// <returns>String of Matrix Parameters.</returns>
119-
[Obsolete("This method is obsolete; HttpUtils.MatrixParameters instead")]
120119
private string MatrixParameters(string zone = null, string context = null)
121120
{
122121
string matrixParameters = "";
123122

124123
if (!string.IsNullOrWhiteSpace(zone))
125124
{
126-
matrixParameters += ";zone=" + zone.Trim();
125+
matrixParameters += ";zoneId=" + zone.Trim();
127126
}
128127

129128
if (!string.IsNullOrWhiteSpace(context))
130129
{
131-
matrixParameters += ";context=" + context.Trim();
130+
matrixParameters += ";contextId=" + context.Trim();
132131
}
133132

134133
return matrixParameters;
@@ -193,7 +192,7 @@ public string GetChangesSinceMarker(string zone = null, string context = null)
193192
throw new InvalidOperationException("Consumer has not registered.");
194193
}
195194

196-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
195+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
197196
WebHeaderCollection responseHeaders = HttpUtils.HeadRequest(url, RegistrationService.AuthorisationToken);
198197

199198
return responseHeaders[HttpUtils.RequestHeader.changesSinceMarker.ToDescription()];
@@ -210,7 +209,7 @@ public virtual TSingle Create(TSingle obj, string zone = null, string context =
210209
throw new InvalidOperationException("Consumer has not registered.");
211210
}
212211

213-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zone, context);
212+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + MatrixParameters(zone, context);
214213
string body = SerialiseSingle(obj);
215214
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
216215
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -230,7 +229,7 @@ public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null,
230229
throw new InvalidOperationException("Consumer has not registered.");
231230
}
232231

233-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
232+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
234233
string body = SerialiseMultiple(obj);
235234
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
236235
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -256,7 +255,7 @@ public virtual TSingle Query(TPrimaryKey refId, string zone = null, string conte
256255

257256
try
258257
{
259-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
258+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
260259
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
261260
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
262261
if (log.IsDebugEnabled) log.Debug(xml);
@@ -300,7 +299,7 @@ public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPage
300299
throw new InvalidOperationException("Consumer has not registered.");
301300
}
302301

303-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
302+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
304303
string xml;
305304

306305
if (navigationPage.HasValue && navigationPageSize.HasValue)
@@ -326,7 +325,7 @@ public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null
326325
throw new InvalidOperationException("Consumer has not registered.");
327326
}
328327

329-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
328+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
330329
string body = SerialiseSingle(obj);
331330
// TODO: Update PostRequest to accept paging parameters.
332331
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
@@ -359,7 +358,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditio
359358

360359
}
361360

362-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
361+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + MatrixParameters(zone, context);
363362
if (log.IsDebugEnabled) log.Debug("Service Path URL is " + url);
364363
string xml;
365364

@@ -387,7 +386,7 @@ public TMultiple QueryChangesSince(string changesSinceMarker, out string nextCha
387386
}
388387

389388
string changesSinceParameter = (changesSinceMarker == null ? string.Empty : "?changesSinceMarker=" + changesSinceMarker);
390-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context) + changesSinceParameter;
389+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context) + changesSinceParameter;
391390
WebHeaderCollection responseHeaders;
392391
string xml;
393392

@@ -416,7 +415,7 @@ public virtual void Update(TSingle obj, string zone = null, string context = nul
416415
throw new InvalidOperationException("Consumer has not registered.");
417416
}
418417

419-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + HttpUtils.MatrixParameters(zone, context);
418+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + MatrixParameters(zone, context);
420419
string body = SerialiseSingle(obj);
421420
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
422421
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -434,7 +433,7 @@ public virtual MultipleUpdateResponse Update(TMultiple obj, string zone = null,
434433
throw new InvalidOperationException("Consumer has not registered.");
435434
}
436435

437-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
436+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
438437
string body = SerialiseMultiple(obj);
439438
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
440439
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -456,7 +455,7 @@ public virtual void Delete(TPrimaryKey refId, string zone = null, string context
456455
throw new InvalidOperationException("Consumer has not registered.");
457456
}
458457

459-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
458+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
460459
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken);
461460
if (log.IsDebugEnabled) log.Debug("XML from DELETE request ...");
462461
if (log.IsDebugEnabled) log.Debug(xml);
@@ -482,7 +481,7 @@ public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, st
482481
}
483482

484483
deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
485-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
484+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
486485
string body = SerialiserFactory.GetXmlSerialiser<deleteRequestType>().Serialise(request);
487486
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
488487
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");

Code/Sif3Framework/Sif.Framework/Controllers/EnvironmentsController.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,27 @@ public EnvironmentsController()
135135
/// This operation is forbidden.
136136
/// </summary>
137137
/// <returns>HTTP status 403.</returns>
138-
public override ICollection<environmentType> Get([MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
138+
public override ICollection<environmentType> Get([MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
139139
{
140140
throw new HttpResponseException(HttpStatusCode.Forbidden);
141141
}
142142

143143
[Route("{id}")]
144144
[HttpGet]
145-
public override environmentType Get(Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
145+
public override environmentType Get(Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
146146
{
147-
return base.Get(id, zone, context);
147+
return base.Get(id, zoneId, contextId);
148148
}
149149

150150
/// <summary>
151151
/// POST api/environments
152152
/// This operation is forbidden.
153153
/// </summary>
154154
/// <param name="item">Object to create.</param>
155-
/// <param name="zone">The zone in which to perform the request.</param>
156-
/// <param name="context">The context in which to perform the request.</param>
155+
/// <param name="zoneId">The zone in which to perform the request.</param>
156+
/// <param name="contextId">The context in which to perform the request.</param>
157157
/// <returns>HTTP status 403.</returns>
158-
public override HttpResponseMessage Post(environmentType item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
158+
public override HttpResponseMessage Post(environmentType item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
159159
{
160160
throw new HttpResponseException(HttpStatusCode.Forbidden);
161161
}
@@ -224,16 +224,16 @@ public virtual HttpResponseMessage Create
224224
/// </summary>
225225
/// <param name="id">Identifier for the object to update.</param>
226226
/// <param name="item">Object to update.</param>
227-
public override void Put(Guid id, environmentType item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
227+
public override void Put(Guid id, environmentType item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
228228
{
229229
throw new HttpResponseException(HttpStatusCode.Forbidden);
230230
}
231231

232232
[Route("{id}")]
233233
[HttpDelete]
234-
public override void Delete(Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
234+
public override void Delete(Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
235235
{
236-
base.Delete(id, zone, context);
236+
base.Delete(id, zoneId, contextId);
237237
}
238238

239239
}

Code/Sif3Framework/Sif.Framework/Controllers/SifController.cs

Lines changed: 14 additions & 14 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.
@@ -54,9 +54,9 @@ public SifController(ISifService<UI, DB> service)
5454
/// DELETE api/{controller}/{id}
5555
/// </summary>
5656
/// <param name="id">Identifier of the object to delete.</param>
57-
/// <param name="zone">The zone in which to perform the request.</param>
58-
/// <param name="context">The context in which to perform the request.</param>
59-
public virtual void Delete(Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
57+
/// <param name="zoneId">The zone in which to perform the request.</param>
58+
/// <param name="contextId">The context in which to perform the request.</param>
59+
public virtual void Delete(Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
6060
{
6161

6262
if (!authService.VerifyAuthenticationHeader(Request.Headers.Authorization))
@@ -90,10 +90,10 @@ public virtual void Delete(Guid id, [MatrixParameter] string[] zone = null, [Mat
9090
/// GET api/{controller}/{id}
9191
/// </summary>
9292
/// <param name="id">Identifier of the object to retrieve.</param>
93-
/// <param name="zone">The zone in which to perform the request.</param>
94-
/// <param name="context">The context in which to perform the request.</param>
93+
/// <param name="zoneId">The zone in which to perform the request.</param>
94+
/// <param name="contextId">The context in which to perform the request.</param>
9595
/// <returns>Object with that identifier.</returns>
96-
public virtual UI Get(Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
96+
public virtual UI Get(Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
9797
{
9898

9999
if (!authService.VerifyAuthenticationHeader(Request.Headers.Authorization))
@@ -125,7 +125,7 @@ public virtual UI Get(Guid id, [MatrixParameter] string[] zone = null, [MatrixPa
125125
/// GET api/{controller}
126126
/// </summary>
127127
/// <returns>All objects.</returns>
128-
public virtual ICollection<UI> Get([MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
128+
public virtual ICollection<UI> Get([MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
129129
{
130130

131131
if (!authService.VerifyAuthenticationHeader(Request.Headers.Authorization))
@@ -152,10 +152,10 @@ public virtual ICollection<UI> Get([MatrixParameter] string[] zone = null, [Matr
152152
/// POST api/{controller}
153153
/// </summary>
154154
/// <param name="item">Object to create.</param>
155-
/// <param name="zone">The zone in which to perform the request.</param>
156-
/// <param name="context">The context in which to perform the request.</param>
155+
/// <param name="zoneId">The zone in which to perform the request.</param>
156+
/// <param name="contextId">The context in which to perform the request.</param>
157157
/// <returns>HTTP response message indicating success or failure.</returns>
158-
public virtual HttpResponseMessage Post(UI item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
158+
public virtual HttpResponseMessage Post(UI item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
159159
{
160160

161161
if (!authService.VerifyAuthenticationHeader(Request.Headers.Authorization))
@@ -186,10 +186,10 @@ public virtual HttpResponseMessage Post(UI item, [MatrixParameter] string[] zone
186186
/// PUT api/{controller}/{id}
187187
/// </summary>
188188
/// <param name="id">Identifier for the object to update.</param>
189-
/// <param name="zone">The zone in which to perform the request.</param>
190-
/// <param name="context">The context in which to perform the request.</param>
189+
/// <param name="zoneId">The zone in which to perform the request.</param>
190+
/// <param name="contextId">The context in which to perform the request.</param>
191191
/// <param name="item">Object to update.</param>
192-
public virtual void Put(Guid id, UI item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
192+
public virtual void Put(Guid id, UI item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
193193
{
194194

195195
if (!authService.VerifyAuthenticationHeader(Request.Headers.Authorization))

0 commit comments

Comments
 (0)