summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core/src/main/java
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-09-25 15:52:24 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-09-25 15:53:55 -0400
commit3a2b5c60384feb490e878020bdb9c01f514d7856 (patch)
tree840d02d1090640b08aa481f52d3385ad92552991 /ecomp-sdk/epsdk-core/src/main/java
parent65c475eb72271f674f5ec4502fa67fd972344543 (diff)
Sonar Scans and Role Centralization; clean nl
PORTAL-21: centralized user role management PORTAL-72: Address Sonar Scan code issues for ONAP - mostly on raptor PORTAL-86: ONAP - Remove internal att.com usages from tests and otherfiles PORTAL-90: Add debug statements to demo app's class; no functional change Issue: PORTAL-21 PORTAL-72 PORTAL-86 PORTAL-90 Change-Id: I72a6c812009f51446330bf42bab6d3338d053805 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java')
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java5
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Publisher.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/BroadcastServiceImpl.java10
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchService.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchServiceImpl.java22
6 files changed, 25 insertions, 20 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java
index 1114bca0..48c8a4f5 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java
@@ -39,6 +39,8 @@ package org.onap.portalsdk.core.domain;
import org.onap.portalsdk.core.domain.support.DomainVo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
/**
* <p>
* RoleFunction.java
@@ -71,7 +73,8 @@ public class RoleFunction extends DomainVo {
public void setCode(String code) {
this.code = code;
}
-
+
+ @JsonIgnore
public String getEditUrl() {
return "/role_function.htm?role_function_id=" + getCode();
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java
index 9ae1fbf0..5b87e2bf 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java
@@ -71,7 +71,5 @@ public enum ErrorCodesEnum implements EELFResolvableErrorEnum {
* Static initializer to ensure the resource bundles for this class are
* loaded... Here this application loads messages from three bundles
*/
- // static {
- // EELFResourceManager.loadMessageBundle("com/att/fusion/core/logging/format/ApplicationCodes");
- // }
+
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Publisher.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Publisher.java
index b73b0110..920d79cf 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Publisher.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Publisher.java
@@ -56,7 +56,7 @@ import com.fasterxml.jackson.databind.ObjectWriter;
/**
* Provides a publisher that sends messages to a UEB topic.
*
- * Utilizes AT&T's UEB/Cambria subscriber/publisher messaging service.
+ * UEB/Cambria subscriber/publisher messaging service.
*/
public class Publisher {
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/BroadcastServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/BroadcastServiceImpl.java
index 5d14ee47..e37d54e1 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/BroadcastServiceImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/BroadcastServiceImpl.java
@@ -219,11 +219,13 @@ public class BroadcastServiceImpl extends FusionService implements BroadcastServ
if (siteCd == null) {
return messagesExist;
} else {
- for (int i = 0; i < messages.size(); i++) {
- BroadcastMessage message = (BroadcastMessage) messages.get(i);
+ if(messages!=null){
+ for (int i = 0; i < messages.size(); i++) {
+ BroadcastMessage message = (BroadcastMessage) messages.get(i);
- if ((message.getSiteCd() == null) || message.getSiteCd().equals(siteCd)) {
- return true;
+ if ((message.getSiteCd() == null) || message.getSiteCd().equals(siteCd)) {
+ return true;
+ }
}
}
return false;
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchService.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchService.java
index 248fdbfb..0d31f08a 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchService.java
@@ -50,6 +50,6 @@ public interface PostSearchService {
* @param postSearch
* @return the number of users successfully imported
*/
- int process(HttpServletRequest request, PostSearchBean postSearch);
+ int process(HttpServletRequest request, PostSearchBean postSearch) throws Exception;
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchServiceImpl.java
index 4bf78eed..1f2a3e8f 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchServiceImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/PostSearchServiceImpl.java
@@ -55,7 +55,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("postSearchService")
-@Transactional
public class PostSearchServiceImpl implements PostSearchService {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchServiceImpl.class);
@@ -65,7 +64,8 @@ public class PostSearchServiceImpl implements PostSearchService {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public int process(HttpServletRequest request, PostSearchBean postSearch) {
+ @Transactional(rollbackFor = Exception.class)
+ public int process(HttpServletRequest request, PostSearchBean postSearch) throws Exception {
HashMap additionalParams = new HashMap();
additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
int numUsersImported = 0;
@@ -202,24 +202,26 @@ public class PostSearchServiceImpl implements PostSearchService {
}
user.setActive(true);
-
+ Role role = null;
try {
dataAccessService.saveDomainObject(user, additionalParams);
- Role role = (Role) dataAccessService.getDomainObject(Role.class,
+ role = (Role) dataAccessService.getDomainObject(Role.class,
Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)),
null);
+ if(role.getId() == null){
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "process failed: No Role Exsists in DB with requested RoleId :"+ Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)));
+ throw new Exception("user cannot be added");
+ }
user.addRole(role);
numUsersImported++;
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "process: saveDomainObject failed on user " + user.getLoginId(), e);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "process: saveDomainObject failed on user " + user.getLoginId(), e);
+ throw e;
}
}
}
-
}
-
return numUsersImported;
}
-
}