diff options
Diffstat (limited to 'apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java')
-rw-r--r-- | apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java index 29e8066..c365c8c 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java @@ -1,22 +1,18 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route; -import com.fasterxml.jackson.core.JsonProcessingException; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -25,17 +21,19 @@ import org.onap.msb.apiroute.wrapper.dao.RedisAccessWrapper; import org.onap.msb.apiroute.wrapper.dao.route.bean.RouteInfo; import org.onap.msb.apiroute.wrapper.util.Jackson; -public class RouteDAOImpl implements IRouteDAO{ +import com.fasterxml.jackson.core.JsonProcessingException; + +public class RouteDAOImpl implements IRouteDAO { public void saveRoute(String key, RouteInfo routeInfo) throws Exception { String routeInfoStr = null; // change orginal url from “/” to empty string accord to the rewrite rule while forwarding - if("/".equals(routeInfo.getSpec().getUrl())){ + if ("/".equals(routeInfo.getSpec().getUrl())) { routeInfo.getSpec().setUrl(""); } try { routeInfoStr = Jackson.MAPPER.writeValueAsString(routeInfo); } catch (JsonProcessingException e) { - throw new Exception("error occurred while parsing RouteInfo to json data",e); + throw new Exception("error occurred while parsing RouteInfo to json data", e); } RedisAccessWrapper.save(key, routeInfoStr); } @@ -48,7 +46,7 @@ public class RouteDAOImpl implements IRouteDAO{ try { routeInfo = Jackson.MAPPER.readValue(routeInfoStr, RouteInfo.class); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to RouteInfo",e); + throw new Exception("error occurred while parsing the redis json data to RouteInfo", e); } return routeInfo; } @@ -62,7 +60,7 @@ public class RouteDAOImpl implements IRouteDAO{ routeInfo = Jackson.MAPPER.readValue(routeInfoStr, RouteInfo.class); routeInfoList.add(routeInfo); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to RouteInfo",e); + throw new Exception("error occurred while parsing the redis json data to RouteInfo", e); } } return routeInfoList; @@ -72,7 +70,7 @@ public class RouteDAOImpl implements IRouteDAO{ return RedisAccessWrapper.delete(key); } - public long deleteMultiRoute(String keyPattern) throws Exception{ + public long deleteMultiRoute(String keyPattern) throws Exception { return RedisAccessWrapper.deleteMultiKeys(keyPattern); } } |