diff options
3 files changed, 108 insertions, 31 deletions
diff --git a/rulemgt/pom.xml b/rulemgt/pom.xml index 705f927..1e63e09 100644 --- a/rulemgt/pom.xml +++ b/rulemgt/pom.xml @@ -32,11 +32,25 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.6.2</version> + <version>2.8.9</version> </dependency> <dependency> <groupId>org.onap.msb.java-sdk</groupId> <artifactId>msb-java-sdk</artifactId> + <exclusions> + <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.reflections</groupId> @@ -77,12 +91,29 @@ <artifactId>logback</artifactId> </exclusion> <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </exclusion> + <exclusion> <artifactId>log4j-over-slf4j</artifactId> <groupId>org.slf4j</groupId> </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> </exclusions> </dependency> - <dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> @@ -113,6 +144,16 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + </exclusions> <scope>provided</scope> </dependency> @@ -172,8 +213,28 @@ <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> + <exclusions> + <exclusion> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </exclusion> + <exclusion> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.2</version> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>1.1.23</version> + </dependency> + <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-server</artifactId> <version>${jersey.version}</version> @@ -197,6 +258,12 @@ <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>19.0</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> <build> @@ -277,7 +344,17 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> - <version>1.5.0</version> + <version>1.5.3</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> <build> diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java index 183e52f..18a326e 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java @@ -15,9 +15,10 @@ */
package org.onap.holmes.rulemgt.bolt.enginebolt;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
-import net.sf.json.JSONObject;
import org.apache.http.HttpResponse;
import org.jvnet.hk2.annotations.Service;
import org.onap.holmes.common.utils.HttpsUtils;
@@ -43,7 +44,8 @@ public class EngineWrapper { if (response.getStatusLine().getStatusCode() == RuleMgtConstant.RESPONSE_STATUS_OK) {
log.info("Succeeded in calling the rule deployment RESTful API from the engine management service.");
try {
- JSONObject json = JSONObject.fromObject(HttpsUtils.extractResponseEntity(response));
+ // JSONObject json = JSONObject.fromObject(HttpsUtils.extractResponseEntity(response));
+ JSONObject json= JSON.parseObject(HttpsUtils.extractResponseEntity(response));
return json.get(RuleMgtConstant.PACKAGE).toString();
} catch (Exception e) {
throw new CorrelationException("Failed to parse the value returned by the engine management service.", e);
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java index d3c01ae..8e5b7a0 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java @@ -1,17 +1,15 @@ /**
* Copyright 2017 ZTE Corporation.
*
- * 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.holmes.rulemgt.resources;
@@ -20,9 +18,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.SwaggerDefinition;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
@@ -37,7 +32,6 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import lombok.extern.slf4j.Slf4j;
-import net.sf.json.JSONObject;
import org.jvnet.hk2.annotations.Service;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.ExceptionUtil;
@@ -50,7 +44,6 @@ import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest;
import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;
import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse;
-import org.onap.holmes.rulemgt.bean.response.RuleResult4API;
import org.onap.holmes.rulemgt.constant.RuleMgtConstant;
import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper;
@@ -71,9 +64,10 @@ public class RuleMgtResources { response = RuleAddAndUpdateResponse.class)
@Timed
public RuleAddAndUpdateResponse addCorrelationRule(@Context HttpServletRequest request,
- @ApiParam(value = "The request entity of the HTTP call, which comprises \"ruleName\"(required), "
- + "\"loopControlName\"(required), \"content\"(required), \"enabled\"(required) "
- + "and \"description\"(optional)", required = true)
+ @ApiParam(value =
+ "The request entity of the HTTP call, which comprises \"ruleName\"(required), "
+ + "\"loopControlName\"(required), \"content\"(required), \"enabled\"(required) "
+ + "and \"description\"(optional)", required = true)
RuleCreateRequest ruleCreateRequest) {
Locale locale = LanguageUtil.getLocale(request);
RuleAddAndUpdateResponse ruleChangeResponse;
@@ -93,13 +87,15 @@ public class RuleMgtResources { @ApiOperation(value = "Update an existing rule; deploy it to the Drools engine if it is enabled.", response = RuleAddAndUpdateResponse.class)
@Timed
public RuleAddAndUpdateResponse updateCorrelationRule(@Context HttpServletRequest request,
- @ApiParam(value = "The request entity of the HTTP call, which comprises \"ruleId\"(required), "
- + "\"content\"(required), \"enabled\"(required) and \"description\"(optional)", required = true)
+ @ApiParam(value =
+ "The request entity of the HTTP call, which comprises \"ruleId\"(required), "
+ + "\"content\"(required), \"enabled\"(required) and \"description\"(optional)", required = true)
RuleUpdateRequest ruleUpdateRequest) {
Locale locale = LanguageUtil.getLocale(request);
RuleAddAndUpdateResponse ruleChangeResponse;
try {
- ruleChangeResponse = ruleMgtWrapper.updateCorrelationRule(UserUtil.getUserName(request), ruleUpdateRequest);
+ ruleChangeResponse = ruleMgtWrapper
+ .updateCorrelationRule(UserUtil.getUserName(request), ruleUpdateRequest);
log.info("update rule:" + ruleUpdateRequest.getRuleId() + " successful");
return ruleChangeResponse;
} catch (CorrelationException e) {
@@ -131,9 +127,10 @@ public class RuleMgtResources { @ApiOperation(value = "Query rules using certain criteria.", response = RuleQueryListResponse.class)
@Timed
public RuleQueryListResponse getCorrelationRules(@Context HttpServletRequest request,
- @ApiParam(value = "A JSON string used as a query parameter, which comprises \"ruleid\"(optional), "
- + "\"rulename\"(optional), \"creator\"(optional), "
- + "\"modifier\"(optional) and \"enabled\"(optional). E.g. {\"ruleid\":\"rule_1484727187317\"}",
+ @ApiParam(value =
+ "A JSON string used as a query parameter, which comprises \"ruleid\"(optional), "
+ + "\"rulename\"(optional), \"creator\"(optional), "
+ + "\"modifier\"(optional) and \"enabled\"(optional). E.g. {\"ruleid\":\"rule_1484727187317\"}",
required = false) @QueryParam("queryrequest") String ruleQueryRequest) {
Locale locale = LanguageUtil.getLocale(request);
RuleQueryListResponse ruleQueryListResponse;
@@ -142,7 +139,7 @@ public class RuleMgtResources { try {
ruleQueryListResponse = ruleMgtWrapper
.getCorrelationRuleByCondition(ruleQueryCondition);
- log.info("query rule successful by condition:" + JSONObject.fromObject(ruleQueryCondition));
+ log.info("query rule successful by condition:" + ruleQueryCondition);
return ruleQueryListResponse;
} catch (CorrelationException e) {
log.error("query rule failed,cause query condition conversion failure", e);
@@ -153,9 +150,10 @@ public class RuleMgtResources { private RuleQueryCondition getRuleQueryCondition(String queryRequest,
HttpServletRequest request) {
Locale locale = LanguageUtil.getLocale(request);
- RuleQueryCondition ruleQueryCondition = GsonUtil.jsonToBean(queryRequest, RuleQueryCondition.class);
+ RuleQueryCondition ruleQueryCondition = GsonUtil
+ .jsonToBean(queryRequest, RuleQueryCondition.class);
if (queryRequest == null) {
- if(ruleQueryCondition==null){
+ if (ruleQueryCondition == null) {
ruleQueryCondition = new RuleQueryCondition();
}
ruleQueryCondition.setEnabled(RuleMgtConstant.STATUS_RULE_ALL);
|