@Override public Collection<Property<?>> getSourceItems() { return propertyService.getProperties(source); }
@Override public Collection<Property<?>> getTargetItems() { return propertyService.getProperties(target); }
private DataFetcher projectEntityPropertiesDataFetcher(Class<? extends ProjectEntity> projectEntityClass) { return environment -> { Object o = environment.getSource(); if (projectEntityClass.isInstance(o)) { // Filters Optional<String> typeFilter = GraphqlUtils.getStringArgument(environment, "type"); boolean hasValue = GraphqlUtils.getBooleanArgument(environment, "hasValue", false); // Gets the raw list return propertyService.getProperties((ProjectEntity) o).stream() // Filter by type .filter(property -> typeFilter .map(typeFilterName -> StringUtils.equals( typeFilterName, property.getTypeDescriptor().getTypeName() )) .orElse(true) ) // Filter by value .filter(property -> !hasValue || !property.isEmpty()) // OK .collect(Collectors.toList()); } else { return null; } }; } }
protected void validateIssues(List<I> issuesList, SCMChangeLog<T> changeLog) { // Same branch only if (changeLog.isSameBranch()) { // Gets the branch Branch branch = changeLog.getFrom().getBuild().getBranch(); // Gets the list of validators for this branch List<Property<?>> properties = propertyService.getProperties(branch).stream() .filter(property -> !property.isEmpty() && property.getType() instanceof SCMChangeLogIssueValidator) .collect(Collectors.toList()); // Validates each issues issuesList.forEach(issue -> validateIssue(issue, properties, changeLog)); } }