List of usage examples for org.apache.commons.lang3 StringUtils isNoneBlank
public static boolean isNoneBlank(final CharSequence... css)
Checks if none of the CharSequences are blank ("") or null and whitespace only..
StringUtils.isNoneBlank(null) = false StringUtils.isNoneBlank(null, "foo") = false StringUtils.isNoneBlank(null, null) = false StringUtils.isNoneBlank("", "bar") = false StringUtils.isNoneBlank("bob", "") = false StringUtils.isNoneBlank(" bob ", null) = false StringUtils.isNoneBlank(" ", "bar") = false StringUtils.isNoneBlank("foo", "bar") = true
From source file:com.hbc.api.trade.fund.GFundWithdrawController.java
@RequestMapping(value = "v1.0/g/account/withdraw/history", method = RequestMethod.GET, produces = "application/json; charset=utf-8") public ReturnResult withdraw_history(FundAccountLogParam param) { int totalHistoryCount = 0; //final String pattern = "{0}{1}"; List<GFundWithdrawHistory> histories = new ArrayList<GFundWithdrawHistory>(); FundValidator.validateParamString(param.getAccountNo(), "AccountNo"); @SuppressWarnings("unchecked") List<Integer> bizTypeList = Arrays .asList(new Integer[] { BizType.RECHARAGE.value, BizType.BOSS_RECHARAGE.value, BizType.REWARD_BY_YINGDAOYOU.value, BizType.INVITEREWORD.value, BizType.REWARD_BY_MIS.value, BizType.PUNISH_BY_MIS.value, BizType.WITHDRAW_APPLY.value, BizType.WITHDRAW_DENY.value, BizType.PICKUP.value, BizType.TRANSFER.value, BizType.DAILY.value, BizType.SINGLE.value, BizType.CANCAL_TRANSFER.value, BizType.CANCAL_DAILY.value, BizType.CANCLE_SINGLE.value, BizType.CANCAL_COMMNENDATION.value }); List<FundAccountLog> historyAccountLogs = fundAccountLogService .getAccountAllLogsByType(param.getAccountNo(), bizTypeList, param.getLimit(), param.getOffset()); if (historyAccountLogs != null && historyAccountLogs.size() > 0) { totalHistoryCount = fundAccountLogService.getAccountAllLogsSizeByType(param.getAccountNo(), bizTypeList);/*from w w w . ja v a 2 s . c om*/ Iterator<FundAccountLog> fundAccountLogIterator = historyAccountLogs.iterator(); while (fundAccountLogIterator.hasNext()) { String orderNo; FundAccountLog fundAccountLog = fundAccountLogIterator.next(); GFundWithdrawHistory history = new GFundWithdrawHistory(); if (fundAccountLog.getBizType() != null) { history.setContent(BizType.getType(fundAccountLog.getBizType()).name); } if (StringUtils.isNoneBlank(orderNo = fundAccountLog.getOrderNo())) { history.setOrderNo(orderNo); } history.setAccountLogNo(fundAccountLog.getLogNo()); history.setBizComment(fundAccountLog.getBizStatus() == 1 ? "?" : ""); history.setCreateTime(DateFormatUtils.format(fundAccountLog.getCreateTime(), DATE_FORMAT)); history.setPrice(String.valueOf(fundAccountLog.getChangAmount())); histories.add(history); } } ReturnResult returnResult = new ReturnResult(); returnResult.setData(histories, totalHistoryCount); return returnResult; }
From source file:com.hbc.api.fund.biz.service.FundWithdrawService.java
public Integer getFundWithdrawListTotalSizeByProcessStatus(FundWithDrawQueryBean queryBean) { FundWithdrawalExample criteria = new FundWithdrawalExample(); FundWithdrawalExample.Criteria cc = criteria.createCriteria(); cc.andProcessStatusEqualTo(queryBean.getProcessStatus()); if (StringUtils.isNoneBlank(queryBean.getGuideNo())) { cc.andGuideNoEqualTo(queryBean.getGuideNo()); }/*from w w w . ja v a 2 s .c o m*/ if (StringUtils.isNoneBlank(queryBean.getGuideName())) { cc.andGuideNameLike( new StringBuilder().append("%").append(queryBean.getGuideName()).append("%").toString()); } if (queryBean.getProcessStatus() == FundWithDrawQueryBean.AUTO_PROC) { if (queryBean.getDrawStatus() == null) { List<Integer> in = new ArrayList<Integer>(); in.add(FundDrawStatus.APPLY.value); in.add(FundDrawStatus.HAVE_TRANSFERED.value); in.add(FundDrawStatus.AUTO_WITHDRAW_FAILED.value); in.add(FundDrawStatus.AUTO_WITHDRAW_APPLIED.value); cc.andDrawStatusIn(in); } else { cc.andDrawStatusEqualTo(queryBean.getDrawStatus()); } } return fundWithdrawMapper.countByExample(criteria); }
From source file:com.chessix.vas.actors.ClerkActor.java
private String createAccount(final CreateAccount.Request message) { log.debug("createAccount({})", message); final String accountId; if (StringUtils.isNoneBlank(message.getAccountId())) { accountId = message.getAccountId(); } else {// w ww . ja v a2s. com accountId = RandomStringUtils.randomNumeric(accountLength); } final Boolean inserted = storage.create(clasId, accountId); if (inserted) { return accountId; } else { return null; } }
From source file:com.oembedler.moon.graphql.engine.GraphQLQueryTemplate.java
protected String expandNestedObjectTree(String nodeName, GraphQLObjectType graphQLOutputType) { StringBuilder stringBuilder = new StringBuilder(); for (GraphQLFieldDefinition graphQLFieldDefinition : graphQLOutputType.getFieldDefinitions()) { GraphQLUnmodifiedType graphQLUnmodifiedType = schemaUtil .getUnmodifiedType(graphQLFieldDefinition.getType()); if (graphQLUnmodifiedType instanceof GraphQLScalarType) stringBuilder.append(graphQLFieldDefinition.getName() + ", "); else {/*from w w w.j a v a 2 s . com*/ GraphQLObjectType castedGraphQLObjectType = (GraphQLObjectType) graphQLUnmodifiedType; stringBuilder .append(expandNestedObjectTree(graphQLFieldDefinition.getName(), castedGraphQLObjectType)); } } String result = StringUtils.removeEnd(stringBuilder.toString(), ", "); return StringUtils.isNoneBlank(result) ? String.format("%s { %s }", nodeName, result) : ""; }
From source file:com.quancheng.saluki.registry.consul.internal.ConsulClient.java
public ConsulRouterResp lookupRouterMessage(String serviceName, long lastConsulIndex) { QueryParams queryParams = new QueryParams(ConsulConstants.CONSUL_BLOCK_TIME_SECONDS, lastConsulIndex); Response<GetValue> orgResponse = client.getKVValue(serviceName, queryParams); GetValue getValue = orgResponse.getValue(); if (getValue != null && StringUtils.isNoneBlank(getValue.getValue())) { String router = new String(Base64.decodeBase64(getValue.getValue())); ConsulRouterResp response = ConsulRouterResp.newResponse()// .withValue(router)// .withConsulIndex(orgResponse.getConsulIndex())// .withConsulLastContact(orgResponse.getConsulLastContact())// .withConsulKnowLeader(orgResponse.isConsulKnownLeader())// .build();/*w ww. jav a 2 s . com*/ return response; } return null; }
From source file:cz.lbenda.dataman.db.TestHelperPrepareDB.java
public static void prepareSmallDb(Connection connection, DBDriver dbDriver) throws SQLException, IOException { if (dbDriver.getTestScript() != null) { String sql = IOUtils.toString(TestHelperPrepareDB.class.getResourceAsStream(dbDriver.getTestScript())); String[] lines = sql.split(";"); try (Statement st = connection.createStatement()) { for (String line : lines) { line = line.trim();//from w w w . j ava 2 s . c o m if (StringUtils.isNoneBlank(line)) { st.addBatch(line); } } st.executeBatch(); } } else { try (Statement st = connection.createStatement()) { for (String[] sqls : SQL_COMMANDS) { if (sqls.length == 1) { st.addBatch(replaceSql(sqls[0], dbDriver)); } else { boolean apply = false; for (int i = 0; i < sqls.length - 1; i++) { if (dbDriver.toString().equals(sqls[i])) { apply = true; } } if (apply) { st.addBatch(replaceSql(sqls[sqls.length - 1], dbDriver)); } } } st.executeBatch(); } } }
From source file:com.quancheng.saluki.boot.runner.GrpcReferenceRunner.java
private void addHostAndPort(RpcReferenceConfig rpcReferenceConfig) { String host = thrallProperties.getHost(); int registryHttpPort = thrallProperties.getRegistryHttpPort(); if (StringUtils.isNoneBlank(host)) { rpcReferenceConfig.setHost(host); }//from w w w . j a va 2s . c o m if (registryHttpPort == 0) { if (this.httpPort != 0) { rpcReferenceConfig.setHttpPort(this.httpPort); thrallProperties.setRegistryHttpPort(this.httpPort); } else { throw new java.lang.IllegalArgumentException("http port must be set in properties"); } } else { rpcReferenceConfig.setHttpPort(registryHttpPort); } }
From source file:com.uletian.ultcrm.business.service.CustomerInfoSyncService.java
public void notifycationDataChange(Customer customer) { StringWriter writer = new StringWriter(); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding("UTF-8"); Document doc = DocumentHelper.createDocument(); Namespace namespace = new Namespace("ns0", "http://crm/91jpfw.cn"); Element root = doc.addElement(new QName("customer", namespace)); root.addElement(new QName("action")).addText(action.BINDING_TEL.toString()); root.addElement(new QName("sourceSys")).addText("ULTCRM"); root.addElement(new QName("ultcrmid")).addText(customer.getId().toString()); root.addElement(new QName("crmid")).addText(customer.getSyncid() == null ? "" : customer.getSyncid()); String name = null;// w w w . j av a2s. c o m if (customer.getName() == null || "".equals(customer.getName())) { name = customer.getNickname(); } else { name = customer.getName(); } root.addElement(new QName("name")).addText(name); root.addElement(new QName("sexy")).addText(customer.getSex() == null ? "" : customer.getSex()); root.addElement(new QName("telephone")).addText(customer.getPhone() == null ? "" : customer.getPhone()); root.addElement(new QName("country")).addText(customer.getCountry() == null ? "" : customer.getCountry()); root.addElement(new QName("province")) .addText(customer.getProvince() == null ? "" : customer.getProvince()); root.addElement(new QName("city")).addText(customer.getCity() == null ? "" : customer.getCity()); root.addElement(new QName("address")).addText(customer.getAddress() == null ? "" : customer.getAddress()); root.addElement(new QName("postcode")) .addText(customer.getPostcode() == null ? "" : customer.getPostcode()); Element techsElement = root.addElement(new QName("techs")); List<Tech> techs = customer.getTechs(); if (techs != null && techs.size() > 0) { for (int i = 0; i < techs.size(); i++) { Tech tech = techs.get(i); Element techElement = techsElement.addElement("tech"); techElement.addElement(new QName("crmtechid")) .addText(tech.getCrmTechId() == null ? "" : tech.getCrmTechId()); techElement.addElement(new QName("code")).addText(tech.getTechModel().getCode()); techElement.addElement(new QName("techlevelno")) .addText(tech.getTechlevelno() == null ? "" : tech.getTechlevelno()); techElement.addElement(new QName("techerno")) .addText(tech.getTecherno() == null ? "" : tech.getTecherno()); techElement.addElement(new QName("techname")) .addText(tech.getTechname() == null ? "" : tech.getTechname()); techElement.addElement(new QName("coursetime")) .addText(tech.getCoursetime() == null ? "" : tech.getCoursetime()); String trainExpireDate = ""; if (tech.getTrainExpireDate() != null) { trainExpireDate = sdf.format(tech.getTrainExpireDate()); } techElement.addElement(new QName("trainExpireDate")).addText(trainExpireDate); techElement.addElement(new QName("trainCompany")) .addText(tech.getTrainCompany() == null ? "" : tech.getTrainCompany()); techElement.addElement(new QName("courseCode")) .addText(tech.getCourseCode() == null ? "" : tech.getCourseCode()); techElement.addElement(new QName("techColor")) .addText(tech.getColor() == null ? "" : tech.getColor()); String registerDate = ""; if (tech.getRegisterDate() != null) { registerDate = sdf.format(tech.getRegisterDate()); } techElement.addElement(new QName("registerDate")).addText(registerDate); techElement.addElement(new QName("courseLicense")) .addText(tech.getCourseLicense() == null ? "" : tech.getCourseLicense()); String checkExpireDate = ""; if (tech.getCheckExpireDate() != null) { checkExpireDate = sdf.format(tech.getCheckExpireDate()); } techElement.addElement(new QName("checkExpireDate")).addText(checkExpireDate); techElement.addElement(new QName("memberLevel")) .addText(tech.getMemberLevel() == null ? "" : tech.getMemberLevel()); // ? by xiecheng 2015-11-19 techElement.addElement(new QName("nextMaintCoursetime")) .addText(StringUtils.isNoneBlank(tech.getNextMaintCoursetime()) ? tech.getNextMaintCoursetime() : ""); String nextMaintDate = ""; if (tech.getNextMaintDate() != null) { nextMaintDate = sdf.format(tech.getNextMaintDate()); } techElement.addElement(new QName("nextMaintDate")).addText(nextMaintDate); String lastConsumeDate = ""; if (tech.getLastConsumeDate() != null) { lastConsumeDate = sdf.format(tech.getLastConsumeDate()); } techElement.addElement(new QName("lastConsumeDate")).addText(lastConsumeDate); } } XMLWriter xmlwriter = new XMLWriter(writer, format); try { xmlwriter.write(doc); } catch (IOException e) { } customerInfoMessageService.sendMessage(writer.toString()); }
From source file:com.cisco.oss.foundation.message.HornetQMessageProducer.java
private void sendMessageInternal(String message, Map<String, Object> messageHeaders) throws HornetQException { String groupIdentifier = null; if (StringUtils.isNoneBlank(groupId) && messageHeaders.get(groupId) != null) { groupIdentifier = messageHeaders.get(groupId).toString(); }/*w w w . j a v a2 s . c o m*/ ClientMessage clientMessage = getClientMessage(messageHeaders, groupIdentifier); clientMessage.setExpiration(System.currentTimeMillis() + expiration); clientMessage.getBodyBuffer().writeString(message); getProducer(groupIdentifier).send(clientMessage); }
From source file:com.twosigma.beaker.core.rest.FileIORest.java
@POST @Consumes("application/x-www-form-urlencoded") @Path("setPosixFileOwnerAndPermissions") @Produces(MediaType.TEXT_PLAIN)/* w w w. j a v a 2s . c o m*/ public Response setPosixFilePermissions(@FormParam("path") String pathString, @FormParam("owner") String owner, @FormParam("group") String group, @FormParam("permissions[]") List<String> permissions) throws IOException { HashSet<PosixFilePermission> filePermissions = getPosixFilePermissions(permissions); try { java.nio.file.Path path = Paths.get(pathString); Files.setPosixFilePermissions(path, filePermissions); UserPrincipalLookupService userPrincipalLookupService = FileSystems.getDefault() .getUserPrincipalLookupService(); if (StringUtils.isNoneBlank(owner)) { Files.setOwner(path, userPrincipalLookupService.lookupPrincipalByName(owner)); } if (StringUtils.isNoneBlank(group)) { Files.getFileAttributeView(path, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS) .setGroup(userPrincipalLookupService.lookupPrincipalByGroupName(group)); } return status(OK).build(); } catch (FileSystemException e) { return status(INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } }