2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.bpmn.core;
23 import org.camunda.bpm.engine.delegate.DelegateExecution;
24 import org.camunda.bpm.engine.delegate.Expression;
26 import org.openecomp.mso.logger.MsoAlarmLogger;
27 import org.openecomp.mso.logger.MsoLogger;
30 * Logs a text message. The text may contain variable references.
31 * For example:<br/><br/>
32 * name=$name, address=$address
34 * Required fields:<br/><br/>
35 * text: The text to log<br/>
36 * Optional fields:<br/><br/>
37 * level: The log level (TRACE, DEBUG, INFO, WARN, ERROR)<br/>
39 public class LogTask extends BaseTask {
42 private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
43 private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
45 private Expression text;
46 private Expression level;
48 public void execute(DelegateExecution execution) throws Exception {
49 String theText = getStringField(text, execution, "text");
53 StringBuilder out = new StringBuilder();
54 StringBuilder var = new StringBuilder();
55 boolean inVar = false;
58 int len = theText.length();
61 char c = theText.charAt(pos++);
63 if (inVar && !Character.isLetterOrDigit(c) && c != '_') {
64 if (var.length() > 0) {
65 Object value = execution.getVariable(var.toString());
68 out.append(value.toString());
88 if (inVar && var.length() > 0) {
89 Object value = execution.getVariable(var.toString());
91 out.append(value.toString());