Search in sources :

Example 1 with AllowableValueDTO

use of org.apache.nifi.web.api.dto.AllowableValueDTO in project kylo by Teradata.

the class TemplateCreationHelperTest method newPropertyDescriptor.

/**
 * Creates a new {@link PropertyDescriptorDTO} that identifies the specified controller service.
 *
 * @param name            the name of the property
 * @param type            the type of controller service
 * @param allowableValues the allowable controller service ids
 * @return the new property descriptor
 */
@Nonnull
private PropertyDescriptorDTO newPropertyDescriptor(@Nonnull final String name, @Nonnull final String type, @Nonnull final String... allowableValues) {
    // Create the list of allowable values
    final List<AllowableValueEntity> allowableValueEntities = Stream.of(allowableValues).map(value -> {
        final AllowableValueDTO dto = new AllowableValueDTO();
        dto.setValue(value);
        return dto;
    }).map(dto -> {
        final AllowableValueEntity entity = new AllowableValueEntity();
        entity.setAllowableValue(dto);
        return entity;
    }).collect(Collectors.toList());
    // Create the property descriptor
    final PropertyDescriptorDTO property = new PropertyDescriptorDTO();
    property.setAllowableValues(allowableValueEntities);
    property.setName(name);
    property.setIdentifiesControllerService(type);
    property.setRequired(true);
    return property;
}
Also used : AllowableValueEntity(org.apache.nifi.web.api.entity.AllowableValueEntity) ProcessorConfigDTO(org.apache.nifi.web.api.dto.ProcessorConfigDTO) ProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO) NiFiPropertyDescriptor(com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor) AllowableValueDTO(org.apache.nifi.web.api.dto.AllowableValueDTO) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) NiFiPropertyDescriptorTransform(com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptorTransform) ArrayList(java.util.ArrayList) NiFiAllowableValue(com.thinkbiganalytics.nifi.rest.model.NiFiAllowableValue) PropertyDescriptorDTO(org.apache.nifi.web.api.dto.PropertyDescriptorDTO) NiFiRestClient(com.thinkbiganalytics.nifi.rest.client.NiFiRestClient) NiFiControllerServicesRestClient(com.thinkbiganalytics.nifi.rest.client.NiFiControllerServicesRestClient) Nonnull(javax.annotation.Nonnull) ImmutableSet(com.google.common.collect.ImmutableSet) ControllerServiceDTO(org.apache.nifi.web.api.dto.ControllerServiceDTO) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) Test(org.junit.Test) Collectors(java.util.stream.Collectors) Mockito(org.mockito.Mockito) List(java.util.List) Stream(java.util.stream.Stream) ProcessorDTO(org.apache.nifi.web.api.dto.ProcessorDTO) Assert(org.junit.Assert) Collections(java.util.Collections) LegacyNifiRestClient(com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient) AllowableValueDTO(org.apache.nifi.web.api.dto.AllowableValueDTO) AllowableValueEntity(org.apache.nifi.web.api.entity.AllowableValueEntity) PropertyDescriptorDTO(org.apache.nifi.web.api.dto.PropertyDescriptorDTO) Nonnull(javax.annotation.Nonnull)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 LegacyNifiRestClient (com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient)1 NiFiControllerServicesRestClient (com.thinkbiganalytics.nifi.rest.client.NiFiControllerServicesRestClient)1 NiFiRestClient (com.thinkbiganalytics.nifi.rest.client.NiFiRestClient)1 NiFiAllowableValue (com.thinkbiganalytics.nifi.rest.model.NiFiAllowableValue)1 NiFiPropertyDescriptor (com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor)1 NiFiPropertyDescriptorTransform (com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptorTransform)1 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 Nonnull (javax.annotation.Nonnull)1 AllowableValueDTO (org.apache.nifi.web.api.dto.AllowableValueDTO)1 ControllerServiceDTO (org.apache.nifi.web.api.dto.ControllerServiceDTO)1 ProcessorConfigDTO (org.apache.nifi.web.api.dto.ProcessorConfigDTO)1 ProcessorDTO (org.apache.nifi.web.api.dto.ProcessorDTO)1