diff --git a/Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs b/Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs
index a245d247..aaf35317 100644
--- a/Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs
+++ b/Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs
@@ -110,29 +110,6 @@ public Consumer(string applicationKey, string instanceId = null, string userToke
registrationService = new RegistrationService(SettingsManager.ConsumerSettings, SessionsManager.ConsumerSessionService);
}
- ///
- /// Build up a string of Matrix Parameters based upon the passed parameters.
- ///
- /// Zone associated with a request.
- /// Zone context.
- /// String of Matrix Parameters.
- private string MatrixParameters(string zone = null, string context = null)
- {
- string matrixParameters = "";
-
- if (!string.IsNullOrWhiteSpace(zone))
- {
- matrixParameters += ";zoneId=" + zone.Trim();
- }
-
- if (!string.IsNullOrWhiteSpace(context))
- {
- matrixParameters += ";contextId=" + context.Trim();
- }
-
- return matrixParameters;
- }
-
///
/// SerialiseSingle
///
@@ -192,7 +169,7 @@ public string GetChangesSinceMarker(string zone = null, string context = null)
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
WebHeaderCollection responseHeaders = HttpUtils.HeadRequest(url, RegistrationService.AuthorisationToken);
return responseHeaders[HttpUtils.RequestHeader.changesSinceMarker.ToDescription()];
@@ -209,7 +186,7 @@ public virtual TSingle Create(TSingle obj, string zone = null, string context =
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zone, context);
string body = SerialiseSingle(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -229,7 +206,7 @@ public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null,
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string body = SerialiseMultiple(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -255,7 +232,7 @@ public virtual TSingle Query(TPrimaryKey refId, string zone = null, string conte
try
{
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
if (log.IsDebugEnabled) log.Debug(xml);
@@ -299,7 +276,7 @@ public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPage
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string xml;
if (navigationPage.HasValue && navigationPageSize.HasValue)
@@ -325,7 +302,7 @@ public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string body = SerialiseSingle(obj);
// TODO: Update PostRequest to accept paging parameters.
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
@@ -358,7 +335,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable conditio
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
if (log.IsDebugEnabled) log.Debug("Service Path URL is " + url);
string xml;
@@ -386,7 +363,7 @@ public TMultiple QueryChangesSince(string changesSinceMarker, out string nextCha
}
string changesSinceParameter = (changesSinceMarker == null ? string.Empty : "?changesSinceMarker=" + changesSinceMarker);
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context) + changesSinceParameter;
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context) + changesSinceParameter;
WebHeaderCollection responseHeaders;
string xml;
@@ -415,7 +392,7 @@ public virtual void Update(TSingle obj, string zone = null, string context = nul
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + HttpUtils.MatrixParameters(zone, context);
string body = SerialiseSingle(obj);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -433,7 +410,7 @@ public virtual MultipleUpdateResponse Update(TMultiple obj, string zone = null,
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string body = SerialiseMultiple(obj);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -455,7 +432,7 @@ public virtual void Delete(TPrimaryKey refId, string zone = null, string context
throw new InvalidOperationException("Consumer has not registered.");
}
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken);
if (log.IsDebugEnabled) log.Debug("XML from DELETE request ...");
if (log.IsDebugEnabled) log.Debug(xml);
@@ -481,7 +458,7 @@ public virtual MultipleDeleteResponse Delete(IEnumerable refIds, st
}
deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
- string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
+ string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string body = SerialiserFactory.GetXmlSerialiser().Serialise(request);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");
diff --git a/Code/Sif3Framework/Sif.Framework/Providers/FunctionalServiceProvider.cs b/Code/Sif3Framework/Sif.Framework/Providers/FunctionalServiceProvider.cs
index b2a38cd1..594a6114 100644
--- a/Code/Sif3Framework/Sif.Framework/Providers/FunctionalServiceProvider.cs
+++ b/Code/Sif3Framework/Sif.Framework/Providers/FunctionalServiceProvider.cs
@@ -75,9 +75,9 @@ public FunctionalServiceProvider()
///
[HttpPost]
[Route("{serviceName}/{jobName}")]
- public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] string jobName, [FromBody] jobType item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] string jobName, [FromBody] jobType item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.CREATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.CREATE, RightValue.APPROVED));
HttpResponseMessage result;
try
@@ -104,14 +104,14 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri]
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Request requires use of advisory id, but none has been supplied.");
}
- Guid id = service.Create(item, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ Guid id = service.Create(item, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
if (SettingsManager.ProviderSettings.JobBinding)
{
service.Bind(id, getOwnerId(sessionToken));
}
- jobType job = service.Retrieve(id, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ jobType job = service.Retrieve(id, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
string uri = Url.Link("ServicesRoute", new { controller = serviceName, id = id });
@@ -150,9 +150,9 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri]
///
[HttpPost]
[Route("{serviceName}")]
- public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromBody] jobCollectionType items, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromBody] jobCollectionType items, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.CREATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.CREATE, RightValue.APPROVED));
HttpResponseMessage result;
try
@@ -168,7 +168,7 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromBody]
{
throw new ArgumentException("Service " + serviceName + " does not handle jobs named " + job.name);
}
- Guid id = service.Create(job, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ Guid id = service.Create(job, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
if (SettingsManager.ProviderSettings.JobBinding)
{
@@ -222,9 +222,9 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromBody]
/// Forbidden (403)
[HttpGet]
[Route("")]
- public virtual HttpResponseMessage Get([MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Get([MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- CheckAuthorisation(zone, context);
+ CheckAuthorisation(zoneId, contextId);
return Request.CreateResponse(HttpStatusCode.Forbidden);
}
@@ -234,16 +234,16 @@ public virtual HttpResponseMessage Get([MatrixParameter] string[] zone = null, [
///
[HttpGet]
[Route("{serviceName}")]
- public virtual ICollection Get([FromUri] string serviceName, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual ICollection Get([FromUri] string serviceName, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.QUERY, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.QUERY, RightValue.APPROVED));
ICollection items = new List();
try
{
IFunctionalService service = getService(serviceName);
- ICollection jobs = service.Retrieve(zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ ICollection jobs = service.Retrieve(zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
foreach (jobType job in jobs)
{
if (!SettingsManager.ProviderSettings.JobBinding
@@ -271,9 +271,9 @@ public virtual ICollection Get([FromUri] string serviceName, [MatrixPar
///
[HttpGet]
[Route("{serviceName}/{id}")]
- public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.QUERY, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.QUERY, RightValue.APPROVED));
// Check that we support that provider
// if not then throw new HttpResponseException(HttpStatusCode.NotFound);
@@ -283,7 +283,7 @@ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] G
try
{
IFunctionalService service = getService(serviceName);
- item = service.Retrieve(id, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ item = service.Retrieve(id, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
if (SettingsManager.ProviderSettings.JobBinding
&& !service.IsBound(Guid.Parse(item.id), getOwnerId(sessionToken)))
@@ -312,9 +312,9 @@ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] G
/// Forbidden (403)
[HttpPut]
[Route("{serviceName}/{id}")]
- public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] Guid id, [FromBody] jobType item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] Guid id, [FromBody] jobType item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
return Request.CreateResponse(HttpStatusCode.Forbidden);
}
@@ -325,9 +325,9 @@ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] G
/// Forbidden (403)
[HttpPut]
[Route("{serviceName}")]
- public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromBody] jobCollectionType items, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromBody] jobCollectionType items, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
return Request.CreateResponse(HttpStatusCode.Forbidden);
}
@@ -337,9 +337,9 @@ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromBody]
///
[HttpDelete]
[Route("{serviceName}/{id}")]
- public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri] Guid id, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri] Guid id, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.DELETE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.DELETE, RightValue.APPROVED));
try
{
@@ -351,7 +351,7 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri
throw new InvalidSessionException("Request failed as one or more jobs referred to in this request do not belong to this consumer.");
}
- service.Delete(id, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ service.Delete(id, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
if (SettingsManager.ProviderSettings.JobBinding)
{
@@ -373,10 +373,10 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri
///
[HttpDelete]
[Route("{serviceName}")]
- public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromBody] deleteRequestType deleteRequest, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromBody] deleteRequestType deleteRequest, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.DELETE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.DELETE, RightValue.APPROVED));
IFunctionalService service = getService(serviceName);
ICollection statuses = new List();
@@ -391,7 +391,7 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromBod
throw new InvalidSessionException("Request failed as job does not belong to this consumer.");
}
- service.Delete(Guid.Parse(deleteId.id), zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ service.Delete(Guid.Parse(deleteId.id), zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
if (SettingsManager.ProviderSettings.JobBinding)
{
@@ -434,9 +434,9 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromBod
///
[HttpPost]
[Route("{serviceName}/{id}/{phaseName}")]
- public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
preventPagingHeaders();
@@ -450,7 +450,7 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri]
{
throw new InvalidSessionException("Request failed as the job referred to in this request does not belong to this consumer.");
}
- return OKResult(service.CreateToPhase(id, phaseName, body, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
+ return OKResult(service.CreateToPhase(id, phaseName, body, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
}
catch (ArgumentException e)
{
@@ -475,9 +475,9 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri]
///
[HttpGet]
[Route("{serviceName}/{id}/{phaseName}")]
- public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
preventPagingHeaders();
@@ -491,7 +491,7 @@ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] G
{
throw new InvalidSessionException("Request failed as the job referred to in this request does not belong to this consumer.");
}
- return OKResult(service.RetrieveToPhase(id, phaseName, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
+ return OKResult(service.RetrieveToPhase(id, phaseName, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
}
catch (ArgumentException e)
{
@@ -516,9 +516,9 @@ public virtual HttpResponseMessage Get([FromUri] string serviceName, [FromUri] G
///
[HttpPut]
[Route("{serviceName}/{id}/{phaseName}")]
- public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
string body = Request.Content.ReadAsStringAsync().Result;
@@ -530,7 +530,7 @@ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] G
{
throw new InvalidSessionException("Request failed as the job referred to in this request does not belong to this consumer.");
}
- return OKResult(service.UpdateToPhase(id, phaseName, body, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
+ return OKResult(service.UpdateToPhase(id, phaseName, body, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
}
catch (ArgumentException e)
{
@@ -555,9 +555,9 @@ public virtual HttpResponseMessage Put([FromUri] string serviceName, [FromUri] G
///
[HttpDelete]
[Route("{serviceName}/{id}/{phaseName}")]
- public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
preventPagingHeaders();
@@ -571,7 +571,7 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri
{
throw new InvalidSessionException("Request failed as the job referred to in this request does not belong to this consumer.");
}
- return OKResult(service.DeleteToPhase(id, phaseName, body, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
+ return OKResult(service.DeleteToPhase(id, phaseName, body, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]), contentType: HttpUtils.GetContentType(Request), accept: HttpUtils.GetAccept(Request)));
}
catch (ArgumentException e)
{
@@ -600,9 +600,9 @@ public virtual HttpResponseMessage Delete([FromUri] string serviceName, [FromUri
///
[HttpPost]
[Route("{serviceName}/{id}/{phaseName}/states/state")]
- public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [FromBody] stateType item, [MatrixParameter] string[] zone = null, [MatrixParameter] string[] context = null)
+ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri] Guid id, [FromUri] string phaseName, [FromBody] stateType item, [MatrixParameter] string[] zoneId = null, [MatrixParameter] string[] contextId = null)
{
- string sessionToken = CheckAuthorisation(serviceName, zone, context, new Right(RightType.UPDATE, RightValue.APPROVED));
+ string sessionToken = CheckAuthorisation(serviceName, zoneId, contextId, new Right(RightType.UPDATE, RightValue.APPROVED));
preventPagingHeaders();
@@ -615,7 +615,7 @@ public virtual HttpResponseMessage Post([FromUri] string serviceName, [FromUri]
{
throw new InvalidSessionException("Request failed as the job referred to in this request does not belong to this consumer.");
}
- stateType state = service.CreateToState(id, phaseName, item, zone: (zone == null ? null : zone[0]), context: (context == null ? null : context[0]));
+ stateType state = service.CreateToState(id, phaseName, item, zone: (zoneId == null ? null : zoneId[0]), context: (contextId == null ? null : contextId[0]));
string uri = Url.Link("ServiceStatesRoute", new { controller = serviceName, id = id, phaseName = phaseName, stateId = state.id });
result = Request.CreateResponse(HttpStatusCode.Created, state);
@@ -672,7 +672,7 @@ protected virtual IFunctionalService getService(string serviceName)
/// Internal method to check if the request is authorised in the given zone and context by checking the environment XML.
///
/// The SessionToken if the request is authorised, otherwise an excpetion will be thrown.
- protected virtual string CheckAuthorisation(string[] zone, string[] context)
+ protected virtual string CheckAuthorisation(string[] zoneId, string[] contextId)
{
string sessionToken = "";
if (!authService.VerifyAuthenticationHeader(Request.Headers, out sessionToken))
@@ -683,7 +683,7 @@ protected virtual string CheckAuthorisation(string[] zone, string[] context)
// Check ACLs and return StatusCode(HttpStatusCode.Forbidden) if appropriate.
- if ((zone != null && zone.Length != 1) || (context != null && context.Length != 1))
+ if ((zoneId != null && zoneId.Length != 1) || (contextId != null && contextId.Length != 1))
{
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Request failed as Zone and/or Context are invalid."));
}
@@ -695,13 +695,13 @@ protected virtual string CheckAuthorisation(string[] zone, string[] context)
/// Internal method to check if a given right is supported by the ACL.
///
/// The name of the service to check
- /// The zone to check authorization in
- /// The context to check authorization in
+ /// The zone to check authorization in
+ /// The context to check authorization in
/// The right to check
/// The session token if authorized, otherwise a HttpResponseException is thrown
- protected virtual string CheckAuthorisation(string serviceName, string[] zone, string[] context, Right right)
+ protected virtual string CheckAuthorisation(string serviceName, string[] zoneId, string[] contextId, Right right)
{
- string sessionToken = CheckAuthorisation(zone, context);
+ string sessionToken = CheckAuthorisation(zoneId, contextId);
Environment environment = authService.GetEnvironmentBySessionToken(sessionToken);
if (environment == null)
@@ -710,7 +710,7 @@ protected virtual string CheckAuthorisation(string serviceName, string[] zone, s
}
try
{
- RightsUtils.CheckRight(getRights(serviceName, EnvironmentUtils.GetTargetZone(environment, zone == null ? null : zone[0])), right);
+ RightsUtils.CheckRight(getRights(serviceName, EnvironmentUtils.GetTargetZone(environment, zoneId == null ? null : zoneId[0])), right);
log.Debug("Functional Service " + serviceName + " has expected ACL (" + right.Type + ":" + right.Value + ")");
return sessionToken;
}
diff --git a/Code/Sif3Framework/Sif.Framework/Utils/HttpUtils.cs b/Code/Sif3Framework/Sif.Framework/Utils/HttpUtils.cs
index 07fe81cf..8e87f553 100644
--- a/Code/Sif3Framework/Sif.Framework/Utils/HttpUtils.cs
+++ b/Code/Sif3Framework/Sif.Framework/Utils/HttpUtils.cs
@@ -638,12 +638,12 @@ public static string MatrixParameters(string zone = null, string context = null)
if (!string.IsNullOrWhiteSpace(zone))
{
- matrixParameters += ";zone=" + zone.Trim();
+ matrixParameters += ";zoneId=" + zone.Trim();
}
if (!string.IsNullOrWhiteSpace(context))
{
- matrixParameters += ";context=" + context.Trim();
+ matrixParameters += ";contextId=" + context.Trim();
}
return matrixParameters;
diff --git a/Data/Databases/SQLite/SifFrameworkDatabase.db b/Data/Databases/SQLite/SifFrameworkDatabase.db
index 169d1b1f..1e060323 100644
Binary files a/Data/Databases/SQLite/SifFrameworkDatabase.db and b/Data/Databases/SQLite/SifFrameworkDatabase.db differ
diff --git a/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll b/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll
index c7b2b084..3e352053 100644
Binary files a/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll and b/SharedLibs/Sif.Framework 3.2.0/Sif.Framework.dll differ