List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty
public static boolean isNotEmpty(final CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
StringUtils.isNotEmpty(null) = false StringUtils.isNotEmpty("") = false StringUtils.isNotEmpty(" ") = true StringUtils.isNotEmpty("bob") = true StringUtils.isNotEmpty(" bob ") = true
From source file:de.micromata.genome.gwiki.plugin.confluenceimporter_1_0.confluence.ConfluenceElement.java
public boolean isArchive() { return StringUtils.isNotEmpty(originalVersion); }
From source file:io.wcm.config.core.management.util.TypeConversion.java
/** * Converts a string value to an object with the given parameter type. * @param value String value/*from w w w. j a v a2 s . com*/ * @param type Parameter type * @return Converted value * @throws IllegalArgumentException If type is not supported */ @SuppressWarnings("unchecked") public static <T> T stringToObject(String value, Class<T> type) { if (value == null) { return null; } if (type == String.class) { return (T) value; } else if (type == String[].class) { return (T) StringUtils.splitPreserveAllTokens(value, ARRAY_DELIMITER); } if (type == Integer.class) { return (T) (Integer) NumberUtils.toInt(value, 0); } if (type == Long.class) { return (T) (Long) NumberUtils.toLong(value, 0L); } if (type == Double.class) { return (T) (Double) NumberUtils.toDouble(value, 0d); } if (type == Boolean.class) { return (T) (Boolean) BooleanUtils.toBoolean(value); } if (type == Map.class) { String[] rows = StringUtils.splitPreserveAllTokens(value, ARRAY_DELIMITER); Map<String, String> map = new LinkedHashMap<>(); for (int i = 0; i < rows.length; i++) { String[] keyValue = StringUtils.splitPreserveAllTokens(rows[i], KEY_VALUE_DELIMITER); if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) { map.put(keyValue[0], StringUtils.isEmpty(keyValue[1]) ? null : keyValue[1]); } } return (T) map; } throw new IllegalArgumentException("Unsupported type: " + type.getName()); }
From source file:com.ec2box.manage.socket.SecureShellWS.java
@OnOpen public void onOpen(Session session, EndpointConfig config) { //set websocket timeout if (StringUtils.isNotEmpty(AppConfig.getProperty("websocketTimeout"))) { session.setMaxIdleTimeout(Long.parseLong(AppConfig.getProperty("websocketTimeout")) * 60000); } else {//from ww w .j a v a 2 s.c om session.setMaxIdleTimeout(0); } this.httpSession = (HttpSession) config.getUserProperties().get(HttpSession.class.getName()); this.sessionId = AuthUtil.getSessionId(httpSession); this.session = session; Runnable run = new SentOutputTask(sessionId, session, UserDB.getUser(AuthUtil.getUserId(httpSession))); Thread thread = new Thread(run); thread.start(); }
From source file:ltistarter.lti.LTIConsumerDetailsService.java
@Override public ConsumerDetails loadConsumerByConsumerKey(String consumerKey) throws OAuthException { consumerKey = StringUtils.trimToNull(consumerKey); assert StringUtils.isNotEmpty(consumerKey) : "consumerKey must be set and not null"; BaseConsumerDetails cd;/*from w w w . j a v a2s . c o m*/ LtiKeyEntity ltiKey = ltiKeyRepository.findByKeyKey(consumerKey); if (ltiKey == null) { // no matching key found throw new OAuthException("No matching lti key record was found for " + consumerKey); } else { cd = new BaseConsumerDetails(); cd.setConsumerKey(consumerKey); cd.setSignatureSecret(new SharedConsumerSecretImpl(ltiKey.getSecret())); cd.setConsumerName(String.valueOf(ltiKey.getKeyId())); cd.setRequiredToObtainAuthenticatedToken(false); // no token required (0-legged) cd.getAuthorities().add(new SimpleGrantedAuthority("ROLE_OAUTH")); // add the ROLE_OAUTH (can add others as well) cd.getAuthorities().add(new SimpleGrantedAuthority("ROLE_LTI")); log.info("LTI check SUCCESS, consumer key: " + consumerKey); } return cd; }
From source file:com.glaf.mail.MxMailHelper.java
public String getCallbackHref(Template template, String messageId) { if (template != null && StringUtils.isNotEmpty(template.getCallbackUrl())) { return this.getCallbackHref(template.getCallbackUrl(), messageId); }/* w ww . ja va 2 s .c om*/ return this.getCallbackHref(messageId); }
From source file:com.lichengbao.specification.VehicleSpecDef.java
@SuppressWarnings("rawtypes") @Override//from www . j a va 2s . c o m List<Specification> getSpecifications(SpecDef def) { List<Specification> specs = new ArrayList<>(); VehicleSpecDef specDef = (VehicleSpecDef) def; if (StringUtils.isNotEmpty(specDef.getLicenseNo())) specs.add(isLicenseNo(specDef.getLicenseNo())); return specs; }
From source file:com.alogic.ik.dic.Dictionary.java
public void addWord(String word) { if (StringUtils.isNotEmpty(word)) { _MainDict.fillSegment(word.trim().toLowerCase().toCharArray()); } }
From source file:com.ourslook.production.activiti.rest.editor.model.ModelEditorJsonRestResource.java
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json") public ObjectNode getEditorJson(@PathVariable String modelId) { ObjectNode modelNode = null;//from w w w. ja v a 2s .c om Model model = repositoryService.getModel(modelId); if (model != null) { try { if (StringUtils.isNotEmpty(model.getMetaInfo())) { modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); } else { modelNode = objectMapper.createObjectNode(); modelNode.put(MODEL_NAME, model.getName()); } modelNode.put(MODEL_ID, model.getId()); ObjectNode editorJsonNode = (ObjectNode) objectMapper .readTree(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")); modelNode.put("model", editorJsonNode); } catch (Exception e) { LOGGER.error("Error creating model JSON", e); throw new ActivitiException("Error creating model JSON", e); } } return modelNode; }
From source file:com.twosigma.beaker.chart.Graphics.java
public boolean hasClickAction() { return onClickListener != null || StringUtils.isNotEmpty(clickTag); }
From source file:io.wcm.handler.media.ui.ResourceMedia.java
@PostConstruct private void activate() { MediaBuilder builder = mediaHandler.get(resource); if (StringUtils.isNotEmpty(mediaFormat)) { builder.mediaFormatName(mediaFormat); }/*from ww w .jav a2 s. c o m*/ media = builder.build(); if (media.isValid() && StringUtils.isNotEmpty(cssClass)) { media.getElement().addCssClass(cssClass); } }