Skip to content

Commit

Permalink
Update references to zone and context to zoneId and contextId for all…
Browse files Browse the repository at this point in the history
… Consumer-side code.
  • Loading branch information
rafidzal committed Mar 29, 2017
1 parent 8b95d14 commit 4d97478
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 162 deletions.
48 changes: 24 additions & 24 deletions Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ public void Unregister(bool? deleteOnUnregister = null)
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.GetChangesSinceMarker(string, string)">GetChangesSinceMarker</see>
/// </summary>
public string GetChangesSinceMarker(string zone = null, string context = null)
public string GetChangesSinceMarker(string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
WebHeaderCollection responseHeaders = HttpUtils.HeadRequest(url, RegistrationService.AuthorisationToken);

return responseHeaders[HttpUtils.RequestHeader.changesSinceMarker.ToDescription()];
Expand All @@ -178,15 +178,15 @@ public string GetChangesSinceMarker(string zone = null, string context = null)
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TSingle, string, string)">Create</see>
/// </summary>
public virtual TSingle Create(TSingle obj, string zone = null, string context = null)
public virtual TSingle Create(TSingle obj, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseSingle(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
Expand All @@ -198,15 +198,15 @@ public virtual TSingle Create(TSingle obj, string zone = null, string context =
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TMultiple, string, string)">Create</see>
/// </summary>
public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null, string context = null)
public virtual MultipleCreateResponse Create(TMultiple obj, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseMultiple(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
Expand All @@ -220,7 +220,7 @@ public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null,
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Query(TPrimaryKey, string, string)">Query</see>
/// </summary>
public virtual TSingle Query(TPrimaryKey refId, string zone = null, string context = null)
public virtual TSingle Query(TPrimaryKey refId, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -232,7 +232,7 @@ public virtual TSingle Query(TPrimaryKey refId, string zone = null, string conte

try
{
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zoneId, contextId);
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
if (log.IsDebugEnabled) log.Debug(xml);
Expand Down Expand Up @@ -268,15 +268,15 @@ public virtual TSingle Query(TPrimaryKey refId, string zone = null, string conte
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Query(uint?, uint?, string, string)">Query</see>
/// </summary>
public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPageSize = null, string zone = null, string context = null)
public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPageSize = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string xml;

if (navigationPage.HasValue && navigationPageSize.HasValue)
Expand All @@ -294,15 +294,15 @@ public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPage
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.QueryByExample(TSingle, uint?, uint?, string, string)">QueryByExample</see>
/// </summary>
public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null, uint? navigationPageSize = null, string zone = null, string context = null)
public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null, uint? navigationPageSize = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseSingle(obj);
// TODO: Update PostRequest to accept paging parameters.
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
Expand All @@ -315,7 +315,7 @@ public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.QueryByServicePath(IEnumerable{EqualCondition}, uint?, uint?, string, string)">QueryByServicePath</see>
/// </summary>
public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditions, uint? navigationPage = null, uint? navigationPageSize = null, string zone = null, string context = null)
public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditions, uint? navigationPage = null, uint? navigationPageSize = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -335,7 +335,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditio

}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
if (log.IsDebugEnabled) log.Debug("Service Path URL is " + url);
string xml;

Expand All @@ -354,7 +354,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditio
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.QueryChangesSince(string, out string, uint?, uint?, string, string)">QueryChangesSince</see>
/// </summary>
public TMultiple QueryChangesSince(string changesSinceMarker, out string nextChangesSinceMarker, uint? navigationPage = null, uint? navigationPageSize = null, string zone = null, string context = null)
public TMultiple QueryChangesSince(string changesSinceMarker, out string nextChangesSinceMarker, uint? navigationPage = null, uint? navigationPageSize = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -363,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" + HttpUtils.MatrixParameters(zone, context) + changesSinceParameter;
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId) + changesSinceParameter;
WebHeaderCollection responseHeaders;
string xml;

Expand All @@ -384,15 +384,15 @@ public TMultiple QueryChangesSince(string changesSinceMarker, out string nextCha
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Update(TSingle, string, string)">Update</see>
/// </summary>
public virtual void Update(TSingle obj, string zone = null, string context = null)
public virtual void Update(TSingle obj, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseSingle(obj);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
Expand All @@ -402,15 +402,15 @@ public virtual void Update(TSingle obj, string zone = null, string context = nul
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKeyPK}.Update(TMultiple, string, string)">Update</see>
/// </summary>
public virtual MultipleUpdateResponse Update(TMultiple obj, string zone = null, string context = null)
public virtual MultipleUpdateResponse Update(TMultiple obj, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseMultiple(obj);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
Expand All @@ -424,15 +424,15 @@ public virtual MultipleUpdateResponse Update(TMultiple obj, string zone = null,
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Delete(TPrimaryKey, string, string)">Delete</see>
/// </summary>
public virtual void Delete(TPrimaryKey refId, string zone = null, string context = null)
public virtual void Delete(TPrimaryKey refId, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
{
throw new InvalidOperationException("Consumer has not registered.");
}

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zoneId, contextId);
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken);
if (log.IsDebugEnabled) log.Debug("XML from DELETE request ...");
if (log.IsDebugEnabled) log.Debug(xml);
Expand All @@ -441,7 +441,7 @@ public virtual void Delete(TPrimaryKey refId, string zone = null, string context
/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Delete(IEnumerable{TPrimaryKey}, string, string)">Delete</see>
/// </summary>
public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, string zone = null, string context = null)
public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -458,7 +458,7 @@ public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, st
}

deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiserFactory.GetXmlSerialiser<deleteRequestType>().Serialise(request);
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");
Expand Down
Loading

0 comments on commit 4d97478

Please sign in to comment.