diff options
author | sa282w <sa282w@att.com> | 2018-05-29 17:00:44 -0400 |
---|---|---|
committer | sa282w <sa282w@att.com> | 2018-06-11 14:39:24 -0400 |
commit | 8e2ec1973570cde1b3166410643bb86bc37f3eff (patch) | |
tree | dcf275e2993fa470dfae06b7e69663290e8a8e0e | |
parent | 4f1afd26403c688b29c8329be66dcaded951bd54 (diff) |
API Versioning for ECOMP Components in SDK
Issue-ID: PORTAL-263
Included the fix for the defect regarding profile self pages returning
404 error.
Change-Id: Id6b1ed6ffde319ba41e9da445de8aa5f38249a8b
Signed-off-by: sa282w <sa282w@att.com>
7 files changed, 45 insertions, 21 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java index d2ccfc2e..063c207f 100644 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java @@ -59,6 +59,7 @@ 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.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service("loginExternalAuthService") public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { @@ -79,6 +80,7 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { @Override @SuppressWarnings("rawtypes") + @Transactional public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams, boolean matchPassword, HttpServletRequest request) throws Exception { diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java index 3aeb0147..138a805d 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java @@ -49,9 +49,8 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class AngularAdminController extends RestrictedBaseController{ - public static final String API_VERSION = "/v3"; - @RequestMapping(value = {API_VERSION + "/userProfile" }, method = RequestMethod.GET) + @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET) public ModelAndView view() { Map<String, Object> model = new HashMap<>(); return new ModelAndView("user_profile_list","model", model); diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index 5ef0d469..45ebddc3 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -125,7 +125,7 @@ <dependency> <groupId>org.onap.music</groupId> <artifactId>MUSIC</artifactId> - <version>2.5.4</version> + <version>2.5.5</version> </dependency> <!-- Mapper --> diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 7d2e51ff..0e8551b9 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -55,40 +55,50 @@ public class MusicSessionRepositoryHandler { public Session get(String id) { - if(!musicCache){ + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + return this.sessions.get(id); + }else{ try { Session session = MusicService.getMetaAttribute(id); return session; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e); + return null; } - } - return this.sessions.get(id); + } } public void remove(String id) { - sessions.remove(id); - try { - MusicService.removeSession(id); - } catch (MusicLockingException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); - } catch (MusicServiceException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.remove(id); + }else{ + try { + MusicService.removeSession(id); + } catch (MusicLockingException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); + } catch (MusicServiceException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + } } } public void put(String id, MusicSession musicSession) { - sessions.put(id, musicSession); - try { - MusicService.setMetaAttribute(musicSession); - MusicService.cleanUpMusic(); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.put(id, musicSession); + }else{ + try { + MusicService.setMetaAttribute(musicSession); + MusicService.cleanUpMusic(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + } } } - } diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java index aa9e2e3e..694e80cd 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java @@ -59,7 +59,7 @@ public class MusicSessionRepositoryFilter extends DelegatingFilterProxy{ try{ if (request instanceof HttpServletRequest) { String path = ((HttpServletRequest)request).getRequestURI().substring(((HttpServletRequest) request).getContextPath().length()); - if(MusicUtil.isExcludedApi(path)) + if(MusicUtil.isExcludedApi(path) || !MusicUtil.isMusicEnable()) request.setAttribute("org.springframework.session.web.http.SessionRepositoryFilter.FILTERED", Boolean.TRUE); } }catch(Exception e){ diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java index 802634b6..5aae01d0 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java @@ -99,6 +99,8 @@ public class MusicProperties { public static final String MUSIC_CLEAN_UP_THRESHOLD = "music.cleanup.threshold"; + public static final String MUSIC_ENABLE = "music.enable"; + public static final String SESSION_MAX_INACTIVE_INTERVAL_SECONDS = "music.session.max.inactive.interval.seconds"; public static final String ATTRIBUTE_NAME = "ATTRIBUTE_NAME"; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java index d7de16bd..a62c929c 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java @@ -67,6 +67,8 @@ public class MusicUtil { private static String cached = MusicProperties.getProperty(MusicProperties.MUSIC_CACHE); private static String cleanUpFreq = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_FREQUENCY); private static String musicSerializeCompress = MusicProperties.getProperty(MusicProperties.MUSIC_SERIALIZE_COMPRESS); + private static String musicEnable = MusicProperties.getProperty(MusicProperties.MUSIC_ENABLE); + public static boolean isSessionMetaAttr(String key){ return sessionAttrNameSet.contains(key); } @@ -203,4 +205,13 @@ public class MusicUtil { return false; } } + + public static boolean isMusicEnable(){ + if(musicEnable==null) + return false; + if(musicEnable.equals("true")) + return true; + else + return false; + } } |