List of usage examples for org.apache.commons.lang StringUtils indexOfAny
public static int indexOfAny(String str, String[] searchStrs)
Find the first index of any of a set of potential substrings.
From source file:uk.ac.ebi.embl.api.validation.check.genomeassembly.UnlocalisedFieldandValueCheck.java
public ValidationResult check(GenomeAssemblyRecord unLocalisedRecord) { result = new ValidationResult(); if (unLocalisedRecord == null) { return result; }//from w w w. ja v a2 s .c o m @SuppressWarnings("unchecked") ArrayList<UnlocalisedDataRow> rows = (ArrayList<UnlocalisedDataRow>) unLocalisedRecord.getFields(); for (UnlocalisedDataRow row : rows) { object_name = row.get_object_name(); chromosome_name = row.get_chromosome_name(); if (object_name == null) { reportError(row.getOrigin(), MISSING_MANDATORY_ID, UnlocalisedRecord.OBJECT_NAME_KEYWORD); } else if (object_name.split(" ").length > 1) { reportError(row.getOrigin(), INVALID_VALUE_ID, UnlocalisedRecord.OBJECT_NAME_KEYWORD, object_name); } if (chromosome_name == null) { reportError(row.getOrigin(), MISSING_MANDATORY_ID, UnlocalisedRecord.CHROMOSOME_NAME_KEYWORD); } else if (StringUtils.indexOfAny(chromosome_name, UnlocalisedRecord.INVALID_CHNAME_VALUES) != -1) { reportError(row.getOrigin(), INVALID_VALUE_ID, UnlocalisedRecord.CHROMOSOME_NAME_KEYWORD, chromosome_name); } } return result; }
From source file:uk.ac.ebi.embl.api.validation.helper.FileUtils.java
public static FileType getFileType(File formatFile) throws IOException { BufferedReader fileFormatReader = new BufferedReader(new FileReader(formatFile)); // FINDING THE TYPE OF FILE BY READING THE FIRST LINE OF THE FILE String firstLineofFile = fileFormatReader.readLine(); fileFormatReader.close();/*from w ww. ja va 2 s . c o m*/ if (firstLineofFile.startsWith(embl_filetoken)) { return FileType.EMBL; } else if (firstLineofFile.startsWith(genbank_filetoken)) { return FileType.GENBANK; } else if (firstLineofFile.startsWith(gff_filetoken)) { return FileType.GFF3; } else if (StringUtils.indexOfAny(formatFile.getName(), AssemblyFileToken) != -1) { return FileType.GENOMEASSEMBLY; } else if (firstLineofFile.startsWith(fasta_filetoken)) { return FileType.FASTA; } return null; }