API Versioning for ECOMP Components in SDK 53/51153/1
authorsa282w <sa282w@att.com>
Tue, 29 May 2018 21:00:44 +0000 (17:00 -0400)
committersa282w <sa282w@att.com>
Mon, 11 Jun 2018 18:39:24 +0000 (14:39 -0400)
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>
ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java
ecomp-sdk/epsdk-music/pom.xml
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java

index d2ccfc2..063c207 100644 (file)
@@ -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 {
 
index 3aeb014..138a805 100644 (file)
@@ -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);
index 5ef0d46..45ebddc 100644 (file)
                <dependency>
                        <groupId>org.onap.music</groupId>
                        <artifactId>MUSIC</artifactId>
-                       <version>2.5.4</version>
+                       <version>2.5.5</version>
                </dependency>
                
                <!-- Mapper -->
index 7d2e51f..0e8551b 100644 (file)
@@ -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);
+                       }
                }
        }
-
 }
index aa9e2e3..694e80c 100644 (file)
@@ -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){
index 802634b..5aae01d 100644 (file)
@@ -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";
index d7de16b..a62c929 100644 (file)
@@ -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;
+       }
 }