List of usage examples for org.apache.commons.lang StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(String str, String searchStr)
Checks if String contains a search String irrespective of case, handling null
.
From source file:org.jenkinsci.plugins.os_ci.utils.VersionUtils.java
static public ArrayList<ArtifactParameters> resolveVersionInformation(ArtifactParameters[] artifacts, AbstractBuild build, BuildListener listener) { ArrayList<ArtifactParameters> resolvedModules = new ArrayList<ArtifactParameters>(); // Resolve version information on all modules if (artifacts != null) { for (ArtifactParameters artifact : artifacts) { String moduleVersion = artifact.getVersion(); if (artifact.getVersion().equalsIgnoreCase("latest")) { NexusClient nc = new NexusClient(artifact, build, listener); moduleVersion = nc.getLatestVersion(); } else if (StringUtils.containsIgnoreCase(artifact.getVersion(), "cisco_vcs-f_snapshots")) { // repoId = "cisco_vcs-f_snapshots"; NexusClient nc = new NexusClient(artifact, build, listener); moduleVersion = nc.getLatestVersion("cisco_vcs-f_snapshots"); }//from w w w .j a v a2s .c o m if (artifact.getVersion().equalsIgnoreCase("latest-snapshot")) { NexusClient nc = new NexusClient(artifact, build, listener); moduleVersion = nc.getLatestVersion("snapshots"); } //checkArtifactVersion(artifact.getArtifactId(), moduleVersion); resolvedModules.add(new ArtifactParameters(artifact.getGroupId(), artifact.getArtifactId(), moduleVersion, artifact.getOsVersion())); } } return resolvedModules; }
From source file:org.jevis.emaildatasource.EMailManager.java
/** * Find attachment and save it in inputstream * * @param message EMail message/* www . ja v a2 s.c om*/ * * @return List of InputStream */ private static List<InputStream> prepareAnswer(Message message, String filename) throws IOException, MessagingException { Multipart multiPart = (Multipart) message.getContent(); List<InputStream> input = new ArrayList<>(); // For all multipart contents for (int i = 0; i < multiPart.getCount(); i++) { MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(i); String disp = part.getDisposition(); String partName = part.getFileName(); Logger.getLogger(EMailDataSource.class.getName()).log(Level.INFO, "is Multipart"); // If multipart content is attachment if (!Part.ATTACHMENT.equalsIgnoreCase(disp) && !StringUtils.isNotBlank(partName)) { continue; // dealing with attachments only } if (Part.ATTACHMENT.equalsIgnoreCase(disp) || disp == null) { if (StringUtils.containsIgnoreCase(part.getFileName(), filename)) { Logger.getLogger(EMailManager.class.getName()).log(Level.INFO, "Attach found: {0}", part.getFileName()); final long start = System.currentTimeMillis(); input.add(toInputStream(part));//add attach to answerlist final long answerDone = System.currentTimeMillis(); Logger.getLogger(EMailDataSource.class.getName()).log(Level.INFO, ">>Attach to inputstream: " + (answerDone - start) + " Millisek."); } } } //for multipart check return input; }
From source file:org.jumpmind.db.platform.AbstractJdbcDdlReader.java
public Table readTable(final String catalog, final String schema, final String table) { try {/*from w w w.j av a 2 s. c o m*/ log.debug("reading table: " + table); JdbcSqlTemplate sqlTemplate = (JdbcSqlTemplate) platform.getSqlTemplate(); return postprocessTableFromDatabase(sqlTemplate.execute(new IConnectionCallback<Table>() { public Table execute(Connection connection) throws SQLException { DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper(); metaData.setMetaData(connection.getMetaData()); metaData.setCatalog(catalog); metaData.setSchemaPattern(schema); metaData.setTableTypes(null); ResultSet tableData = null; try { log.debug("getting table metadata for " + table); tableData = metaData.getTables(getTableNamePattern(table)); log.debug("done getting table metadata for " + table); if (tableData != null && tableData.next()) { Map<String, Object> values = readMetaData(tableData, initColumnsForTable()); return readTable(connection, metaData, values); } else { return null; } } finally { close(tableData); } } })); } catch (SqlException e) { if (e.getMessage() != null && StringUtils.containsIgnoreCase(e.getMessage(), "does not exist")) { return null; } else { throw e; } } }
From source file:org.jumpmind.db.platform.JdbcDatabasePlatformFactory.java
private static boolean isMariaDBDatabase(Connection connection) { Statement stmt = null;/* w w w.j av a2s. c o m*/ ResultSet rs = null; String productName = null; boolean isMariaDB = false; try { stmt = connection.createStatement(); rs = stmt.executeQuery(MariaDBDatabasePlatform.SQL_GET_MARIADB_NAME); while (rs.next()) { productName = rs.getString(1); } if (productName != null && StringUtils.containsIgnoreCase(productName, DatabaseNamesConstants.MARIADB)) { isMariaDB = true; } } catch (SQLException ex) { // ignore the exception, if it is caught, then this is most likely // not a mariadb database } finally { try { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } } catch (SQLException ex) { } } return isMariaDB; }
From source file:org.jumpmind.metl.ui.common.MultiPropertyFilter.java
@SuppressWarnings("rawtypes") public boolean passesFilter(Object itemId, Item item) throws UnsupportedOperationException { for (String property : properties) { Property prop = item.getItemProperty(property); if (prop != null) { String value = null;//from w w w.j a v a2 s .co m if (prop.getValue() != null) { value = prop.getValue().toString(); } if (StringUtils.containsIgnoreCase(value, text)) { return true; } } else { throw new RuntimeException("Property " + property + " does not exist in item, valid properties are: " + item.getItemPropertyIds()); } } return false; }
From source file:org.kie.workbench.common.dmn.backend.DMNMarshallerTest.java
/** * Two issues bellow prevents us from running marshalling tests on IBM jdk * https://support.oracle.com/knowledge/Middleware/1459269_1.html * https://www-01.ibm.com/support/docview.wss?uid=swg1PK99682 *//*from w ww.j a v a2 s . c om*/ @Before public void doNotRunTestsOnIbmJdk() { final String ibmVendorName = "IBM"; final String javaVendorPropertyKey = "java.vendor"; Assume.assumeFalse( StringUtils.containsIgnoreCase(System.getProperty(javaVendorPropertyKey), ibmVendorName)); }
From source file:org.kitodo.config.ConfigProject.java
/** * Find title definitions. Conditions:/*from www.java2 s.c om*/ * <dl> * <dt>{@code isDocType.equals("") && isNotDocType.equals("")}</dt> * <dd>nothing was specified</dd> * <dt>{@code isNotDocType.equals("") && StringUtils.containsIgnoreCase(isDocType, docType)}</dt> * <dd>only duty was specified</dd> * <dt>{@code isDocType.equals("") && !StringUtils.containsIgnoreCase(isNotDocType, docType)}</dt> * <dd>only may not was specified</dd> * <dt>{@code !isDocType.equals("") && !isNotDocType.equals("") && StringUtils.containsIgnoreCase(isDocType, docType) * && !StringUtils.containsIgnoreCase(isNotDocType, docType)}</dt> * <dd>both were specified</dd> * </dl> */ private String findTitleDefinition(String title, String docType, String isDocType, String isNotDocType) { if ((isDocType.equals("") && (isNotDocType.equals("") || !StringUtils.containsIgnoreCase(isNotDocType, docType))) || (!isDocType.equals("") && !isNotDocType.equals("") && StringUtils.containsIgnoreCase(isDocType, docType) && !StringUtils.containsIgnoreCase(isNotDocType, docType)) || (isNotDocType.equals("") && StringUtils.containsIgnoreCase(isDocType, docType))) { return title; } return ""; }
From source file:org.kitodo.production.process.field.AdditionalField.java
/** * Get show depending on document type./*from w w w .jav a2 s . c o m*/ * * @return true or false */ public boolean showDependingOnDoctype() { // if nothing was specified, then show if (this.isDocType.equals("") && this.isNotDoctype.equals("")) { return true; } // if obligatory was specified if (!this.isDocType.equals("") && !StringUtils.containsIgnoreCase(this.isDocType, this.docType)) { return false; } // if only "may not" was specified return !(!this.isNotDoctype.equals("") && StringUtils.containsIgnoreCase(this.isNotDoctype, this.docType)); }
From source file:org.kuali.kfs.coa.document.validation.impl.AccountRule.java
/** * the income stream account is required if account's sub fund group code's fund group code is either GF or CG. * * @param newAccount/* ww w . j av a 2 s . c o m*/ * @return true if fund group code (obtained through sub fund group) is in the system parameter INCOME_STREAM_ACCOUNT_REQUIRING_FUND_GROUPS (values GF;CG) * else return false. */ protected boolean checkIncomeStreamAccountRule() { // KFSMI-4877: if fund group is in system parameter values then income stream account number must exist. if (ObjectUtils.isNotNull(newAccount.getSubFundGroup()) && StringUtils.isNotBlank(newAccount.getSubFundGroup().getFundGroupCode())) { if (ObjectUtils.isNull(newAccount.getIncomeStreamAccount())) { String incomeStreamRequiringFundGroupCode = SpringContext.getBean(ParameterService.class) .getParameterValueAsString(Account.class, KFSConstants.ChartApcParms.INCOME_STREAM_ACCOUNT_REQUIRING_FUND_GROUPS); if (StringUtils.containsIgnoreCase(newAccount.getSubFundGroup().getFundGroupCode(), incomeStreamRequiringFundGroupCode)) { GlobalVariables.getMessageMap().putError(KFSPropertyConstants.ACCOUNT_NUMBER, KFSKeyConstants.ERROR_DOCUMENT_BA_NO_INCOME_STREAM_ACCOUNT, newAccount.getAccountNumber()); return false; } } } return true; }
From source file:org.kuali.kfs.fp.document.service.impl.CashReceiptCoverSheetServiceImpl.java
/** * Use iText <code>{@link PdfStamper}</code> to stamp information from <code>{@link CashReceiptDocument}</code> into field * values on a PDF Form Template./*from www . j a va2 s . c o m*/ * * @param document The cash receipt document the values will be pulled from. * @param searchPath The directory path of the template to be used to generate the cover sheet. * @param returnStream The output stream the cover sheet will be written to. */ protected void stampPdfFormValues(CashReceiptDocument document, String searchPath, OutputStream returnStream) throws Exception { String templateName = CR_COVERSHEET_TEMPLATE_NM; try { // populate form with document values //KFSMI-7303 //The PDF template is retrieved through web static URL rather than file path, so the File separator is unnecessary final boolean isWebResourcePath = StringUtils.containsIgnoreCase(searchPath, "HTTP"); //skip the File.separator if reference by web resource PdfStamper stamper = new PdfStamper( new PdfReader(searchPath + (isWebResourcePath ? "" : File.separator) + templateName), returnStream); AcroFields populatedCoverSheet = stamper.getAcroFields(); populatedCoverSheet.setField(DOCUMENT_NUMBER_FIELD, document.getDocumentNumber()); populatedCoverSheet.setField(INITIATOR_FIELD, document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()); populatedCoverSheet.setField(CREATED_DATE_FIELD, document.getDocumentHeader().getWorkflowDocument().getDateCreated().toString()); populatedCoverSheet.setField(AMOUNT_FIELD, document.getTotalDollarAmount().toString()); populatedCoverSheet.setField(ORG_DOC_NUMBER_FIELD, document.getDocumentHeader().getOrganizationDocumentNumber()); populatedCoverSheet.setField(CAMPUS_FIELD, document.getCampusLocationCode()); if (document.getDepositDate() != null) { // This value won't be set until the CR document is // deposited. A CR document is deposited only when it has // been associated with a Cash Management Document (CMD) // and with a Deposit within that CMD. And only when the // CMD is submitted and FINAL, will the CR documents // associated with it, be "deposited." So this value will // fill in at an arbitrarily later point in time. So your // code shouldn't expect it, but if it's there, then // display it. populatedCoverSheet.setField(DEPOSIT_DATE_FIELD, document.getDepositDate().toString()); } populatedCoverSheet.setField(DESCRIPTION_FIELD, document.getDocumentHeader().getDocumentDescription()); populatedCoverSheet.setField(EXPLANATION_FIELD, document.getDocumentHeader().getExplanation()); /* * We should print original amounts before cash manager approves the CR; after that, we should print confirmed amounts. * Note that, in CashReceiptAction.printCoverSheet, it always retrieves the CR from DB, rather than from the current form. * Since during CashManagement route node, the CR can't be saved until CM approves/disapproves the document; this means * that if CM prints during this route node, he will get the original amounts. This is consistent with our logic here. */ boolean isConfirmed = document.isConfirmed(); KualiDecimal totalCheckAmount = !isConfirmed ? document.getTotalCheckAmount() : document.getTotalConfirmedCheckAmount(); KualiDecimal totalCurrencyAmount = !isConfirmed ? document.getTotalCurrencyAmount() : document.getTotalConfirmedCurrencyAmount(); KualiDecimal totalCoinAmount = !isConfirmed ? document.getTotalCoinAmount() : document.getTotalConfirmedCoinAmount(); KualiDecimal totalCashInAmount = !isConfirmed ? document.getTotalCashInAmount() : document.getTotalConfirmedCashInAmount(); KualiDecimal totalMoneyInAmount = !isConfirmed ? document.getTotalMoneyInAmount() : document.getTotalConfirmedMoneyInAmount(); KualiDecimal totalChangeCurrencyAmount = !isConfirmed ? document.getTotalChangeCurrencyAmount() : document.getTotalConfirmedChangeCurrencyAmount(); KualiDecimal totalChangeCoinAmount = !isConfirmed ? document.getTotalChangeCoinAmount() : document.getTotalConfirmedChangeCoinAmount(); KualiDecimal totalChangeAmount = !isConfirmed ? document.getTotalChangeAmount() : document.getTotalConfirmedChangeAmount(); KualiDecimal totalNetAmount = !isConfirmed ? document.getTotalNetAmount() : document.getTotalConfirmedNetAmount(); populatedCoverSheet.setField(CHECKS_FIELD, totalCheckAmount.toString()); populatedCoverSheet.setField(CURRENCY_FIELD, totalCurrencyAmount.toString()); populatedCoverSheet.setField(COIN_FIELD, totalCoinAmount.toString()); populatedCoverSheet.setField(CASH_IN_FIELD, totalCashInAmount.toString()); populatedCoverSheet.setField(MONEY_IN_FIELD, totalMoneyInAmount.toString()); populatedCoverSheet.setField(CHANGE_CURRENCY_FIELD, totalChangeCurrencyAmount.toString()); populatedCoverSheet.setField(CHANGE_COIN_FIELD, totalChangeCoinAmount.toString()); populatedCoverSheet.setField(CHANGE_OUT_FIELD, totalChangeAmount.toString()); populatedCoverSheet.setField(RECONCILIATION_TOTAL_FIELD, totalNetAmount.toString()); stamper.setFormFlattening(true); stamper.close(); } catch (Exception e) { LOG.error("Error creating coversheet for: " + document.getDocumentNumber() + ". ::" + e); throw e; } }