diff options
Diffstat (limited to 'ecomp-sdk/epsdk-core')
10 files changed, 83 insertions, 4 deletions
diff --git a/ecomp-sdk/epsdk-core/README.md b/ecomp-sdk/epsdk-core/README.md index 2d65f17b..fbc2bf24 100644 --- a/ecomp-sdk/epsdk-core/README.md +++ b/ecomp-sdk/epsdk-core/README.md @@ -13,6 +13,9 @@ ECOMP SDK web application. ### ONAP Distributions +Version 2.1.0 +- PORTAL-19 Rename Java package base to org.onap + Version 1.4.0 - PORTAL-19 Rename Java package base to org.onap - PORTAL-42 Use OParent as parent POM diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index d9993110..49b8f901 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>2.1.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java index 3ffd0894..0e23a36f 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java @@ -43,6 +43,7 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.onap.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; import org.springframework.beans.factory.annotation.Autowired; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Aspect @org.springframework.context.annotation.Configuration @@ -108,4 +109,18 @@ public class EELFLoggerAspect { return result; } + + //Metrics Logging + @Pointcut("execution(* *(..))") + public void performMetricsLogging() {} + + @Around("performMetricsLogging() && @within(MetricsLog)") + public Object metricsLoggingAroundClass(ProceedingJoinPoint joinPoint, MetricsLog MetricsLog) throws Throwable { + return this.logAroundMethod(joinPoint, null); + } + + @Around("performMetricsLogging() && @annotation(MetricsLog)") + public Object metricsLoggingAroundMethod(ProceedingJoinPoint joinPoint, MetricsLog MetricsLog) throws Throwable { + return this.logAroundMethod(joinPoint, null); + } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/AuditServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/AuditServiceImpl.java index 1bc81d9a..68cbe11c 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/AuditServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/AuditServiceImpl.java @@ -43,9 +43,11 @@ import org.onap.portalsdk.core.domain.AuditLog; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Service("auditService") @Transactional +@MetricsLog public class AuditServiceImpl implements AuditService { @Autowired diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessService.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessService.java index 8eacefa9..f2863e06 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessService.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessService.java @@ -60,10 +60,31 @@ public interface DataAccessService { void saveDomainObject(DomainVo domainObject, Map additionalParams); // generic get list method(s) + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ + @Deprecated List getList(Class domainClass, Map additionalParams); + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ + @Deprecated List getList(Class domainClass, String filter, String orderBy, Map additionalParams); + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ + @Deprecated List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, Map additionalParams); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessServiceImpl.java index f34610cb..8fce7e89 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/DataAccessServiceImpl.java @@ -157,6 +157,11 @@ public class DataAccessServiceImpl extends FusionService implements DataAccessSe /** * generic get list method * + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + * * @param domainClass * @param filterClause * @param fromIndex @@ -164,6 +169,7 @@ public class DataAccessServiceImpl extends FusionService implements DataAccessSe * @param orderBy * @return */ + @Deprecated private List getListCommon(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex, String orderBy) { String className = domainClass.getName(); @@ -186,17 +192,38 @@ public class DataAccessServiceImpl extends FusionService implements DataAccessSe return list; } + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ @Override + @Deprecated public List getList(Class domainClass, Map additionalParams) { return getListCommon(domainClass, null, null, null, null); } + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ @Override + @Deprecated public List getList(Class domainClass, String filter, String orderBy, Map additionalParams) { return getListCommon(domainClass, filter, null, null, orderBy); } - + + /** + * @deprecated + * This method may be vulnerable to SQL Injection attacks depending on the usage and is being deprecated. Please use + * getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, + List<Order> orderByList) method instead + */ @Override + @Deprecated public List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, Map additionalParams) { return getListCommon(domainClass, filter, new Integer(fromIndex), new Integer(toIndex), orderBy); @@ -401,8 +428,10 @@ public class DataAccessServiceImpl extends FusionService implements DataAccessSe @Override public int executeNamedUpdateQuery(String queryName, Map params, Map additionalParams) { - logger.error(EELFLoggerDelegate.errorLogger, "Not implemented"); - throw new UnsupportedOperationException(); + Session session = sessionFactory.getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query,params); + return query.executeUpdate(); } @Override diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LdapServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LdapServiceImpl.java index 6470ca63..9f078403 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LdapServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LdapServiceImpl.java @@ -58,6 +58,7 @@ import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Service("ldapService") @Transactional @@ -144,6 +145,7 @@ public class LdapServiceImpl extends FusionService implements LdapService { } @SuppressWarnings({ "rawtypes", "unchecked" }) + @MetricsLog private ArrayList processResults(NamingEnumeration e) throws NamingException { ArrayList results = new ArrayList(); int count = 0; @@ -163,6 +165,7 @@ public class LdapServiceImpl extends FusionService implements LdapService { } @SuppressWarnings("rawtypes") + @MetricsLog private DomainVo processAttributes(Attributes resultAttributes) { User user = new User(); try { diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceImpl.java index d16a86d8..840c6063 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceImpl.java @@ -56,8 +56,10 @@ import org.onap.portalsdk.core.web.support.AppUtils; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Transactional +@MetricsLog public class LoginServiceImpl extends FusionService implements LoginService { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LoginServiceImpl.class); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ProfileServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ProfileServiceImpl.java index 20b14eb6..f91cf2eb 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ProfileServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ProfileServiceImpl.java @@ -44,8 +44,10 @@ import org.onap.portalsdk.core.domain.Profile; import org.onap.portalsdk.core.domain.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Transactional +@MetricsLog public class ProfileServiceImpl implements ProfileService { @Autowired diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java index e0e2d2e3..cfb1c34a 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java @@ -52,8 +52,10 @@ import org.onap.portalsdk.core.domain.RoleFunction; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Transactional +@MetricsLog public class RoleServiceImpl implements RoleService { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleServiceImpl.class); |