List of usage examples for org.apache.commons.lang StringUtils replaceChars
public static String replaceChars(String str, String searchChars, String replaceChars)
Replaces multiple characters in a String in one go.
From source file:org.jrimum.vallia.digitoverificador.CPFDV.java
/** * Mtodo null-safe que remove a formatao da String, com a inteno de deixar * apenas nmeros./*from ww w.jav a2 s . co m*/ * * @param numero - CNPJ que pode estar formatado. * @return Nmero CNPJ sem formatao. */ private String removaFormatacao(String numero) { numero = StringUtils.replaceChars(numero, ".", ""); return numero; }
From source file:org.kuali.kfs.vnd.batch.dataaccess.DebarredVendorDaoJdbc.java
/** * Gets the addressGeneratedId of the vendor address that matches best with the address of the * EPLS debarred vendor in the specified vendor exclude match. * If no address matches, returns the default address for IU campus. *//*from w ww . ja v a 2 s. com*/ protected long getMatchAddressId(DebarredVendorMatch match) { long bestid = 0; long defaultId = 0; int maxPriority = 0; List<VendorAddress> addresses = vendorService.getVendorDetail(match.getVendorHeaderGeneratedIdentifier(), match.getVendorDetailAssignedIdentifier()).getVendorAddresses(); if (addresses == null) { return bestid; } for (VendorAddress address : addresses) { if (address.isVendorDefaultAddressIndicator()) { defaultId = address.getVendorAddressGeneratedIdentifier(); } //each condition satisfied will increase the priority score for this address int priority = 0; String vendorAddr1 = StringUtils.replaceChars(address.getVendorLine1Address(), ".,# ", ""); String eplsAddr1 = StringUtils.replaceChars(match.getAddress1(), ".,# ", ""); if (StringUtils.equalsIgnoreCase(vendorAddr1, eplsAddr1)) { priority++; } String vendorCity = StringUtils.replaceChars(address.getVendorCityName(), "., ", ""); String eplsCity = StringUtils.replaceChars(match.getCity(), "., ", ""); if (StringUtils.equalsIgnoreCase(vendorCity, eplsCity)) { priority++; } if (StringUtils.equalsIgnoreCase(address.getVendorStateCode(), match.getState())) { priority++; } String vendorZip = StringUtils.substring(address.getVendorZipCode(), 0, 5); String eplsZip = StringUtils.substring(match.getZip(), 0, 5); if (StringUtils.equals(vendorZip, eplsZip)) { priority++; } if (priority >= maxPriority) { bestid = address.getVendorAddressGeneratedIdentifier(); maxPriority = priority; } } if (bestid == 0) { bestid = defaultId; } return bestid; }
From source file:org.kuali.kra.printing.service.impl.PrintingServiceImpl.java
protected void logPrintDetails(Map<String, byte[]> xmlStreamMap) throws PrintingException { byte[] xmlBytes = null; String xmlString = null;/* www. ja v a2s . c o m*/ String loggingDirectory = kualiConfigurationService.getPropertyString(Constants.PRINT_LOGGING_DIRECTORY); Iterator<String> it = xmlStreamMap.keySet().iterator(); if (loggingDirectory != null) { try { while (it.hasNext()) { String key = (String) it.next(); xmlBytes = xmlStreamMap.get(key); xmlString = new String(xmlBytes); String dateString = getDateTimeService().getCurrentTimestamp().toString(); String reportName = StringUtils.deleteWhitespace(key); String createdTime = StringUtils.replaceChars(StringUtils.deleteWhitespace(dateString), ":", "_"); File file = new File(loggingDirectory + reportName + createdTime + ".xml"); BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write(xmlString); out.close(); } } catch (IOException e) { LOG.error(e.getMessage(), e); throw new PrintingException(e.getMessage(), e); } } }
From source file:org.kuali.kra.proposaldevelopment.budget.service.impl.BudgetSubAwardServiceImpl.java
protected String cleanContentId(String contentId) { return StringUtils.replaceChars(contentId, " .%-_", ""); }
From source file:org.kuali.student.cm.course.modifiers.CMCourseLOCollectionCompareModifier.java
@Override public void performCollectionCompare(Object model, Component component) { LoDisplayWrapperModel los;//from w w w . ja v a 2 s . c o m LoDisplayWrapperModel losCompare; if (model instanceof ViewCourseForm) { ViewCourseForm form = (ViewCourseForm) model; los = form.getCourseInfoWrapper().getLoDisplayWrapperModel(); losCompare = form.getCompareCourseInfoWrapper().getLoDisplayWrapperModel(); } else if (model instanceof MaintenanceDocumentForm) { MaintenanceDocumentForm form = (MaintenanceDocumentForm) model; los = ((CourseInfoWrapper) form.getDocument().getNewMaintainableObject().getDataObject()) .getLoDisplayWrapperModel(); losCompare = ((CourseInfoWrapper) form.getDocument().getOldMaintainableObject().getDataObject()) .getLoDisplayWrapperModel(); } else { throw new RuntimeException("Does not support"); } int index = 0; for (LoDisplayInfoWrapper lo : los.getLoWrappers()) { if (!lo.isFakeObjectForCompare()) { LoDisplayInfoWrapper loToCompare = getLOFromCompare(losCompare.getLoWrappers(), index); if (loToCompare != null && !loToCompare.isFakeObjectForCompare() && lo.getLoInfo() != null && loToCompare.getLoInfo() != null) { String loDesc = StringUtils.trim(lo.getLoInfo().getDescr().getPlain()); String compareLoDesc = StringUtils.trim(loToCompare.getLoInfo().getDescr().getPlain()); loDesc = StringUtils.replaceChars(loDesc, "\t", " "); compareLoDesc = StringUtils.replaceChars(compareLoDesc, "\t", " "); if (!StringUtils.equals(compareLoDesc, loDesc)) { lo.setHightlightRow(true); loToCompare.setHightlightRow(true); } } else { lo.setHightlightRow(true); } } index++; } }
From source file:org.lexevs.dao.indexer.utility.Utility.java
public static String getIndexName(AbsoluteCodingSchemeVersionReference reference) throws LBParameterException { String codingSchemeName = LexEvsServiceLocator.getInstance().getSystemResourceService() .getInternalCodingSchemeNameForUserCodingSchemeName(reference.getCodingSchemeURN(), reference.getCodingSchemeVersion()); String indexName = codingSchemeName + "-" + reference.getCodingSchemeVersion(); char charsToReplace[] = { '!', '#', '$', '%', '&', '\'', '@', '^', '`', '~', '+', ',', '.', ';', ':', '=', ')', '(', '>', '<', '+', '|', '\\', '/', '*', '"' }; for (char c : charsToReplace) { indexName = StringUtils.replaceChars(indexName, c, '_'); }/*from www .jav a 2 s .co m*/ return indexName; }
From source file:org.lfs.common.dao.util.SQLTool.java
private static String createSQLCreateTable(ConfigurableFile configurable) { FileSet fs = (FileSet) configurable; StringBuilder sb = new StringBuilder(); sb.append("create table ").append(StringUtils.replaceChars(fs.getFileNameInRegExpr(), ".", "_")); // table name should be unique for each FileSet object sb.append("("); for (FileColumn col : fs.getFileColumns()) { sb.append(col.getId()).append(" "); sb.append(generateType(col.getType(), col.getDataLength())).append(","); }//from w w w . j a va 2s .c o m sb.delete(sb.length() - 1, sb.length()); sb.append(")"); return sb.toString(); }
From source file:org.metaabm.act.provider.AActItemProvider.java
public String suggestID(IID object) { String suggestID = StringUtils.deleteWhitespace(suggestLabel(object)); suggestID = StringUtils.replaceChars(suggestID, "[]()", null); return StringUtils.uncapitalize(suggestID); }
From source file:org.opencommercesearch.CloudSearchServer.java
/** * Helper method to format a synonym list into a file name for storing in * ZooKeeper// w w w . j a v a2s. c o m * * @param synonymListName * the name of the synonym list to format * @return the file name */ private String formatSynonymListFileName(String synonymListName) { if (synonymListName.trim().endsWith(".txt")) { return StringUtils.replaceChars(synonymListName, ' ', '_').toLowerCase(); } return StringUtils.replaceChars(synonymListName, ' ', '_').toLowerCase() + ".txt"; }
From source file:org.openlegacy.designtime.terminal.analyzer.support.ScreenEntityDefinitionsBuilderUtils.java
private ScreenIdentifier createIdentifier(ScreenEntityDesigntimeDefinition screenEntityDefinition, TerminalField field, boolean verifyExistance) { if (verifyExistance && isFieldRemovedFromSnapshot(screenEntityDefinition, field)) { return null; }// w ww.jav a 2 s .c o m // ignore the identifier if it's outside a defined window border. On border is OK (true param) if (!screenEntityDefinition.getSnapshotBorders().contains(field.getPosition(), true)) { return null; } String fieldValue = field.getVisualValue() != null ? field.getVisualValue() : field.getValue(); fieldValue = StringUtils.replaceChars(fieldValue, "\n\t", " "); fieldValue = fieldValue.replaceAll("\"", "\\\\\""); ScreenIdentifier identifier = new SimpleScreenIdentifier(field.getPosition(), fieldValue, false); return identifier; }