diff options
author | Einat Vinouze <einat.vinouze@intl.att.com> | 2019-07-16 17:17:36 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-07-30 06:01:44 +0300 |
commit | e601bbdc43bae9a08e2e10c5139a6f76b47860d7 (patch) | |
tree | 1913f0b369ead3f2ea5557e5649d8281eca9871c /vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java | |
parent | 76c6ee4a697617ec4cdee2f3b48bc83136c858c5 (diff) |
Implant vid-app-common org.onap.vid.job (main and test)
Issue-ID: VID-378
Change-Id: I41b0bdc2c4e3635f3f3319b1cd63cefc61912dfc
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java index 4a4f3d300..eee2acc51 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java @@ -50,6 +50,7 @@ import org.onap.vid.aai.model.AaiGetPnfs.Pnf; import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; import org.onap.vid.aai.util.AAIRestInterface; import org.onap.vid.model.VersionByInvariantIdsRequest; +import org.onap.vid.properties.Features; import org.onap.vid.roles.Role; import org.onap.vid.roles.RoleProvider; import org.onap.vid.roles.RoleValidator; @@ -68,6 +69,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; +import org.togglz.core.manager.FeatureManager; @RestController @@ -80,17 +82,22 @@ public class AaiController extends RestrictedBaseController { private AAIRestInterface aaiRestInterface; private RoleProvider roleProvider; private SystemPropertiesWrapper systemPropertiesWrapper; + private FeatureManager featureManager; + @Autowired public AaiController(AaiService aaiService, AAIRestInterface aaiRestInterface, RoleProvider roleProvider, - SystemPropertiesWrapper systemPropertiesWrapper) { + SystemPropertiesWrapper systemPropertiesWrapper, + FeatureManager featureManager + ) { this.aaiService = aaiService; this.aaiRestInterface = aaiRestInterface; this.roleProvider = roleProvider; this.systemPropertiesWrapper = systemPropertiesWrapper; + this.featureManager = featureManager; } @RequestMapping(value = {"/subscriberSearch"}, method = RequestMethod.GET) @@ -261,13 +268,13 @@ public class AaiController extends RestrictedBaseController { } @RequestMapping(value = "/aai_sub_details/{subscriberId}", method = RequestMethod.GET) - public ResponseEntity<String> GetSubscriberDetails(HttpServletRequest request, - @PathVariable("subscriberId") String subscriberId) throws IOException { + public ResponseEntity<String> getSubscriberDetails(HttpServletRequest request, @PathVariable("subscriberId") String subscriberId, + @RequestParam(value="omitServiceInstances", required = false, defaultValue = "false") boolean omitServiceInstances) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); ResponseEntity responseEntity; List<Role> roles = roleProvider.getUserRoles(request); RoleValidator roleValidator = RoleValidator.by(roles); - AaiResponse subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator); + AaiResponse subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator, featureManager.isActive(Features.FLAG_1906_AAI_SUB_DETAILS_REDUCE_DEPTH) && omitServiceInstances); String httpMessage = subscriberData.getT() != null ? objectMapper.writeValueAsString(subscriberData.getT()) : subscriberData.getErrorMessage(); |