ErrorMerger.mergeErrors(validationErrorMap, nodeId, nodeControllerService.getValidationErrors());
/** * Updates the affected controller services in the specified updateRequest with the serviceEntities. * * @param serviceEntities service entities * @param affectedServices affected services */ private void updateAffectedControllerServices(final Set<ControllerServiceEntity> serviceEntities, final Map<String, AffectedComponentEntity> affectedServices) { // update the affected components serviceEntities.stream() .filter(entity -> affectedServices.containsKey(entity.getId())) .forEach(entity -> { final AffectedComponentEntity affectedComponentEntity = affectedServices.get(entity.getId()); affectedComponentEntity.setRevision(entity.getRevision()); // only consider update this component if the user had permissions to it if (Boolean.TRUE.equals(affectedComponentEntity.getPermissions().getCanRead())) { final AffectedComponentDTO affectedComponent = affectedComponentEntity.getComponent(); affectedComponent.setState(entity.getComponent().getState()); if (Boolean.TRUE.equals(entity.getPermissions().getCanRead())) { affectedComponent.setValidationErrors(entity.getComponent().getValidationErrors()); } } }); }
/** * Updates the affected controller services in the specified updateRequest with the serviceEntities. * * @param serviceEntities service entities * @param affectedServices all Controller Services whose state should be equal to the given desired state */ private void updateAffectedControllerServices(final Set<ControllerServiceEntity> serviceEntities, final Map<String, AffectedComponentEntity> affectedServices) { // update the affected components serviceEntities.stream() .filter(entity -> affectedServices.containsKey(entity.getId())) .forEach(entity -> { final AffectedComponentEntity affectedComponentEntity = affectedServices.get(entity.getId()); affectedComponentEntity.setRevision(entity.getRevision()); // only consider update this component if the user had permissions to it if (Boolean.TRUE.equals(affectedComponentEntity.getPermissions().getCanRead())) { final AffectedComponentDTO affectedComponent = affectedComponentEntity.getComponent(); affectedComponent.setState(entity.getComponent().getState()); if (Boolean.TRUE.equals(entity.getPermissions().getCanRead())) { affectedComponent.setValidationErrors(entity.getComponent().getValidationErrors()); } } }); }
/** * Updates the affected controller services in the specified updateRequest with the serviceEntities. * * @param serviceEntities service entities * @param updateRequest update request */ private void updateAffectedControllerServices(final Set<ControllerServiceEntity> serviceEntities, final VariableRegistryUpdateRequest updateRequest) { // update the affected components serviceEntities.stream() .filter(entity -> updateRequest.getAffectedComponents().containsKey(entity.getId())) .forEach(entity -> { final AffectedComponentEntity affectedComponentEntity = updateRequest.getAffectedComponents().get(entity.getId()); affectedComponentEntity.setRevision(entity.getRevision()); // only consider update this component if the user had permissions to it if (Boolean.TRUE.equals(affectedComponentEntity.getPermissions().getCanRead())) { final AffectedComponentDTO affectedComponent = affectedComponentEntity.getComponent(); affectedComponent.setState(entity.getComponent().getState()); if (Boolean.TRUE.equals(entity.getPermissions().getCanRead())) { affectedComponent.setValidationErrors(entity.getComponent().getValidationErrors()); } } }); }
private void printServicesNotEnabled(final FlowClient flowClient, final String pgId) throws NiFiClientException, IOException { final ControllerServicesEntity servicesEntity = flowClient.getControllerServices(pgId); if (servicesEntity == null || servicesEntity.getControllerServices() == null) { return; } println(); println("The following services could not be enabled: "); for (final ControllerServiceEntity serviceEntity : servicesEntity.getControllerServices()) { if (!ControllerServiceStates.STATE_ENABLED.equals(serviceEntity.getComponent().getState())) { println(); println("Service: " + serviceEntity.getId() + " - " + serviceEntity.getComponent().getName()); final ControllerServiceDTO serviceDTO = serviceEntity.getComponent(); if (serviceDTO.getValidationErrors() != null) { println(); println("Validation Errors: "); for (final String validationError : serviceDTO.getValidationErrors()) { println("- " + validationError); } } } } }
private ComponentDetails getComponentConfiguration(final ControllerServiceDTO controllerService) { return new ComponentDetails.Builder() .id(controllerService.getId()) .name(controllerService.getName()) .type(controllerService.getType()) .state(controllerService.getState()) .annotationData(controllerService.getAnnotationData()) .properties(controllerService.getProperties()) .validateErrors(controllerService.getValidationErrors()).build(); } }
public AffectedComponentEntity createAffectedComponentEntity(final ControllerServiceEntity serviceEntity) { if (serviceEntity == null) { return null; } final AffectedComponentEntity component = new AffectedComponentEntity(); component.setBulletins(serviceEntity.getBulletins()); component.setId(serviceEntity.getId()); component.setPermissions(serviceEntity.getPermissions()); component.setPosition(serviceEntity.getPosition()); component.setRevision(serviceEntity.getRevision()); component.setUri(serviceEntity.getUri()); final ControllerServiceDTO serviceDto = serviceEntity.getComponent(); final AffectedComponentDTO componentDto = new AffectedComponentDTO(); componentDto.setId(serviceDto.getId()); componentDto.setName(serviceDto.getName()); componentDto.setProcessGroupId(serviceDto.getParentGroupId()); componentDto.setReferenceType(AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE); componentDto.setState(serviceDto.getState()); componentDto.setValidationErrors(serviceDto.getValidationErrors()); component.setComponent(componentDto); return component; }
public ControllerServiceDTO copy(final ControllerServiceDTO original) { final ControllerServiceDTO copy = new ControllerServiceDTO(); copy.setAnnotationData(original.getAnnotationData()); copy.setControllerServiceApis(original.getControllerServiceApis()); copy.setComments(original.getComments()); copy.setCustomUiUrl(original.getCustomUiUrl()); copy.setDescriptors(copy(original.getDescriptors())); copy.setId(original.getId()); copy.setParentGroupId(original.getParentGroupId()); copy.setName(original.getName()); copy.setProperties(copy(original.getProperties())); copy.setReferencingComponents(copy(original.getReferencingComponents())); copy.setState(original.getState()); copy.setType(original.getType()); copy.setBundle(copy(original.getBundle())); copy.setExtensionMissing(original.getExtensionMissing()); copy.setMultipleVersionsAvailable(original.getMultipleVersionsAvailable()); copy.setPersistsState(original.getPersistsState()); copy.setValidationErrors(copy(original.getValidationErrors())); copy.setValidationStatus(original.getValidationStatus()); copy.setVersionedComponentId(original.getVersionedComponentId()); return copy; }