summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt/src/main/java')
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java)14
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java)2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java)10
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java)33
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java)4
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java)19
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java)19
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java)4
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java)51
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java (renamed from rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java)53
20 files changed, 109 insertions, 120 deletions
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
index 96a1f00..8dc697c 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package org.openo.holmes.rulemgt;
+package org.onap.holmes.rulemgt;
import io.dropwizard.setup.Environment;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
-import org.openo.dropwizard.ioc.bundle.IOCApplication;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.utils.MSBRegisterUtil;
+import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
+import org.onap.holmes.common.utils.MSBRegisterUtil;
@Slf4j
-public class RuleActiveApp extends IOCApplication < RuleAppConfig > {
+public class RuleActiveApp extends IOCApplication< RuleAppConfig > {
public static void main( String[] args ) throws Exception {
new RuleActiveApp().run( args );
@@ -53,7 +53,7 @@ public class RuleActiveApp extends IOCApplication < RuleAppConfig > {
serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
serviceRegisterEntity.setProtocol("REST");
serviceRegisterEntity.setVersion("v1");
- serviceRegisterEntity.setUrl("/openoapi/holmes-rule-mgmt/v1");
+ serviceRegisterEntity.setUrl("/onapapi/holmes-rule-mgmt/v1");
serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
serviceRegisterEntity.setVisualRange("1|0");
return serviceRegisterEntity;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java
index 4fcb486..20f96c2 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt;
+package org.onap.holmes.rulemgt;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java
index 1475ce9..c36fce7 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import lombok.Getter;
import lombok.Setter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java
index 3ed4c4d..7c94395 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java
index 463eb2a..e79cc62 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import lombok.Getter;
import lombok.Setter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java
index 9407b99..f090c3b 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java
index ac9d795..7cc4fff 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java
index c68b40d..f3b9b91 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java
index 6ce265a..e2811e3 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.request;
+package org.onap.holmes.rulemgt.bean.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java
index e5597b8..7fe432e 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.response;
+package org.onap.holmes.rulemgt.bean.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java
index a720eca..17903ab 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.response;
+package org.onap.holmes.rulemgt.bean.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java
index ee948d0..c444b22 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bean.response;
+package org.onap.holmes.rulemgt.bean.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java
index e792fbf..f3e8d5c 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bolt.enginebolt;
+package org.onap.holmes.rulemgt.bolt.enginebolt;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -26,10 +26,10 @@ import javax.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.glassfish.jersey.client.ClientConfig;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.common.config.MicroServiceConfig;
@Slf4j
@Service
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java
index 8e9055b..733cae0 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.bolt.enginebolt;
+package org.onap.holmes.rulemgt.bolt.enginebolt;
import javax.inject.Inject;
import javax.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.common.exception.CorrelationException;
@Service
@Slf4j
@@ -38,18 +37,18 @@ public class EngineWrapper {
try {
response = engineService.deploy(correlationRule);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED, e);
+ throw new CorrelationException("Failed to call the rule deployment RESTful API.", e);
}
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {
- log.info("Call deploy rule rest interface in engine successfully.");
+ log.info("Succeeded in calling the rule deployment RESTful API from the engine management service.");
try {
JSONObject json = JSONObject.fromObject(response.readEntity(String.class));
return json.get(RuleMgtConstant.PACKAGE).toString();
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR, e);
+ throw new CorrelationException("Failed to parse the value returned by the engine management service.", e);
}
} else {
- throw new CorrelationException(I18nProxy.ENGINE_DEPLOY_RULE_FAILED);
+ throw new CorrelationException("Failed to deploy the rule!");
}
}
@@ -58,31 +57,31 @@ public class EngineWrapper {
try {
response = engineService.delete(packageName);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED, e);
+ throw new CorrelationException("Failed to call the rule deleting RESTful API.", e);
}
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {
- log.info("Call delete rule rest interface in engine successfully.");
+ log.info("Succeeded in calling the rule deleting RESTful API from the engine management service.");
return true;
} else {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED);
+ throw new CorrelationException("Failed to delete the rule!");
}
}
public boolean checkRuleFromEngine(CorrelationCheckRule4Engine correlationCheckRule4Engine)
throws CorrelationException {
- log.info("content:" + correlationCheckRule4Engine.getContent());
+ log.info("Rule Contents: " + correlationCheckRule4Engine.getContent());
Response response;
try {
response = engineService.check(correlationCheckRule4Engine);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED, e);
+ throw new CorrelationException("Failed to call the rule verification RESTful API.", e);
}
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {
- log.info("Call check rule rest interface in engine successfully.");
+ log.info("Succeeded in calling the rule verification RESTful API from the engine management service.");
return true;
} else {
log.info(response.getStatus() + " " + response.getStatusInfo() + " " + response.getEntity());
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS);
+ throw new CorrelationException("Failed to verify the rule. The contents of the rule are invalid.");
}
}
}
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java
index a9b891a..debfb05 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.constant;
+package org.onap.holmes.rulemgt.constant;
public class RuleMgtConstant {
@@ -24,6 +24,6 @@ public class RuleMgtConstant {
public static final int STATUS_RULE_CLOSE = 0;
public static final int STATUS_RULE_ALL = 2;
public static final String PACKAGE = "package";
- public static final String ENGINE_PATH = "/openoapi/holmes-engine-mgmt/v1/rule";
+ public static final String ENGINE_PATH = "/onapapi/holmes-engine-mgmt/v1/rule";
public static final int RESPONSE_STATUS_OK = 200;
}
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java
index 3a7f300..2a422c4 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.db;
+package org.onap.holmes.rulemgt.db;
import java.util.List;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.rulemgt.db.mapper.CorrelationRuleMapper;
+import org.onap.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.rulemgt.db.mapper.CorrelationRuleMapper;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.GetGeneratedKeys;
@@ -67,7 +66,7 @@ public abstract class CorrelationRuleDao {
addRule(correlationRule);
return correlationRule;
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);
}
}
@@ -75,7 +74,7 @@ public abstract class CorrelationRuleDao {
try {
updateRuleByRid(correlationRule);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);
}
}
@@ -83,7 +82,7 @@ public abstract class CorrelationRuleDao {
try {
deleteRule2DbInner(correlationRule);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);
}
}
@@ -92,7 +91,7 @@ public abstract class CorrelationRuleDao {
try {
return queryRuleById(rid);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);
}
}
@@ -100,7 +99,7 @@ public abstract class CorrelationRuleDao {
try {
return queryRuleByName(name);
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);
}
}
}
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java
index 487684e..322006d 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.db;
+package org.onap.holmes.rulemgt.db;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
@@ -26,12 +26,11 @@ import java.util.Properties;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.DbDaoUtil;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.DbDaoUtil;
import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.Query;
@@ -57,8 +56,8 @@ public class CorrelationRuleQueryDao {
}
return correlationRules;
} catch (Exception e) {
- log.warn("Query rule: rule id =" + ruleQueryCondition.getRid() + " failed");
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED, e);
+ log.warn("Failed to query the rule: id =" + ruleQueryCondition.getRid() + ".");
+ throw new CorrelationException("Failed to query the rule.", e);
} finally {
dbDaoUtil.close(handle);
}
@@ -123,7 +122,7 @@ public class CorrelationRuleQueryDao {
}
return "";
} catch (Exception e) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED, e);
+ throw new CorrelationException("An error occurred while building the query SQL.", e);
}
}
}
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java
index 437e0dd..d40253f 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.db.mapper;
+package org.onap.holmes.rulemgt.db.mapper;
-import org.openo.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.api.entity.CorrelationRule;
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java
index f3256b2..04578f7 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.resources;
+package org.onap.holmes.rulemgt.resources;
import com.codahale.metrics.annotation.Timed;
import io.swagger.annotations.Api;
@@ -22,7 +22,6 @@ import io.swagger.annotations.ApiParam;
import io.swagger.annotations.SwaggerDefinition;
import java.io.IOException;
import java.util.Locale;
-import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DELETE;
@@ -37,23 +36,22 @@ import javax.ws.rs.core.MediaType;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.ExceptionUtil;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.common.utils.JacksonUtil;
-import org.openo.holmes.common.utils.LanguageUtil;
-import org.openo.holmes.common.utils.MSBRegisterUtil;
-import org.openo.holmes.common.utils.UserUtil;
-import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest;
-import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest;
-import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;
-import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest;
-import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;
-import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse;
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
-import org.openo.holmes.rulemgt.wrapper.RuleMgtWrapper;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.ExceptionUtil;
+import org.onap.holmes.common.utils.JacksonUtil;
+import org.onap.holmes.common.utils.LanguageUtil;
+import org.onap.holmes.common.utils.MSBRegisterUtil;
+import org.onap.holmes.common.utils.UserUtil;
+import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
+import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;
+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.constant.RuleMgtConstant;
+import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper;
@Service
@SwaggerDefinition
@@ -81,8 +79,7 @@ public class RuleMgtResources {
return ruleChangeResponse;
} catch (CorrelationException e) {
log.error("create rule:" + ruleCreateRequest.getRuleName() + " failed", e);
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,
- e.getMessage()));
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -100,8 +97,7 @@ public class RuleMgtResources {
return ruleChangeResponse;
} catch (CorrelationException e) {
log.error("update rule:" + ruleUpdateRequest.getContent() + " failed", e);
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,
- e.getMessage()));
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -118,8 +114,7 @@ public class RuleMgtResources {
return true;
} catch (CorrelationException e) {
log.error("delete rule:" + ruleDeleteRequest.getRuleId() + " failed", e);
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,
- e.getMessage()));
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -142,8 +137,7 @@ public class RuleMgtResources {
return ruleQueryListResponse;
} catch (CorrelationException e) {
log.error("query rule failed,cause query condition conversion failure", e);
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,
- e.getMessage()));
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -161,8 +155,7 @@ public class RuleMgtResources {
return ruleQueryCondition;
} catch (IOException e) {
log.warn("queryRequest convert to json failed", e);
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,
- I18nProxy.RULE_MANAGEMENT_DATA_FORMAT_ERROR));
+ throw ExceptionUtil.buildExceptionResponse("The request format is invalid!");
}
}
}
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java
index 58d461f..beffa56 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt.wrapper;
+package org.onap.holmes.rulemgt.wrapper;
import java.util.ArrayList;
import java.util.Date;
@@ -23,23 +23,22 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.DbDaoUtil;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
-import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest;
-import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest;
-import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;
-import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest;
-import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;
-import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse;
-import org.openo.holmes.rulemgt.bean.response.RuleResult4API;
-import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper;
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
-import org.openo.holmes.rulemgt.db.CorrelationRuleDao;
-import org.openo.holmes.rulemgt.db.CorrelationRuleQueryDao;
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
+import org.onap.holmes.rulemgt.bean.response.RuleResult4API;
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;
+import org.onap.holmes.rulemgt.db.CorrelationRuleDao;
+import org.onap.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.DbDaoUtil;
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
+import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
+import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;
+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.bolt.enginebolt.EngineWrapper;
+import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao;
@Service
@@ -64,14 +63,14 @@ public class RuleMgtWrapper {
public RuleAddAndUpdateResponse addCorrelationRule(String creator, RuleCreateRequest ruleCreateRequest)
throws CorrelationException {
if (ruleCreateRequest == null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);
+ throw new CorrelationException("The request object can not be empty!");
}
CorrelationRule correlationRule = convertCreateRequest2Rule(creator,
ruleCreateRequest);
checkCorrelation(correlationRule);
CorrelationRule ruleTemp = correlationRuleDao.queryRuleByRuleName(correlationRule.getName());
if (ruleTemp != null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME);
+ throw new CorrelationException("A rule with the same name already exists.");
}
correlationRule.setPackageName(deployRule2Engine(correlationRule));
CorrelationRule result = correlationRuleDao.saveRule(correlationRule);
@@ -83,11 +82,11 @@ public class RuleMgtWrapper {
public RuleAddAndUpdateResponse updateCorrelationRule(String modifier, RuleUpdateRequest ruleUpdateRequest)
throws CorrelationException {
if (ruleUpdateRequest == null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);
+ throw new CorrelationException("The request object can not be empty!");
}
CorrelationRule oldCorrelationRule = correlationRuleDao.queryRuleByRid(ruleUpdateRequest.getRuleId());
if (oldCorrelationRule == null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);
+ throw new CorrelationException("You're trying to update a rule which does not exist in the system.");
}
CorrelationRule newCorrelationRule = convertRuleUpdateRequest2CorrelationRule(modifier,
ruleUpdateRequest, oldCorrelationRule.getName());
@@ -110,14 +109,14 @@ public class RuleMgtWrapper {
String ruleName = correlationRule.getName() == null ? "" : correlationRule.getName().trim();
String content = correlationRule.getContent() == null ? "" : correlationRule.getContent().trim();
if ("".equals(content)) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY);
+ throw new CorrelationException("The contents of the rule can not be empty!");
}
if (enabled != RuleMgtConstant.STATUS_RULE_CLOSE
&& enabled != RuleMgtConstant.STATUS_RULE_OPEN) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR);
+ throw new CorrelationException("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed.");
}
if ("".equals(ruleName)) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY);
+ throw new CorrelationException("The name of the rule can not be empty.");
}
}
@@ -137,12 +136,12 @@ public class RuleMgtWrapper {
public void deleteCorrelationRule(RuleDeleteRequest ruleDeleteRequest)
throws CorrelationException {
if (ruleDeleteRequest == null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);
+ throw new CorrelationException("The request object can not be empty!");
}
CorrelationRule correlationRule = correlationRuleDao.queryRuleByRid(ruleDeleteRequest.getRuleId());
if (correlationRule == null) {
log.warn("the rule:rule id=" + ruleDeleteRequest.getRuleId() + " does not exist the database.");
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);
+ throw new CorrelationException("You're trying to delete a rule which does not exist in the system.");
}
if (correlationRule.getEnabled() == RuleMgtConstant.STATUS_RULE_OPEN) {
engineWarpper.deleteRuleFromEngine(correlationRule.getPackageName());