adamdebreceni commented on a change in pull request #1168: URL: https://github.com/apache/nifi-minifi-cpp/pull/1168#discussion_r707988685
########## File path: extensions/standard-processors/processors/RouteText.cpp ########## @@ -0,0 +1,488 @@ +/** + * @file RouteText.cpp + * TailFile class declaration + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "RouteText.h" + +#include <map> +#include <vector> +#include <utility> +#include <algorithm> +#include <set> + +#ifdef __APPLE__ +#include <experimental/functional> +template<typename It, typename Hash, typename Eq> +using boyer_moore_searcher = std::experimental::boyer_moore_searcher<It, Hash, Eq>; +#else +#include <functional> +template<typename It, typename Hash, typename Eq> +using boyer_moore_searcher = std::boyer_moore_searcher<It, Hash, Eq>; +#endif + +#include "logging/LoggerConfiguration.h" +#include "utils/ProcessorConfigUtils.h" +#include "utils/OptionalUtils.h" +#include "range/v3/view/transform.hpp" +#include "range/v3/range/conversion.hpp" +#include "range/v3/view/tail.hpp" +#include "range/v3/view/join.hpp" +#include "range/v3/view/cache1.hpp" + +namespace org::apache::nifi::minifi::processors { + +const core::Property RouteText::RoutingStrategy( + core::PropertyBuilder::createProperty("Routing Strategy") + ->withDescription("Specifies how to determine which Relationship(s) to use when evaluating the segments " + "of incoming text against the 'Matching Strategy' and user-defined properties. " + "'Dynamic Routing' routes to all the matching dynamic relationships (or 'unmatched' if none matches). " + "'Route On All' routes to 'matched' iff all dynamic relationships match. " + "'Route On Any' routes to 'matched' iff any of the dynamic relationships match. ") + ->isRequired(true) + ->withDefaultValue<std::string>(toString(Routing::DYNAMIC)) + ->withAllowableValues<std::string>(Routing::values()) + ->build()); + +const core::Property RouteText::MatchingStrategy( + core::PropertyBuilder::createProperty("Matching Strategy") + ->withDescription("Specifies how to evaluate each segment of incoming text against the user-defined properties.") + ->isRequired(true) + ->withAllowableValues<std::string>(Matching::values()) + ->build()); + +const core::Property RouteText::TrimWhitespace( + core::PropertyBuilder::createProperty("Ignore Leading/Trailing Whitespace") + ->withDescription("Indicates whether or not the whitespace at the beginning and end should be ignored when evaluating a segment.") + ->isRequired(true) + ->withDefaultValue<bool>(true) + ->build()); + +const core::Property RouteText::IgnoreCase( + core::PropertyBuilder::createProperty("Ignore Case") + ->withDescription("If true, capitalization will not be taken into account when comparing values. E.g., matching against 'HELLO' or 'hello' will have the same result. " + "This property is ignored if the 'Matching Strategy' is set to 'Satisfies Expression'.") + ->isRequired(true) + ->withDefaultValue<bool>(false) + ->build()); + +const core::Property RouteText::GroupingRegex( + core::PropertyBuilder::createProperty("Grouping Regular Expression") + ->withDescription("Specifies a Regular Expression to evaluate against each segment to determine which Group it should be placed in. " + "The Regular Expression must have at least one Capturing Group that defines the segment's Group. If multiple Capturing Groups " + "exist in the Regular Expression, the values from all Capturing Groups will be concatenated together. Two segments will not be " Review comment: changed it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
