Change replaceAll() with repalce() in apex-pdp/plugins and
apex-pdp/testsuites
Issue-ID: POLICY-2722
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: Ib9d5256c050197b06f9df9c4cbb7562be081283c
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
public final class AvroSchemaKeyTranslationUtilities {
// Constants for key replacements
*/
public final class AvroSchemaKeyTranslationUtilities {
// Constants for key replacements
- private static final String DOT_STRING = "\\.";
+ private static final String DOT_STRING = ".";
private static final String DOT_STRING_REPLACEMENT = "_DoT_";
private static final String DASH_STRING = "-";
private static final String DASH_STRING_REPLACEMENT = "_DasH_";
private static final String DOT_STRING_REPLACEMENT = "_DoT_";
private static final String DASH_STRING = "-";
private static final String DASH_STRING_REPLACEMENT = "_DasH_";
*/
private static String translateIllegalKey(final String key, final boolean revert) {
if (revert) {
*/
private static String translateIllegalKey(final String key, final boolean revert) {
if (revert) {
- return key.replaceAll(DOT_STRING_REPLACEMENT, DOT_STRING).replaceAll(DASH_STRING_REPLACEMENT, DASH_STRING);
+ return key.replace(DOT_STRING_REPLACEMENT, DOT_STRING).replace(DASH_STRING_REPLACEMENT, DASH_STRING);
- return key.replaceAll(DOT_STRING, DOT_STRING_REPLACEMENT).replaceAll(DASH_STRING, DASH_STRING_REPLACEMENT);
+ return key.replace(DOT_STRING, DOT_STRING_REPLACEMENT).replace(DASH_STRING, DASH_STRING_REPLACEMENT);
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* 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
* ================================================================================
* 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
* 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.
* 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.
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
obTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
obTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
- obAxLogic.setLogic(obAxLogic.getLogic().replaceAll(STATE_NAME, OBSERVE)
- .replaceAll(TASK_NAME, obTask.getKey().getName()).replaceAll(STATE_NUMBER, "1"));
+ obAxLogic.setLogic(obAxLogic.getLogic().replace(STATE_NAME, OBSERVE)
+ .replace(TASK_NAME, obTask.getKey().getName()).replace(STATE_NUMBER, "1"));
obTask.setTaskLogic(obAxLogic);
final AxTask orTask = new AxTask(new AxArtifactKey("Task_Orient_0", DEFAULT_VERSION));
obTask.setTaskLogic(obAxLogic);
final AxTask orTask = new AxTask(new AxArtifactKey("Task_Orient_0", DEFAULT_VERSION));
orTask.duplicateOutputFields(event0002.getParameterMap());
final AxTaskLogic orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
orTask.duplicateOutputFields(event0002.getParameterMap());
final AxTaskLogic orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
- orAxLogic.setLogic(orAxLogic.getLogic().replaceAll(STATE_NAME, ORIENT)
- .replaceAll(TASK_NAME, orTask.getKey().getName()).replaceAll(STATE_NUMBER, "2"));
+ orAxLogic.setLogic(orAxLogic.getLogic().replace(STATE_NAME, ORIENT)
+ .replace(TASK_NAME, orTask.getKey().getName()).replace(STATE_NUMBER, "2"));
orTask.setTaskLogic(orAxLogic);
final AxTask dTask = new AxTask(new AxArtifactKey("Task_Decide_0", DEFAULT_VERSION));
orTask.setTaskLogic(orAxLogic);
final AxTask dTask = new AxTask(new AxArtifactKey("Task_Decide_0", DEFAULT_VERSION));
dTask.duplicateOutputFields(event0003.getParameterMap());
final AxTaskLogic dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC,
(justOneLang == null ? MVEL : justOneLang), logicReader);
dTask.duplicateOutputFields(event0003.getParameterMap());
final AxTaskLogic dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC,
(justOneLang == null ? MVEL : justOneLang), logicReader);
- dAxLogic.setLogic(dAxLogic.getLogic().replaceAll(STATE_NAME, ORIENT)
- .replaceAll(TASK_NAME, dTask.getKey().getName()).replaceAll(STATE_NUMBER, "3"));
+ dAxLogic.setLogic(dAxLogic.getLogic().replace(STATE_NAME, ORIENT)
+ .replace(TASK_NAME, dTask.getKey().getName()).replace(STATE_NUMBER, "3"));
dTask.setTaskLogic(dAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Act_0", DEFAULT_VERSION));
dTask.setTaskLogic(dAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Act_0", DEFAULT_VERSION));
aTask.duplicateOutputFields(event0004.getParameterMap());
final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
(justOneLang == null ? "JAVA" : justOneLang), logicReader);
aTask.duplicateOutputFields(event0004.getParameterMap());
final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
(justOneLang == null ? "JAVA" : justOneLang), logicReader);
- aAxLogic.setLogic(aAxLogic.getLogic().replaceAll(STATE_NAME, "Act")
- .replaceAll(TASK_NAME, aTask.getKey().getName()).replaceAll(STATE_NUMBER, "4"));
+ aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, "Act")
+ .replace(TASK_NAME, aTask.getKey().getName()).replace(STATE_NUMBER, "4"));
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(obTask.getKey(), obTask);
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(obTask.getKey(), obTask);
final Set<AxArtifactKey> actTasks = new TreeSet<>();
addOodaTasks(tasks, obTasks, orTasks, decTasks, actTasks);
final Set<AxArtifactKey> actTasks = new TreeSet<>();
addOodaTasks(tasks, obTasks, orTasks, decTasks, actTasks);
final List<Set<AxArtifactKey>> taskReferenceList = new ArrayList<>();
taskReferenceList.add(obTasks);
taskReferenceList.add(orTasks);
final List<Set<AxArtifactKey>> taskReferenceList = new ArrayList<>();
taskReferenceList.add(obTasks);
taskReferenceList.add(orTasks);
/**
* Add OODA tasks to the policy.
/**
* Add OODA tasks to the policy.
* @param tasks the policy tasks
* @param obTasks observe tasks
* @param orTasks orient tasks
* @param tasks the policy tasks
* @param obTasks observe tasks
* @param orTasks orient tasks
/**
* Initialize the logic executor list.
/**
* Initialize the logic executor list.
* @param justOneLang the language to use
* @return the list of languages
*/
* @param justOneLang the language to use
* @return the list of languages
*/
eTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JYTHON : justOneLang), logicReader);
eTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JYTHON : justOneLang), logicReader);
- eAxLogic.setLogic(eAxLogic.getLogic().replaceAll(STATE_NAME, EVENT)
- .replaceAll(TASK_NAME, eTask.getKey().getName()).replaceAll(STATE_NUMBER, "1"));
+ eAxLogic.setLogic(eAxLogic.getLogic().replace(STATE_NAME, EVENT)
+ .replace(TASK_NAME, eTask.getKey().getName()).replace(STATE_NUMBER, "1"));
eTask.setTaskLogic(eAxLogic);
final AxTask cTask = new AxTask(new AxArtifactKey("Task_Condition_0", DEFAULT_VERSION));
eTask.setTaskLogic(eAxLogic);
final AxTask cTask = new AxTask(new AxArtifactKey("Task_Condition_0", DEFAULT_VERSION));
cTask.duplicateOutputFields(event0002.getParameterMap());
final AxTaskLogic cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
cTask.duplicateOutputFields(event0002.getParameterMap());
final AxTaskLogic cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC,
(justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
- cAxLogic.setLogic(cAxLogic.getLogic().replaceAll(STATE_NAME, CONDITION)
- .replaceAll(TASK_NAME, cTask.getKey().getName()).replaceAll(STATE_NUMBER, "2"));
+ cAxLogic.setLogic(cAxLogic.getLogic().replace(STATE_NAME, CONDITION)
+ .replace(TASK_NAME, cTask.getKey().getName()).replace(STATE_NUMBER, "2"));
cTask.setTaskLogic(cAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Action_0", DEFAULT_VERSION));
cTask.setTaskLogic(cAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Action_0", DEFAULT_VERSION));
aTask.duplicateOutputFields(event0003.getParameterMap());
final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
(justOneLang == null ? "JAVA" : justOneLang), logicReader);
aTask.duplicateOutputFields(event0003.getParameterMap());
final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
(justOneLang == null ? "JAVA" : justOneLang), logicReader);
- aAxLogic.setLogic(aAxLogic.getLogic().replaceAll(STATE_NAME, ACTION)
- .replaceAll(TASK_NAME, aTask.getKey().getName()).replaceAll(STATE_NUMBER, "3"));
+ aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, ACTION)
+ .replace(TASK_NAME, aTask.getKey().getName()).replace(STATE_NUMBER, "3"));
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(eTask.getKey(), eTask);
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(eTask.getKey(), eTask);
* @param tasks the tasks
* @param eventTasks event tasks
* @param conditionTasks condition tasks
* @param tasks the tasks
* @param eventTasks event tasks
* @param conditionTasks condition tasks
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* 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
* ================================================================================
* 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
* 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.
* 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.
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
AxTaskLogic axLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour,
logicReader);
AxTaskLogic axLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour,
logicReader);
- axLogic.setLogic(axLogic.getLogic().replaceAll("<STATE_NAME>", stateName)
- .replaceAll("<TASK_NAME>", task.getKey().getName())
- .replaceAll("<RANDOM_BYTE_VALUE>", caseToUse));
+ axLogic.setLogic(axLogic.getLogic().replace("<STATE_NAME>", stateName)
+ .replace("<TASK_NAME>", task.getKey().getName())
+ .replace("<RANDOM_BYTE_VALUE>", caseToUse));