List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:com.alibaba.doris.admin.service.main.CommonConfigServiceAction.java
public String execute(Map<String, String> params) { String subActions = params.get(AdminServiceConstants.COMMON_CONFIG_ACTION_ITEMS); String subVersions = params.get(AdminServiceConstants.COMMON_CONFIG_VERSION_ITEMS); String[] actions = null;// ww w. ja v a 2 s .co m if (StringUtils.isNotEmpty(subActions)) { actions = subActions.split(","); } if (actions.length == 0) { return null; } String[] versions = null; if (StringUtils.isNotEmpty(subVersions)) { versions = subVersions.split(","); } boolean noVersion = (versions == null || (versions.length != actions.length)); Map<String, String> resultMap = new HashMap<String, String>(); for (int i = 0; i < actions.length; i++) { String actionName = actions[i]; if (noVersion) { params.put(AdminServiceConstants.CONFIG_VERSION, "0"); } else { params.put(AdminServiceConstants.CONFIG_VERSION, StringUtils.isEmpty(versions[i]) ? "0" : versions[i]); } AdminServiceAction action = AdminServiceActionFactory.getAdminServiceAction(actionName); String resultItem = action.execute(params); resultMap.put(actionName, resultItem); } return JSON.toJSONString(resultMap); }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.LabelLoader.java
@Override public void loadComponent() { assignXmlDescriptor(resultComponent, element); assignFrame(resultComponent);//from w ww . jav a 2 s . c om loadDatasource(resultComponent, element); loadVisible(resultComponent, element); loadAlign(resultComponent, element); loadStyleName(resultComponent, element); String htmlEnabled = element.attributeValue("htmlEnabled"); if (StringUtils.isNotEmpty(htmlEnabled)) { resultComponent.setHtmlEnabled(Boolean.parseBoolean(htmlEnabled)); } String caption = element.attributeValue("value"); if (StringUtils.isNotEmpty(caption)) { caption = loadResourceString(caption); resultComponent.setValue(caption); } loadCaption(resultComponent, element); loadDescription(resultComponent, element); loadIcon(resultComponent, element); loadWidth(resultComponent, element, Component.AUTO_SIZE); loadHeight(resultComponent, element, Component.AUTO_SIZE); loadResponsive(resultComponent, element); resultComponent.setFormatter(loadFormatter(element)); }
From source file:com.qcloud.project.macaovehicle.web.handler.impl.CarOwnerEnterprisersHandlerImpl.java
@Override public CarOwnerEnterprisersVO toVO(CarOwnerEnterprisers carOwnerEnterprisers) { String json = Json.toJson(carOwnerEnterprisers); CarOwnerEnterprisersVO vo = Json.toObject(json, CarOwnerEnterprisersVO.class, true); if (StringUtils.isNotEmpty(vo.getLicense())) { vo.setLicenseUid(fileSDKClient.urlToUid(vo.getLicense())); }//w w w . j ava2 s . c o m if (StringUtils.isNotEmpty(vo.getOppositeUrl())) { vo.setOppositeUrlUid(fileSDKClient.urlToUid(vo.getOppositeUrl())); } if (StringUtils.isNotEmpty(vo.getPositiveUrl())) { vo.setPositiveUrlUid(fileSDKClient.urlToUid(vo.getPositiveUrl())); } if (StringUtils.isNotEmpty(vo.getPaymentUrl())) { vo.setPaymentUrlUid(fileSDKClient.urlToUid(vo.getPaymentUrl())); } if (StringUtils.isNotEmpty(vo.getCommitmentUrl())) { vo.setCommitmentUrlUid(fileSDKClient.urlToUid(vo.getCommitmentUrl())); } vo.setOperatingPeriodFormat(DateUtil.date2String(vo.getOperatingPeriod(), "yyyy-MM-dd")); return vo; }
From source file:com.gson.oauth.User.java
/** * ??/*w w w .jav a 2 s .co m*/ * @param accessToken * @param openid * @return * @throws IOException * @throws NoSuchProviderException * @throws NoSuchAlgorithmException * @throws KeyManagementException */ public UserInfo getUserInfo(String accessToken, String openid) throws Exception { Map<String, String> params = new HashMap<String, String>(); params.put("access_token", accessToken); params.put("openid", openid); String jsonStr = HttpKit.get(USER_INFO_URI, params); if (StringUtils.isNotEmpty(jsonStr)) { JSONObject obj = JSONObject.parseObject(jsonStr); if (obj.get("errcode") != null) { throw new Exception(obj.getString("errmsg")); } UserInfo user = JSONObject.toJavaObject(obj, UserInfo.class); return user; } return null; }
From source file:com.haulmont.cuba.core.sys.dbupdate.DbProperties.java
public Map<String, String> getProperties() { String connectionParams = getConnectionParams(); if (StringUtils.isNotEmpty(connectionParams)) { Map<String, String> result = new HashMap<>(); if (connectionParams.startsWith("?")) { connectionParams = connectionParams.substring(1); }//from w w w .j a v a 2 s . co m for (String param : connectionParams.split("[&,;]")) { int index = param.indexOf("="); if (index > 0) { String key = param.substring(0, index); String value = param.substring(index + 1); if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) { result.put(key.trim(), value.trim()); } } } return result; } return null; }
From source file:com.baifendian.swordfish.execserver.parameter.ParamHelper.java
/** * ? "???" ?/*from w w w .ja v a 2 s. c o m*/ * * @param cycTimeStr * @return */ private static Date getCycTime(String cycTimeStr) { Date cycTime = null; if (StringUtils.isNotEmpty(cycTimeStr)) { try { cycTime = DateUtils.parseDate(cycTimeStr, new String[] { SystemParamManager.TIME_FORMAT }); } catch (ParseException e) { LOGGER.error(String.format("parse time exception: %s", cycTimeStr), e); } } else { cycTime = new Date(); } return cycTime; }
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.SqlDateDataConverter.java
@Override public Date stringToValue(String rawData) throws ParseException { return StringUtils.isNotEmpty(rawData) ? new Date(dateDataConverter.stringToValue(rawData).getTime()) : null;/*from ww w. ja va 2 s . com*/ }
From source file:com.alibaba.otter.node.extend.fileresolver.TestFileResolver.java
public FileInfo[] getFileInfo(Map<String, String> rowMap) { // //from w w w .jav a 2 s . c o m // 1. ?binlog???version+path // 2. ?????.(NFS mountndde). // 3. FileInfo(?????FileInfo?)???null. String path = rowMap.get("FIELD"); //? FileInfo fileInfo = null; if (StringUtils.isNotEmpty(path)) { fileInfo = new FileInfo(path); return new FileInfo[] { fileInfo }; } else { return null; } }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.LinkLoader.java
@Override public void loadComponent() { assignXmlDescriptor(resultComponent, element); assignFrame(resultComponent);//from w ww . j a va 2 s.c o m loadVisible(resultComponent, element); loadAlign(resultComponent, element); loadStyleName(resultComponent, element); loadDescription(resultComponent, element); loadCaption(resultComponent, element); String url = element.attributeValue("url"); if (StringUtils.isNotEmpty(url)) { resultComponent.setUrl(url); } String target = element.attributeValue("target"); if (StringUtils.isNotEmpty(target)) { resultComponent.setTarget(target); } String icon = element.attributeValue("icon"); if (StringUtils.isNotEmpty(icon)) { resultComponent.setIcon(getIconPath(icon)); } String rel = element.attributeValue("rel"); if (StringUtils.isNotEmpty(rel)) { resultComponent.setRel(rel); } loadWidth(resultComponent, element, Component.AUTO_SIZE); loadHeight(resultComponent, element, Component.AUTO_SIZE); }
From source file:demo.repository.UserSearchQueryGenerator.java
/** * {@inheritDoc}//from w w w . java 2s .c o m */ @Override protected String createQueryString(QueryMethodParameterInfo qmpi, JpaQueryExecutionContext context) { String firstname = qmpi.getParameter(0, String.class); String lastname = qmpi.getParameter(1, String.class); StringBuilder query = new StringBuilder("from User where 1=1"); if (StringUtils.isNotEmpty(firstname)) { query.append(" AND firstname = :fn"); addDynamicQueryParam(new JpaQueryParam("fn", firstname)); } if (StringUtils.isNotEmpty(lastname)) { query.append(" AND lastname = :ln"); addDynamicQueryParam(new JpaQueryParam("ln", lastname)); } return query.toString(); }