private void lookupSensitiveControllerServiceProperties(final Set<ControllerServiceDTO> controllerServices) { // go through each service for (final ControllerServiceDTO serviceDTO : controllerServices) { // ensure that some property configuration have been specified final Map<String, String> serviceProperties = serviceDTO.getProperties(); if (serviceProperties != null) { // find the corresponding controller service final ControllerServiceNode serviceNode = flowController.getFlowManager().getControllerServiceNode(serviceDTO.getId()); if (serviceNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Controller Service '%s' could not be found", serviceDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : serviceNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { serviceProperties.put(descriptor.getName(), entry.getValue()); } } } } }
private void addControllerServiceFingerprint(final StringBuilder builder, final ControllerServiceDTO dto) { builder.append(dto.getId()); builder.append(dto.getVersionedComponentId()); builder.append(dto.getType()); builder.append(dto.getName()); addBundleFingerprint(builder, dto.getBundle()); builder.append(dto.getComments()); builder.append(dto.getAnnotationData()); builder.append(dto.getState()); // get the temp instance of the ControllerService so that we know the default property values final BundleCoordinate coordinate = getCoordinate(dto.getType(), dto.getBundle()); final ConfigurableComponent configurableComponent = extensionManager.getTempComponent(dto.getType(), coordinate); if (configurableComponent == null) { logger.warn("Unable to get ControllerService of type {}; its default properties will be fingerprinted instead of being ignored.", dto.getType()); } addPropertiesFingerprint(builder, configurableComponent, dto.getProperties()); }
values.put(EXTENSION_VERSION, formatExtensionVersion(controllerService.getComponentType(), bundle)); if (controllerServiceDTO.getProperties() != null) { Map<String, String> properties = controllerServiceDTO.getProperties(); Map<PropertyDescriptor, String> configuredProperties = controllerService.getProperties(); for (String propertyName : properties.keySet()) {
private static void configureControllerService(final ControllerServiceNode node, final Element controllerServiceElement, final StringEncryptor encryptor) { final ControllerServiceDTO dto = FlowFromDOMFactory.getControllerService(controllerServiceElement, encryptor); node.pauseValidationTrigger(); try { node.setAnnotationData(dto.getAnnotationData()); node.setProperties(dto.getProperties()); } finally { node.resumeValidationTrigger(); } }
private static void scrubControllerServices(final Set<ControllerServiceDTO> controllerServices) { for (final ControllerServiceDTO serviceDTO : controllerServices) { final Map<String, String> properties = serviceDTO.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = serviceDTO.getDescriptors(); if (properties != null && descriptors != null) { for (final PropertyDescriptorDTO descriptor : descriptors.values()) { if (Boolean.TRUE.equals(descriptor.isSensitive())) { properties.put(descriptor.getName(), null); } scrubPropertyDescriptor(descriptor); } } serviceDTO.setControllerServiceApis(null); serviceDTO.setExtensionMissing(null); serviceDTO.setMultipleVersionsAvailable(null); serviceDTO.setCustomUiUrl(null); serviceDTO.setValidationErrors(null); serviceDTO.setValidationStatus(null); } }
AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerServiceDTO.getProperties(), authorizable, authorizer, lookup); }, () -> serviceFacade.verifyUpdateControllerService(requestControllerServiceDTO),
if (snippet.getControllerServices() != null) { snippet.getControllerServices().forEach(dto -> { if (dto.getProperties() == null) { dto.setProperties(new LinkedHashMap<>()); final ConfigurableComponent configurableComponent = controllerFacade.getTemporaryComponent(dto.getType(), dto.getBundle()); configurableComponent.getPropertyDescriptors().forEach(descriptor -> { if (dto.getProperties().get(descriptor.getName()) == null) { dto.getProperties().put(descriptor.getName(), descriptor.getDefaultValue());
if (requestControllerService.getProperties() != null) { AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerService.getProperties(), authorizable, authorizer, lookup);
if (requestControllerService.getProperties() != null) { AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerService.getProperties(), authorizable, authorizer, lookup);
dto.getProperties().put(descriptor.getName(), propertyValue);
ControllerServiceDTO csDTO = (ControllerServiceDTO) componentDto; Map<String, PropertyDescriptorDTO> map = csDTO.getDescriptors(); Map<String, String> props = csDTO.getProperties(); for (Entry<String, PropertyDescriptorDTO> entry : map.entrySet()) { if (entry.getValue().getIdentifiesControllerService() != null && props.get(entry.getKey()) != null) {
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(); } }
controllerServiceDTO.getAnnotationData(), controllerServiceDTO.getComments(), controllerServiceDTO.getProperties(), controllerServiceDTO.getBundle())) { modificationRequest = true;
private void configureControllerService(final ControllerServiceNode controllerService, final ControllerServiceDTO controllerServiceDTO) { final String name = controllerServiceDTO.getName(); final String annotationData = controllerServiceDTO.getAnnotationData(); final String comments = controllerServiceDTO.getComments(); final Map<String, String> properties = controllerServiceDTO.getProperties(); controllerService.pauseValidationTrigger(); // avoid causing validation to be triggered multiple times try { if (isNotNull(name)) { controllerService.setName(name); } if (isNotNull(annotationData)) { controllerService.setAnnotationData(annotationData); } if (isNotNull(comments)) { controllerService.setComments(comments); } if (isNotNull(properties)) { controllerService.setProperties(properties); } } finally { controllerService.resumeValidationTrigger(); } }
final Map<String, String> properties = serviceDTO.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = serviceDTO.getDescriptors(); if (properties != null && descriptors != null) {
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; }
final String serviceId = controllerServiceDTO.getId(); final ControllerServiceNode serviceNode = flowManager.getControllerServiceNode(serviceId); serviceNode.setProperties(controllerServiceDTO.getProperties());
@Override public ControllerServiceSchema apply(ControllerServiceDTO controllerServiceDTO) { Map<String, Object> map = new HashMap<>(); map.put(NAME_KEY, controllerServiceDTO.getName()); map.put(ID_KEY, controllerServiceDTO.getId()); map.put(TYPE_KEY, controllerServiceDTO.getType()); map.put(PROPERTIES_KEY, new HashMap<>(nullToEmpty(controllerServiceDTO.getProperties()))); String annotationData = controllerServiceDTO.getAnnotationData(); if(annotationData != null && !annotationData.isEmpty()) { map.put(ANNOTATION_DATA_KEY, annotationData); } return new ControllerServiceSchema(map); } }
@Override public ControllerServiceSchema apply(ControllerServiceDTO controllerServiceDTO) { Map<String, Object> map = new HashMap<>(); map.put(NAME_KEY, controllerServiceDTO.getName()); map.put(ID_KEY, controllerServiceDTO.getId()); map.put(TYPE_KEY, controllerServiceDTO.getType()); map.put(PROPERTIES_KEY, new HashMap<>(nullToEmpty(controllerServiceDTO.getProperties()))); String annotationData = controllerServiceDTO.getAnnotationData(); if(annotationData != null && !annotationData.isEmpty()) { map.put(ANNOTATION_DATA_KEY, annotationData); } return new ControllerServiceSchema(map); } }