summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-widget-ms
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-widget-ms')
-rw-r--r--ecomp-portal-widget-ms/.gitignore36
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/approx-portal-usage.zipbin90114 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count.zipbin52363 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count2.zipbin90872 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/widget_events.zipbin1504004 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/widget_news.zipbin1503954 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/1702-widgets/widget_resources.zipbin1504661 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/README.md223
-rw-r--r--ecomp-portal-widget-ms/common-widgets/.gitignore5
-rw-r--r--ecomp-portal-widget-ms/common-widgets/assembly-descriptor-events.xml23
-rw-r--r--ecomp-portal-widget-ms/common-widgets/assembly-descriptor-news.xml23
-rw-r--r--ecomp-portal-widget-ms/common-widgets/assembly-descriptor-resources.xml23
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js64
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/markup/markup.html49
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/styles/app-widget-1-by-3.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/generic.pngbin0 -> 208 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/grips.pngbin0 -> 951 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/styles/styles.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js60
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/markup/markup.html21
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget-1-by-3.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/generic.pngbin0 -> 208 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/grips.pngbin0 -> 951 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/style.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/styles/styles.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/pom.xml79
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js60
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/markup/markup.html21
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget-1-by-3.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/generic.pngbin0 -> 208 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/grips.pngbin0 -> 951 bytes
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/style.css43
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/styles/styles.css43
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage.zipbin5017 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage2.zipbin5062 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/ccd_widget.zipbin1502265 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/daily-app-usage-count.zipbin4962 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/events-widget.zipbin1501585 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/news-widget.zipbin1502150 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/dashboard-widgets/resources-widget.zipbin1502662 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/java0
-rw-r--r--ecomp-portal-widget-ms/pom.xml184
-rw-r--r--ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java102
-rw-r--r--ecomp-portal-widget-ms/src/main/resources/events-widget.zipbin1501585 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/src/main/resources/news-widget.zipbin1502150 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/src/main/resources/resources-widget.zipbin1502662 -> 0 bytes
-rw-r--r--ecomp-portal-widget-ms/widget-ms/.gitignore39
-rw-r--r--ecomp-portal-widget-ms/widget-ms/README.md189
-rw-r--r--ecomp-portal-widget-ms/widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx (renamed from ecomp-portal-widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx)bin92934 -> 92934 bytes
-rw-r--r--ecomp-portal-widget-ms/widget-ms/pom.xml170
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/certificates/be1/widget-keystore.p12 (renamed from ecomp-portal-widget-ms/src/main/certificates/be1/widget-keystore.p12)bin2614 -> 2614 bytes
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/certificates/be2/widget-keystore.p12 (renamed from ecomp-portal-widget-ms/src/main/certificates/be2/widget-keystore.p12)bin2614 -> 2614 bytes
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/docker/Dockerfile (renamed from ecomp-portal-widget-ms/src/main/docker/Dockerfile)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java)1
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java)2
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java)3
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java)2
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java)1
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java)6
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java)2
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java)1
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java)89
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java)1
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java)242
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java)3
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java (renamed from ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java110
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties (renamed from ecomp-portal-widget-ms/src/main/resources/application-properties)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated (renamed from ecomp-portal-widget-ms/src/main/resources/application.properties.templated)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js (renamed from ecomp-portal-widget-ms/src/main/resources/framework-template.js)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml (renamed from ecomp-portal-widget-ms/src/main/resources/logback.xml)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html (renamed from ecomp-portal-widget-ms/src/main/resources/templates/Upload.html)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html (renamed from ecomp-portal-widget-ms/src/main/resources/templates/widgetsPage.html)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12 (renamed from ecomp-portal-widget-ms/src/main/resources/widget-keystore.p12)bin2638 -> 2638 bytes
-rwxr-xr-xecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh (renamed from ecomp-portal-widget-ms/src/main/resources/widget_ms_start.sh)0
-rwxr-xr-xecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh (renamed from ecomp-portal-widget-ms/src/main/resources/widget_ms_stop.sh)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java (renamed from ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java (renamed from ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java (renamed from ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/testadd.txt (renamed from ecomp-portal-widget-ms/testadd.txt)0
-rw-r--r--ecomp-portal-widget-ms/widget-ms/website.url (renamed from ecomp-portal-widget-ms/website.url)bin103 -> 103 bytes
97 files changed, 1575 insertions, 689 deletions
diff --git a/ecomp-portal-widget-ms/.gitignore b/ecomp-portal-widget-ms/.gitignore
index 172a425c..f151f08a 100644
--- a/ecomp-portal-widget-ms/.gitignore
+++ b/ecomp-portal-widget-ms/.gitignore
@@ -1,39 +1,5 @@
.classpath
.project
+/.settings/
/bin/
target/
-logs/
-DEV_HOME_IS_UNDEFINED/
-!.mvn/wrapper/maven-wrapper.jar
-
-### STS ###
-.apt_generated
-.factorypath
-.settings
-.springBeans
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-nbproject/private/
-build/
-nbbuild/
-dist/
-nbdist/
-.nb-gradle/
-
-/target/
-/catalina.base_IS_UNDEFINED/
-.mvn
-.settings/
-.springBeans
-bin/
-debug-logs/
-logs/
-/application.properties
-mvnw
-mvnw.cmd
diff --git a/ecomp-portal-widget-ms/1702-widgets/approx-portal-usage.zip b/ecomp-portal-widget-ms/1702-widgets/approx-portal-usage.zip
deleted file mode 100644
index 9f7eca41..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/approx-portal-usage.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count.zip b/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count.zip
deleted file mode 100644
index ce37c653..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count2.zip b/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count2.zip
deleted file mode 100644
index 142b412b..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/daily-app-usage-count2.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/1702-widgets/widget_events.zip b/ecomp-portal-widget-ms/1702-widgets/widget_events.zip
deleted file mode 100644
index 380a5868..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/widget_events.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/1702-widgets/widget_news.zip b/ecomp-portal-widget-ms/1702-widgets/widget_news.zip
deleted file mode 100644
index 532cf610..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/widget_news.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/1702-widgets/widget_resources.zip b/ecomp-portal-widget-ms/1702-widgets/widget_resources.zip
deleted file mode 100644
index e9de9c48..00000000
--- a/ecomp-portal-widget-ms/1702-widgets/widget_resources.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/README.md b/ecomp-portal-widget-ms/README.md
index b2424dd3..aef8c901 100644
--- a/ecomp-portal-widget-ms/README.md
+++ b/ecomp-portal-widget-ms/README.md
@@ -1,220 +1,5 @@
-# Portl Widget Microservice
+# Portal Widget Microservice
-For security, the server listens only on localhost (127.0.0.1) and requires HTTP Basic
-Authentication. Because no network traffic is accepted or processed (packets never leave
-the host). Currently, the server uses a self signed certificate - details below.
-
-## Build Prerequisites
-
-1. Java version 1.8
-2. Maven version 3
-3. Connectivity to AT&T Maven Central
-
-## Run Prerequisites
-
-1. Java version 1.8
-2. A Mysql database using the same database as the Portal
-
-## Build and Package
-
-Use maven to build and package the microservice into a jar using this command:
-
- mvn clean package
-
-## Configuring
-
-All configuration parameters are entered in a file called application.properties. A version with default values can be found in the top level of this project.
-
-Details about the database are configured in this file. The default entries for the database configuration are shown here:
-
- spring.datasource.url=jdbc:mariadb:failover://{db_host:db_port/{portal_db}
- spring.datasource.username={username}
- spring.datasource.password=ENC({encrypted_password})
-
-The HTTP server's username and password are configured in this file. Only one username/password is used to secure the REST endpoint. The default entries for the server are shown here:
-
- security.user.name={basic_auth_username}
- security.user.password=ENC({encrypted_basic_auth_password})
-
-When you package the application into a jar file and launch the microservice using that jar, the configuration file must be in the current working directory where you launch the service.
-
-## Generating Encrypted Passwords
-
-Use the following command to generate an encrypted password for the database and the
-micro service. The entire command must be entered on one line; the command shown
-below uses backslashes to break lines for readability:
-
- java -cp ~/.m2/repository/org/jasypt/jasypt/1.9.2/jasypt-1.9.2.jar \
- org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
- algorithm=PBEWithMD5AndDES \
- input='YourPasswordHere' \
- password='EncryptionKey'
-
-Note, 'YourPasswordHere' is the actual database password, as supplied in the 'password'
-parameter. The value 'EncryptionKey' is used to encrypt the input, and must be supplied
-at run time in one of two ways:
-
-* On the command line with a JVM argument "-Djasypt.encryptor.password". Here's an example
-of using maven with the Spring-Boot goal:
-
- mvn -Djasypt.encryptor.password=EncryptionKey spring-boot:run
-
-Here's an example of using java and the jar file:
-
- java -jar dbc-microservice.jar -Djasypt.encryptor.password=EncryptionKey
-
-* In the application.properties file using the key jasypt.encryptor.password. For example:
-
- jasypt.encryptor.password=EncryptionKey
-
-## Development Launch
-
-Check the configuration properties in file src/main/resources/application.properties. Then launch the microservice for development and testing like this:
-
- mvn clean spring-boot:run
-
-## Production Launch
-
-Ensure a valid configuration is present in file application.properties in the current working directory. Then launch the microservice for production like this:
-
- widget-service.sh start
-
-## Supported Methods
-
-This micro service supports the following methods. All can be accessed with a web browser
-or a REST client such as Postman.
-
-## Generating Encrypted Passwords
-
-Use the following command to generate an encrypted password for the database and the
-micro service. The entire command must be entered on one line; the command shown
-below uses backslashes to break lines for readability:
-
- java -cp ~/.m2/repository/org/jasypt/jasypt/1.9.2/jasypt-1.9.2.jar \
- org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
- algorithm=PBEWithMD5AndDES \
- input='YourPasswordHere' \
- password='EncryptionKey'
-
-Note, 'YourPasswordHere' is the actual database password, as supplied in the 'password'
-parameter. The value 'EncryptionKey' is used to encrypt the input, and must be supplied
-at run time in one of two ways:
-
-* On the command line with a JVM argument "-Djasypt.encryptor.password". Here's an example
-of using maven with the Spring-Boot goal:
-
- mvn -Djasypt.encryptor.password=EncryptionKey spring-boot:run
-
-Here's an example of using java and the jar file:
-
- java -jar dbc-microservice.jar -Djasypt.encryptor.password=EncryptionKey
-
-* In the application.properties file using the key jasypt.encryptor.password. For example:
-
- jasypt.encryptor.password=EncryptionKey
-
-## Release Notes
-
-### Release 1702, February 2017
-
-#### Consul Release Notes
-
-Build 1702.3.48, 5 Feb 2017
-- DE264319 - Corrected spelling for output file from 'consule.out' to 'consul.out' - Please do not miss re-deploying consul build. Widget-ms build is not enough (or required) for this bug fix to be validated.
-
-#### Widget-ms Release Notes
-
-Build 1.2.145
-- Def 143148 - fixed the defect, common widgets work on Firefox version 45
-- Def 142432 - Widget-ms: InputStream is not getting closed in file StorageServiceImpl.java
-
-Build 1.2.140
-- St 164888 allow partner applications to trigger a new app tab through portal
-- St 164847 CCD Widgets
-- Def 141951 Fixed the issue for inappropriate location of framework-template.js file
-- Def 141352 Widget Onboarding Page, download icon is not clickable in FF 45 version, Revise widget upload service temporary storage to /tmp
-- St 164902 One copy of framework.js hidden in the Portal instead of being part of the widgets
-- St 164905 Download the widget
-- St 164711 Widget Personalization: Allow user to define his/her own parameters on widgets
-- St 164863 Widgets to use service onboarding feature
-
-Build 1702.3.86
-- MariaDB connector / failover fix
-
-Build 1702.3.79, 10 Feb 2017
-- Updated application.properties to correct database schema name from dbca to portal
-- US799260 appended complete hostname to widget certificate for irvine
-- US799260 appended complete hostname to consul config.json file in prod1 and prod2
-- US799260 fixed the bar chart issue on devn1, the bar chart shows up on devn1 Home Page
-
-Build 1702.3.78, 9 Feb 2017
-- US799260 fixed the firefox compatibility issue; and y-scales issue in bar chart
-- US799260 Added the three new widgets in dashboard-widgets folder; removed all testing logs in all widgets; fixed a bug in widget-test
-
-Build 1702.3.75, 07 Feb 2017
-DE267061 - Removed a hardcoded intance of loginId used in the query.
-
-Build 1702.3.73, 06 Feb 2017
-DE267061 - Fixed - user should only see widgets that were uploaded against app/roles that they have OR if they were uploaded by checking All Users checkbox.
-Build 1702.3.71, 5 Feb 2017
-- Important Note: Copied all these build notes from Portal WebApp to here (widget-ms) - in order not to confuse folks, we have removed Portal's build numbers for these notes. Going forward, will add widget-ms's own build number. Also note that we've changed the version series in POM.xml from 1702.0 to 1702.3 in pom.xml - Although Jenkins/SWM overrides and doesn't care about maven's versioning, but did this to synch with what Portal Web App POM.
-- DE261560 Portal App: Widgets MS logs are not getting rolled over
-- DE261655 Unable to delete standard widgets
-- DE262487 EP-Portal App: News widget not adapting when tile size is changed by user
-- DE257516 Common widgets reload in a single tab
-- DE262505 Upload Duplicate Widget Issue
-- DE262610 Widget Microservice logging is not following EELF guidelines
-- DE262800 Issues with widget name this requires database modifications
-- DE263090 Issues with widget roles
-- US799260 BE now 'discovers' widget-service using Consul. If consul is not running, it fallbacks to the current implemenation which is https://localhost and the port of your choosing in system.properties - Ex: localhost:8082
-- US799260 Fix delete feature for the three special widgets news, events, resources widget can have spaces in its name
-- US799260 Widget feature:
- + Add the editing feature in widgetOnboarding page
- + Move widget catalog and onboarding to new directories
-- US811188 Log / Audit widgets logging in DB
-- US818934 Allow basic authentication
-- US814730 Make news / Events and Resources as widgets
-- US827836 Portal Widget Framework
-
-## Contact
-
-Ikram Ikramullah
-
-## Certificate
-
-### Create self signed certificate
-
-1. Create a self signed certificate for the microservice
-keytool -genkey -alias widget-microservice -storetype PKCS12 -keyalg RSA -keystore widget-keystore.p12
-
-### Import into client's trust store
-
-1. Export certificate from microservice's keystore - default password is 'microservice'
-keytool -exportcert -keystore widget-keystore.p12 -alias widget-microservice -file widget-cert.cer
-
-2. Import the exported certificate of microservice from step 1 and import it into Portal JRE's cacerts file. The location of this file is %JRE%/lib/secuirty/cacerts.
-
-keytool -import -trustcacerts -keystore "C:\Program Files\Java\jre1.8.0_91\lib\security\cacerts" -noprompt -alias widget-microservice -file widget-cert.cer
-
-OR
-;
-keytool -import -trustcacerts -keystore /usr/local/add-on/jdk1.8.0_60/jre/lib/security/ -noprompt -alias widget-microservice -file widget-cert.cer
-
-### Runing on http (not https)
-
-If the intent is to run this microservice without https i.e run on plain http, comment out (put a leading #) infront of all properties in 'Certificate Properties' section of application.properties - these properties are
-
-server.ssl.key-store=classpath:widget-keystore.p12
-server.ssl.key-store-password=ENC(DiIYnAMab4u7rEW2yKhF9zBL00uU55q8)
-server.ssl.keyStoreType=PKCS12
-server.ssl.keyAlias=widget-microservice
-
-## Running service in docker
-
-a). Build docker image: mvn docker:build
-b). Run the service in docker: docker run -p <port>:<port-in> -t <image-name>
-c). Check running docker containers: docker ps
-
-## Migration Instruction
-1. Due to changes in the existing tables, the user will have to remove all the existing widgets in 1702 release
-2. Re-upload the latest version of widgets under dashboard-widgets folder
+This directory holds the ONAP Portal Widget Microservice.
+Subdirectory dashboard-widgets-os has widgets suitable for open-source use,
+and subdirectory widget-ms has the Spring-Boot application that is the service.
diff --git a/ecomp-portal-widget-ms/common-widgets/.gitignore b/ecomp-portal-widget-ms/common-widgets/.gitignore
new file mode 100644
index 00000000..f151f08a
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/.gitignore
@@ -0,0 +1,5 @@
+.classpath
+.project
+/.settings/
+/bin/
+target/
diff --git a/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-events.xml b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-events.xml
new file mode 100644
index 00000000..0ed3c98a
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-events.xml
@@ -0,0 +1,23 @@
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 "
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+ http://maven.apache.org/xsd/assembly-1.1.2.xsd ">
+ <!-- second part of the final zip archive name -->
+ <id>widget</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>events-widget/**</include>
+ </includes>
+ <!-- silence warning about filesystem-root relative reference -->
+ <outputDirectory>${file.separator}</outputDirectory>
+ <filtered>true</filtered>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-news.xml b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-news.xml
new file mode 100644
index 00000000..93797b66
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-news.xml
@@ -0,0 +1,23 @@
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 "
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+ http://maven.apache.org/xsd/assembly-1.1.2.xsd ">
+ <!-- second part of the final zip archive name -->
+ <id>widget</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>news-widget/**</include>
+ </includes>
+ <!-- silence warning about filesystem-root relative reference -->
+ <outputDirectory>${file.separator}</outputDirectory>
+ <filtered>true</filtered>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-resources.xml b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-resources.xml
new file mode 100644
index 00000000..e584a81b
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/assembly-descriptor-resources.xml
@@ -0,0 +1,23 @@
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 "
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+ http://maven.apache.org/xsd/assembly-1.1.2.xsd ">
+ <!-- second part of the final zip archive name -->
+ <id>widget</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>resources-widget/**</include>
+ </includes>
+ <!-- silence warning about filesystem-root relative reference -->
+ <outputDirectory>${file.separator}</outputDirectory>
+ <filtered>true</filtered>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js
new file mode 100644
index 00000000..8ccebeee
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js
@@ -0,0 +1,64 @@
+function EventsCtrl($rootScope, applicationsService , $log,
+ $window, userProfileService, $scope, $cookies, $timeout, $interval,
+ $uibModal, dashboardService, ngDialog) {
+ var _this = this;
+
+ //activate spinner
+ this.isLoading = true;
+ $scope.getUserAppsIsDone = false;
+ this.userProfileService = userProfileService;
+ $scope.demoNum = 1;
+ $scope.event_content_show = false;
+ $scope.widgetData = [];
+
+ $scope.editWidgetModalPopup = function(availableData, resourceType) {
+
+ $scope.editData = JSON.stringify(availableData);
+ $scope.availableDataTemp = $scope.availableData;
+ ngDialog.open({
+ templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
+ controller : 'CommonWidgetController',
+ resolve : {
+ message : function message() {
+ var message = {
+ type : resourceType,
+ availableData : $scope.editData
+ };
+ return message;
+ }
+ }
+ }).closePromise.then(needUpdate => {
+ if(resourceType=='NEWS'){
+ $scope.updateNews();
+ }else if(resourceType=='EVENTS'){
+ $scope.updateEvents();
+ }else if(resourceType=='IMPORTANTRESOURCES'){
+ $scope.updateImportRes();
+ }
+ });
+ };
+ /*Setting News data*/
+ $scope.eventData = [];
+ $scope.updateEvents = function() {
+
+ $scope.eventData.length=0;
+ //dashboardService.getCommonWidgetData('EVENTS').then(function(res) {
+ var eventDataJsonArray = res.response.items;
+ for (var i = 0; i < eventDataJsonArray.length; i++) {
+ if(eventDataJsonArray[i].eventDate !=null) {
+ // yyyy-mm-dd
+ eventDataJsonArray[i].year = eventDataJsonArray[i].eventDate.substring(2,4);
+ eventDataJsonArray[i].mon = eventDataJsonArray[i].eventDate.substring(5,7);
+ eventDataJsonArray[i].day = eventDataJsonArray[i].eventDate.substring(8,10);
+ }
+ $scope.eventData.push(eventDataJsonArray[i]);
+ }
+ //})['catch'](function(err) {
+ // $log.error('dashboard controller: failed to get Events list', err);
+ // _this.isLoading = false;
+ //});
+ }
+ $scope.updateEvents();
+
+
+ }
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/markup/markup.html b/ecomp-portal-widget-ms/common-widgets/events-widget/markup/markup.html
new file mode 100644
index 00000000..39715547
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/markup/markup.html
@@ -0,0 +1,49 @@
+<div id="widget-events" ng-controller="EventsCtrl" class="widget-news-main">
+ <div att-gridster-item-body
+ class="information-section-gridsterContent">
+ <div class="events">
+ <ul ng-show="eventData.length!=0">
+ <li ng-repeat="event in eventData">
+ <div ng-click="event_content_show=!event_content_show">
+ <div class="events-date">{{event.mon}}/{{event.day}}/{{event.year}}
+ </div>
+ <div>
+ <div class="event-title-div">
+ <p ng-bind="event.title"></p>
+ </div>
+ <div>
+ <span class="icon-chevron-up" ng-if="event_content_show"
+ style="color: #888; font-size: 22px;"></span> <span
+ class="icon-chevron-down" ng-if="!event_content_show"
+ style="color: #888; font-size: 22px;"></span>
+
+ </div>
+ <div style="clear: both;"></div>
+ </div>
+ </div>
+ <div class="events-content" ng-show="event_content_show">
+ <div class="events-content-body">
+ <a id="event-widget-{{event.id}}" class="events-link" ng-href="{{event.href}}"
+ target="_blank"> <span ng-bind="event.content"></span>
+ </a>
+ </div>
+ <div></div>
+ </div>
+ </li>
+
+
+ </ul>
+ <div ng-hide="eventData.length!=0">
+ <div class="activity-error-container"
+ style="background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;">
+ <div class="activity-error-block">
+ <i class="icon-information full-linear-icon-information"
+ style="margin-left: 125px; font-size: 90px"></i> <br>
+ <div class="activity-error-msg1">There's currently no
+ event available.</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/styles/app-widget-1-by-3.css b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/app-widget-1-by-3.css
new file mode 100644
index 00000000..53ac5c82
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/app-widget-1-by-3.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#stork-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/generic.png b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/generic.png
new file mode 100644
index 00000000..5f06bc2e
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/generic.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/grips.png b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/grips.png
new file mode 100644
index 00000000..29b92cc5
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/images/grips.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/styles/styles.css b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/styles.css
new file mode 100644
index 00000000..b2fbe871
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/styles/styles.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#events-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js
new file mode 100644
index 00000000..13133339
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js
@@ -0,0 +1,60 @@
+function NewsCtrl($rootScope, applicationsService , $log,
+ $window, userProfileService, $scope, $cookies, $timeout, $interval,
+ $uibModal, dashboardService, ngDialog) {
+
+ var _this = this;
+
+ //activate spinner
+ this.isLoading = true;
+ $scope.getUserAppsIsDone = false;
+ this.userProfileService = userProfileService;
+ $scope.demoNum = 1;
+ $scope.event_content_show = false;
+ $scope.widgetData = [];
+
+ $scope.editWidgetModalPopup = function(availableData, resourceType) {
+
+ $scope.editData = JSON.stringify(availableData);
+ $scope.availableDataTemp = $scope.availableData;
+ ngDialog.open({
+ templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
+ controller : 'CommonWidgetController',
+ resolve : {
+ message : function message() {
+ var message = {
+ type : resourceType,
+ availableData : $scope.editData
+ };
+ return message;
+ }
+ }
+ }).closePromise.then(needUpdate => {
+ if(resourceType=='NEWS'){
+ $scope.updateNews();
+ }else if(resourceType=='EVENTS'){
+ $scope.updateEvents();
+ }else if(resourceType=='IMPORTANTRESOURCES'){
+ $scope.updateImportRes();
+ }
+ });
+ };
+
+ /*Setting News data*/
+ $scope.newsData = [];
+ $scope.updateNews = function() {
+ $scope.newsData.length=0;
+ //dashboardService.getCommonWidgetData('NEWS').then(function(res) {
+ // $log.info(res.message);
+ var newsDataJsonArray = res.response.items;
+ for (var i = 0; i < newsDataJsonArray.length; i++) {
+ $scope.newsData.push(newsDataJsonArray[i]);
+ }
+ //})['catch'](function(err) {
+ // $log.error('dashboard controller: failed to get news list', err);
+ // _this.isLoading = false;
+ //});
+ }
+ $scope.updateNews();
+
+ }
+
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/markup/markup.html b/ecomp-portal-widget-ms/common-widgets/news-widget/markup/markup.html
new file mode 100644
index 00000000..c7d2df44
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/markup/markup.html
@@ -0,0 +1,21 @@
+<div id="widget-news" ng-controller="NewsCtrl" class="widget-news-main">
+ <div att-gridster-item-body class="information-section-gridsterContent">
+ <div class="resources">
+ <ul ng-show="newsData.length!=0">
+ <li ng-repeat="item in newsData"><a id="new-widget-{{item.id}}"
+ href="{{item.href}}" target="_blank" ng-bind="item.title"></a></li>
+ </ul>
+ <div ng-hide="newsData.length!=0">
+ <div class="activity-error-container"
+ style="background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;">
+ <div class="activity-error-block">
+ <i class="icon-information full-linear-icon-information"
+ style="margin-left: 125px; font-size: 90px"></i> <br>
+ <div class="activity-error-msg1">There's currently no
+ news available.</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget-1-by-3.css b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget-1-by-3.css
new file mode 100644
index 00000000..53ac5c82
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget-1-by-3.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#stork-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget.css b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget.css
new file mode 100644
index 00000000..0fbc8758
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/app-widget.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#stork-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/generic.png b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/generic.png
new file mode 100644
index 00000000..5f06bc2e
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/generic.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/grips.png b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/grips.png
new file mode 100644
index 00000000..29b92cc5
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/images/grips.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/style.css b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/style.css
new file mode 100644
index 00000000..e7c07d59
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/style.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/styles/styles.css b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/styles.css
new file mode 100644
index 00000000..e7c07d59
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/styles/styles.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml
new file mode 100644
index 00000000..a71c5ac5
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.portal</groupId>
+ <artifactId>widget-ms-widgets-os</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <!-- <version>2.4</version> -->
+ <executions>
+ <execution>
+ <id>events</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptor>assembly-descriptor-events.xml</descriptor>
+ <!-- final zip archive name -->
+ <finalName>events-widget</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ <execution>
+ <id>news</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptor>assembly-descriptor-news.xml</descriptor>
+ <!-- final zip archive name -->
+ <finalName>news-widget</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ <execution>
+ <id>resources</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptor>assembly-descriptor-resources.xml</descriptor>
+ <!-- final zip archive name -->
+ <finalName>resources-widget</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- No deployment step for this project -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js
new file mode 100644
index 00000000..13133339
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js
@@ -0,0 +1,60 @@
+function NewsCtrl($rootScope, applicationsService , $log,
+ $window, userProfileService, $scope, $cookies, $timeout, $interval,
+ $uibModal, dashboardService, ngDialog) {
+
+ var _this = this;
+
+ //activate spinner
+ this.isLoading = true;
+ $scope.getUserAppsIsDone = false;
+ this.userProfileService = userProfileService;
+ $scope.demoNum = 1;
+ $scope.event_content_show = false;
+ $scope.widgetData = [];
+
+ $scope.editWidgetModalPopup = function(availableData, resourceType) {
+
+ $scope.editData = JSON.stringify(availableData);
+ $scope.availableDataTemp = $scope.availableData;
+ ngDialog.open({
+ templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
+ controller : 'CommonWidgetController',
+ resolve : {
+ message : function message() {
+ var message = {
+ type : resourceType,
+ availableData : $scope.editData
+ };
+ return message;
+ }
+ }
+ }).closePromise.then(needUpdate => {
+ if(resourceType=='NEWS'){
+ $scope.updateNews();
+ }else if(resourceType=='EVENTS'){
+ $scope.updateEvents();
+ }else if(resourceType=='IMPORTANTRESOURCES'){
+ $scope.updateImportRes();
+ }
+ });
+ };
+
+ /*Setting News data*/
+ $scope.newsData = [];
+ $scope.updateNews = function() {
+ $scope.newsData.length=0;
+ //dashboardService.getCommonWidgetData('NEWS').then(function(res) {
+ // $log.info(res.message);
+ var newsDataJsonArray = res.response.items;
+ for (var i = 0; i < newsDataJsonArray.length; i++) {
+ $scope.newsData.push(newsDataJsonArray[i]);
+ }
+ //})['catch'](function(err) {
+ // $log.error('dashboard controller: failed to get news list', err);
+ // _this.isLoading = false;
+ //});
+ }
+ $scope.updateNews();
+
+ }
+
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/markup/markup.html b/ecomp-portal-widget-ms/common-widgets/resources-widget/markup/markup.html
new file mode 100644
index 00000000..ce27632e
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/markup/markup.html
@@ -0,0 +1,21 @@
+<div id="widget-news" ng-controller="NewsCtrl" class="widget-news-main">
+ <div att-gridster-item-body class="information-section-gridsterContent">
+ <div class="resources">
+ <ul ng-show="newsData.length!=0">
+ <li ng-repeat="item in newsData"><a id="resource-widget-{{item.id}}"
+ href="{{item.href}}" target="_blank" ng-bind="item.title"></a></li>
+ </ul>
+ <div ng-hide="newsData.length!=0">
+ <div class="activity-error-container"
+ style="background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;">
+ <div class="activity-error-block">
+ <i class="icon-information full-linear-icon-information"
+ style="margin-left: 125px; font-size: 90px"></i> <br>
+ <div class="activity-error-msg1">There's currently no
+ news available.</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget-1-by-3.css b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget-1-by-3.css
new file mode 100644
index 00000000..53ac5c82
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget-1-by-3.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#stork-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget.css b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget.css
new file mode 100644
index 00000000..0fbc8758
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/app-widget.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#stork-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/generic.png b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/generic.png
new file mode 100644
index 00000000..5f06bc2e
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/generic.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/grips.png b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/grips.png
new file mode 100644
index 00000000..29b92cc5
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/images/grips.png
Binary files differ
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/style.css b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/style.css
new file mode 100644
index 00000000..e7c07d59
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/style.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/styles.css b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/styles.css
new file mode 100644
index 00000000..e7c07d59
--- /dev/null
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/styles/styles.css
@@ -0,0 +1,43 @@
+
+.portal-widget-panel-container {
+ margin-left:150px;
+ width:1500px;
+}
+
+
+.portal-widget-panel-fixed-panel {
+ min-height: 300px;
+ max-height: 1300px;
+ overflow: auto;
+}
+
+.portal-widget-panel-double-middle {
+ min-height: 660px;
+ max-height: 660px;
+ overflow: auto;
+}
+
+.portal-widget-panel-row {
+ margin-right: 0px;
+ margin-left: 0px;
+ width: 2800px;
+}
+
+/*Increases the width of the card/panel */
+.portal-widget-panel-panel-default {
+ width:450px
+}
+
+/*Controls the spacing between the cards */
+.portal-widget-panel-col-sm-3 {
+ width:20.5%
+}
+
+.portal-widget-panel-top {
+ top: 15px;
+ left: 15px;
+}
+
+#-css-ready {
+color: #bada55 !important;
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage.zip b/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage.zip
deleted file mode 100644
index ce0f1a89..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage2.zip b/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage2.zip
deleted file mode 100644
index 3d31a00f..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/approx-portal-usage2.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/ccd_widget.zip b/ecomp-portal-widget-ms/dashboard-widgets/ccd_widget.zip
deleted file mode 100644
index 03b4f76f..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/ccd_widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/daily-app-usage-count.zip b/ecomp-portal-widget-ms/dashboard-widgets/daily-app-usage-count.zip
deleted file mode 100644
index ab023cb4..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/daily-app-usage-count.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/events-widget.zip b/ecomp-portal-widget-ms/dashboard-widgets/events-widget.zip
deleted file mode 100644
index bddee8ec..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/events-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/news-widget.zip b/ecomp-portal-widget-ms/dashboard-widgets/news-widget.zip
deleted file mode 100644
index 2d367c89..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/news-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/dashboard-widgets/resources-widget.zip b/ecomp-portal-widget-ms/dashboard-widgets/resources-widget.zip
deleted file mode 100644
index d2ada049..00000000
--- a/ecomp-portal-widget-ms/dashboard-widgets/resources-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/java b/ecomp-portal-widget-ms/java
deleted file mode 100644
index e69de29b..00000000
--- a/ecomp-portal-widget-ms/java
+++ /dev/null
diff --git a/ecomp-portal-widget-ms/pom.xml b/ecomp-portal-widget-ms/pom.xml
index 5438ad13..d2c72fb3 100644
--- a/ecomp-portal-widget-ms/pom.xml
+++ b/ecomp-portal-widget-ms/pom.xml
@@ -3,164 +3,30 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openecomp.portal</groupId>
- <artifactId>widget-ms</artifactId>
- <version>1.2</version>
- <packaging>jar</packaging>
- <name>ecompportal-widget-microservice</name>
-
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.4.2.RELEASE</version>
- <relativePath /> <!-- lookup parent from repository -->
- </parent>
-
- <properties>
- <docker.imagename>widget-ms</docker.imagename>
- <docker.host>zlp11313.vci.att.com</docker.host>
- <docker.port>5100</docker.port>
- <docker.namespace>com.att.ecompportal</docker.namespace>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <java.version>1.8</java.version>
- <hibernate.version>4.3.11.Final</hibernate.version>
- <!-- docker.image.prefix>${docker.host}:${docker.port}/${docker.namespace}</docker.image.prefix -->
- <docker.image.prefix>${docker.host}:${docker.port}/${docker.namespace}</docker.image.prefix>
-
- </properties>
-
- <dependencies>
- <dependency>
- <!-- Setup Spring Data JPA Repository support -->
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-configuration-processor</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.10</version>
- </dependency>
-
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
- <groupId>com.github.ulisesbocchio</groupId>
- <artifactId>jasypt-spring-boot-starter</artifactId>
- <version>1.9</version>
- </dependency>
-
- <!--
- hibernate-core depends on dom4j, which has optional dependencies.
- On jenkins, contrary to doc, mvn 3.0.5 packages the optional
- dependencies in the war. Workaround: exclude them explicitly.
- -->
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>1.6.1</version>
- <exclusions>
- <exclusion>
- <groupId>jaxme</groupId>
- <artifactId>jaxme-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- </exclusion>
- <exclusion>
- <groupId>msv</groupId>
- <artifactId>xsdlib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>msv</groupId>
- <artifactId>relaxngDatatype</artifactId>
- </exclusion>
- <exclusion>
- <groupId>pull-parser</groupId>
- <artifactId>pull-parser</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xpp3</groupId>
- <artifactId>xpp3</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
- <build>
-
- <finalName>${project.artifactId}</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.4.11</version>
- <configuration>
- <imageName>${project.artifactId}</imageName>
- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
- <resources>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>${project.build.finalName}.jar</include>
- </resource>
- </resources>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
+ <artifactId>widget-ms-parent</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <!-- Child modules do NOT name this parent. -->
+ <!-- Defined for build convenience only! -->
+ <!-- This POM names only ONAP projects -->
+ <module>common-widgets</module>
+ <module>widget-ms</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <!-- No deployment step for this project -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java b/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java
deleted file mode 100644
index efbfe437..00000000
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.openecomp.portalapp.widget.utils;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.openecomp.portalapp.widget.constant.WidgetConstant;
-import org.openecomp.portalapp.widget.service.impl.StorageServiceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-public class UnzipUtil {
-
- /**
- * Size of the buffer to read/write data
- */
- private static final int BUFFER_SIZE = 4096;
- private static final Logger logger = LoggerFactory.getLogger(UnzipUtil.class);
- /**
- * Extracts a zip file specified by the zipFilePath to a directory specified by
- * destDirectory (will be created if does not exists)
- * @param zipFilePath
- * @param destDirectory
- * @throws IOException
- */
-
- public Map<String, byte[]> unzip_db(String zipFilePath, String destDirectory, String widgetName) throws IOException {
-
- logger.debug("UnzipUtil.unzip_db: unzip widget file {}", widgetName);
- File destDir = new File(destDirectory);
- if (!destDir.exists()) {
- destDir.mkdir();
- }
- ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
- ZipEntry entry = zipIn.getNextEntry();
- Map<String, byte[]> map = new HashMap<>();
-
- map.put(WidgetConstant.WIDGET_CONTROLLER_LOCATION, null);
- map.put(WidgetConstant.WIDGET_MARKUP_LOCATION, null);
- map.put(WidgetConstant.WIDGET_STYLE_LOCATION, null);
-
-
- Stack<File> stack = new Stack<>();
-
- // iterates over entries in the zip file
- while (entry != null) {
- String filePath = destDirectory + File.separator + widgetName + File.separator +
- entry.getName().substring(entry.getName().indexOf("/")+1);
- logger.debug("UnzipUtil.unzip_db: file path " + filePath);
- if (!entry.isDirectory()) {
- // if the entry is a file, extracts it
- logger.debug("UnzipUtil.unzip_db: unzip and save widget file {}", filePath);
- stack.push(new File(filePath));
- extractFile(zipIn, filePath);
- } else {
- // if the entry is a directory, make the directory
- logger.debug("UnzipUtil.unzip_db: unzip and create widget folder {}", filePath);
- File dir = new File(filePath);
- stack.push(new File(filePath));
-
- dir.mkdir();
-
- }
- if(map.containsKey(entry.getName().substring(entry.getName().indexOf("/")+1))){
- map.put(entry.getName().substring(entry.getName().indexOf("/")+1), Files.readAllBytes(Paths.get(filePath)));
- }
- zipIn.closeEntry();
- entry = zipIn.getNextEntry();
- }
- zipIn.close();
- while(!stack.isEmpty())
- stack.pop().delete();
- return map;
- }
-
-
-
-
- /**
- * Extracts a zip entry (file entry)
- * @param zipIn
- * @param filePath
- * @throws IOException
- */
- private void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
- byte[] bytesIn = new byte[BUFFER_SIZE];
- int read = 0;
- while ((read = zipIn.read(bytesIn)) != -1) {
- bos.write(bytesIn, 0, read);
- }
- bos.close();
- }
-} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/src/main/resources/events-widget.zip b/ecomp-portal-widget-ms/src/main/resources/events-widget.zip
deleted file mode 100644
index bddee8ec..00000000
--- a/ecomp-portal-widget-ms/src/main/resources/events-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/src/main/resources/news-widget.zip b/ecomp-portal-widget-ms/src/main/resources/news-widget.zip
deleted file mode 100644
index 2d367c89..00000000
--- a/ecomp-portal-widget-ms/src/main/resources/news-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/src/main/resources/resources-widget.zip b/ecomp-portal-widget-ms/src/main/resources/resources-widget.zip
deleted file mode 100644
index d2ada049..00000000
--- a/ecomp-portal-widget-ms/src/main/resources/resources-widget.zip
+++ /dev/null
Binary files differ
diff --git a/ecomp-portal-widget-ms/widget-ms/.gitignore b/ecomp-portal-widget-ms/widget-ms/.gitignore
new file mode 100644
index 00000000..172a425c
--- /dev/null
+++ b/ecomp-portal-widget-ms/widget-ms/.gitignore
@@ -0,0 +1,39 @@
+.classpath
+.project
+/bin/
+target/
+logs/
+DEV_HOME_IS_UNDEFINED/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.factorypath
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
+
+/target/
+/catalina.base_IS_UNDEFINED/
+.mvn
+.settings/
+.springBeans
+bin/
+debug-logs/
+logs/
+/application.properties
+mvnw
+mvnw.cmd
diff --git a/ecomp-portal-widget-ms/widget-ms/README.md b/ecomp-portal-widget-ms/widget-ms/README.md
new file mode 100644
index 00000000..ceb9dd2b
--- /dev/null
+++ b/ecomp-portal-widget-ms/widget-ms/README.md
@@ -0,0 +1,189 @@
+# Portal Widget Microservice
+
+For security, the server listens only on localhost (127.0.0.1) and requires HTTP Basic
+Authentication. No outside network traffic is accepted or processed (packets never leave
+the host). Currently, the server uses a self signed certificate - details below.
+
+## Build Prerequisites
+
+1. Java version 1.8
+2. Maven version 3
+3. Connectivity to AT&T Maven Central
+
+## Run Prerequisites
+
+1. Java version 1.8
+2. A Mysql database using the same database as the Portal
+
+## Build and Package
+
+Use maven to build and package the microservice into a jar using this command:
+
+ mvn clean package
+
+## Configuring
+
+All configuration parameters are entered in a file called application.properties. A version with default values can be found in the top level of this project.
+
+Details about the database are configured in this file. The default entries for the database configuration are shown here:
+
+ spring.datasource.url=jdbc:mariadb:failover://{db_host:db_port/{portal_db}
+ spring.datasource.username={username}
+ spring.datasource.password=ENC({encrypted_password})
+
+The HTTP server's username and password are configured in this file. Only one username/password is used to secure the REST endpoint. The default entries for the server are shown here:
+
+ security.user.name={basic_auth_username}
+ security.user.password=ENC({encrypted_basic_auth_password})
+
+When you package the application into a jar file and launch the microservice using that jar, the configuration file must be in the current working directory where you launch the service.
+
+## Generating Encrypted Passwords
+
+Use the following command to generate an encrypted password for the database and the
+micro service. The entire command must be entered on one line; the command shown
+below uses backslashes to break lines for readability:
+
+ java -cp ~/.m2/repository/org/jasypt/jasypt/1.9.2/jasypt-1.9.2.jar \
+ org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
+ algorithm=PBEWithMD5AndDES \
+ input='YourPasswordHere' \
+ password='EncryptionKey'
+
+Note, 'YourPasswordHere' is the actual database password, as supplied in the 'password'
+parameter. The value 'EncryptionKey' is used to encrypt the input, and must be supplied
+at run time in one of two ways:
+
+* On the command line with a JVM argument "-Djasypt.encryptor.password". Here's an example
+of using maven with the Spring-Boot goal:
+
+ mvn -Djasypt.encryptor.password=EncryptionKey spring-boot:run
+
+Here's an example of using java and the jar file:
+
+ java -jar dbc-microservice.jar -Djasypt.encryptor.password=EncryptionKey
+
+* In the application.properties file using the key jasypt.encryptor.password. For example:
+
+ jasypt.encryptor.password=EncryptionKey
+
+## Development Launch
+
+Check the configuration properties in file src/main/resources/application.properties. Then launch the microservice for development and testing like this:
+
+ mvn clean spring-boot:run
+
+## Production Launch
+
+Ensure a valid configuration is present in file application.properties in the current working directory. Then launch the microservice for production like this:
+
+ widget-service.sh start
+
+## Release Notes
+
+### Release 1702, February 2017
+
+#### Consul Release Notes
+
+Build 1702.3.48, 5 Feb 2017
+- DE264319 - Corrected spelling for output file from 'consule.out' to 'consul.out' - Please do not miss re-deploying consul build. Widget-ms build is not enough (or required) for this bug fix to be validated.
+
+#### Widget-ms Release Notes
+
+Build 1.2.175
+- Def 120258 Fixed the widget displaying issues in Internet Explorer 11
+
+Build 1.2.145
+- Def 143148 - fixed the defect, common widgets work on Firefox version 45
+- Def 142432 - Widget-ms: InputStream is not getting closed in file StorageServiceImpl.java
+
+Build 1.2.140
+- St 164888 allow partner applications to trigger a new app tab through portal
+- St 164847 CCD Widgets
+- Def 141951 Fixed the issue for inappropriate location of framework-template.js file
+- Def 141352 Widget Onboarding Page, download icon is not clickable in FF 45 version, Revise widget upload service temporary storage to /tmp
+- St 164902 One copy of framework.js hidden in the Portal instead of being part of the widgets
+- St 164905 Download the widget
+- St 164711 Widget Personalization: Allow user to define his/her own parameters on widgets
+- St 164863 Widgets to use service onboarding feature
+
+Build 1702.3.86
+- MariaDB connector / failover fix
+
+Build 1702.3.79, 10 Feb 2017
+- Updated application.properties to correct database schema name from dbca to portal
+- US799260 appended complete hostname to widget certificate for irvine
+- US799260 appended complete hostname to consul config.json file in prod1 and prod2
+- US799260 fixed the bar chart issue on devn1, the bar chart shows up on devn1 Home Page
+
+Build 1702.3.78, 9 Feb 2017
+- US799260 fixed the firefox compatibility issue; and y-scales issue in bar chart
+- US799260 Added the three new widgets in dashboard-widgets folder; removed all testing logs in all widgets; fixed a bug in widget-test
+
+Build 1702.3.75, 07 Feb 2017
+DE267061 - Removed a hardcoded intance of loginId used in the query.
+
+Build 1702.3.73, 06 Feb 2017
+DE267061 - Fixed - user should only see widgets that were uploaded against app/roles that they have OR if they were uploaded by checking All Users checkbox.
+Build 1702.3.71, 5 Feb 2017
+- Important Note: Copied all these build notes from Portal WebApp to here (widget-ms) - in order not to confuse folks, we have removed Portal's build numbers for these notes. Going forward, will add widget-ms's own build number. Also note that we've changed the version series in POM.xml from 1702.0 to 1702.3 in pom.xml - Although Jenkins/SWM overrides and doesn't care about maven's versioning, but did this to synch with what Portal Web App POM.
+- DE261560 Portal App: Widgets MS logs are not getting rolled over
+- DE261655 Unable to delete standard widgets
+- DE262487 EP-Portal App: News widget not adapting when tile size is changed by user
+- DE257516 Common widgets reload in a single tab
+- DE262505 Upload Duplicate Widget Issue
+- DE262610 Widget Microservice logging is not following EELF guidelines
+- DE262800 Issues with widget name this requires database modifications
+- DE263090 Issues with widget roles
+- US799260 BE now 'discovers' widget-service using Consul. If consul is not running, it fallbacks to the current implemenation which is https://localhost and the port of your choosing in system.properties - Ex: localhost:8082
+- US799260 Fix delete feature for the three special widgets news, events, resources widget can have spaces in its name
+- US799260 Widget feature:
+ + Add the editing feature in widgetOnboarding page
+ + Move widget catalog and onboarding to new directories
+- US811188 Log / Audit widgets logging in DB
+- US818934 Allow basic authentication
+- US814730 Make news / Events and Resources as widgets
+- US827836 Portal Widget Framework
+
+## Contact
+
+Ikram Ikramullah
+
+## Certificate
+
+### Create self signed certificate
+
+1. Create a self signed certificate for the microservice
+keytool -genkey -alias widget-microservice -storetype PKCS12 -keyalg RSA -keystore widget-keystore.p12
+
+### Import into client's trust store
+
+1. Export certificate from microservice's keystore - default password is 'microservice'
+keytool -exportcert -keystore widget-keystore.p12 -alias widget-microservice -file widget-cert.cer
+
+2. Import the exported certificate of microservice from step 1 and import it into Portal JRE's cacerts file. The location of this file is %JRE%/lib/secuirty/cacerts.
+
+keytool -import -trustcacerts -keystore "C:\Program Files\Java\jre1.8.0_91\lib\security\cacerts" -noprompt -alias widget-microservice -file widget-cert.cer
+
+OR
+;
+keytool -import -trustcacerts -keystore /usr/local/add-on/jdk1.8.0_60/jre/lib/security/ -noprompt -alias widget-microservice -file widget-cert.cer
+
+### Runing on http (not https)
+
+If the intent is to run this microservice without https i.e run on plain http, comment out (put a leading #) infront of all properties in 'Certificate Properties' section of application.properties - these properties are
+
+server.ssl.key-store=classpath:widget-keystore.p12
+server.ssl.key-store-password=ENC(DiIYnAMab4u7rEW2yKhF9zBL00uU55q8)
+server.ssl.keyStoreType=PKCS12
+server.ssl.keyAlias=widget-microservice
+
+## Running service in docker
+
+a). Build docker image: mvn docker:build
+b). Run the service in docker: docker run -p <port>:<port-in> -t <image-name>
+c). Check running docker containers: docker ps
+
+## Migration Instruction
+1. Due to changes in the existing tables, the user will have to remove all the existing widgets in 1702 release
+2. Re-upload the latest version of widgets under dashboard-widgets folder
diff --git a/ecomp-portal-widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx b/ecomp-portal-widget-ms/widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx
index 683b1e92..683b1e92 100644
--- a/ecomp-portal-widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx
+++ b/ecomp-portal-widget-ms/widget-ms/docs/Deployment Guide Portal Microservices and Consul.docx
Binary files differ
diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml
new file mode 100644
index 00000000..14820b65
--- /dev/null
+++ b/ecomp-portal-widget-ms/widget-ms/pom.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.portal</groupId>
+ <artifactId>widget-ms</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>widget-microservice</name>
+
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>1.4.2.RELEASE</version>
+ <relativePath /> <!-- lookup parent from repository -->
+ </parent>
+
+ <properties>
+ <docker.imagename>widget-ms</docker.imagename>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <java.version>1.8</java.version>
+ <hibernate.version>4.3.11.Final</hibernate.version>
+ <skipTests>true</skipTests>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <!-- Setup Spring Data JPA Repository support -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <!-- <version>${hibernate.version}</version> -->
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <!-- <version>1.10</version> -->
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <!-- <version>1.5.8</version> -->
+ </dependency>
+ <dependency>
+ <groupId>com.github.ulisesbocchio</groupId>
+ <artifactId>jasypt-spring-boot-starter</artifactId>
+ <version>1.9</version>
+ </dependency>
+ <!-- hibernate-core depends on dom4j, which has optional dependencies.
+ On jenkins, contrary to doc, mvn 3.0.5 packages the optional dependencies
+ in the war. Workaround: exclude them explicitly. -->
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <!-- <version>1.6.1</version> -->
+ <exclusions>
+ <exclusion>
+ <groupId>jaxme</groupId>
+ <artifactId>jaxme-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>msv</groupId>
+ <artifactId>xsdlib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>msv</groupId>
+ <artifactId>relaxngDatatype</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>pull-parser</groupId>
+ <artifactId>pull-parser</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <finalName>${project.artifactId}</finalName>
+
+ <!-- To add resources, must name all including usual src/main/resources -->
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>../common-widgets/target</directory>
+ <includes>
+ <include>**/*.zip</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.4.11</version>
+ <configuration>
+ <imageName>${project.artifactId}</imageName>
+ <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+ <resources>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>${project.build.finalName}.jar</include>
+ </resource>
+ </resources>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/ecomp-portal-widget-ms/src/main/certificates/be1/widget-keystore.p12 b/ecomp-portal-widget-ms/widget-ms/src/main/certificates/be1/widget-keystore.p12
index 9dcdb1a0..9dcdb1a0 100644
--- a/ecomp-portal-widget-ms/src/main/certificates/be1/widget-keystore.p12
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/certificates/be1/widget-keystore.p12
Binary files differ
diff --git a/ecomp-portal-widget-ms/src/main/certificates/be2/widget-keystore.p12 b/ecomp-portal-widget-ms/widget-ms/src/main/certificates/be2/widget-keystore.p12
index 600dc01d..600dc01d 100644
--- a/ecomp-portal-widget-ms/src/main/certificates/be2/widget-keystore.p12
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/certificates/be2/widget-keystore.p12
Binary files differ
diff --git a/ecomp-portal-widget-ms/src/main/docker/Dockerfile b/ecomp-portal-widget-ms/widget-ms/src/main/docker/Dockerfile
index 7e25c222..7e25c222 100644
--- a/ecomp-portal-widget-ms/src/main/docker/Dockerfile
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/docker/Dockerfile
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java
index eb1e7844..6516c364 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java
@@ -2,7 +2,6 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java
index 3cd95b8e..b1a939b1 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java
@@ -1,7 +1,5 @@
package org.openecomp.portalapp.widget.constant;
-import java.io.File;
-
public final class WidgetConstant {
public static final String WIDGET_MARKUP_LOCATION = "markup/markup.html";
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java
index eac8b37b..ec32e42f 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java
@@ -5,7 +5,6 @@ import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.openecomp.portalapp.widget.domain.ValidationRespond;
import org.openecomp.portalapp.widget.service.StorageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -14,9 +13,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
@Controller
public class DatabaseFileUploadController {
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java
index fc324ab1..fc324ab1 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java
index e801a256..1af5a3cc 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java
@@ -143,7 +143,7 @@ public class WidgetsCatalogController {
}
} catch (Exception e) {
- logger.error("Exception occurred while performing WidgetsCatalogController.saveWidgetCatalog in widget microservices. Details:" + e.getMessage());
+ logger.error("Exception occurred while performing WidgetsCatalogController.saveWidgetCatalog in widget microservices. Details:", e);
}
return respond;
}
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java
index 0a950c54..0a950c54 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java
index 19c6311b..19c6311b 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java
index 831b1e65..831b1e65 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java
index 9f19c0d4..9f19c0d4 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java
index 93fa9963..ca73f313 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java
@@ -13,7 +13,6 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
-import javax.persistence.PreRemove;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java
index 25c74af1..25c74af1 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java
index a4491997..6b7823e6 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java
@@ -19,7 +19,6 @@ import javax.persistence.Transient;
@Entity
@Table(name="EP_WIDGET_CATALOG")
public class WidgetCatalog{
- private static final long serialVersionUID = 1L;
@Id
@Column(name = "widget_id")
@@ -128,7 +127,8 @@ public class WidgetCatalog{
@Override
public String toString() {
- return "WidgetCatalog [name=" + name + ", desc=" + desc + ", allowAllUser=" + allowAllUser + "]";
+ return "WidgetCatalog [id=" + id + ", name=" + name + ", desc=" + desc + ", fileLocation=" + fileLocation
+ + ", allowAllUser=" + allowAllUser + ", serviceId=" + serviceId + ", sortOrder=" + sortOrder
+ + ", statusCode=" + statusCode + ", widgetRoles=" + widgetRoles + "]";
}
-
}
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java
index 7eb3c1ef..7eb3c1ef 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java
index 65b71454..65b71454 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java
index 44fb7286..44fb7286 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java
index 2fdb5480..2fdb5480 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java
index a376da0a..a376da0a 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java
index 3516196b..25eadfa7 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java
@@ -28,7 +28,7 @@ public class WidgetEventListener implements ApplicationListener<ApplicationReady
if(Boolean.parseBoolean(init_default_widget))
initializationService.initialize();
} catch (Exception e) {
- logger.error("Exception occurred while performing WidgetsCatalogController.initializeWidgetCatalog in widget microservices. Details:" + e.getMessage());
+ logger.error("onApplicationEvent: InitializationService#initialize failed", e);
}
}
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java
index 4a34606a..4a34606a 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java
index 32eb48b1..32eb48b1 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java
index 1eb14704..1eb14704 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java
index 82853dcd..e9bd0f33 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java
@@ -2,7 +2,6 @@ package org.openecomp.portalapp.widget.service;
import java.util.List;
-import org.openecomp.portalapp.widget.domain.RoleApp;
import org.openecomp.portalapp.widget.domain.WidgetCatalog;
public interface WidgetCatalogService {
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java
index 31635f74..7a45d71e 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java
@@ -8,7 +8,6 @@ import java.util.HashSet;
import javax.transaction.Transactional;
-import org.openecomp.portalapp.widget.controller.WidgetsCatalogController;
import org.openecomp.portalapp.widget.domain.MicroserviceData;
import org.openecomp.portalapp.widget.domain.MicroserviceParameter;
import org.openecomp.portalapp.widget.domain.RoleApp;
@@ -24,49 +23,51 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
+/**
+ * Uploads widget zip archives to Portal.
+ */
@Service("initService")
@Transactional
@org.springframework.context.annotation.Configuration
@EnableAspectJAutoProxy
-public class InitializationServiceImpl implements InitializationService{
-
+public class InitializationServiceImpl implements InitializationService {
+
private static final String BASIC_AUTH = "Basic Authentication";
private static final String PARAMETER_KEY = "resourceType";
- private static final Logger logger = LoggerFactory.getLogger(WidgetsCatalogController.class);
-
+ private static final Logger logger = LoggerFactory.getLogger(InitializationServiceImpl.class);
+
@Autowired
WidgetCatalogService widgetCatalogService;
-
+
@Autowired
StorageService storageService;
-
+
@Autowired
MicroserviceService microserviceService;
-
+
@Value("${account.user.name}")
String account_user;
-
+
@Value("${account.user.password}")
String account_password;
-
+
@Value("${initialization.widgetData.url}")
String widgetData_url;
-
+
@Override
public void initialize() {
initCommonWidget("News");
initCommonWidget("Events");
initCommonWidget("Resources");
}
-
- private void initCommonWidget(String name){
-
+
+ private void initCommonWidget(String name) {
+
final String newServiceName = name + " Microservice";
- final String newWidgetName = name + " Widget";
-
+
Long serviceId = microserviceService.getMicroserviceIdByName(newServiceName);
-
- if(serviceId == null){
+
+ if (serviceId == null) {
MicroserviceData newService = new MicroserviceData();
newService.setName(newServiceName);
newService.setDesc(name);
@@ -77,30 +78,29 @@ public class InitializationServiceImpl implements InitializationService{
newService.setPassword(account_password);
newService.setActive("Y");
serviceId = microserviceService.saveMicroserivce(newService);
-
-
+
MicroserviceParameter parameter = new MicroserviceParameter();
parameter.setServiceId(serviceId);
parameter.setPara_key(PARAMETER_KEY);
String parameter_value = null;
- switch(name.toLowerCase()){
- case "news":
- parameter_value = "NEWS";
- break;
- case "events":
- parameter_value = "EVENTS";
- break;
- case "resources":
- parameter_value = "IMPORTANTRESOURCES";
- break;
+ switch (name.toLowerCase()) {
+ case "news":
+ parameter_value = "NEWS";
+ break;
+ case "events":
+ parameter_value = "EVENTS";
+ break;
+ case "resources":
+ parameter_value = "IMPORTANTRESOURCES";
+ break;
}
parameter.setPara_value(parameter_value);
microserviceService.saveMicroserviceParameter(parameter);
}
-
- if(!widgetCatalogService.getWidgetIdByName(newWidgetName)){
+
+ if (!widgetCatalogService.getWidgetIdByName(name)) {
WidgetCatalog newWidget = new WidgetCatalog();
- newWidget.setName(newWidgetName);
+ newWidget.setName(name);
newWidget.setDesc(name);
newWidget.setAllowAllUser("1");
String fileLocation = name.toLowerCase() + "-widget.zip";
@@ -108,21 +108,26 @@ public class InitializationServiceImpl implements InitializationService{
newWidget.setServiceId(serviceId);
newWidget.setWidgetRoles(new HashSet<RoleApp>());
long widgetId = widgetCatalogService.saveWidgetCatalog(newWidget);
-
- File file = new File("/tmp/" + fileLocation);
- try{
-
- InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream(fileLocation);
- OutputStream outputStream = new FileOutputStream(file);
+
+ File tmpZipFile = new File("/tmp/" + fileLocation);
+ InputStream fileInputStream = null;
+ OutputStream outputStream = null;
+ try {
+ fileInputStream = this.getClass().getClassLoader().getResourceAsStream(fileLocation);
+ outputStream = new FileOutputStream(tmpZipFile);
int read = 0;
byte[] bytes = new byte[4096];
while ((read = fileInputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
- }catch(Exception e){
- logger.error("Exception occurred while performing InitializationServiceImpl.initCommonWidget in widget microservices. Details:" + e.getMessage());
+ outputStream.close();
+ fileInputStream.close();
+ } catch (Exception e) {
+ logger.error(
+ "Exception occurred while performing InitializationServiceImpl.initCommonWidget in widget microservices. Details:", e);
}
- storageService.initSave(file, newWidget, widgetId);
+ storageService.initSave(tmpZipFile, newWidget, widgetId);
+ tmpZipFile.delete();
}
}
}
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java
index 395d4283..80c45a2e 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java
@@ -11,7 +11,6 @@ import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.openecomp.portalapp.widget.domain.MicroserviceData;
import org.openecomp.portalapp.widget.domain.MicroserviceParameter;
-import org.openecomp.portalapp.widget.domain.WidgetCatalog;
import org.openecomp.portalapp.widget.service.MicroserviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java
index 046b5ac4..f459ffc4 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java
@@ -1,14 +1,11 @@
package org.openecomp.portalapp.widget.service.impl;
-import java.io.BufferedInputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
@@ -24,7 +21,6 @@ import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.openecomp.portalapp.widget.constant.WidgetConstant;
-import org.openecomp.portalapp.widget.controller.DatabaseFileUploadController;
import org.openecomp.portalapp.widget.domain.ValidationRespond;
import org.openecomp.portalapp.widget.domain.WidgetCatalog;
import org.openecomp.portalapp.widget.domain.WidgetFile;
@@ -43,20 +39,21 @@ import org.springframework.web.multipart.MultipartFile;
public class StorageServiceImpl implements StorageService {
private static final Logger logger = LoggerFactory.getLogger(StorageServiceImpl.class);
-
+
@Autowired
private SessionFactory sessionFactory;
@Autowired
WidgetCatalogService widgetCatalogService;
-
+
@Override
@Transactional
public void deleteWidgetFile(long widgetId) {
WidgetFile widgetFile = getWidgetFile(widgetId);
logger.debug("StorageServiceImpl.deleteWidgetFile: deleting widget file {}", widgetId);
- if (widgetFile == null){
- logger.debug("StorageServiceImpl.deleteWidgetFile: No widget file found in database while performing StorageServiceImpl.deleteWidgetFile.");
+ if (widgetFile == null) {
+ logger.debug(
+ "StorageServiceImpl.deleteWidgetFile: No widget file found in database while performing StorageServiceImpl.deleteWidgetFile.");
return;
}
Session session = sessionFactory.getCurrentSession();
@@ -64,7 +61,7 @@ public class StorageServiceImpl implements StorageService {
session.delete(widgetFile);
tx.commit();
}
-
+
@Override
@SuppressWarnings("unchecked")
@Transactional
@@ -81,9 +78,9 @@ public class StorageServiceImpl implements StorageService {
widgetFile = widgetFiles.get(0);
return widgetFile;
}
-
+
@Override
- public ValidationRespond checkZipFile(MultipartFile file){
+ public ValidationRespond checkZipFile(MultipartFile file) {
StringBuilder error_msg = new StringBuilder();
UnzipUtil unzipper = new UnzipUtil();
Map<String, byte[]> map;
@@ -96,8 +93,10 @@ public class StorageServiceImpl implements StorageService {
}
try {
if (file.isEmpty()) {
- logger.error("StorageServiceImpl.checkZipFile: Failed to store empty file " + file.getOriginalFilename());
- throw new StorageException("StorageServiceImpl.checkZipFile: Failed to store empty file " + file.getOriginalFilename());
+ logger.error(
+ "StorageServiceImpl.checkZipFile: Failed to store empty file " + file.getOriginalFilename());
+ throw new StorageException(
+ "StorageServiceImpl.checkZipFile: Failed to store empty file " + file.getOriginalFilename());
}
String fileLocation = file.getOriginalFilename();
logger.debug("StorageServiceImpl.checkZipFile: store the widget to:" + fileLocation);
@@ -109,23 +108,24 @@ public class StorageServiceImpl implements StorageService {
convFile.delete();
} catch (IOException e) {
logger.error("StorageServiceImpl.checkZipFile: Failed to store file " + file.getOriginalFilename(), e);
- throw new StorageException("torageServiceImpl.checkZipFile: Failed to store file " + file.getOriginalFilename(), e);
+ throw new StorageException(
+ "torageServiceImpl.checkZipFile: Failed to store file " + file.getOriginalFilename(), e);
}
-
- for(byte[] b: map.values()){
- if(isValid && b == null){
+
+ for (byte[] b : map.values()) {
+ if (isValid && b == null) {
isValid = false;
error_msg.append(WidgetConstant.VALIDATION_MESSAGE_FILES);
break;
}
}
- return new ValidationRespond(isValid, error_msg.toString());
+ return new ValidationRespond(isValid, error_msg.toString());
}
-
+
@Override
@Transactional
public void save(MultipartFile file, WidgetCatalog newWidget, long widgetId) {
-
+
UnzipUtil unzipper = new UnzipUtil();
Map<String, byte[]> map;
File convFile;
@@ -148,15 +148,14 @@ public class StorageServiceImpl implements StorageService {
}
saveHelper(newWidget, widgetId, map);
}
-
-
+
@Override
@Transactional
public void initSave(File file, WidgetCatalog newWidget, long widgetId) {
-
+
UnzipUtil unzipper = new UnzipUtil();
Map<String, byte[]> map;
-
+
try {
String fileLocation = file.getPath();
logger.debug("StorageServiceImpl.save: store the widget to:" + fileLocation);
@@ -165,27 +164,27 @@ public class StorageServiceImpl implements StorageService {
logger.error("StorageServiceImpl.save: Failed to store file " + file.getName(), e);
throw new StorageException("Failed to store file " + file.getName(), e);
}
+
saveHelper(newWidget, widgetId, map);
}
-
-
+
/**
- * Helper method for saving widget files (controller.js, framework.js, markup.html and style.css)
- * to ep_widget_catalog_files table in database
+ * Helper method for saving widget files (controller.js, framework.js,
+ * markup.html and style.css) to ep_widget_catalog_files table in database
*
* @param newWidget
* @param widgetId
* @param map
*/
- private void saveHelper(WidgetCatalog newWidget, long widgetId, Map<String, byte[]> map){
-
+ private void saveHelper(WidgetCatalog newWidget, long widgetId, Map<String, byte[]> map) {
+
+ logger.debug("Going to save widget " + newWidget);
WidgetFile widgetFile = new WidgetFile();
widgetFile.setName(newWidget.getName());
widgetFile.setWidgetId(widgetId);
-
-
+
InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream("framework-template.js");
-
+
String sb = null;
try {
byte[] bytes = new byte[fileInputStream.available()];
@@ -200,65 +199,71 @@ public class StorageServiceImpl implements StorageService {
fileInputStream.close();
} catch (IOException e) {
logger.error("StorageServiceImpl.update: Failed to close the fileInputStream ", e);
- e.printStackTrace();
}
}
}
-
-
+
String namespace = "Portal" + widgetId + "Widget";
String controllerName = "Portal" + widgetId + "Ctrl";
String cssName = "portal" + widgetId + "-css-ready";
String colorArg1 = "color: #fff";
- String framework = sb
- .replaceAll("ARUGMENT1", namespace)
- .replaceAll("ARUGMENT2", controllerName)
- .replaceAll("ARUGMENT3", cssName)
- .replaceAll("CSS_ARG1", colorArg1)
+ String framework = sb.replaceAll("ARUGMENT1", namespace).replaceAll("ARUGMENT2", controllerName)
+ .replaceAll("ARUGMENT3", cssName).replaceAll("CSS_ARG1", colorArg1)
.replaceAll("MICROSERVICE_ID", newWidget.getServiceId().toString())
.replaceAll("WIDGET_ID", Long.toString(widgetId));
-
+
widgetFile.setFramework(framework.getBytes());
-
- String javascript = new String(map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION));
- String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")")+1);
+
+ final byte[] controllerLoc = map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+ if (controllerLoc == null || controllerLoc.length == 0)
+ throw new IllegalArgumentException(
+ "Map is missing required key " + WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+ String javascript = new String(controllerLoc);
+ String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")") + 1);
String functionName = functionHeader.substring(functionHeader.indexOf(" "), functionHeader.indexOf("(")).trim();
javascript = javascript.replaceFirst(functionName, controllerName);
- String functionParam = functionHeader.substring(functionHeader.indexOf("(")+1, functionHeader.indexOf(")"));
+ String functionParam = functionHeader.substring(functionHeader.indexOf("(") + 1, functionHeader.indexOf(")"));
List<String> paramList = Arrays.asList(functionParam.split(","));
-
+
int left_bracket_index = javascript.indexOf("{") + 1;
String widgetData = namespace + "=" + namespace + "||{};" + "var res = " + namespace + ".widgetData;";
- javascript = javascript.substring(0, left_bracket_index) + widgetData + javascript.substring(left_bracket_index);
-
+ javascript = javascript.substring(0, left_bracket_index) + widgetData
+ + javascript.substring(left_bracket_index);
+
StringBuilder injectStr = new StringBuilder().append("[");
- for(int i = 0; i < paramList.size(); i++){
- if(i == paramList.size()-1)
+ for (int i = 0; i < paramList.size(); i++) {
+ if (i == paramList.size() - 1)
injectStr.append("'" + paramList.get(i).trim() + "'];");
else
injectStr.append("'" + paramList.get(i).trim() + "',");
}
- javascript = namespace + ".controller = " + javascript + ";" + namespace + ".controller.$inject = " + injectStr.toString();
-
- String html = new String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName, controllerName);;
-
+ javascript = namespace + ".controller = " + javascript + ";" + namespace + ".controller.$inject = "
+ + injectStr.toString();
+
+ String html = new String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName,
+ controllerName);
+ ;
+
Pattern cssPattern = Pattern.compile("#.*-css-ready");
Matcher cssMatcher = cssPattern.matcher(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION)));
- if (cssMatcher.find( )) {
- widgetFile.setCss(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION)).replace(cssMatcher.group(0), "#" + cssName).getBytes());
+ if (cssMatcher.find()) {
+ widgetFile.setCss(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION))
+ .replace(cssMatcher.group(0), "#" + cssName).getBytes());
}
-
+
widgetFile.setMarkup(html.getBytes());
widgetFile.setController(javascript.getBytes());
Session session = sessionFactory.openSession();
session.save(widgetFile);
session.flush();
session.close();
- //sessionFactory.getCurrentSession().save(widgetFile);
- logger.debug("StorageServiceImpl.save: saved fraemwork.js controller.js, markup.html and style.css files to the database for widget {}", widgetId);
-
+ // sessionFactory.getCurrentSession().save(widgetFile);
+ logger.debug(
+ "StorageServiceImpl.save: saved fraemwork.js controller.js, markup.html and style.css files to the database for widget {}",
+ widgetId);
+
}
-
+
@Override
public void update(MultipartFile file, WidgetCatalog newWidget, long widgetId) {
UnzipUtil unzipper = new UnzipUtil();
@@ -279,10 +284,11 @@ public class StorageServiceImpl implements StorageService {
convFile.delete();
} catch (IOException e) {
logger.error("StorageServiceImpl.update: Failed to store file " + file.getOriginalFilename(), e);
- throw new StorageException("StorageServiceImpl.update: Failed to store file " + file.getOriginalFilename(), e);
+ throw new StorageException("StorageServiceImpl.update: Failed to store file " + file.getOriginalFilename(),
+ e);
}
WidgetFile widgetFile = getWidgetFile(widgetId);
-
+
InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream("framework-template.js");
String sb = null;
try {
@@ -302,61 +308,64 @@ public class StorageServiceImpl implements StorageService {
}
}
}
-
+
String namespace = "Portal" + widgetId + "Widget";
String controllerName = "Portal" + widgetId + "Ctrl";
String cssName = "portal" + widgetId + "-css-ready";
String colorArg1 = "color: #fff";
- String framework = sb
- .replaceAll("ARUGMENT1", namespace)
- .replaceAll("ARUGMENT2", controllerName)
- .replaceAll("ARUGMENT3", cssName)
- .replaceAll("CSS_ARG1", colorArg1)
+ String framework = sb.replaceAll("ARUGMENT1", namespace).replaceAll("ARUGMENT2", controllerName)
+ .replaceAll("ARUGMENT3", cssName).replaceAll("CSS_ARG1", colorArg1)
.replaceAll("MICROSERVICE_ID", newWidget.getServiceId().toString())
.replaceAll("WIDGET_ID", Long.toString(widgetId));
widgetFile.setFramework(framework.getBytes());
-
+
String javascript = new String(map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION));
- String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")")+1);
+ String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")") + 1);
String functionName = functionHeader.substring(functionHeader.indexOf(" "), functionHeader.indexOf("(")).trim();
javascript = javascript.replaceFirst(functionName, controllerName);
- String functionParam = functionHeader.substring(functionHeader.indexOf("(")+1, functionHeader.indexOf(")"));
+ String functionParam = functionHeader.substring(functionHeader.indexOf("(") + 1, functionHeader.indexOf(")"));
List<String> paramList = Arrays.asList(functionParam.split(","));
-
+
int left_bracket_index = javascript.indexOf("{") + 1;
String widgetData = namespace + "=" + namespace + "||{};" + "var res = " + namespace + ".widgetData;";
- javascript = javascript.substring(0, left_bracket_index) + widgetData + javascript.substring(left_bracket_index);
-
+ javascript = javascript.substring(0, left_bracket_index) + widgetData
+ + javascript.substring(left_bracket_index);
+
StringBuilder injectStr = new StringBuilder().append("[");
- for(int i = 0; i < paramList.size(); i++){
- if(i == paramList.size()-1)
+ for (int i = 0; i < paramList.size(); i++) {
+ if (i == paramList.size() - 1)
injectStr.append("'" + paramList.get(i).trim() + "'];");
else
injectStr.append("'" + paramList.get(i).trim() + "',");
}
- javascript = namespace + ".controller = " + javascript + ";" + namespace + ".controller.$inject = " + injectStr.toString();
-
- String html = new String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName, controllerName);;
-
+ javascript = namespace + ".controller = " + javascript + ";" + namespace + ".controller.$inject = "
+ + injectStr.toString();
+
+ String html = new String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName,
+ controllerName);
+ ;
+
Pattern cssPattern = Pattern.compile("#.*-css-ready");
Matcher cssMatcher = cssPattern.matcher(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION)));
- if (cssMatcher.find( )) {
- widgetFile.setCss(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION)).replace(cssMatcher.group(0), "#" + cssName).getBytes());
+ if (cssMatcher.find()) {
+ widgetFile.setCss(new String(map.get(WidgetConstant.WIDGET_STYLE_LOCATION))
+ .replace(cssMatcher.group(0), "#" + cssName).getBytes());
}
-
+
widgetFile.setMarkup(html.getBytes());
widgetFile.setController(javascript.getBytes());
- //widgetFile.setCss(map.get(WidgetConstant.WIDGET_STYLE_LOCATION));
+ // widgetFile.setCss(map.get(WidgetConstant.WIDGET_STYLE_LOCATION));
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.update(widgetFile);
tx.commit();
session.flush();
session.close();
- logger.debug("StorageServiceImpl.save: updated fraemwork.js controller.js, markup.html and style.css files to the database for widget {}", widgetId);
+ logger.debug(
+ "StorageServiceImpl.save: updated fraemwork.js controller.js, markup.html and style.css files to the database for widget {}",
+ widgetId);
}
-
@Override
@SuppressWarnings("unchecked")
@Transactional
@@ -367,9 +376,9 @@ public class StorageServiceImpl implements StorageService {
criteria.add(Restrictions.eq("widgetId", widgetId));
List<WidgetFile> widgetFile = criteria.list();
logger.debug("StorageServiceImpl.getWidgetMarkup: getting widget markup result={}", widgetFile);
-
- if(widgetFile.size() > 0 )
- markup = new String(widgetFile.get(0).getMarkup(), "UTF-8");
+
+ if (widgetFile.size() > 0)
+ markup = new String(widgetFile.get(0).getMarkup(), "UTF-8");
return markup;
}
@@ -383,8 +392,8 @@ public class StorageServiceImpl implements StorageService {
criteria.add(Restrictions.eq("widgetId", widgetId));
List<WidgetFile> widgetFile = criteria.list();
logger.debug("StorageServiceImpl.getWidgetController: getting widget controller result={}", widgetFile);
-
- if(widgetFile.size() > 0 )
+
+ if (widgetFile.size() > 0)
controller = new String(widgetFile.get(0).getController(), "UTF-8");
return controller;
}
@@ -399,8 +408,8 @@ public class StorageServiceImpl implements StorageService {
criteria.add(Restrictions.eq("widgetId", widgetId));
List<WidgetFile> widgetFile = criteria.list();
logger.debug("StorageServiceImpl.getWidgetFramework: getting widget framework result={}", widgetFile);
-
- if(widgetFile.size() > 0 )
+
+ if (widgetFile.size() > 0)
framework = new String(widgetFile.get(0).getFramework(), "UTF-8");
return framework;
}
@@ -415,24 +424,21 @@ public class StorageServiceImpl implements StorageService {
criteria.add(Restrictions.eq("widgetId", widgetId));
List<WidgetFile> widgetFile = criteria.list();
logger.debug("StorageServiceImpl.getWidgetCSS: getting widget css result={}", widgetFile);
-
- if(widgetFile.size() > 0 )
+
+ if (widgetFile.size() > 0)
css = new String(widgetFile.get(0).getCss(), "UTF-8");
return css;
}
-
-
+
@Override
@Transactional
- public byte[] getWidgetCatalogContent(long widgetId) throws Exception{
-
-
+ public byte[] getWidgetCatalogContent(long widgetId) throws Exception {
+
WidgetCatalog widget = widgetCatalogService.getWidgetCatalog(widgetId);
String namespace = "Portal" + widgetId + "Widget";
String controllerName = "Portal" + widgetId + "Ctrl";
String cssName = "portal" + widgetId + "-css-ready";
-
-
+
String styles = getWidgetCSS(widgetId).replaceAll(cssName, widget.getName() + "-css-ready");
File f = File.createTempFile("temp", ".zip");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
@@ -442,36 +448,36 @@ public class StorageServiceImpl implements StorageService {
out.putNextEntry(e);
byte[] data = styles.getBytes();
out.write(data, 0, data.length);
-
String widgetData = namespace + "=" + namespace + "||{};" + "var res = " + namespace + ".widgetData;";
- String javascript = getWidgetController(widgetId).replace(widgetData, "")
- .replace(namespace + ".controller =", "");
-
- String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")")+1);
+ String javascript = getWidgetController(widgetId).replace(widgetData, "").replace(namespace + ".controller =",
+ "");
+
+ String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")") + 1);
javascript = javascript.replaceFirst(controllerName, widget.getName() + "Ctrl");
- String functionParam = functionHeader.substring(functionHeader.indexOf("(")+1, functionHeader.indexOf(")"));
+ String functionParam = functionHeader.substring(functionHeader.indexOf("(") + 1, functionHeader.indexOf(")"));
StringBuilder injectStr = new StringBuilder().append("[");
List<String> paramList = Arrays.asList(functionParam.split(","));
- for(int i = 0; i < paramList.size(); i++){
- if(i == paramList.size()-1)
+ for (int i = 0; i < paramList.size(); i++) {
+ if (i == paramList.size() - 1)
injectStr.append("'" + paramList.get(i).trim() + "'];");
else
injectStr.append("'" + paramList.get(i).trim() + "',");
}
javascript = javascript.replace(";" + namespace + ".controller.$inject = " + injectStr.toString(), "");
-
+
e = new ZipEntry(widget.getName() + "/js/controller.js");
out.putNextEntry(new ZipEntry(widget.getName() + "/js/"));
out.putNextEntry(e);
data = javascript.getBytes();
out.write(data, 0, data.length);
-
+
String html = getWidgetMarkup(widgetId).replaceFirst(controllerName, widget.getName() + "Ctrl");
-
- //new String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName, controllerName);;
-
-
+
+ // new
+ // String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName,
+ // controllerName);;
+
e = new ZipEntry(widget.getName() + "/markup/markup.html");
out.putNextEntry(new ZipEntry(widget.getName() + "/markup/"));
out.putNextEntry(e);
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
index 700274e2..51f78227 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
@@ -57,9 +57,12 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
.append(" ep_widget_catalog w, ")
.append(" ep_widget_catalog_role wr, ")
.append(" fn_user_role ur, ")
+ .append(" fn_app app, ")
.append(" fn_user u ")
.append(" where ")
.append(" w.widget_id = wr.WIDGET_ID and ")
+ .append(" ur.app_id = app.app_id and ")
+ .append(" app.enabled = 'Y' and ")
.append(" wr.role_id = ur.role_id and ")
.append(" ur.user_id = u.user_id and ")
.append(" u.login_id = '" + loginName + "' and (w.all_user_flag = 'N' or w.all_user_flag is null) ")
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java
index f25f0db6..f25f0db6 100644
--- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java
new file mode 100644
index 00000000..1d61d587
--- /dev/null
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java
@@ -0,0 +1,110 @@
+package org.openecomp.portalapp.widget.utils;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Stack;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.openecomp.portalapp.widget.constant.WidgetConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UnzipUtil {
+
+ /**
+ * Size of the buffer to read/write data
+ */
+ private static final int BUFFER_SIZE = 4096;
+ private static final Logger logger = LoggerFactory.getLogger(UnzipUtil.class);
+
+ /**
+ * Extracts a zip file specified by the zipFilePath to a directory specified by
+ * destDirectory (will be created if does not exists)
+ *
+ * @param zipFilePath
+ * path
+ * @param destDirectory
+ * directory
+ * @param widgetName
+ * name
+ * @return Map of contents
+ * @throws IOException
+ * On error
+ */
+ public Map<String, byte[]> unzip_db(String zipFilePath, String destDirectory, String widgetName)
+ throws IOException {
+
+ logger.debug("UnzipUtil.unzip_db: unzip widget file {}", widgetName);
+ File destDir = new File(destDirectory);
+ if (!destDir.exists())
+ destDir.mkdir();
+ ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
+ ZipEntry entry = zipIn.getNextEntry();
+ Map<String, byte[]> map = new HashMap<>();
+
+ String[] requiredKeys = { WidgetConstant.WIDGET_CONTROLLER_LOCATION, WidgetConstant.WIDGET_MARKUP_LOCATION,
+ WidgetConstant.WIDGET_STYLE_LOCATION };
+ for (String k : requiredKeys)
+ map.put(k, null);
+
+ // iterates over entries in the zip file
+ Stack<File> stack = new Stack<>();
+ while (entry != null) {
+ String filePath = destDirectory + File.separator + widgetName + File.separator
+ + entry.getName().substring(entry.getName().indexOf("/") + 1);
+ final String entryShortName = entry.getName().substring(entry.getName().indexOf("/") + 1);
+ logger.debug("UnzipUtil.unzip_db: file path {}, short name {}", filePath, entryShortName);
+ if (!entry.isDirectory()) {
+ // if the entry is a file, extracts it
+ logger.debug("UnzipUtil.unzip_db: unzip and save widget file {}", filePath);
+ stack.push(new File(filePath));
+ extractFile(zipIn, filePath);
+ } else {
+ // if the entry is a directory, make the directory
+ logger.debug("UnzipUtil.unzip_db: unzip and create widget folder {}", filePath);
+ File dir = new File(filePath);
+ stack.push(new File(filePath));
+ dir.mkdir();
+ }
+ // Is this one we need?
+ if (map.containsKey(entryShortName))
+ map.put(entryShortName, Files.readAllBytes(Paths.get(filePath)));
+ zipIn.closeEntry();
+ entry = zipIn.getNextEntry();
+ }
+ zipIn.close();
+ while (!stack.isEmpty())
+ stack.pop().delete();
+
+ for (String k : requiredKeys)
+ if (!map.containsKey(k))
+ logger.warn("UnzipUtil.unzip_db: no zip archive entry found for required key {}", k);
+
+ return map;
+ }
+
+ /**
+ * Extracts a zip entry (file entry)
+ *
+ * @param zipIn
+ * @param filePath
+ * @throws IOException
+ */
+ private void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
+ byte[] bytesIn = new byte[BUFFER_SIZE];
+ int read = 0;
+ while ((read = zipIn.read(bytesIn)) != -1) {
+ bos.write(bytesIn, 0, read);
+ }
+ bos.close();
+ }
+} \ No newline at end of file
diff --git a/ecomp-portal-widget-ms/src/main/resources/application-properties b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties
index 77d2b78d..77d2b78d 100644
--- a/ecomp-portal-widget-ms/src/main/resources/application-properties
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties
diff --git a/ecomp-portal-widget-ms/src/main/resources/application.properties.templated b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated
index ec4803f0..ec4803f0 100644
--- a/ecomp-portal-widget-ms/src/main/resources/application.properties.templated
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated
diff --git a/ecomp-portal-widget-ms/src/main/resources/framework-template.js b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js
index 45350d91..45350d91 100644
--- a/ecomp-portal-widget-ms/src/main/resources/framework-template.js
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js
diff --git a/ecomp-portal-widget-ms/src/main/resources/logback.xml b/ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml
index 204a6598..204a6598 100644
--- a/ecomp-portal-widget-ms/src/main/resources/logback.xml
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml
diff --git a/ecomp-portal-widget-ms/src/main/resources/templates/Upload.html b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html
index a5e7c632..a5e7c632 100644
--- a/ecomp-portal-widget-ms/src/main/resources/templates/Upload.html
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html
diff --git a/ecomp-portal-widget-ms/src/main/resources/templates/widgetsPage.html b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html
index 440f64ca..440f64ca 100644
--- a/ecomp-portal-widget-ms/src/main/resources/templates/widgetsPage.html
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html
diff --git a/ecomp-portal-widget-ms/src/main/resources/widget-keystore.p12 b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12
index b2dd42ff..b2dd42ff 100644
--- a/ecomp-portal-widget-ms/src/main/resources/widget-keystore.p12
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12
Binary files differ
diff --git a/ecomp-portal-widget-ms/src/main/resources/widget_ms_start.sh b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh
index 8405fe99..8405fe99 100755
--- a/ecomp-portal-widget-ms/src/main/resources/widget_ms_start.sh
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh
diff --git a/ecomp-portal-widget-ms/src/main/resources/widget_ms_stop.sh b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh
index 8c9abf56..8c9abf56 100755
--- a/ecomp-portal-widget-ms/src/main/resources/widget_ms_stop.sh
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh
diff --git a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java
index 2045435c..2045435c 100644
--- a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java
diff --git a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java
index bd7eba3a..bd7eba3a 100644
--- a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java
diff --git a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java
index 3def6062..3def6062 100644
--- a/ecomp-portal-widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java
diff --git a/ecomp-portal-widget-ms/testadd.txt b/ecomp-portal-widget-ms/widget-ms/testadd.txt
index bdf08de0..bdf08de0 100644
--- a/ecomp-portal-widget-ms/testadd.txt
+++ b/ecomp-portal-widget-ms/widget-ms/testadd.txt
diff --git a/ecomp-portal-widget-ms/website.url b/ecomp-portal-widget-ms/widget-ms/website.url
index 4b50369c..4b50369c 100644
--- a/ecomp-portal-widget-ms/website.url
+++ b/ecomp-portal-widget-ms/widget-ms/website.url
Binary files differ