Code Review
/
policy
/
engine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Fix technical debt and reduce lines"
[policy/engine.git]
/
POLICY-SDK-APP
/
src
/
main
/
java
/
org
/
onap
/
policy
/
daoImp
/
CommonClassDaoImpl.java
diff --git
a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
index
336c42c
..
170c308
100644
(file)
--- a/
POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
+++ b/
POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
@@
-21,12
+21,14
@@
package org.onap.policy.daoImp;
import java.util.ArrayList;
package org.onap.policy.daoImp;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.script.SimpleBindings;
import org.hibernate.Criteria;
import java.util.List;
import java.util.Map;
import javax.script.SimpleBindings;
import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@
-41,9
+43,11
@@
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.PolicyRoles;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.onap.policy.rest.jpa.PolicyRoles;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@Service("CommonClassDao")
import org.springframework.stereotype.Service;
@Service("CommonClassDao")
+@Primary
public class CommonClassDaoImpl implements CommonClassDao{
private static final Logger LOGGER = FlexLogger.getLogger(CommonClassDaoImpl.class);
public class CommonClassDaoImpl implements CommonClassDao{
private static final Logger LOGGER = FlexLogger.getLogger(CommonClassDaoImpl.class);
@@
-250,7
+254,7
@@
public class CommonClassDaoImpl implements CommonClassDao{
@Override
public List<Object> checkExistingGroupListforUpdate(String arg0, String arg1) {
@Override
public List<Object> checkExistingGroupListforUpdate(String arg0, String arg1) {
- return
null
;
+ return
Collections.emptyList()
;
}
}
@@
-267,7
+271,12
@@
public class CommonClassDaoImpl implements CommonClassDao{
try {
Query hbquery = session.createQuery(query);
for (Map.Entry<String, Object> paramPair : params.entrySet()) {
try {
Query hbquery = session.createQuery(query);
for (Map.Entry<String, Object> paramPair : params.entrySet()) {
- hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ if(paramPair.getValue() instanceof java.lang.Long){
+ hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue());
+ }
+ else{
+ hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ }
}
data = hbquery.list();
tx.commit();
}
data = hbquery.list();
tx.commit();
@@
-277,9
+286,8
@@
public class CommonClassDaoImpl implements CommonClassDao{
}finally{
try{
session.close();
}finally{
try{
session.close();
- }catch(Exception e1){
+ }catch(
Hibernate
Exception e1){
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
- throw e1;
}
}
return data;
}
}
return data;