Object entity; if (path.contains("/notifyContext")) { entity = new NotifyContextResponse(statusCode); } else if (path.contains("/updateContextSubscription")) { UpdateContextSubscriptionResponse response = new UpdateContextSubscriptionResponse(); SubscribeError error = new SubscribeError(); error.setErrorCode(statusCode); response.setSubscribeError(error); entity = response; } else if (path.contains("/updateContext")) { UpdateContextResponse updateContextResponse = new UpdateContextResponse(); updateContextResponse.setErrorCode(statusCode); entity = updateContextResponse; } else if (path.contains("/registerContext")) { RegisterContextResponse registerContextResponse = new RegisterContextResponse(); registerContextResponse.setErrorCode(statusCode); entity = registerContextResponse; } else if (path.contains("/subscribeContext")) { SubscribeContextResponse subscribeContextResponse = new SubscribeContextResponse(); SubscribeError error = new SubscribeError(); error.setErrorCode(statusCode); subscribeContextResponse.setSubscribeError(error); entity = subscribeContextResponse; } else if (path.contains("/unsubscribeContext")) { UnsubscribeContextResponse unsubscribeContextResponse = new UnsubscribeContextResponse(); unsubscribeContextResponse.setStatusCode(statusCode); entity = unsubscribeContextResponse; } else if (path.contains("/queryContext")) { QueryContextResponse queryContextResponse = new QueryContextResponse();
@JsonIgnore public StatusCode(CodeEnum code, String... paramDetail) { this.code = code.getLabel(); this.reasonPhrase = code.getShortPhrase(); this.detail = String.format(code.getLongPhrase(), paramDetail); }
public void checkUpdateContextSubscription(UpdateContextSubscription updateContextSubscription) throws MissingRequestParameterException { if (nullOrEmpty(updateContextSubscription.getSubscriptionId())){ throw new MissingRequestParameterException("subscriptionId", "String"); } if (updateContextSubscription.getRestriction() != null) { if (nullOrEmpty(updateContextSubscription.getRestriction().getAttributeExpression()) && nullOrEmpty(updateContextSubscription.getRestriction().getScopes())) { throw new MissingRequestParameterException("attributeExpression or scopes", "string"); } } }
public void checkSubscribeContext(SubscribeContext subscribeContext) throws MissingRequestParameterException { if (nullOrEmpty(subscribeContext.getEntityIdList())) { throw new MissingRequestParameterException("entities", "List<EntityId>"); } for(EntityId entityId: subscribeContext.getEntityIdList()) { checkEntityId(entityId); } if (nullOrEmpty(subscribeContext.getReference())){ throw new MissingRequestParameterException("reference", "URI"); } if (subscribeContext.getRestriction() != null) { if (nullOrEmpty(subscribeContext.getRestriction().getAttributeExpression()) && nullOrEmpty(subscribeContext.getRestriction().getScopes())) { throw new MissingRequestParameterException("attributeExpression or scopes", "string"); } } }
public void checkQueryContext(QueryContext queryContext) throws MissingRequestParameterException { if (nullOrEmpty(queryContext.getEntityIdList())) { throw new MissingRequestParameterException("entities", "List<EntityId>"); } for(EntityId entityId : queryContext.getEntityIdList()) { checkEntityId(entityId); } if (queryContext.getRestriction() != null) { if (nullOrEmpty(queryContext.getRestriction().getAttributeExpression())) { throw new MissingRequestParameterException("attributeExpression", "string"); } } } public void checkAppendContextElement(AppendContextElement appendContextElement) throws MissingRequestParameterException {
private void checkContextElementResponse(ContextElementResponse contextElementResponse) throws MissingRequestParameterException { if (contextElementResponse.getStatusCode() == null) { throw new MissingRequestParameterException("statusCode", "StatusCode"); } if (contextElementResponse.getContextElement() == null) { throw new MissingRequestParameterException("contextElement", "ContextElement"); } checkContextElement(contextElementResponse.getContextElement()); }
public void checkUpdateContext(UpdateContext updateContext) throws MissingRequestParameterException { if (updateContext.getUpdateAction() == null) { throw new MissingRequestParameterException("updateAction", "string"); } if (nullOrEmpty(updateContext.getContextElements())) { throw new MissingRequestParameterException("contextElements", "List<ContextElement>"); } for (ContextElement contextElement : updateContext.getContextElements()) { checkContextElement(contextElement); } }
/** * Send an unsubscription request * @param url the URL of the subscription provider * @param httpHeaders the HTTP header to use, or null for default * @param subscriptionId the subscription ID to unsubscribe * @return a future for a UnsubscribeContextResponse */ public ListenableFuture<UnsubscribeContextResponse> unsubscribeContext(String url, HttpHeaders httpHeaders, String subscriptionId) { return request(url + "/ngsi10/unsubscribeContext", httpHeaders, new UnsubscribeContext(subscriptionId), UnsubscribeContextResponse.class); }
public void checkAppendContextElement(AppendContextElement appendContextElement) throws MissingRequestParameterException { if (nullOrEmpty(appendContextElement.getAttributeList())) { throw new MissingRequestParameterException("contextAttributes", "List<ContextAttribute>"); } }
public void checkUpdateContextElement(UpdateContextElement updateContextElement) throws MissingRequestParameterException { if (nullOrEmpty(updateContextElement.getContextAttributes())) { throw new MissingRequestParameterException("contextAttributes", "List<ContextAttribute>"); } }
public void checkRegisterContext(RegisterContext registerContext) throws MissingRequestParameterException { if (nullOrEmpty(registerContext.getContextRegistrationList())) { throw new MissingRequestParameterException("contextRegistrations", "List<ContextRegistration>"); } for (ContextRegistration contextRegistration : registerContext.getContextRegistrationList()) { checkContextRegistration(contextRegistration); } }
public void checkUnsubscribeContext(UnsubscribeContext unsubscribeContext) throws MissingRequestParameterException { if (nullOrEmpty(unsubscribeContext.getSubscriptionId())){ throw new MissingRequestParameterException("subscriptionId", "String"); } }
public void checkSubscribeContext(SubscribeContext subscribeContext) throws MissingRequestParameterException { if (nullOrEmpty(subscribeContext.getEntityIdList())) { throw new MissingRequestParameterException("entities", "List<EntityId>"); } for(EntityId entityId: subscribeContext.getEntityIdList()) { checkEntityId(entityId); } if (nullOrEmpty(subscribeContext.getReference())){ throw new MissingRequestParameterException("reference", "URI"); } if (subscribeContext.getRestriction() != null) { if (nullOrEmpty(subscribeContext.getRestriction().getAttributeExpression()) && nullOrEmpty(subscribeContext.getRestriction().getScopes())) { throw new MissingRequestParameterException("attributeExpression or scopes", "string"); } } }
public void checkUpdateContextSubscription(UpdateContextSubscription updateContextSubscription) throws MissingRequestParameterException { if (nullOrEmpty(updateContextSubscription.getSubscriptionId())){ throw new MissingRequestParameterException("subscriptionId", "String"); } if (updateContextSubscription.getRestriction() != null) { if (nullOrEmpty(updateContextSubscription.getRestriction().getAttributeExpression()) && nullOrEmpty(updateContextSubscription.getRestriction().getScopes())) { throw new MissingRequestParameterException("attributeExpression or scopes", "string"); } } }
public void checkQueryContext(QueryContext queryContext) throws MissingRequestParameterException { if (nullOrEmpty(queryContext.getEntityIdList())) { throw new MissingRequestParameterException("entities", "List<EntityId>"); } for(EntityId entityId : queryContext.getEntityIdList()) { checkEntityId(entityId); } if (queryContext.getRestriction() != null) { if (nullOrEmpty(queryContext.getRestriction().getAttributeExpression())) { throw new MissingRequestParameterException("attributeExpression", "string"); } } } public void checkAppendContextElement(AppendContextElement appendContextElement) throws MissingRequestParameterException {
private void checkContextElementResponse(ContextElementResponse contextElementResponse) throws MissingRequestParameterException { if (contextElementResponse.getStatusCode() == null) { throw new MissingRequestParameterException("statusCode", "StatusCode"); } if (contextElementResponse.getContextElement() == null) { throw new MissingRequestParameterException("contextElement", "ContextElement"); } checkContextElement(contextElementResponse.getContextElement()); }
public void checkUpdateContext(UpdateContext updateContext) throws MissingRequestParameterException { if (updateContext.getUpdateAction() == null) { throw new MissingRequestParameterException("updateAction", "string"); } if (nullOrEmpty(updateContext.getContextElements())) { throw new MissingRequestParameterException("contextElements", "List<ContextElement>"); } for (ContextElement contextElement : updateContext.getContextElements()) { checkContextElement(contextElement); } }
/** * Send an unsubscription request * @param url the URL of the subscription provider * @param httpHeaders the HTTP header to use, or null for default * @param subscriptionId the subscription ID to unsubscribe * @return a future for a UnsubscribeContextResponse */ public ListenableFuture<UnsubscribeContextResponse> unsubscribeContext(String url, HttpHeaders httpHeaders, String subscriptionId) { return request(url + "/ngsi10/unsubscribeContext", httpHeaders, new UnsubscribeContext(subscriptionId), UnsubscribeContextResponse.class); }
public void checkAppendContextElement(AppendContextElement appendContextElement) throws MissingRequestParameterException { if (nullOrEmpty(appendContextElement.getAttributeList())) { throw new MissingRequestParameterException("contextAttributes", "List<ContextAttribute>"); } }
public void checkUpdateContextElement(UpdateContextElement updateContextElement) throws MissingRequestParameterException { if (nullOrEmpty(updateContextElement.getContextAttributes())) { throw new MissingRequestParameterException("contextAttributes", "List<ContextAttribute>"); } }