List of usage examples for org.apache.commons.lang ArrayUtils isEmpty
public static boolean isEmpty(boolean[] array)
Checks if an array of primitive booleans is empty or null
.
From source file:cx.jbzdak.diesIrae.genieConnector.GenieException.java
@Override public String getMessage() { StringBuilder message = new StringBuilder("Bd Genie 2000 "); if (!StringUtils.isEmpty(super.getMessage())) { message.append("wiadomo orygnialna '"); message.append(super.getMessage()); message.append("' "); }//from ww w.java2s.c o m message.append("Kod bdu oglnego '"); message.append(String.valueOf(errorCode)); message.append(", "); message.append(errorDescription); if (!ArrayUtils.isEmpty(additionalInfo)) { message.append("\nDodatkowe informacje: "); for (Object o : additionalInfo) { message.append(o); message.append("\n"); } } return message.toString(); }
From source file:io.fabric8.utils.cxf.WebClients.java
public static void configureCaCert(WebClient webClient, String caCertData, File caCertFile) { try {/*from w w w. ja v a 2 s . c o m*/ KeyStore trustStore = createTrustStore(caCertData, caCertFile); TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); HTTPConduit conduit = WebClient.getConfig(webClient).getHttpConduit(); TLSClientParameters params = conduit.getTlsClientParameters(); if (params == null) { params = new TLSClientParameters(); conduit.setTlsClientParameters(params); } TrustManager[] existingTrustManagers = params.getTrustManagers(); if (!ArrayUtils.isEmpty(existingTrustManagers)) { trustManagers = (TrustManager[]) ArrayUtils.addAll(existingTrustManagers, trustManagers); } params.setTrustManagers(trustManagers); } catch (Exception e) { LOG.error("Could not create trust manager for " + caCertFile, e); } }
From source file:de.codesourcery.planning.impl.AbstractJob.java
@Override public final boolean hasStatus(JobStatus... s) { if (ArrayUtils.isEmpty(s)) { throw new IllegalArgumentException("s cannot be NULL"); }//from w w w . ja va 2 s .c om for (JobStatus expected : s) { if (status == expected) { return true; } } return false; }
From source file:hudson.plugins.clearcase.ConfigSpec.java
public ConfigSpec setLoadRules(String[] loadRules) { StringBuilder sb = stripLoadRulesOnRaw(); if (!ArrayUtils.isEmpty(loadRules)) { for (String loadRule : loadRules) { // Make sure the load rule starts with \ or /, as appropriate sb.append("load "); sb.append(cleanLoadRule(loadRule, isUnix).trim()).append(PathUtil.newLineForOS(isUnix)); }// ww w. j a v a 2 s. c o m } return new ConfigSpec(sb.toString(), isUnix); }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getAuthorizedInvoiceAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { total = total.add(invoices[i].getTollAmount()); }//from w w w .j av a 2 s.c o m } } return total; }
From source file:com.dreamerpartner.codereview.lucene.SearchHelper.java
/** * ?//from w w w.ja v a2 s . c o m * @param module ? * @param fields ? * @param queryStr ? * @param sort * @param pageNo * @param pageSize * @return */ @SuppressWarnings("deprecation") public static PageBean<Document> search(String module, String[] fields, String[] queryStr, Sort sort, int pageNo, int pageSize) { if (ArrayUtils.isEmpty(fields) || ArrayUtils.isEmpty(queryStr)) return null; IndexReader reader = null; try { reader = DirectoryReader.open(FSDirectory.open(new File(LuceneUtil.getIndexPath(module)))); IndexSearcher searcher = new IndexSearcher(reader); BooleanClause.Occur[] flags = new BooleanClause.Occur[fields.length]; for (int i = 0; i < fields.length; i++) { flags[i] = BooleanClause.Occur.SHOULD; } Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_4_10_0); Query query = MultiFieldQueryParser.parse(Version.LUCENE_4_10_0, queryStr, fields, flags, analyzer); // return doPagingSearch(searcher, query, sort, pageNo, pageSize); } catch (Exception e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); } catch (IOException e) { e.printStackTrace(); } } return null; }
From source file:net.jforum.core.hibernate.PostReportDAO.java
private Query createGetAllQuery(PostReportStatus status, int... forumIds) { String query = "select new PostReport(report.id, post.id, post.subject, post.topic.id, report.date, " + "report.description, reportUser.username, reportUser.id, postUser.username, postUser.id, report.status)" + " from PostReport report " + " join report.user reportUser " + " join report.post post" + " join post.user postUser " + " where report.status = :status"; if (!ArrayUtils.isEmpty(forumIds)) { query += " and post.forum.id in (:forumIds)"; }/*from ww w. j a v a 2s.co m*/ if (!ArrayUtils.isEmpty(forumIds)) { return this.session().createQuery(query).setParameter("status", status).setParameterList("forumIds", this.primitiveToWrapper(forumIds)); } else { return this.session().createQuery(query).setParameter("status", status); } }
From source file:com.mindcognition.mindraider.ui.swing.explorer.NotebooksTree.java
private void reloadModel(String labelUri, String notebookPrefix) { clear();// w ww .j a v a 2s .co m notebookUris.clear(); ResourceDescriptor[] labelDescriptors = MindRaider.labelCustodian.getLabelDescriptors(); if (!ArrayUtils.isEmpty(labelDescriptors)) { for (ResourceDescriptor folderDescriptor : labelDescriptors) { String folderUri = folderDescriptor.getUri(); if (labelUri == null || (labelUri != null && labelUri.equals(folderUri))) { // insert notebooks ResourceDescriptor[] notebookDescriptors = MindRaider.labelCustodian .getOutlineDescriptors(folderUri); if (notebookDescriptors != null) { for (ResourceDescriptor notebookDescriptor : notebookDescriptors) { if (notebookPrefix == null || (notebookPrefix != null && notebookDescriptor.getLabel() .toLowerCase().startsWith(notebookPrefix.toLowerCase()))) { addNodeToTree(notebookDescriptor.getLabel(), notebookDescriptor.getUri()); } } } } } // now expand 0 rows - 0 row is enough (sub nodes has no children) expandRow(0); setSelectionRow(0); ((NotebookNodeUserObject) notebooksRootNode.getUserObject()).setNotebooksConcepts(getRowCount() - 1); } validate(); }
From source file:hudson.plugins.clearcase.action.BaseSnapshotCheckoutAction.java
@Override public boolean checkout(Launcher launcher, FilePath workspace, String viewTag) throws IOException, InterruptedException { boolean viewCreated = cleanAndCreateViewIfNeeded(workspace, viewTag, viewPath, null); // At this stage, we have a valid view and a valid path boolean needSetCs = true; SnapshotCheckoutAction.LoadRulesDelta loadRulesDelta = null; if (!viewCreated) { ConfigSpec viewConfigSpec = new ConfigSpec(getCleartool().catcs(viewTag), launcher.isUnix()); loadRulesDelta = getLoadRulesDelta(viewConfigSpec.getLoadRules(), launcher); needSetCs = !configSpec.stripLoadRules().equals(viewConfigSpec.stripLoadRules()) || !ArrayUtils.isEmpty(loadRulesDelta.getRemoved()); }// w ww. j av a2s . c om CleartoolUpdateResult result = null; if (needSetCs) { try { result = getCleartool().setcs2(viewPath, SetcsOption.CONFIGSPEC, configSpec.setLoadRules(loadRules).getRaw()); } catch (IOException e) { launcher.getListener().fatalError(e.toString()); return false; } } else { // Perform a full update of the view to reevaluate config spec try { result = getCleartool().setcs2(viewPath, SetcsOption.CURRENT, null); } catch (IOException e) { launcher.getListener().fatalError(e.toString()); return false; } String[] addedLoadRules = loadRulesDelta.getAdded(); if (!ArrayUtils.isEmpty(addedLoadRules)) { // Config spec haven't changed, but there are new load rules try { result = getCleartool().update2(viewPath, addedLoadRules); } catch (IOException e) { launcher.getListener().fatalError(e.toString()); return false; } } } if (result != null) { updtFile = result.getUpdateFile(); launcher.getListener().getLogger().println("[INFO] updt file name: '" + updtFile.getRemote() + "'"); } if (build != null) { // add config spec to dataAction ClearCaseDataAction dataAction = build.getAction(ClearCaseDataAction.class); if (dataAction != null) { dataAction.setCspec(getCleartool().catcs(viewTag).trim()); } } return true; }
From source file:hudson.plugins.sonar.SonarGlobalConfiguration.java
/** * Attempts to migrated data from SonarPublished, which was previously holding the global configuration. * It is thread safe and will refuse to migrate if a SonarQube installation already exists in this class. * Migration will only be attempted once. *//*from w ww . j av a2 s .c o m*/ public void migrate() { if (migrated) { return; } synchronized (this) { if (migrated) { return; } // SonarPublisher might be null if Maven plugin is disabled or not installed Jenkins j = Jenkins.getInstance(); if (j == null) { return; } DescriptorImpl publisher = j.getDescriptorByType(SonarPublisher.DescriptorImpl.class); if (publisher != null && publisher.getDeprecatedInstallations() != null && publisher.getDeprecatedInstallations().length > 0) { if (ArrayUtils.isEmpty(this.installations)) { this.installations = publisher.getDeprecatedInstallations(); this.buildWrapperEnabled = publisher.isDeprecatedBuildWrapperEnabled(); save(); } else { Logger.LOG.warning( "SonarQube server configurations exist in both deprecated SonarPublisher and SonarGlobalConfiguration. Deleting deprecated configuration.."); } publisher.deleteGlobalConfiguration(); } migrated = true; } }