public EnumerationValidator(String expr) { values = new HashSet<String>(); String[] vals = StringUtils.split(expr, ',', true); for (String v : vals) { values.add(v); } }
@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); }
@XNode("filters/lifeCycle") protected void setLifeCycleExpr(String lifeCycles) { lifeCycle = StringUtils.split(lifeCycles, ',', true); }
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; }
@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; }
return null; String[] paths = StringUtils.split(cp, ',', true); URL base = new URL("jar:" + new File(jarFile.getName()).toURI().toURL().toExternalForm() + "!/"); String fileName = getFileName();
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); }
@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; }
if (v.length() > 0) { types = new HashSet<String>(); for (String t : StringUtils.split(v, ',', true)) { types.add(t);
@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; } }
@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; } }
@Override public DocumentRefList getInput(String input) { String[] ar = StringUtils.split(input, ',', true); DocumentRefList list = new DocumentRefListImpl(ar.length); for (String s : ar) { list.add(DocumentInputResolver.docRefFromString(s)); } return list; }
String[] ar = StringUtils.split(bundlesString, ':', true); for (String entry : ar) { File file;
public static StandaloneApplication createInstance(SharedClassLoader cl) throws IOException { if (instance != null) { throw new IllegalStateException("Application already instantiated"); } // create application environment Environment env = createEnvironment(); Environment.setDefault(env); instance = new StandaloneApplication(cl, env); String val = options.getOption("scanForNestedJARs"); if (val != null) { StandaloneApplication.instance.scanForNestedJARs = Boolean.parseBoolean(val); } // hack to avoid deploying all jars in classpath as bundles String javaLibsProp = System.getProperty("org.nuxeo.launcher.libdirs"); if (javaLibsProp != null) { String[] ar = StringUtils.split(javaLibsProp, ',', false); if (ar.length > 0) { instance.libdirs = ar; File wd = instance.getWorkingDir(); for (int i = 0; i < ar.length; i++) { if (!ar[i].startsWith("/")) { instance.libdirs[i] = new File(wd, ar[i]).getCanonicalFile().getAbsolutePath(); } } } } // end hack return instance; }
protected static void setLocalAcl(CoreSession session, DocumentModel doc, String value) { ACPImpl acp = new ACPImpl(); ACLImpl acl = new ACLImpl(ACL.LOCAL_ACL); acp.addACL(acl); String[] entries = StringUtils.split(value, ',', true); if (entries.length == 0) { return; } for (String entry : entries) { String[] ace = StringUtils.split(entry, ':', true); acl.add(new ACE(ace[0], ace[1], Boolean.parseBoolean(ace[2]))); } session.setACP(doc.getRef(), acp, false); }
val = TypeAdapterHelper.createDocumentRefOrExpression(param.value); } else if (T_DOCUMENTS.equals(type)) { String[] ar = StringUtils.split(param.value, ',', true); DocumentRefListImpl result = new DocumentRefListImpl(ar.length); for (String ref : ar) {