Java Code Examples for org.apache.nifi.web.api.dto.PortDTO#setUserAccessControl()

The following examples show how to use org.apache.nifi.web.api.dto.PortDTO#setUserAccessControl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowFromDOMFactory.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public static PortDTO getPort(final Element element) {
    final PortDTO portDTO = new PortDTO();
    portDTO.setId(getString(element, "id"));
    portDTO.setPosition(getPosition(DomUtils.getChild(element, "position")));
    portDTO.setName(getString(element, "name"));
    portDTO.setComments(getString(element, "comments"));
    final ScheduledState scheduledState = getScheduledState(element);
    portDTO.setState(scheduledState.toString());

    final List<Element> maxTasksElements = getChildrenByTagName(element, "maxConcurrentTasks");
    if (!maxTasksElements.isEmpty()) {
        portDTO.setConcurrentlySchedulableTaskCount(Integer.parseInt(maxTasksElements.get(0).getTextContent()));
    }

    final List<Element> userAccessControls = getChildrenByTagName(element, "userAccessControl");
    if (userAccessControls != null && !userAccessControls.isEmpty()) {
        final Set<String> users = new HashSet<>();
        portDTO.setUserAccessControl(users);
        for (final Element userElement : userAccessControls) {
            users.add(userElement.getTextContent());
        }
    }

    final List<Element> groupAccessControls = getChildrenByTagName(element, "groupAccessControl");
    if (groupAccessControls != null && !groupAccessControls.isEmpty()) {
        final Set<String> groups = new HashSet<>();
        portDTO.setGroupAccessControl(groups);
        for (final Element groupElement : groupAccessControls) {
            groups.add(groupElement.getTextContent());
        }
    }

    return portDTO;
}
 
Example 2
Source File: FlowFromDOMFactory.java    From nifi with Apache License 2.0 5 votes vote down vote up
public static PortDTO getPort(final Element element) {
    final PortDTO portDTO = new PortDTO();
    portDTO.setId(getString(element, "id"));
    portDTO.setVersionedComponentId(getString(element, "versionedComponentId"));
    portDTO.setPosition(getPosition(DomUtils.getChild(element, "position")));
    portDTO.setName(getString(element, "name"));
    portDTO.setComments(getString(element, "comments"));
    portDTO.setAllowRemoteAccess(getBoolean(element, "allowRemoteAccess"));
    final ScheduledState scheduledState = getScheduledState(element);
    portDTO.setState(scheduledState.toString());

    final List<Element> maxTasksElements = getChildrenByTagName(element, "maxConcurrentTasks");
    if (!maxTasksElements.isEmpty()) {
        portDTO.setConcurrentlySchedulableTaskCount(Integer.parseInt(maxTasksElements.get(0).getTextContent()));
    }

    final List<Element> userAccessControls = getChildrenByTagName(element, "userAccessControl");
    if (userAccessControls != null && !userAccessControls.isEmpty()) {
        final Set<String> users = new HashSet<>();
        portDTO.setUserAccessControl(users);
        for (final Element userElement : userAccessControls) {
            users.add(userElement.getTextContent());
        }
    }

    final List<Element> groupAccessControls = getChildrenByTagName(element, "groupAccessControl");
    if (groupAccessControls != null && !groupAccessControls.isEmpty()) {
        final Set<String> groups = new HashSet<>();
        portDTO.setGroupAccessControl(groups);
        for (final Element groupElement : groupAccessControls) {
            groups.add(groupElement.getTextContent());
        }
    }

    return portDTO;
}