--- /dev/null
+distribution_type: container
+container_release_tag: 3.2.1
+project: portal
+ref: b310e558488c48cadc251a3d87b1f10f044c2499
+containers:
+ - name: portal-app
+ version: 3.2.0-STAGING-latest
if [ "$SDK_DOCKERFILE" != "skip" ] && [ "SDK_APP_DIR" != "skip" ]; then
echo "Build Portal-SDK app"
cd $BASEDIR/$SDK_APP_DIR
- ${MVN} ${MVN_EXTRA_SDK} clean package
+ ${MVN} ${MVN_EXTRA_SDK} clean package -Dskiptests=true
fi
echo "Java build complete."
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
- <version>3.3.3</version>
+ <version>3.3.4</version>
</dependency>
<!-- Mapper -->
<dependency>
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
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.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
}
@ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class)
- @RequestMapping(value = { "/v3/extendSessionTimeOuts" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/v3/extendSessionTimeOuts" })
public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response,
@RequestParam String sessionMap) throws Exception {
@SuppressWarnings("unchecked")
@ApiOperation(value = "Accepts messages from external ticketing systems and creates notifications for Portal users.", response = PortalRestResponse.class)
- @RequestMapping(value = { "/v3/ticketevent" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/v3/ticketevent" })
public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
@RequestBody String ticketEventJson) throws Exception {
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.onap.portalapp.portal.domain.BEProperty;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
import org.onap.portalapp.portal.transport.CommonWidgetMeta;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptAdminController.class);
- @RequestMapping(value = { "/executeEncryptQuery" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/executeEncryptQuery" })
public Map<Long, String> executeEncrypt(HttpServletRequest request, HttpServletResponse response)
throws CipherUtilException {
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.DeserializationFeature;
String lastNameStr = null;
String emailStr = null;
String lastLogin = null;
+ boolean isSystemUser = false;
EPUser user = EPUserUtils.getUserSession(request);
firstNameStr = user.getFirstName();
lastNameStr = user.getLastName();
orgUserIdStr = user.getOrgUserId();
+ isSystemUser = user.isSystemUser();
emailStr = user.getEmail();
if (emailStr == null || emailStr.equals("")) {
- EPUser userResult = searchService.searchUserByUserId(orgUserIdStr);
- emailStr = userResult.getEmail();
+ try {
+ EPUser userResult = searchService.searchUserByUserId(orgUserIdStr);
+ emailStr = userResult.getEmail();
+ }catch(Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId call failed", ex);
+ }
}
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss Z a");
Date lastLoginDate = user.getLastLoginDate();
map.put("userId",
orgUserIdStr != null ? orgUserIdStr : (orgUserIdSC != null ? orgUserIdSC.getCvalue() : null));
map.put("last_login", lastLogin);
+ map.put("isSystemUser", String.valueOf(isSystemUser));
JSONObject j = new JSONObject(map);
fnMenuStaticResponse = j.toString();
// Be chatty in the log
* ===================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
/**
* Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
*
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* ===================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@Autowired
private MicroserviceService microserviceService;
- @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/portalApi/microservices" })
public PortalRestResponse<String> createMicroservice(HttpServletRequest request, HttpServletResponse response,
@Valid @RequestBody MicroserviceData newServiceData) throws Exception {
if (newServiceData == null) {
return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", "");
}
- @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/portalApi/microservices" })
public List<MicroserviceData> getMicroservice(HttpServletRequest request, HttpServletResponse response)
throws Exception {
return microserviceService.getMicroserviceData();
}
- @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.PUT)
+ @PutMapping(value = { "/portalApi/microservices/{serviceId}" })
public PortalRestResponse<String> updateMicroservice(HttpServletRequest request, HttpServletResponse response,
@PathVariable("serviceId") long serviceId, @Valid @RequestBody MicroserviceData newServiceData) {
return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", "");
}
- @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.DELETE)
+ @DeleteMapping(value = { "/portalApi/microservices/{serviceId}" })
public PortalRestResponse<String> deleteMicroservice(HttpServletRequest request, HttpServletResponse response,
@PathVariable("serviceId") long serviceId) {
try {
* ===================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
@Autowired
private MicroserviceProxyService microserviceProxyService;
- @RequestMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, method = {
- RequestMethod.GET }, produces = "application/json")
+ @GetMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, produces = "application/json")
public String getMicroserviceProxy(HttpServletRequest request, HttpServletResponse response,
@PathVariable("serviceId") long serviceId) throws Exception {
EPUser user = EPUserUtils.getUserSession(request);
return isValidJSON(answer) ? answer : "{\"error\":\"" + answer.replace(System.getProperty("line.separator"), "") + "\"}";
}
- @RequestMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, method = {
- RequestMethod.GET }, produces = "application/json")
+ @GetMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, produces = "application/json")
public String getMicroserviceProxyByWidgetId(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws Exception {
EPUser user = EPUserUtils.getUserSession(request);
* ===================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
this.auditService = auditService;
}
- @RequestMapping(value = { "/portalApi/portalAdmins" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/portalApi/portalAdmins" }, produces = "application/json")
public List<PortalAdmin> getPortalAdmins(HttpServletRequest request, HttpServletResponse response) {
EPUser user = EPUserUtils.getUserSession(request);
List<PortalAdmin> portalAdmins = null;
* @param response
* @return FieldsValidator
*/
- @RequestMapping(value = { "/portalApi/portalAdmin" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/portalApi/portalAdmin" })
public FieldsValidator createPortalAdmin(HttpServletRequest request, @RequestBody String userId,
HttpServletResponse response) {
EPUser user = EPUserUtils.getUserSession(request);
return fieldsValidator;
}
- @RequestMapping(value = { "/portalApi/portalAdmin/{userInfo}" }, method = RequestMethod.DELETE)
+ @DeleteMapping(value = { "/portalApi/portalAdmin/{userInfo}" })
public FieldsValidator deletePortalAdmin(HttpServletRequest request, @PathVariable("userInfo") String userInfo,
HttpServletResponse response) {
return fieldsValidator;
}
- @RequestMapping(value = {
- "/portalApi/adminAppsRoles/{appId}" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = {
+ "/portalApi/adminAppsRoles/{appId}" }, produces = "application/json")
public List<EPRole> getRolesByApp(HttpServletRequest request, @PathVariable("appId") Long appId,
HttpServletResponse response) {
EPUser user = EPUserUtils.getUserSession(request);
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
*/
package org.onap.portalapp.portal.interceptor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
import java.util.HashMap;
import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.mockito.internal.stubbing.answers.ThrowsException;
import org.onap.aaf.cadi.CadiWrap;
import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController;
import org.onap.portalapp.portal.controller.BasicAuthenticationController;
import org.onap.portalapp.portal.controller.WebAnalyticsExtAppController;
import org.onap.portalapp.portal.domain.BasicAuthCredentials;
import org.onap.portalapp.portal.domain.EPApp;
-import org.onap.portalapp.portal.domain.EPEndpoint;
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice;
import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
import org.onap.portalapp.portal.service.AdminRolesService;
import org.onap.portalapp.portal.service.AppsCacheService;
import org.onap.portalapp.portal.service.BasicAuthenticationCredentialService;
-import org.onap.portalapp.portal.service.ExternalAccessRolesService;
import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
import org.onap.portalapp.portal.utils.EcompPortalUtils;
import org.onap.portalapp.service.RemoteWebServiceCallService;
import java.util.Date;
import javax.security.auth.login.CredentialException;
-import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
package org.onap.portalapp.portal.scheduleraux;
import org.glassfish.jersey.client.ClientResponse;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
public class SchedulerAuxUtil {
import org.onap.portalapp.portal.service.AppsCacheService;
import org.onap.portalapp.portal.service.AppsCacheServiceImple;
import org.onap.portalapp.portal.transport.OnboardingApp;
-import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
@Service("appsCacheService")
@org.springframework.context.annotation.Configuration
import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
import org.onap.portalsdk.core.onboarding.util.CipherUtil;
import org.onap.portalsdk.core.service.DataAccessService;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
package org.onap.portalapp.portal.service;
import com.alibaba.fastjson.JSONObject;
-import org.onap.portalapp.portal.domain.Language;
-
-import java.util.List;
public interface LanguageService {
@Test
public void getFunctionalMenuStaticInfoTest(){
String fnMenuStaticactualResponse = null;
- String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"email\":\"test\"}";
+ String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"isSystemUser\":\"false\",\"email\":\"test\"}";
String orgUserIdStr = null;
EPUser user = mockUser.mockEPUser();
<artifactId>tiles-jsp</artifactId>
<version>3.0.5</version>
</dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-client</artifactId>
- <version>3.0.0-milestone1</version>
- </dependency>
<!-- Mapper -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.3</version>
- </dependency>
<!-- OpenID Connect Dependencies -->
<dependency>
<groupId>org.mitre</groupId>
ext_central_access_user_domain = @csp.onap.org
# External Central Auth system access
-remote_centralized_system_access = false
+remote_centralized_system_access = true
#left menu with root value or non-root
portal_left_menu = non-root
\ No newline at end of file
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.11.RELEASE</version>
+ <version>2.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<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>
+ <hibernate.version>5.4.14.Final</hibernate.version>
<skipTests>false</skipTests>
<!-- Replicate this from OParent -->
- <jacocoVersion>0.7.6.201602180812</jacocoVersion>
+ <jacocoVersion>0.8.2</jacocoVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <!-- <version>${hibernate.version}</version> -->
+ <version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
- <version>1.9</version>
+ <version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
- <!-- <version>1.6.1</version> -->
+ <version>1.6.1</version>
<exclusions>
<exclusion>
<groupId>jaxme</groupId>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>8.5.28</version>
+ <version>9.0.33</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
- <version>4.2.13.RELEASE</version>
+ <version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
import java.util.ArrayList;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onap.portalapp.widget.domain.ValidationRespond;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Value("${server.port}")
String port;
- @Value("${server.contextPath}")
+ @Value("${server.servlet.context-path}")
String context;
- @Value("${security.user.name}")
+ @Value("${spring.security.user.name}")
String security_user;
- @Value("${security.user.password}")
+ @Value("${spring.security.user.password}")
String security_pass;
@Autowired
private static final Logger logger = LoggerFactory.getLogger(WidgetsCatalogController.class);
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/microservices/widgetCatalog" }, produces = "application/json")
public List<WidgetCatalog> getWidgetCatalog(HttpServletRequest request, HttpServletResponse response
,@RequestHeader(value="Authorization") String auth) throws IOException{
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/microservices/widgetCatalog/{loginName}" }, produces = "application/json")
public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
@PathVariable("loginName") String loginName, @RequestHeader(value="Authorization") String auth) throws IOException {
List<WidgetCatalog> widgetCatalog = null;
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.PUT, produces = "application/json")
+ @PutMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json")
public void updateWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId,
@RequestHeader(value="Authorization") String auth) throws IOException {
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog" }, method = RequestMethod.POST, produces = "application/json")
+ @PostMapping(value = { "/microservices/widgetCatalog" }, produces = "application/json")
public ValidationRespond saveWidgetCatalog(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value="Authorization") String auth,
@RequestParam("file") MultipartFile file, @RequestParam("widget") String widget) throws IOException {
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.POST, produces = "application/json")
+ @PostMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json")
public ValidationRespond updateWidgetCatalogwithFiles(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value="Authorization") String auth,
@RequestParam("file") MultipartFile file, @RequestParam("widget") String widget, @PathVariable("widgetId") long widgetId) throws IOException {
logger.debug("microserivces updating with files {}", widgetId);
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = {
- RequestMethod.DELETE }, produces = "application/json")
+ @DeleteMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json")
public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId, @RequestHeader(value="Authorization") String auth) throws IOException{
if(!util.authorization(auth, security_user, security_pass)){
}
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/parameters/{widgetId}" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/microservices/widgetCatalog/parameters/{widgetId}" }, produces = "application/json")
public Long getServiceIdByWidget(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") Long widgetId, @RequestHeader(value="Authorization") String auth) throws IOException {
@ResponseBody
- @RequestMapping(value = { "/microservices/widgetCatalog/service/{serviceId}" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/microservices/widgetCatalog/service/{serviceId}" }, produces = "application/json")
public List<WidgetCatalog> getWidgetByServiceId(HttpServletRequest request, HttpServletResponse response,
@PathVariable("serviceId") Long serviceId, @RequestHeader(value="Authorization") String auth) throws IOException {
List<WidgetCatalog> list = new ArrayList<>();
@ResponseBody
- @RequestMapping(value = { "/microservices/download/{widgetId}" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/microservices/download/{widgetId}" }, produces = "application/json")
public byte[] getWidgetZipFile(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId, @RequestHeader(value="Authorization") String auth) throws Exception {
byte[] byteFile = null;
@Id
@Column(name = "APP_ID")
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Digits(integer = 11, fraction = 0)
private Long appId;
@Id
@Column(name = "id")
@Digits(integer = 11, fraction = 0)
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column(name = "name")
@Id
@Column(name = "id")
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Digits(integer = 11, fraction = 0)
private Long id;
@Id
@Column(name = "ROLE_ID")
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Digits(integer = 11, fraction = 0)
private Long roleId;
@Id
@Column(name = "widget_id")
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Digits(integer = 11, fraction = 0)
private long id;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
-import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
Transaction tx = session.beginTransaction();
session.save(newService);
tx.commit();
- session.flush();
+// session.flush();
session.close();
}
catch(Exception e){
Transaction tx = session.beginTransaction();
session.save(newParameter);
tx.commit();
- session.flush();
+// session.flush();
session.close();
}
catch(Exception e){
List<MicroserviceData> services = criteria.list();
logger.debug("MicroserviceServiceImpl.getMicroserviceByName: result={}", services);
- session.flush();
+// session.flush();
session.close();
return (services.size() > 0) ? services.get(0).getId() : null;
Transaction tx = session.beginTransaction();
session.save(newWidgetCatalog);
tx.commit();
- session.flush();
+ //session.flush();
session.close();
updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles());
}
Transaction tx = session.beginTransaction();
session.update(newWidgetCatalog);
tx.commit();
- session.flush();
+ //session.flush();
session.close();
updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles());
}catch(Exception e){
List<MicroserviceData> widgets = criteria.list();
logger.debug("WidgetCatalogServiceImpl.getWidgetIdByName: result={}", widgets);
- session.flush();
+// session.flush();
session.close();
return (widgets.size() > 0) ? true : false;
## General App Properties
-server.contextPath=/widget
+server.servlet.context-path=/widget
server.port=9082
-spring.http.multipart.max-file-size=128MB
-spring.http.multipart.max-request-size=128MB
+spring.servlet.multipart.max-file-size=128MB
+spring.servlet.multipart.max-request-size=128MB
microservice.widget.location=/tmp
## App DB Properties
spring.datasource.url=jdbc:mariadb://localhost:3306/portal
spring.datasource.username=root
-spring.datasource.password=root
+spring.datasource.password=welcome2ibm
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.database.driver.classname=org.mariadb.jdbc.Driver
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=false
## Basic Authentication Properties
-security.user.name=widget_user
-security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718)
+spring.security.user.name=widget_user
+spring.security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718)
account.user.name=portal
account.user.password=6APqvG4AU2rfLgCvMdySwQ==
import org.onap.portalapp.widget.domain.App;
import org.onap.portalapp.widget.domain.RoleApp;
import org.onap.portalapp.widget.domain.WidgetCatalog;
+import org.hibernate.query.NativeQuery;
public class WidgetCatalogServiceImplTest {
Criteria criteria;
@Mock
- SQLQuery query;
+ NativeQuery query;
@Before
public void init() {
List<WidgetCatalog> list = new ArrayList<WidgetCatalog>();
WidgetCatalog widget = new WidgetCatalog();
list.add(widget);
- Mockito.when(widgetService.getWidgetCatalog()).thenReturn(list);
+ Mockito.lenient().when(widgetService.getWidgetCatalog()).thenReturn(list);
mockMvc.perform(get("/microservices/widgetCatalog/"))
.andExpect(status().isBadRequest());
widget.setId(1);
widget.setName("junit");
list.add(widget);
- Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
+ Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
String security_user = "user";
String security_pass = "password";
widget.setId(1);
widget.setName("junit");
list.add(widget);
- Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
+ Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
String security_user = "user";
String security_pass = "password";
@Test
public void saveWidgetCatalog_ValidAuthorization_NoError() throws Exception {
ValidationRespond respond = new ValidationRespond(true, null);
- Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+ Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
String security_user = "user";
String security_pass = "password";
@Test
public void saveWidgetCatalog_Authorization_Error() throws Exception {
ValidationRespond respond = new ValidationRespond(true, null);
- Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+ Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
String security_user = "user";
String security_pass = "password";
@Test
public void updateWidgetCatalogwithFiles_ValidAuthorization_NoError() throws Exception {
ValidationRespond respond = new ValidationRespond(true, null);
- Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+ Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
String security_user = "user";
String security_pass = "password";
widget.setId(1);
widget.setName("junit");
list.add(widget);
- Mockito.when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list);
+ Mockito.lenient().when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list);
String security_user = "user";
String security_pass = "password";
String wrong_pass = "wrong";
Long widgetId = new Long(1);
byte[] bytes="Test".getBytes();
- Mockito.when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes);
+ Mockito.lenient().when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes);
ReflectionTestUtils.setField(controller, "security_user", security_user, String.class);
ReflectionTestUtils.setField(controller, "security_pass", security_pass, String.class);
<properties>
<!-- Jenkins should invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} -->
<build.number>0</build.number>
- <epsdk.version>2.6.0</epsdk.version>
+ <epsdk.version>3.3.0-SNAPSHOT</epsdk.version>
<springframework.version>4.3.24.RELEASE</springframework.version>
<springframework.security.version>4.2.13.RELEASE</springframework.security.version>
<hibernate.version>4.3.11.Final</hibernate.version>
</execution>
</executions>
</plugin>
-
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>3.0.0-M2</version>
+ <executions>
+ <execution>
+ <id>enforce-no-snapshots</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireReleaseVersion>
+ <message>No Snapshots Allowed!</message>
+ </requireReleaseVersion>
+ </rules>
+ <fail>false</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<li class="dropdown-item" style="font-weight: lighter">
{{firstName}}, {{lastName}}
</li>
-<li class="dropdown-item">
+<li class="dropdown-item" *ngIf=(!isSystemUser)>
<span class="dropdown-item-name"> {{ 'Email'}}: </span>
<div>
<span class="dropdown-item-value">
</div>
</li>
<li class="dropdown-item">
- <span class="dropdown-item-name"> {{ 'User Id' }}: </span>
+ <span class="dropdown-item-name" *ngIf=(!isSystemUser)> {{ 'User Id' }}: </span>
+ <span class="dropdown-item-name" *ngIf=(isSystemUser)> {{ 'System Id' }}: </span>
<div>
<span class="dropdown-item-value">
{{loginSnippetUserid}}
api = environment.api;
brandName: string;
brandLogoImagePath: string;
+ isSystemUser: boolean = false;
constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
getUserInformation() {
this.userProfileService.getFunctionalMenuStaticInfo().toPromise().then((res: any) => {
- if (res == null || res.firstName == null || res.firstName == '' || res.lastName == null || res.lastName == '') {
+ if (res === null || res.firstName === null || res.firstName === '' || res.lastName === null || res.lastName === '') {
// $log.info('HeaderCtrl: failed to get all required data, trying user profile');
this.userProfileService.getUserProfile().toPromise().then((profile: any) => {
this.firstName = profile.firstName;
this.loginSnippetUserid = res.userId;
this.lastLogin = Date.parse(res.last_login);
}
+ if(res != null && res.isSystemUser === 'true'){
+ this.isSystemUser = true;
+ }
sessionStorage.userId = res.userId;
this.menusService.getFunctionalMenuForUser().toPromise().then((jsonHeaderMenu: any) => {
// $scope.menuItems = unflatten(jsonHeaderMenu);
addNewUser(newUserData){
console.log("User service : ", newUserData);
- return this.http.post(this.api.saveNewUser, newUserData).subscribe((response)=>{
- });
+ return this.http.post(this.api.saveNewUser, newUserData);
}
}
/ng-material-module.ts
/layout/
+!layout/components/search-users
/modals/
/shared/
!shared/interceptors/
<tr mat-row (click)="setSelectedUser(row)" id="table-row-{{i}}" [ngClass]="{ 'selected': row === selectedUser }"
*matRowDef="let row; columns: displayedColumns; let i = index;"></tr>
</table>
+</div>
+<div class="search-user-container" *ngIf="noUserFlag">
+ <p>{{message}} Or <a href="javascript:void(0);" (click)="addNewUser()"><b>Click Here</b></a> to add <b>New User!</b></p>
</div>
\ No newline at end of file
@ViewChild(MatSort) sort: MatSort;
@ViewChild(MatPaginator) paginator: MatPaginator;
@Output() passBackSelectedUser: EventEmitter<any> = new EventEmitter();
+ @Output() userNotFoundFlag = new EventEmitter<boolean>();
searchString: string;
txtResults = 'result';
searchUsersResults: any;
selectedUser: any;
displayedColumns: string[] = ['firstName'];
dataSourceMap = new MatTableDataSource(this.searchUsersResults);
+ submitted = false;
+ message = " No users found with your query. Please change your search and try again.";
ngOnInit() {
this.searchString = '';
this.passBackSelectedUser.emit(systemUser);
}
+ noUserFlag: boolean = false;
searchUsers() {
if (!this.isSystemUser) {
this.isLoading = true;
this.userService.searchUsers(this.searchString).subscribe((_data: PortalAdmin) => {
this.searchUsersResults = _data;
if (this.searchUsersResults == null || this.searchUsersResults.length == 0) {
- const modelRef = this.ngModal.open(ConfirmationModalComponent)
- modelRef.componentInstance.title = "Confirmation";
- modelRef.componentInstance.message = " No users found with your query. Please change your search and try again."
+ this.noUserFlag = true;
this.isLoading = false;
} else {
+ this.noUserFlag = false;
this.showUserTable = true;
this.isLoading = false;
this.dataSourceMap = new MatTableDataSource(this.searchUsersResults);
this.passBackSelectedUser.emit(this.selectedUser);
}
+ addNewUser() {
+ console.log("Emit the value to parent");
+ this.userNotFoundFlag.emit(true);
+ }
+
}
</form>
</div>
<div class="modal-footer">
- <button type="submit" class="btn btn-primary" (click)="addUser()" [disabled]="addNewUserForm.invalid">Next</button>
+ <button type="submit" class="btn btn-primary" (click)="addUser()">Next</button>
<button type="button" class="btn btn-primary" aria-label="Close" (click)="activeModal.dismiss('Cross')">Close</button>
</div>
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MustMatch } from 'src/app/shared/helpers/must-match-validator';
import { UsersService } from 'src/app/shared/services';
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
@Component({
selector: 'app-user-details-form',
addNewUserForm: FormGroup;
submitted = false;
- constructor(private formBuilder: FormBuilder,
+ constructor(private formBuilder: FormBuilder,
private usersService: UsersService,
- public activeModal: NgbActiveModal) { }
+ public activeModal: NgbActiveModal,
+ public ngbModal: NgbModal) { }
ngOnInit() {
this.addNewUserForm = this.formBuilder.group({
lastName: ['', Validators.required],
email: ['', [Validators.required, Validators.email]],
loginId: ['', Validators.required],
- loginPwd: ['', [Validators.required, Validators.minLength(6)]],
+ loginPwd: ['', Validators.required],
confirmPassword: ['', Validators.required]
}, {
validator: MustMatch('loginPwd', 'confirmPassword')
console.log("New user Json : " + JSON.stringify(this.addNewUserForm.value));
console.log("Get Raw value : " + this.addNewUserForm.getRawValue());
let newUserFormData = JSON.stringify(this.addNewUserForm.getRawValue());
- this.usersService.addNewUser(newUserFormData);
+ this.usersService.addNewUser(newUserFormData).subscribe(result => {
+ console.log("Result : ", result);
+ const modalSuccess = this.ngbModal.open(ConfirmationModalComponent);
+ modalSuccess.componentInstance.title = "Success";
+ modalSuccess.componentInstance.message = 'User added Successfully!';
+ }, error => {
+ console.log("Error : ", error);
+ const modalErrorRef = this.ngbModal.open(ConfirmationModalComponent);
+ modalErrorRef.componentInstance.title = "Error";
+ modalErrorRef.componentInstance.message = 'Something went wrong. Error Message: ' + error.message;
+ })
this.activeModal.close();
}