Tabnine Logo
StringUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
StringUtils
in
org.nuxeo.common.utils

Best Java code snippets using org.nuxeo.common.utils.StringUtils (Showing top 20 results out of 315)

origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core

public EnumerationValidator(String expr) {
  values = new HashSet<String>();
  String[] vals = StringUtils.split(expr, ',', true);
  for (String v : vals) {
    values.add(v);
  }
}
origin: org.nuxeo.ecm.core/nuxeo-core-api

protected static String escapeEntryPath(String path) {
  String zipEntryEncoding = Framework.getProperty(ZIP_ENTRY_ENCODING_PROPERTY);
  if (zipEntryEncoding != null && zipEntryEncoding.equals(ZIP_ENTRY_ENCODING_OPTIONS.ascii.toString())) {
    return StringUtils.toAscii(path, true);
  }
  return path;
}
origin: org.nuxeo.runtime/nuxeo-runtime-osgi

protected static String getEnvProperty(String key, Map<String, Object> hostEnv, Properties sysprops,
    boolean addToSystemProperties) {
  String v = (String) hostEnv.get(key);
  if (v == null) {
    v = System.getProperty(key);
  }
  if (v != null) {
    v = StringUtils.expandVars(v, sysprops);
    if (addToSystemProperties) {
      sysprops.setProperty(key, v);
    }
  }
  return v;
}
origin: org.nuxeo.ecm.automation/nuxeo-automation-core

@Override
public Object getAdaptedValue(OperationContext ctx, Object objectToAdapt) throws TypeAdaptException {
  String content = (String) objectToAdapt;
  List<String> li = StringUtils.split(content, ',', '\\', true);
  return new StringList(li);
}
origin: org.nuxeo.common/nuxeo-common

/**
 * Replaces accented characters from a non-null String by their ascii equivalent.
 */
public static String toAscii(String s) {
  return toAscii(s, false);
}
origin: org.nuxeo.runtime/nuxeo-connect-standalone

@Override
protected String getContentToCopy(File fileToCopy, Map<String, String> prefs) throws PackageException {
  try {
    String content = FileUtils.readFileToString(fileToCopy, UTF_8);
    return StringUtils.expandVars(content, prefs);
  } catch (IOException e) {
    throw new PackageException("Failed to run parameterized copy for: " + fileToCopy.getName(), e);
  }
}
origin: org.nuxeo.ecm.automation/nuxeo-automation-core

@XNode("filters/lifeCycle")
protected void setLifeCycleExpr(String lifeCycles) {
  lifeCycle = StringUtils.split(lifeCycles, ',', true);
}
origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

protected String escapeEntryPath(String path) {
  String zipEntryEncoding = Framework.getProperty(ZIP_ENTRY_ENCODING_PROPERTY);
  if (zipEntryEncoding != null && zipEntryEncoding.equals(ZIP_ENTRY_ENCODING_OPTIONS.ascii.toString())) {
    return StringUtils.toAscii(path, true);
  }
  return path;
}
origin: org.nuxeo.runtime/nuxeo-connect-standalone

protected String loadParametrizedFile(File file, Map<String, String> params) throws IOException {
  String content = FileUtils.readFileToString(file, UTF_8);
  // replace variables.
  return StringUtils.expandVars(content, createContextMap(params));
}
origin: org.nuxeo.ecm.webengine/nuxeo-webengine-jaxrs

protected Map<String, String> parseAttrs(String expr) {
  Map<String, String> map = new HashMap<>();
  String[] ar = StringUtils.split(expr, ';', true);
  for (String a : ar) {
    int i = a.indexOf('=');
    if (i == -1) {
      map.put(a, null);
    } else {
      String key = a.substring(0, i).trim();
      String val = a.substring(i + 1).trim();
      if (key.endsWith(":")) {
        key = key.substring(0, key.length() - 1).trim();
      }
      map.put(key, val);
    }
  }
  return map;
}
origin: org.nuxeo.common/nuxeo-common

s = StringUtils.toAscii(s);
s = s.trim();
if (lower) {
origin: org.nuxeo.runtime/nuxeo-runtime-osgi

protected static void loadSystemProperties() {
  File file = new File(home, "system.properties");
  if (!file.isFile()) {
    return;
  }
  FileInputStream in = null;
  try {
    in = new FileInputStream(file);
    Properties p = new Properties();
    p.load(in);
    for (Map.Entry<Object, Object> entry : p.entrySet()) {
      String v = (String) entry.getValue();
      v = StringUtils.expandVars(v, System.getProperties());
      System.setProperty((String) entry.getKey(), v);
    }
  } catch (IOException e) {
    throw new RuntimeException("Failed to load system properties", e);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        log.error(e);
      }
    }
  }
}
origin: org.nuxeo.runtime/nuxeo-runtime-osgi

