List of usage examples for org.apache.commons.lang StringUtils isEmpty
public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
From source file:com.enonic.cms.core.content.contentdata.custom.stringbased.HtmlAreaDataEntry.java
private static String validateXhtml(final DataEntryConfig config, final String value) { if (StringUtils.isEmpty(value)) { return value; }/*from ww w . ja v a2 s . c om*/ try { JDOMUtil.parseDocument(getStartWrap() + value + getEndWrap()); } catch (final Exception e) { throw new InvalidContentDataException("Input " + config.getName() + " has no vaild xhtml value", e); } return value; }
From source file:net.shopxx.dao.impl.PluginConfigDaoImpl.java
public boolean pluginIdExists(String pluginId) { if (StringUtils.isEmpty(pluginId)) { return false; }/*from w w w .j av a 2 s . c o m*/ String jpql = "select count(*) from PluginConfig pluginConfig where pluginConfig.pluginId = :pluginId"; Long count = entityManager.createQuery(jpql, Long.class).setParameter("pluginId", pluginId) .getSingleResult(); return count > 0; }
From source file:com.microsoft.azure.vmagent.util.TokenCache.java
public static TokenCache getInstance(final AzureCredentials.ServicePrincipal servicePrincipal) { synchronized (tsafe) { if (cache == null) { cache = new TokenCache(servicePrincipal); } else if (cache.credentials == null || !StringUtils.isEmpty(cache.credentials.getSubscriptionId()) || !cache.credentials.getSubscriptionId().equals(servicePrincipal.getSubscriptionId()) || !StringUtils.isEmpty(cache.credentials.getClientId()) || !cache.credentials.getClientId().equals(servicePrincipal.getClientId()) || !StringUtils.isEmpty(cache.credentials.getClientSecret()) || !cache.credentials.getClientSecret().equals(servicePrincipal.getClientSecret()) || !StringUtils.isEmpty(cache.credentials.getTenant()) || !cache.credentials.getTenant().equals(servicePrincipal.getTenant()) || !StringUtils.isEmpty(cache.credentials.getServiceManagementURL()) || !cache.credentials .getServiceManagementURL().equals(servicePrincipal.getServiceManagementURL())) { cache = new TokenCache(servicePrincipal); }/*from w w w .j a va2 s . co m*/ } return cache; }
From source file:com.pureinfo.tgirls.utils.servlet.CookieUtils.java
public static User getLoginUser(HttpServletRequest _request, HttpServletResponse _response) { User loginUser = (User) _request.getSession().getAttribute(ArkHelper.ATTR_LOGIN_USER); if (loginUser != null) { logger.debug("get user from session." + loginUser.getTaobaoID()); return loginUser; }//w w w . jav a 2s.co m logger.debug("user not in session."); String taobaoId = getCookieValue(_request.getCookies(), TAOBAO_ID); if (StringUtils.isEmpty(taobaoId)) { return null; } try { IUserMgr mgr = (IUserMgr) ArkContentHelper.getContentMgrOf(User.class); loginUser = mgr.getUserByTaobaoId(taobaoId); _request.getSession().setAttribute(ArkHelper.ATTR_LOGIN_USER, loginUser); return loginUser; } catch (PureException e) { // TODO Auto-generated catch block e.printStackTrace(System.err); } return null; }
From source file:net.duckling.ddl.service.task.ItemWrapper.java
/**?,????? * @param shares /*from www. ja v a2 s. c o m*/ * @param uid ?ID * */ public static List<TaskItemShare> getView(List<TaskItemShare> shares, String uid) { if (shares == null) { return shares; } List<TaskItemShare> canEditList = new ArrayList<TaskItemShare>(); List<TaskItemShare> canNotEditList = new ArrayList<TaskItemShare>(); for (TaskItemShare share : shares) { share.setCanEdit(StringUtils.isEmpty(share.getUserId()) || uid.equals(share.getUserIDStr())); if (share.isCanEdit()) { canEditList.add(share); } else { canNotEditList.add(share); } } canEditList.addAll(canNotEditList); return canEditList; }
From source file:net.sourceforge.fenixedu.util.date.SerializationTool.java
public static YearMonthDay yearMonthDayDeserialize(String string) { if (!StringUtils.isEmpty(string)) { int year = Integer.parseInt(string.substring(0, 4)); int month = Integer.parseInt(string.substring(5, 7)); int day = Integer.parseInt(string.substring(8, 10)); return year == 0 || month == 0 || day == 0 ? null : new YearMonthDay(year, month, day); }/*w w w.j a va2 s . c o m*/ return null; }
From source file:net.duckling.falcon.api.mq.impl.DFMQArgumentValidater.java
public static void fanoutValidate(String[] routingKey) { if (routingKey == null || routingKey.length == 0) { return;/*w w w . j ava2 s. c o m*/ } if (routingKey.length == 1 && StringUtils.isEmpty(routingKey[0])) { return; } LOG.warn("In fanout mode, all arguments of routingKey will be ignored."); }
From source file:com.mmj.app.biz.cons.SubjectEnum.java
/** * ?name?/*from www . j a v a2s.c o m*/ */ public static SubjectEnum getEnum(String name) { if (StringUtils.isEmpty(name)) { return null; } for (SubjectEnum current : values()) { if (StringUtils.equalsIgnoreCase(current.name, name)) { return current; } } return null; }
From source file:com.hs.mail.imap.mailbox.MailboxQuery.java
private static String getExpression(String referenceName, String mailboxName, String sep) { StringBuilder sb = new StringBuilder(referenceName); if (mailboxName.startsWith(sep)) { sb.append(mailboxName.substring(sep.length())); } else if (StringUtils.isEmpty(referenceName)) { sb.append(mailboxName);//from ww w . java 2 s. c om } else { sb.append(sep).append(mailboxName); } return sb.toString(); }
From source file:com.griddynamics.genesis.notification.utils.ConfigReaderUtils.java
public static String getRequiredParameter(java.util.Map<String, String> config, String parameterName) { String value = config.get(parameterName); if (StringUtils.isEmpty(value)) { throw new IllegalArgumentException(String.format("'%s' cannot be empty", parameterName)); }// w w w .ja va 2 s .c om return value; }