Skip to content
Snippets Groups Projects

Added new textEscape method

Merged Eduardo Santos requested to merge bugfix-25 into develop
2 files
+ 90
8
Compare changes
  • Side-by-side
  • Inline
Files
2
package org.etsi.osl.osom.lcm;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
@@ -11,15 +14,20 @@ import java.util.function.Consumer;
import javax.net.ssl.SSLException;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.exc.StreamWriteException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.DatabindException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.Option;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.text.StringEscapeUtils;
import org.etsi.osl.osom.partnerservices.GenericClient;
import org.etsi.osl.tmf.common.model.Any;
import org.etsi.osl.tmf.common.model.EValueType;
@@ -126,7 +134,7 @@ public abstract class LcmBaseExecutor {
}
private Optional<Characteristic> getCharacteristicByName(String charName) {
protected Optional<Characteristic> getCharacteristicByName(String charName) {
List<Characteristic> serviceCharacteristic;
if (lcmspec.getLcmrulephase().equals("PRE_PROVISION") || this.vars.getService() == null) {
@@ -225,19 +233,31 @@ public abstract class LcmBaseExecutor {
return -1;
}
public String getCharValAsString(String charName) {
logger.debug("getCharValAsString " + charName);
Optional<Characteristic> c = getCharacteristicByName(charName);
Optional<Characteristic> characteristic = getCharacteristicByName(charName);
if (c.isPresent()) {
logger.debug("getCharValAsString " + c.get().getValue().getValue());
return c.get().getValue().getValue();
logger.info("Getting characteristic value as a string...");
if (characteristic.isPresent()) {
return characteristic.get().getValue().getValue();
}
logger.debug("getCharValAsString NULL ");
return null;
}
public String escapeText(String s) {
if (s == null || s.isEmpty()) {
logger.debug("escapeText NULL ");
return null;
}
logger.info("Escaping string...");
return "\"" + StringEscapeUtils.escapeJava(s) + "\"";
}
public Boolean getCharValFromBooleanType(String charName) {
logger.debug("getCharValFromBooleanType " + charName);
Loading