X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=rulemgt%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fholmes%2Frulemgt%2Fdb%2FCorrelationRuleDao.java;h=64dcea23eea240ec39b76ad0f739c57ff511fb2c;hb=580d4ce637b1c09b3bd2258b0b9c8332b8789bad;hp=a94c1db7848c84c032482c905fe86fcd065c4f04;hpb=d165bd9397c9de0d16c5dc580306d6e63e1e1d60;p=holmes%2Frule-management.git diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java index a94c1db..64dcea2 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java @@ -30,10 +30,10 @@ import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper; public abstract class CorrelationRuleDao { @GetGeneratedKeys - @SqlUpdate("INSERT INTO APLUS_RULE (NAME,CTRLLOOP,DESCRIPTION,ENABLE,TEMPLATEID,ENGINETYPE,CREATOR,UPDATOR,PARAMS,CONTENT ,VENDOR,CREATETIME,UPDATETIME,ENGINEID,PACKAGE,RID) VALUES (:name,:closedControlLoopName,:description,:enabled,:templateID,:engineType,:creator,:modifier,:params,:content,:vendor,:createTime,:updateTime,:engineID,:packageName,:rid)") + @SqlUpdate("INSERT INTO APLUS_RULE (NAME,CTRLLOOP,DESCRIPTION,ENABLE,TEMPLATEID,ENGINETYPE,CREATOR,UPDATOR,PARAMS,CONTENT ,VENDOR,CREATETIME,UPDATETIME,ENGINEID,PACKAGE,RID, ENGINEINSTANCE) VALUES (:name,:closedControlLoopName,:description,:enabled,:templateID,:engineType,:creator,:modifier,:params,:content,:vendor,:createTime,:updateTime,:engineID,:packageName,:rid,:engineInstance)") protected abstract String addRule(@BindBean CorrelationRule correlationRule); - @SqlUpdate("UPDATE APLUS_RULE SET CTRLLOOP=:closedControlLoopName,DESCRIPTION=:description,ENABLE=:enabled,CONTENT=:content,UPDATOR=:modifier,UPDATETIME=:updateTime, PACKAGE=:packageName WHERE RID=:rid") + @SqlUpdate("UPDATE APLUS_RULE SET CTRLLOOP=:closedControlLoopName,DESCRIPTION=:description,ENABLE=:enabled,CONTENT=:content,UPDATOR=:modifier,UPDATETIME=:updateTime, PACKAGE=:packageName, ENGINEINSTANCE=:engineInstance WHERE RID=:rid") protected abstract int updateRuleByRid(@BindBean CorrelationRule correlationRule); @SqlUpdate("DELETE FROM APLUS_RULE WHERE RID=:rid") @@ -51,6 +51,21 @@ public abstract class CorrelationRuleDao { @SqlQuery("SELECT * FROM APLUS_RULE WHERE NAME=:name") protected abstract CorrelationRule queryRuleByName(@Bind("name") String name); + @SqlQuery("SELECT * FROM APLUS_RULE WHERE enable=:enable") + public abstract List queryRuleByEnable(@Bind("enable") int enable); + + @SqlQuery("SELECT * FROM APLUS_RULE WHERE engineinstance=:engineinstance") + public abstract List queryRuleByEngineInstance(@Bind("engineinstance") String engineinstance); + + public List queryRuleByRuleEngineInstance(String enginetype) { + return queryRuleByEngineInstance(enginetype); + } + + public List queryRuleByRuleEnable(int enable) { + return queryRuleByEnable(enable); + } + + private void deleteRule2DbInner(CorrelationRule correlationRule) { String name = correlationRule.getName() != null ? correlationRule.getName().trim() : ""; String rid = correlationRule.getRid() != null ? correlationRule.getRid().trim() : "";