List of usage examples for org.apache.commons.lang3 StringUtils split
public static String[] split(final String str, final String separatorChars)
Splits the provided text into an array, separators specified.
From source file:dxol.entity.User.java
@Transient @JsonIgnore public List<String> getRoleList() { // ???List. return ImmutableList.copyOf(StringUtils.split(role, ",")); }
From source file:com.boothj5.minions.MinionCommandHandler.java
private String parseMinionsCommand(String message) { String[] tokens = StringUtils.split(message, " "); return tokens[0].substring(minionsPrefix.length()); }
From source file:de.micromata.tpsb.doc.renderer.RendererClassUtils.java
private static void addRenderprojectsCps(List<String> cps) { String tpsbcp = LocalSettings.get().get("genome.tpsb.renderprojectscp"); if (StringUtils.isBlank(tpsbcp) == true) { return;/*from ww w . j a v a2s . c o m*/ } String[] pathes = StringUtils.split(tpsbcp, ','); for (String path : pathes) { String spath = StringUtils.trim(path); File dir = new File(spath); File td = new File(dir, "target/test-classes"); if (td.exists() == true) { cps.add(td.getAbsolutePath()); } td = new File(dir, "target/classes"); if (td.exists() == true) { cps.add(td.getAbsolutePath()); } } }
From source file:ca.on.oicr.pde.workflows.GATKHaplotypeCallerWorkflow.java
@Override public Map<String, SqwFile> setupFiles() { List<String> inputFilesList = Arrays.asList(StringUtils.split(getProperty("input_files"), ",")); Set<String> inputFilesSet = new HashSet<>(inputFilesList); if (inputFilesList.size() != inputFilesSet.size()) { throw new RuntimeException("Duplicate files detected in input_files"); }//from w w w . ja va 2 s . co m if ((inputFilesSet.size() % 2) != 0) { throw new RuntimeException("Each bam should have a corresponding index"); } Map<String, String> bams = new HashMap<>(); Map<String, String> bais = new HashMap<>(); for (String f : inputFilesSet) { String fileExtension = FilenameUtils.getExtension(f); String fileKey = FilenameUtils.removeExtension(f); if (null != fileExtension) { switch (fileExtension) { case "bam": bams.put(fileKey, f); break; case "bai": if (fileKey.endsWith(".bam")) { fileKey = FilenameUtils.removeExtension(fileKey); } bais.put(fileKey, f); break; default: throw new RuntimeException("Unsupported input file type"); } } } int id = 0; for (Entry<String, String> e : bams.entrySet()) { String key = e.getKey(); String bamFilePath = e.getValue(); String baiFilePath = bais.get(key); if (baiFilePath == null) { throw new RuntimeException("Missing index for " + FilenameUtils.getName(bamFilePath)); } SqwFile bam = this.createFile("file_in_" + id++); bam.setSourcePath(bamFilePath); bam.setType("application/bam"); bam.setIsInput(true); SqwFile bai = this.createFile("file_in_" + id++); bai.setSourcePath(baiFilePath); bai.setType("application/bam-index"); bai.setIsInput(true); //FIXME: this seems to work for now, it would be better to be able to set the provisionedPath as //bai.getProvisionedPath != bai.getOutputPath ... //at least with seqware 1.1.0, setting output path changes where the output file will be stored, //but the commonly used get provisioned path will return the incorrect path to the file bai.setOutputPath(FilenameUtils.getPath(bam.getProvisionedPath())); inputBamFiles.add(bam.getProvisionedPath()); } return this.getFiles(); }
From source file:com.mingo.query.util.QueryUtils.java
/** * Gets collection name from composite query id. * * @param compositeQueryId composite query id * @return collection name/*from www.ja v a2 s. c o m*/ */ public static String getCollectionName(String compositeQueryId) { String[] elements = StringUtils.split(compositeQueryId, "."); return getElementByPosition(elements, NUMBER_OF_ELEMENTS, COLLECTION_NAME_POSITION); }
From source file:com.adobe.acs.commons.mcp.impl.processes.asset.NameUtil.java
static String createValidDamPath(String path) { if (StringUtils.isNotEmpty(path)) { path = Arrays.asList(StringUtils.split(path, PATH_SEPARATOR)).stream() .map(name -> name.matches(VALID_NAME_REGEXP) ? name : NameUtil.createValidDamName(name)) .collect(Collectors.joining(PATH_SEPARATOR)); if (!path.startsWith(PATH_SEPARATOR)) { path = PATH_SEPARATOR + path; }//from w w w.j a v a 2 s .c o m } return path; }
From source file:com.thruzero.common.web.servlet.RssFeedPublisherServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // feed id is <userName>.<entityName> String feedId = request.getParameter("id"); String[] feedInfo = StringUtils.split(feedId, '.'); if (feedInfo == null || feedInfo.length != 2) { throw new IllegalArgumentException( "Invalid Feed ID. Verify the format matches this: \"id=userName.feedName\""); }//from www . ja va 2 s . c o m // get and validate userName String userName = feedInfo[0]; Matcher userNameMatcher = namePattern.matcher(userName); if (!userNameMatcher.matches()) { throw new IllegalArgumentException("Invalid Feed ID"); } // get and validate entityName String entityName = feedInfo[1]; Matcher entityNameMatcher = namePattern.matcher(entityName); if (!entityNameMatcher.matches()) { throw new IllegalArgumentException("Invalid Feed ID"); } // load the user that has published the requested feed DataStoreInfo dataStoreInfo = ProviderLocator.locate(DataStoreInfoProvider.class) .getDataStoreInfo(userName); if (dataStoreInfo == null) { throw new IllegalArgumentException("Feed Not Found"); } // load the InfoNode from the user's datastore for the requested feed EntityPath entityPath = new EntityPath( ContainerPath.CONTAINER_PATH_SEPARATOR + userName + ContainerPath.CONTAINER_PATH_SEPARATOR + "rss" + ContainerPath.CONTAINER_PATH_SEPARATOR + entityName + ".xml"); InfoNodeService infoNodeService = ServiceLocator.locate(InfoNodeService.class); InfoNodeElement rssFeedNode = infoNodeService.getInfoNode(entityPath, dataStoreInfo); if (rssFeedNode == null) { throw new IllegalArgumentException("Feed Not Found"); } else { rssFeedNode.enableRootNode(); } // publish the feed RssFeedService rssFeedService = ServiceLocator.locate(RssFeedService.class); Writer writer = response.getWriter(); response.setContentType("application/xml; charset=UTF-8"); rssFeedService.writeRssFeed(rssFeedNode, writer); }
From source file:eu.danieldk.nlp.conllx.reader.CONLLReader.java
@Override public Sentence readSentence() throws IOException { List<Token> tokens = new ArrayList<>(); String line;//from w w w .j a v a 2s .c o m while ((line = reader.readLine()) != null) { String parts[] = StringUtils.split(line.trim(), '\t'); // We are done with these tokens. if (parts.length == 0) { if (tokens.isEmpty()) continue; return constructSentence(tokens); } if (parts.length < 2) throw new IOException(String.format("Line has fewer than two columns: %s", line)); Integer tokenId = Integer.parseInt(parts[0]); Optional<String> form = valueForColumn(parts, 1); Optional<String> lemma = valueForColumn(parts, 2); Optional<String> courseTag = valueForColumn(parts, 3); Optional<String> tag = valueForColumn(parts, 4); Optional<String> features = valueForColumn(parts, 5); Optional<Integer> head = intValueForColumn(parts, 6); Optional<String> headRel = valueForColumn(parts, 7); Optional<Integer> pHead = intValueForColumn(parts, 8); Optional<String> pHeadRel = valueForColumn(parts, 9); Token token = new CONLLToken(tokenId, form, lemma, courseTag, tag, features, head, headRel, pHead, pHeadRel); tokens.add(token); } // If the the file does not end with a blank line, we have left-overs. if (!tokens.isEmpty()) { return constructSentence(tokens); } return null; }
From source file:cn.aozhi.songify.entity.User.java
@Transient @JsonIgnore public List<String> getRoleList() { // ???List. return ImmutableList.copyOf(StringUtils.split(roles, ",")); }
From source file:io.wcm.dam.assetservice.impl.AssetRequestParser.java
private static Map<String, String> parseSuffixPart(String suffixPart) { Map<String, String> params = new HashMap<>(); String[] paramPairParts = StringUtils.split(suffixPart, ","); if (paramPairParts != null) { for (String paramPairPart : paramPairParts) { String[] paramParts = StringUtils.split(paramPairPart, "="); if (paramParts != null && paramParts.length == 2) { params.put(paramParts[0], paramParts[1]); }/* w ww. java 2 s . c o m*/ } } return params; }