Esempio n. 1
0
/* ****************************************************************************
*
* postNotifyContext - 
*/
std::string postNotifyContext(ConnectionInfo* ciP, int components, std::vector<std::string>& compV, ParseData* parseDataP)
{
  NotifyContextResponse  ncr;

  ciP->httpStatusCode = mongoNotifyContext(&parseDataP->ncr.res, &ncr, ciP->tenant);

  std::string answer = ncr.render(NotifyContext, ciP->outFormat, "");

  return answer;
}
/* ****************************************************************************
*
* postNotifyContext -
*/
std::string postNotifyContext
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  NotifyContextResponse  ncr;
  std::string            answer;

  TIMED_MONGO(ciP->httpStatusCode = mongoNotifyContext(&parseDataP->ncr.res, &ncr, ciP->tenant, ciP->httpHeaders.xauthToken, ciP->servicePathV));
  TIMED_RENDER(answer = ncr.render(NotifyContext, ciP->outFormat, ""));

  return answer;
}
/* ****************************************************************************
*
* NotifyContextRequest::check
*/
std::string NotifyContextRequest::check(RequestType requestType, Format format, const std::string& indent, const std::string& predetectedError, int counter)
{
  std::string            res;
  NotifyContextResponse  response;
   
  if (predetectedError != "")
  {
    response.responseCode.fill(SccBadRequest, predetectedError);
  }
  else if (((res = subscriptionId.check(QueryContext, format, indent, predetectedError, 0))               != "OK") ||
           ((res = originator.check(QueryContext, format, indent, predetectedError, 0))                   != "OK") ||
           ((res = contextElementResponseVector.check(QueryContext, format, indent, predetectedError, 0)) != "OK"))
  {
    response.responseCode.fill(SccBadRequest, res);
  }
  else
    return "OK";

  return response.render(NotifyContext, format, indent);
}