<commit_before>/* Copyright 2018 Telstra Open Source
 *
 *   Licensed 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.
 */

package org.openkilda.wfm.topology.nbworker.bolts;

import org.openkilda.messaging.error.ErrorType;
import org.openkilda.messaging.error.MessageException;
import org.openkilda.messaging.info.InfoData;
import org.openkilda.messaging.info.event.FeatureTogglesUpdate;
import org.openkilda.messaging.model.system.FeatureTogglesDto;
import org.openkilda.messaging.nbtopology.request.BaseRequest;
import org.openkilda.messaging.nbtopology.request.CreateOrUpdateFeatureTogglesRequest;
import org.openkilda.messaging.nbtopology.request.GetFeatureTogglesRequest;
import org.openkilda.messaging.nbtopology.response.FeatureTogglesResponse;
import org.openkilda.model.FeatureToggles;
import org.openkilda.persistence.PersistenceManager;
import org.openkilda.wfm.error.FeatureTogglesNotFoundException;
import org.openkilda.wfm.share.mappers.FeatureTogglesMapper;
import org.openkilda.wfm.topology.nbworker.StreamType;
import org.openkilda.wfm.topology.nbworker.services.FeatureTogglesService;
import org.openkilda.wfm.topology.nbworker.services.IFeatureTogglesCarrier;

import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Tuple;
import org.apache.storm.tuple.Values;

import java.util.Collections;
import java.util.List;
import java.util.Map;

public class FeatureTogglesBolt extends PersistenceOperationsBolt implements IFeatureTogglesCarrier {
    public static final String FIELD_ID_PAYLOAD = "payload";

    public static final String STREAM_NOTIFICATION_ID = StreamType.NOTIFICATION.toString();
    public static final Fields STREAM_NOTIFICATION_FIELDS = new Fields(FIELD_ID_PAYLOAD, FIELD_ID_CONTEXT);

    private transient FeatureTogglesService featureTogglesService;
<commit_msg>Fix Tuple format for feature-toggles-update notification<commit_after>/* Copyright 2018 Telstra Open Source
 *
 *   Licensed 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.
 */

package org.openkilda.wfm.topology.nbworker.bolts;

import org.openkilda.messaging.error.ErrorType;
import org.openkilda.messaging.error.MessageException;
import org.openkilda.messaging.info.InfoData;
import org.openkilda.messaging.info.event.FeatureTogglesUpdate;
import org.openkilda.messaging.model.system.FeatureTogglesDto;
import org.openkilda.messaging.nbtopology.request.BaseRequest;
import org.openkilda.messaging.nbtopology.request.CreateOrUpdateFeatureTogglesRequest;
import org.openkilda.messaging.nbtopology.request.GetFeatureTogglesRequest;
import org.openkilda.messaging.nbtopology.response.FeatureTogglesResponse;
import org.openkilda.model.FeatureToggles;
import org.openkilda.persistence.PersistenceManager;
import org.openkilda.wfm.error.FeatureTogglesNotFoundException;
import org.openkilda.wfm.share.mappers.FeatureTogglesMapper;
import org.openkilda.wfm.topology.nbworker.StreamType;
import org.openkilda.wfm.topology.nbworker.services.FeatureTogglesService;
import org.openkilda.wfm.topology.nbworker.services.IFeatureTogglesCarrier;

import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Tuple;
import org.apache.storm.tuple.Values;

import java.util.Collections;
import java.util.List;
import java.util.Map;

public class FeatureTogglesBolt extends PersistenceOperationsBolt implements IFeatureTogglesCarrier {
    public static final String STREAM_NOTIFICATION_ID = StreamType.NOTIFICATION.toString();
    public static final Fields STREAM_NOTIFICATION_FIELDS = new Fields(
            DiscoveryEncoderBolt.FIELD_ID_PAYLOAD, FIELD_ID_CONTEXT);

    private transient FeatureTogglesService featureTogglesService;

{'fraction_non_alphanumeric': 0.07844323452308934, 'fraction_numerical': 0.003226456946965114, 'mean_word_length': 5.666666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2774859', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1482, 'n_words': 334}