@Override
public Collection<BundleFile> getNestedBundles(File tmpDir) throws IOException {
  Attributes attrs = mf.getMainAttributes();
  String cp = attrs.getValue(Constants.BUNDLE_CLASSPATH);
  if (cp == null) {
    cp = attrs.getValue("Class-Path");
  }
  if (cp == null) {
    return null;
  }
  String[] paths = StringUtils.split(cp, ',', true);
  List<BundleFile> nested = new ArrayList<>();
  for (String path : paths) {
    File nestedBundle = new File(file, path);
    if (nestedBundle.isDirectory()) {
      nested.add(new DirectoryBundleFile(nestedBundle));
    } else {
      nested.add(new JarBundleFile(nestedBundle));
    }
  }
  return nested;
}
origin: org.nuxeo.ecm.platform/nuxeo-platform-url-api

  filename = URLDecoder.decode(filename, "UTF-8");
} catch (UnsupportedEncodingException e) {
  filename = StringUtils.toAscii(filename);
origin: org.nuxeo.runtime/nuxeo-runtime-osgi

  return null;
String[] paths = StringUtils.split(cp, ',', true);
URL base = new URL("jar:" + new File(jarFile.getName()).toURI().toURL().toExternalForm() + "!/");
String fileName = getFileName();
origin: org.nuxeo.ecm.webengine/nuxeo-webengine-ui

public List<Map<String, Object>> buildTree(T root, String path) {
  if (path == null || path.length() == 0 || "/".equals(path)) {
    return buildChildren(root);
  }
  String[] ar = StringUtils.split(path, '/', false);
  if (ar.length > 1) {
    String name = getName(root);
    if (name.equals(ar[0])) {
      return buildChildren(root, ar, 1);
    }
  }
  return buildChildren(root);
}
origin: org.nuxeo.ecm.core/nuxeo-core-io

@SuppressWarnings("deprecation")
private Set<String> getSplittedParameterValues(char separator, String category, String... subCategories) {
  if (category == null) {
    return Collections.emptySet();
  }
  StringBuilder sb = new StringBuilder(category);
  for (String subCategory : subCategories) {
    sb.append(separator + subCategory);
  }
  String paramKey = sb.toString().toLowerCase();
  List<Object> dirty = getParameters(paramKey);
  dirty.addAll(getParameters(HEADER_PREFIX + paramKey));
  // Deprecated on server since 5.8, but the code on client wasn't - keep this part of code as Nuxeo Automation
  // Client is deprecated since 8.10 and Nuxeo Java Client handle this properly
  // backward compatibility, supports X-NXDocumentProperties and X-NXContext-Category
  if (EMBED_PROPERTIES.equalsIgnoreCase(paramKey)) {
    dirty.addAll(getParameters("X-NXDocumentProperties"));
  } else if ((EMBED_ENRICHERS + separator + ENTITY_TYPE).equalsIgnoreCase(paramKey)) {
    dirty.addAll(getParameters("X-NXContext-Category"));
  }
  Set<String> result = new TreeSet<>();
  for (Object value : dirty) {
    if (value instanceof String) {
      result.addAll(Arrays.asList(org.nuxeo.common.utils.StringUtils.split((String) value, ',', true)));
    }
  }
  return result;
}
origin: org.nuxeo.ecm.automation/nuxeo-automation-core

if (v.length() > 0) {
  types = new HashSet<String>();
  for (String t : StringUtils.split(v, ',', true)) {
    types.add(t);
origin: org.nuxeo.ecm.automation/nuxeo-automation-core

  @Override
  public Object getAdaptedValue(OperationContext ctx, Object objectToAdapt) throws TypeAdaptException {
    String value = (String) objectToAdapt;
    String[] array = StringUtils.split(value, ',', true);
    DocumentModelList result = new DocumentModelListImpl(array.length);
    for (String val : array) {
      result.add(TypeAdapterHelper.createDocumentModel(ctx, val));
    }
    return result;

  }
}
origin: org.nuxeo.ecm.automation/nuxeo-automation-io

  @Override
  public BlobList getInput(String content) {
    String[] array = StringUtils.split(content, ',', true);
    BlobList list = new BlobList(array.length);
    for (String key : array) {
      list.add(BlobInputResolver.blobFromKey(key));
    }
    return list;
  }
}
org.nuxeo.common.utilsStringUtils

Javadoc

Utils for String manipulations.

Most used methods

  • split
  • toAscii
    Replaces accented characters from a non-null String by their ascii equivalent.
  • expandVars
    Expands any variable found in the given expression with the values in the given map. The variable fo

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • String (java.lang)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • ImageIO (javax.imageio)
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now