Change the groupid from openo to onap
[holmes/rule-management.git] / 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\r
  * limitations under the License.\r
  */\r
-package org.openo.holmes.rulemgt.wrapper;\r
+package org.onap.holmes.rulemgt.wrapper;\r
 \r
 import java.util.ArrayList;\r
 import java.util.Date;\r
@@ -23,23 +23,22 @@ import javax.inject.Inject;
 import javax.inject.Singleton;\r
 import lombok.extern.slf4j.Slf4j;\r
 import org.jvnet.hk2.annotations.Service;\r
-import org.openo.holmes.common.api.entity.CorrelationRule;\r
-import org.openo.holmes.common.exception.CorrelationException;\r
-import org.openo.holmes.common.utils.DbDaoUtil;\r
-import org.openo.holmes.common.utils.I18nProxy;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest;\r
-import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest;\r
-import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;\r
-import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest;\r
-import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;\r
-import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse;\r
-import org.openo.holmes.rulemgt.bean.response.RuleResult4API;\r
-import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper;\r
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;\r
-import org.openo.holmes.rulemgt.db.CorrelationRuleDao;\r
-import org.openo.holmes.rulemgt.db.CorrelationRuleQueryDao;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.response.RuleResult4API;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.db.CorrelationRuleDao;\r
+import org.onap.holmes.common.api.entity.CorrelationRule;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
+import org.onap.holmes.common.utils.DbDaoUtil;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;\r
+import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;\r
+import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;\r
+import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest;\r
+import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;\r
+import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse;\r
+import org.onap.holmes.rulemgt.bolt.enginebolt.EngineWrapper;\r
+import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao;\r
 \r
 \r
 @Service\r
@@ -64,14 +63,14 @@ public class RuleMgtWrapper {
     public RuleAddAndUpdateResponse addCorrelationRule(String creator, RuleCreateRequest ruleCreateRequest)\r
             throws CorrelationException {\r
         if (ruleCreateRequest == null) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+            throw new CorrelationException("The request object can not be empty!");\r
         }\r
         CorrelationRule correlationRule = convertCreateRequest2Rule(creator,\r
                 ruleCreateRequest);\r
         checkCorrelation(correlationRule);\r
         CorrelationRule ruleTemp = correlationRuleDao.queryRuleByRuleName(correlationRule.getName());\r
         if (ruleTemp != null) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME);\r
+            throw new CorrelationException("A rule with the same name already exists.");\r
         }\r
         correlationRule.setPackageName(deployRule2Engine(correlationRule));\r
         CorrelationRule result = correlationRuleDao.saveRule(correlationRule);\r
@@ -83,11 +82,11 @@ public class RuleMgtWrapper {
     public RuleAddAndUpdateResponse updateCorrelationRule(String modifier, RuleUpdateRequest ruleUpdateRequest)\r
             throws CorrelationException {\r
         if (ruleUpdateRequest == null) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+            throw new CorrelationException("The request object can not be empty!");\r
         }\r
         CorrelationRule oldCorrelationRule = correlationRuleDao.queryRuleByRid(ruleUpdateRequest.getRuleId());\r
         if (oldCorrelationRule == null) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);\r
+            throw new CorrelationException("You're trying to update a rule which does not exist in the system.");\r
         }\r
         CorrelationRule newCorrelationRule = convertRuleUpdateRequest2CorrelationRule(modifier,\r
                 ruleUpdateRequest, oldCorrelationRule.getName());\r
@@ -110,14 +109,14 @@ public class RuleMgtWrapper {
         String ruleName = correlationRule.getName() == null ? "" : correlationRule.getName().trim();\r
         String content = correlationRule.getContent() == null ? "" : correlationRule.getContent().trim();\r
         if ("".equals(content)) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY);\r
+            throw new CorrelationException("The contents of the rule can not be empty!");\r
         }\r
         if (enabled != RuleMgtConstant.STATUS_RULE_CLOSE\r
                 && enabled != RuleMgtConstant.STATUS_RULE_OPEN) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR);\r
+            throw new CorrelationException("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed.");\r
         }\r
         if ("".equals(ruleName)) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY);\r
+            throw new CorrelationException("The name of the rule can not be empty.");\r
         }\r
     }\r
 \r
@@ -137,12 +136,12 @@ public class RuleMgtWrapper {
     public void deleteCorrelationRule(RuleDeleteRequest ruleDeleteRequest)\r
             throws CorrelationException {\r
         if (ruleDeleteRequest == null) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+            throw new CorrelationException("The request object can not be empty!");\r
         }\r
         CorrelationRule correlationRule = correlationRuleDao.queryRuleByRid(ruleDeleteRequest.getRuleId());\r
         if (correlationRule == null) {\r
             log.warn("the rule:rule id=" + ruleDeleteRequest.getRuleId() + " does not exist the database.");\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);\r
+            throw new CorrelationException("You're trying to delete a rule which does not exist in the system.");\r
         }\r
         if (correlationRule.getEnabled() == RuleMgtConstant.STATUS_RULE_OPEN) {\r
             engineWarpper.deleteRuleFromEngine(correlationRule.getPackageName());\r