diff options
author | 2018-03-06 08:56:31 +0800 | |
---|---|---|
committer | 2018-03-06 09:47:56 +0800 | |
commit | 3a2c70f1ee024dbad4dc091d3105064641908e1d (patch) | |
tree | 7e720d1a0c8a0d60c1736a1d16006f1e1b62ba47 /rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java | |
parent | 61785d9b87afee1ee0bddd3507fcb7b7308be944 (diff) |
Change HTTP Requests into HTTPS Ones
Issue-ID: HOLMES-104
Change-Id: I73d23418fbfaa23121ec825b11bbb46e55b2058c
Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java')
-rw-r--r-- | rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java | 33 |
1 files changed, 16 insertions, 17 deletions
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 041377f..d3c01ae 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 @@ -5,7 +5,7 @@ * 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,
@@ -20,6 +20,9 @@ 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;
@@ -47,6 +50,7 @@ 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;
@@ -67,10 +71,9 @@ 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;
@@ -90,15 +93,13 @@ 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) {
@@ -130,19 +131,18 @@ 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;
+
RuleQueryCondition ruleQueryCondition = getRuleQueryCondition(ruleQueryRequest, request);
try {
ruleQueryListResponse = ruleMgtWrapper
.getCorrelationRuleByCondition(ruleQueryCondition);
- log.info("query rule successful by condition:" + JSONObject
- .fromObject(ruleQueryCondition));
+ log.info("query rule successful by condition:" + JSONObject.fromObject(ruleQueryCondition));
return ruleQueryListResponse;
} catch (CorrelationException e) {
log.error("query rule failed,cause query condition conversion failure", e);
@@ -153,7 +153,6 @@ public class RuleMgtResources { private RuleQueryCondition getRuleQueryCondition(String queryRequest,
HttpServletRequest request) {
Locale locale = LanguageUtil.getLocale(request);
-
RuleQueryCondition ruleQueryCondition = GsonUtil.jsonToBean(queryRequest, RuleQueryCondition.class);
if (queryRequest == null) {
if(ruleQueryCondition==null){
|