Fixed App Onboarding - List page error 81/111781/1
authorSudarshan Kumar <sudarshan.kumar@att.com>
Thu, 27 Aug 2020 07:32:54 +0000 (13:02 +0530)
committerSudarshan Kumar <sudarshan.kumar@att.com>
Thu, 27 Aug 2020 07:34:07 +0000 (13:04 +0530)
App Onboarding - List page throwing error while loading Apps

Issue-ID: PORTAL-994
Change-Id: If237e7a1050ac5824926b465577166b97ab0a503
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/transport/OnboardingApp.java
ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/transport/OnboardingAppTest.java

index 08d9ad1..d1b2a56 100644 (file)
  */
 package org.onap.portalapp.portal.transport;
 
+import org.hibernate.validator.constraints.SafeHtml;
+import org.onap.portalapp.portal.domain.EpAppType;
+
+/**
+ * Model of rows in the fn_app table; serialized as a message add or update an
+ * on-boarded application.
+ */
 public class OnboardingApp {
 
-       public Long id;
+       private Long id;
+       @SafeHtml
+       private String appName;
+       @SafeHtml
+       private String imageUrl;
+       @SafeHtml
+       private String imageLink;
+       @SafeHtml
+       private String appDescription;
+       @SafeHtml
+       private String appNotes;
+       @SafeHtml
+       private String landingPage;
+       @SafeHtml
+       private String alternateLandingPage;
+       @SafeHtml
+       private String restUrl;
+
+       @SafeHtml
+       private String applicationType;
+       
+       private Boolean isOpen;
+
+       private Boolean isEnabled;
 
-       public String name;
+       private Long motsId;
+       @SafeHtml
+       private String myLoginsAppName;
+       @SafeHtml
+       private String myLoginsAppOwner;
+       @SafeHtml
+       private String appBasicAuthUsername;
+       @SafeHtml
+       private String appBasicAuthPassword;
+       @SafeHtml
+       private String thumbnail;
+       @SafeHtml
+       private String uebTopicName;
+       @SafeHtml
+       private String uebKey;
+       @SafeHtml
+       private String uebSecret;
 
-       public String imageUrl;
+       private Boolean restrictedApp;
        
-       public String imageLink;
+       private Boolean rolesInAAF;
+       @SafeHtml
+       private String nameSpace;
 
-       public String description;
+       @SafeHtml
+       private String modeOfIntegration;
 
-       public String notes;
+       private Boolean appAck;
 
-       public String url;
+       private Boolean usesCadi;
+       
+       /**
+        * Sets the name, myLoginsAppName, myLoginsAppOwner, username and
+        * appPassword fields to the empty string OR trims leading/trailing space,
+        * as appropriate.
+        */
+       public void normalize() {
+               this.appName = (this.appName == null) ? "" : this.appName.trim();
+               this.myLoginsAppName = (this.myLoginsAppName == null) ? "" : this.myLoginsAppName.trim();
+               this.myLoginsAppOwner = (this.myLoginsAppOwner == null) ? "" : this.myLoginsAppOwner.trim();
+               this.appBasicAuthUsername = (this.appBasicAuthUsername == null) ? "" : this.appBasicAuthUsername.trim();
+               this.appBasicAuthPassword = (this.appBasicAuthPassword == null) ? "" : this.appBasicAuthPassword.trim();
+       }
 
-       public String alternateUrl;
+       public Long getId() {
+               return id;
+       }
 
-       public String restUrl;
+       public void setId(Long id) {
+               this.id = id;
+       }
 
-       public Boolean isOpen;
+       public String getAppName() {
+               return appName;
+       }
 
-       public Boolean isEnabled;
+       public void setAppName(String appName) {
+               this.appName = appName;
+       }
 
-       public String username;
+       public String getImageUrl() {
+               return imageUrl;
+       }
 
-       public String appPassword;
+       public void setImageUrl(String imageUrl) {
+               this.imageUrl = imageUrl;
+       }
 
-       public String thumbnail;
-       
-       public String uebTopicName;
-       
-       public String uebKey;
-       
-       public String uebSecret;
-       
-       public Boolean restrictedApp;
-       
-       public Boolean isCentralAuth;
-       
-       public String nameSpace;
+       public String getImageLink() {
+               return imageLink;
+       }
 
-       public void normalize() {
-               this.name = (this.name == null) ? "" : this.name.trim();
-               this.username = (this.username == null) ? "" : this.username.trim();
-               this.appPassword = (this.appPassword == null) ? "" : this.appPassword.trim();
+       public void setImageLink(String imageLink) {
+               this.imageLink = imageLink;
        }
 
-       public void setUebTopicName(String topicName) {
-               this.uebTopicName = topicName;
+       public String getAppDescription() {
+               return appDescription;
        }
 
-       public void setUebKey(String key) {
-               this.uebKey = key;
+       public void setAppDescription(String appDescription) {
+               this.appDescription = appDescription;
        }
-       
-       public void setUebSecret(String secret) {
-               this.uebSecret = secret;
+
+       public String getAppNotes() {
+               return appNotes;
        }
-       
-       // Hide the implementation of restricted and normal app from the front end.
-       // The json sent and received will include restrictedApp but not appType.
-       
+
+       public void setAppNotes(String appNotes) {
+               this.appNotes = appNotes;
+       }
+
+       public String getLandingPage() {
+               return landingPage;
+       }
+
+       public void setLandingPage(String landingPage) {
+               this.landingPage = landingPage;
+       }
+
+       public String getAlternateLandingPage() {
+               return alternateLandingPage;
+       }
+
+       public void setAlternateLandingPage(String alternateLandingPage) {
+               this.alternateLandingPage = alternateLandingPage;
+       }
+
+       public String getRestUrl() {
+               return restUrl;
+       }
+
+       public void setRestUrl(String restUrl) {
+               this.restUrl = restUrl;
+       }
+
+       public Boolean getIsOpen() {
+               return isOpen;
+       }
+
+       public void setIsOpen(Boolean isOpen) {
+               this.isOpen = isOpen;
+       }
+
+       public Boolean getIsEnabled() {
+               return isEnabled;
+       }
+
+       public void setIsEnabled(Boolean isEnabled) {
+               this.isEnabled = isEnabled;
+       }
+
+       public Long getMotsId() {
+               return motsId;
+       }
+
+       public void setMotsId(Long motsId) {
+               this.motsId = motsId;
+       }
+
+       public String getMyLoginsAppName() {
+               return myLoginsAppName;
+       }
+
+       public void setMyLoginsAppName(String myLoginsAppName) {
+               this.myLoginsAppName = myLoginsAppName;
+       }
+
+       public String getMyLoginsAppOwner() {
+               return myLoginsAppOwner;
+       }
+
+       public void setMyLoginsAppOwner(String myLoginsAppOwner) {
+               this.myLoginsAppOwner = myLoginsAppOwner;
+       }
+
+       public String getAppBasicAuthUsername() {
+               return appBasicAuthUsername;
+       }
+
+       public void setAppBasicAuthUsername(String appBasicAuthUsername) {
+               this.appBasicAuthUsername = appBasicAuthUsername;
+       }
+
+       public String getAppBasicAuthPassword() {
+               return appBasicAuthPassword;
+       }
+
+       public void setAppBasicAuthPassword(String appBasicAuthPassword) {
+               this.appBasicAuthPassword = appBasicAuthPassword;
+       }
+
+       public String getThumbnail() {
+               return thumbnail;
+       }
+
+       public void setThumbnail(String thumbnail) {
+               this.thumbnail = thumbnail;
+       }
+
+       public String getUebTopicName() {
+               return uebTopicName;
+       }
+
+       public void setUebTopicName(String uebTopicName) {
+               this.uebTopicName = uebTopicName;
+       }
+
+       public String getUebKey() {
+               return uebKey;
+       }
+
+       public void setUebKey(String uebKey) {
+               this.uebKey = uebKey;
+       }
+
+       public String getUebSecret() {
+               return uebSecret;
+       }
+
+       public void setUebSecret(String uebSecret) {
+               this.uebSecret = uebSecret;
+       }
+
+       public Boolean getRestrictedApp() {
+               return restrictedApp;
+       }
+
        public void setRestrictedApp(Boolean restrictedApp) {
                this.restrictedApp = restrictedApp;
        }
-}
 
+       public Boolean getRolesInAAF() {
+               return rolesInAAF;
+       }
+
+       public void setRolesInAAF(Boolean rolesInAAF) {
+               this.rolesInAAF = rolesInAAF;
+       }
+
+       public String getNameSpace() {
+               return nameSpace;
+       }
+
+       public void setNameSpace(String nameSpace) {
+               this.nameSpace = nameSpace;
+       }
+
+       public String getModeOfIntegration() {
+               return modeOfIntegration;
+       }
+
+       public void setModeOfIntegration(String modeOfIntegration) {
+               this.modeOfIntegration = modeOfIntegration;
+       }
+
+       public Boolean getAppAck() {
+               return appAck;
+       }
+
+       public void setAppAck(Boolean appAck) {
+               this.appAck = appAck;
+       }
+
+       public Boolean getUsesCadi() {
+               return usesCadi;
+       }
+
+       public void setUsesCadi(Boolean usesCadi) {
+               this.usesCadi = usesCadi;
+       }
+
+       public String getApplicationType() {
+               return applicationType;
+       }
+
+       public void setApplicationType(String applicationType) {
+               this.applicationType = applicationType;
+       }
+       
+       public Integer appTypePersistedValue() {
+               switch (this.getApplicationType()) {
+               case EpAppType.GUI_STR:
+                       return EpAppType.GUI;
+               case EpAppType.HYPERLINK_STR:
+                       return EpAppType.HYPERLINK;
+               case EpAppType.NONGUI_STR:
+                       return EpAppType.NONGUI;
+               default:
+                       return 0;
+               }
+       }
+}
index aad47c0..a564355 100644 (file)
@@ -35,14 +35,14 @@ public class OnboardingAppTest {
                oba.setUebTopicName("topicName");
                oba.setRestrictedApp(false);
                oba2.normalize();
-               oba.name="test";
-               oba.appPassword="pass";
-               oba.username="username";
+               oba.setAppName("test");
+               oba.setAppBasicAuthPassword("pass");
+               oba.setAppBasicAuthUsername("username");
                oba.normalize();
-               assertEquals("test", oba.name);
-               assertEquals("key", oba.uebKey);
-               assertEquals("secret", oba.uebSecret);
-               assertEquals(false, oba.restrictedApp);
+               assertEquals("test", oba.getAppName());
+               assertEquals("key", oba.getUebKey());
+               assertEquals("secret", oba.getUebSecret());
+               assertEquals(false, oba.getRestrictedApp());
                
        }