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:br.msf.commons.netbeans.util.ProjectUtils.java
public static Collection<Project> getOpenProjects() { Project[] open = OpenProjects.getDefault().getOpenProjects(); return ArrayUtils.isEmpty(open) ? CollectionUtils.EMPTY_COLLECTION : Arrays.asList(open); }
From source file:extend.logback.logging.spi.StatisticsEvent.java
@Override public String getMessage() { return ArrayUtils.isEmpty(argumentArray) ? this.message : getFormattedMessage(); }
From source file:net.jforum.services.ModerationService.java
/** * Move a set of topics to another forum * @param toForumId the id of the new forum * @param topicIds the id of the topics to move * @param moderationLog/* www.java2 s. c om*/ */ public void moveTopics(int toForumId, ModerationLog moderationLog, int... topicIds) { if (ArrayUtils.isEmpty(topicIds)) { return; } Forum newForum = this.forumRepository.get(toForumId); Forum oldForum = this.topicRepository.get(topicIds[0]).getForum(); this.forumRepository.moveTopics(newForum, topicIds); newForum.setLastPost(this.forumRepository.getLastPost(newForum)); oldForum.setLastPost(this.forumRepository.getLastPost(oldForum)); this.moderationLogService.registerMovedTopics(moderationLog, topicIds); }
From source file:com.jaeksoft.searchlib.snippet.SnippetVectors.java
final static Iterator<SnippetVector> extractTermVectorIterator(final int docId, final ReaderInterface reader, final SnippetQueries snippetQueries, final String fieldName, final Timer parentTimer, final long expiration) throws IOException, ParseException, SyntaxError, SearchLibException { if (ArrayUtils.isEmpty(snippetQueries.terms)) return null; Timer t = new Timer(parentTimer, "getTermPositionVector " + fieldName); TermPositionVector termVector = getTermPositionVector(reader, docId, fieldName); t.end(null);//from w w w .j av a 2s .co m if (termVector == null) return null; Collection<SnippetVector> vectors = new ArrayList<SnippetVector>(); t = new Timer(parentTimer, "populate"); populate(termVector, snippetQueries.terms, vectors, t); t.end(null); t = new Timer(parentTimer, "removeIncludes"); vectors = removeIncludes(vectors); t.end(null); t = new Timer(parentTimer, "checkQueries"); snippetQueries.checkQueries(vectors, t, expiration); t.end(null); t = new Timer(parentTimer, "removeNonQuery"); vectors = removeNonQuery(vectors); t.end(null); return vectors.iterator(); }
From source file:de.codesourcery.eve.apiclient.utils.PasswordCipherProvider.java
@Override public Cipher createCipher(boolean decrypt) { final char[] password = getPassword(); if (ArrayUtils.isEmpty(password)) { log.warn("createCipher(): No password , returning NULL cipher."); return new NullCipher(); }//from w w w. j ava 2 s. c o m try { final int iterations = 20; final byte[] salt = new byte[] { (byte) 0xab, (byte) 0xfe, 0x03, 0x47, (byte) 0xde, (byte) 0x99, (byte) 0xff, 0x1c }; final PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iterations); final PBEKeySpec spec = new PBEKeySpec(password, salt, iterations); final SecretKeyFactory fac = SecretKeyFactory.getInstance("PBEWithMD5andDES"); final SecretKey secretKey; try { secretKey = fac.generateSecret(spec); } catch (InvalidKeySpecException e) { throw e; } final Cipher cipher = Cipher.getInstance("PBEWithMD5andDES"); if (decrypt) { cipher.init(Cipher.DECRYPT_MODE, secretKey, pbeSpec); } else { cipher.init(Cipher.ENCRYPT_MODE, secretKey, pbeSpec); } return cipher; } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.autonomy.aci.client.transport.impl.AbstractEncryptionCodec.java
/** * This method should firstly deflate {@code bytes}, then encrypt it and finally Base64 encode it. * @param bytes An array of bytes to encrypt * @return A Base64 encoded, encrypted, deflated copy of the input array * @throws EncryptionCodecException if there was a problem during any of the three stages of processing *//*from w w w. j ava 2 s .c om*/ public byte[] encrypt(final byte[] bytes) throws EncryptionCodecException { LOGGER.trace("encrypt() called..."); if (ArrayUtils.isEmpty(bytes)) { throw new IllegalArgumentException("The byte array to encrypt must not be null or empty."); } // Do all the work... return encodeInternal(encryptInternal(deflateInternal(bytes))); }
From source file:eu.europeana.api2.v2.model.json.view.RichView.java
@Override public String[] getEdmIsShownBy() { if (ArrayUtils.isEmpty(isShownBy)) { return isShownBy; }/*from ww w . j a v a 2s. c o m*/ // String provider = getProvider()[0]; List<String> isShownByLinks = new ArrayList<>(); for (String item : isShownBy) { if (StringUtils.isBlank(item)) { continue; } isShownByLinks.add(item); } return isShownByLinks.toArray(new String[isShownByLinks.size()]); }
From source file:com.etcc.csc.presentation.action.payment.DisplayPaymentDetailAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaActionForm dynaForm = (DynaActionForm) form; HttpSession session = request.getSession(); AccountLoginDTO accountLoginDTO = SessionUtil.getSessionAccountLogin(session); PaymentContext paymentContext = SessionUtil.getPaymentContext(session); if (!ArrayUtils.isEmpty(paymentContext.getAuthorizedStatementInvoices())) { dynaForm.set("licensePlate", accountLoginDTO.getLicPlate() + "~" + accountLoginDTO.getLicState()); dynaForm.set("tagAmount", paymentContext.getTagAmount().toPlainString()); return mapping.findForward("monthlyStatement.success"); }//from w w w . ja va 2 s . c o m BigDecimal minGoodBalance = getGoodBalanceMinPayment(); if (paymentContext.getOriginalTagAmount() != null && paymentContext.getTagAmount() != null && paymentContext.getOriginalTagAmount().compareTo(minGoodBalance) == 0 && paymentContext.getTagAmount().compareTo(minGoodBalance) >= 0) { if (SessionUtil.getRetailTransId(session) == 0) { request.setAttribute("SuggestedPaymentMessage", true); } } //rtalreja 02/02/2015 boolean hasViolInvoices = processPopulate(paymentContext, form, session); logger.info("Has viol Invoices ::" + hasViolInvoices); PaymentInterface payment = (PaymentInterface) DelegateFactory.create(DelegateEnum.PAYMENT_DELEGATE); AccountInterface account = (AccountInterface) DelegateFactory.create(DelegateEnum.ACCOUNT); Collection<TagDTO> dtos = account.getAccountTags(accountLoginDTO); boolean hasVbInvoice = false; long invoice_id = 0; if (dtos != null && Constants.LOGIN_TYPE_ACCOUNT.equals(accountLoginDTO.getLoginType())) { for (TagDTO dto : dtos) { invoice_id = payment.hasVBInvoices(dto.getLicPlate(), dto.getLicState(), null, null); if (invoice_id > 0) { hasVbInvoice = true; break; } } } else { BigDecimal invoiceId = null; if (Constants.LOGIN_TYPE_ZIPCASH_INVOICE.equals(accountLoginDTO.getLoginType()) || Constants.LOGIN_TYPE_INVOICE.equals(accountLoginDTO.getLoginType())) { invoiceId = new BigDecimal(accountLoginDTO.getInvoiceId()); } BigDecimal violatorId = null; if (accountLoginDTO.getViolatorId() != 0) { violatorId = new BigDecimal(accountLoginDTO.getViolatorId()); } else if (accountLoginDTO.getAcctId() != 0 && Constants.LOGIN_TYPE_ZIPCASH_ACCOUNT.equals(accountLoginDTO.getLoginType())) { violatorId = new BigDecimal(accountLoginDTO.getAcctId()); } invoice_id = payment.hasVBInvoices(accountLoginDTO.getLicPlate(), accountLoginDTO.getLicState(), invoiceId, violatorId); hasVbInvoice = (invoice_id > 0); } if (hasVbInvoice) { request.setAttribute("hasVbViolation", "Y"); request.setAttribute("vBviolationInvoiceId", invoice_id); //rtalreja :: Added logger info :: Issue ZipCash invoices not displayed on Success Forwards logger.error("Account has ZipCash Invoices :: These can be paid through ZipCash Links"); } //rtalreja - 02/02/2015 to handle cases where no invoices are there //In such Scenarios with accounts we have to move to receipt without making payments if ((!hasViolInvoices) && (paymentContext.getOriginalTagAmount() == null || paymentContext.getOriginalTagAmount().compareTo(new BigDecimal(0)) == 0)) { return mapping.findForward("successTag"); } return mapping.findForward("success"); }
From source file:net.jforum.repository.PostReportDao.java
private int countTotalReportsByStatus(PostReportStatus status, int... forumIds) { Criteria criteria = session.createCriteria(PostReport.class).add(Restrictions.eq("status", status)) .setProjection(Projections.rowCount()); if (!ArrayUtils.isEmpty(forumIds)) { criteria.createAlias("post", "post") .add(Restrictions.in("post.forum.id", this.primitiveToWrapper(forumIds))); }/*from www . j a v a 2 s . c om*/ return ((Number) criteria.uniqueResult()).intValue(); }
From source file:com.qcadoo.report.api.ReportException.java
public ReportException(final Type type, final Throwable cause, final String... args) { super(ReportException.generateMessage(type, args), cause); this.type = type; if (ArrayUtils.isEmpty(args)) { this.args = ArrayUtils.EMPTY_STRING_ARRAY; } else {/*from w w w . ja v a 2 s .c om*/ this.args = args; } }