diff options
author | James Forsyth <jf2512@att.com> | 2017-11-22 13:37:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-11-22 13:37:44 +0000 |
commit | 0f6f35ed623ec836312ff2372d96930ef0d7886a (patch) | |
tree | a6b8e37a305783f6c6277e37b0d2fd42c2cbaf99 | |
parent | 43cb52e7951837212e9673c598124330add0fc31 (diff) | |
parent | 9f3d13ee1d6ad9c16bd4a9cd3c697e973bcd828b (diff) |
Merge "add aai exception when missing FromAppId header"
-rw-r--r-- | aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java index 3895f626..f26ac197 100644 --- a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java +++ b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java @@ -249,17 +249,18 @@ public class RESTAPI { throw new AAIException("AAI_3000", "uri and payload keys don't match"); } } - - protected DBConnectionType determineConnectionType(String fromAppId, String realTime) { - DBConnectionType type = DBConnectionType.REALTIME; + + protected DBConnectionType determineConnectionType(String fromAppId, String realTime) throws AAIException { + if (fromAppId == null) { + throw new AAIException("AAI_4009", "X-FromAppId is not set"); + } + boolean isRealTimeClient = AAIConfig.get("aai.realtime.clients", "").contains(fromAppId); if (isRealTimeClient || realTime != null) { - type = DBConnectionType.REALTIME; + return DBConnectionType.REALTIME; } else { - type = DBConnectionType.CACHED; + return DBConnectionType.CACHED; } - - return type; } /** |