CPD Results

The following document contains the results of PMD's CPD 7.0.0.

Duplications

File Line
org/techbd/service/http/hub/prime/health/BundleHealthIndicator.java 34
org/techbd/service/http/hub/prime/health/BundleValidateHealthIndicator.java 34
HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_JSON);
            headers.add(Configuration.Servlet.HeaderName.Request.TENANT_ID, "unit-test");
            headers.add(AppConfig.Servlet.HeaderName.Request.HEALTH_CHECK_HEADER, "true");

            HttpEntity<String> requestEntity = new HttpEntity<>(fixtureContent("TestCase301.json"), headers);
            ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
            if (response.getStatusCode().equals(HttpStatus.OK) && null != response.getBody()) {
                return Health.up().build();
            } else {
                return Health.down().withDetail("Error",
                        String.format("Validation service is not returning status code %d , response body %s",
                                response.getStatusCode(), response.getBody()))
                        .build();
            }
        } catch (final Exception e) {
            return Health.down(e).withDetail("Error", "Bundle endpoint is not responding correctly").build();
File Line
org/techbd/service/http/hub/prime/api/FHIRService.java 1099
org/techbd/service/http/hub/prime/api/FHIRService.java 1139
LOG.info("REGISTER State Complete : BEGIN for interaction id :  {} tenant id : {}",
                                bundleAsyncInteractionId, tenantId);
                final var forwardRIHR = new RegisterInteractionHttpRequest();
                try {
                        forwardRIHR.setInteractionId(bundleAsyncInteractionId);
                        forwardRIHR.setInteractionKey(requestURI);
                        forwardRIHR.setNature((JsonNode) Configuration.objectMapper.valueToTree(
                                        Map.of("nature", "Forwarded HTTP Response",
                                                        "tenant_id", tenantId)));
                        forwardRIHR.setContentType(
                                        MimeTypeUtils.APPLICATION_JSON_VALUE);
                        try {
                                // expecting a JSON payload from the server
                                forwardRIHR.setPayload(Configuration.objectMapper
                                                .readTree(response));
                        } catch (JsonProcessingException jpe) {
                                // in case the payload is not JSON store the string
                                forwardRIHR.setPayload((JsonNode) Configuration.objectMapper
                                                .valueToTree(response));
                        }
                        forwardRIHR.setFromState("FORWARD");
                        forwardRIHR.setToState("COMPLETE");
File Line
org/techbd/service/http/InteractionsFilter.java 234
org/techbd/service/http/hub/prime/api/FHIRService.java 205
if (null != ghUser) {
                            curUserName = Optional.ofNullable(ghUser.name()).orElse("NO_DATA");
                            gitHubLoginId = Optional.ofNullable(ghUser.gitHubId()).orElse("NO_DATA");
                            userRole = curUser.get().principal().getAuthorities().stream()
                                    .map(GrantedAuthority::getAuthority)
                                    .collect(Collectors.joining(","));
                            LOG.info("userRole: " + userRole);
                            userRole = "DEFAULT_ROLE"; // TODO: Remove this when role is implemented as part of Auth
                        }
                    }
                    rihr.setUserName(curUserName);
                    rihr.setUserId(gitHubLoginId);
                    rihr.setUserSession(sessionId);
                    rihr.setUserRole(userRole);
                } else {
File Line
lib/aide/resource/collection/GitHubRepoResources.java 73
lib/aide/resource/collection/VfsResources.java 69
ghfpcs, (parent, newNode) -> {
                            // If the file is `.path.yml` `.path.yaml` or `.path.json` or
                            // `.[parent-dir-name].path.yml` or `.yaml` or `.json` it's a special file which
                            // "elaborates" the current path, not a content resource
                            if (newNode.basename().isPresent()) {
                                final var pe = PathElaboration.fromBasename(newNode.basename().orElseThrow(), parent,
                                        newNode);
                                if (pe.isPresent()) {
                                    pathElaboration.add(pe.orElseThrow());
                                    return;
                                }
                            }

                            // if we get to here, nothing special was found so just add the child
                            parent.addChild(newNode);
                        });
                for (var resourceProvenance : resources()) {
                    result.populate(resourceProvenance);
                }
                return result;
            }
            return existingPaths;
        });
    }

    @Override
    public List<ResourceProvenance<GitHubFileProvenance, Resource<? extends Nature, ?>>> resources() {