List of usage examples for org.springframework.util StringUtils isEmpty
public static boolean isEmpty(@Nullable Object str)
From source file:com.abuabdul.knodex.service.KxDocumentServiceImpl.java
public boolean indexASentence(KnodexDoc entity) { log.debug("Entered KxDocumentServiceImpl.indexASentence method"); KnodexDoc dbKnodexDoc = knodexDAO.save(entity); if (dbKnodexDoc != null && !StringUtils.isEmpty(dbKnodexDoc.getId())) { log.debug("Added the sentence with the key = " + dbKnodexDoc.getKey() + " ,indexBy = " + dbKnodexDoc.getIndexBy()); return true; }/*from ww w .ja v a 2 s .c o m*/ return false; }
From source file:cn.guoyukun.spring.cache.BaseCacheAspect.java
public void put(String key, Object value) { log.debug("cacheName:{}, put key:{}", cacheName, key); if (StringUtils.isEmpty(key)) { return;/*from w w w . j a v a 2 s . c o m*/ } if (value == null) { return; } this.cache.put(key, value); }
From source file:gov.grantsolutions.REST.StateMachineController.java
@RequestMapping(value = "/commitment/availableEvents/{currentState}", method = RequestMethod.GET) public @ResponseBody List<String> availableCommitmentEvents(@PathVariable final String currentState) { List<String> list = new ArrayList<String>(); if (!StringUtils.isEmpty(currentState)) { Iterator<Transition<String, String>> transitions = commitmentState.getTransitions().iterator(); while (transitions.hasNext()) { Transition<String, String> transition = transitions.next(); if (currentState.equalsIgnoreCase(transition.getSource().getId())) { list.add(transition.getTrigger().getEvent()); }/*from w ww. j av a 2 s.c o m*/ } } return list; }
From source file:net.phoenix.thrift.xml.ArgsBeanDefinitionParser.java
@Override protected String getBeanClassName(Element argsElement) { String className = argsElement.getAttribute("class"); if (StringUtils.isEmpty(className)) { Element parent = (Element) argsElement.getParentNode(); className = parent.getAttribute("class") + ".Args"; }/*from w w w.ja v a2s . c om*/ LOG.info("Using '" + className + "' for server args classname."); return className; }
From source file:nz.gate5a.schoolstories.importer.NceaQualificationCreator.java
private Integer integer(String value) { if (StringUtils.isEmpty(value)) { return null; } return Integer.valueOf(value); }
From source file:com.digitalgeneralists.assurance.ui.components.FilePickerTextField.java
public void setFieldName(String name) { if (!StringUtils.isEmpty(name)) { this.fieldName = name; } }
From source file:com.shigengyu.hyperion.core.WorkflowDefinition.java
protected WorkflowDefinition() { final Class<? extends WorkflowDefinition> clazz = this.getClass(); final Workflow workflow = clazz.getAnnotation(Workflow.class); if (workflow == null) { final String message = StringMessage.with( "Workflow definition class [{}] does not have @Workflow annotation present", clazz.getName()); throw new WorkflowDefinitionException(message); }// ww w. j a va 2s.c o m workflowDefinitionId = workflow.id(); workflowDefinitionType = clazz; name = StringUtils.isEmpty(workflow.name()) ? clazz.getSimpleName() : workflow.name(); initialState = WorkflowState.of(workflow.initialState()); workflowContextType = workflow.contextType() == null ? WorkflowContext.class : workflow.contextType(); }
From source file:com.netflix.spinnaker.halyard.config.validate.v1.providers.google.GoogleBakeryDefaultsValidator.java
@Override public void validate(ConfigProblemSetBuilder p, GoogleBakeryDefaults n) { DaemonTaskHandler.log(// w ww . j av a 2 s .c o m "Validating " + n.getNodeName() + " with " + GoogleBakeryDefaultsValidator.class.getSimpleName()); String zone = n.getZone(); String network = n.getNetwork(); List<GoogleBaseImage> baseImages = n.getBaseImages(); if (StringUtils.isEmpty(zone) && StringUtils.isEmpty(network) && CollectionUtils.isEmpty(baseImages)) { return; } else if (CollectionUtils.isEmpty(credentialsList)) { p.addProblem(Problem.Severity.WARNING, "No google accounts are configured."); return; } if (StringUtils.isEmpty(zone)) { p.addProblem(Problem.Severity.ERROR, "No zone supplied for google bakery defaults."); } else { int i = 0; boolean foundZone = false; while (!foundZone && i < credentialsList.size()) { GoogleNamedAccountCredentials credentials = credentialsList.get(i); try { credentials.getCompute().zones().get(credentials.getProject(), zone).execute(); foundZone = true; } catch (Exception e) { } i++; } if (!foundZone) { p.addProblem(Problem.Severity.ERROR, "Zone " + zone + " not found via any configured google account."); } } if (StringUtils.isEmpty(network)) { p.addProblem(Problem.Severity.ERROR, "No network supplied for google bakery defaults."); } else { int j = 0; boolean foundNetwork = false; while (!foundNetwork && j < credentialsList.size()) { GoogleNamedAccountCredentials credentials = credentialsList.get(j); try { credentials.getCompute().networks().get(credentials.getProject(), network).execute(); foundNetwork = true; } catch (Exception e) { } j++; } if (!foundNetwork) { p.addProblem(Problem.Severity.ERROR, "Network " + network + " not found via any configured google account."); } } GoogleBaseImageValidator googleBaseImageValidator = new GoogleBaseImageValidator(credentialsList, halyardVersion); baseImages.forEach(googleBaseImage -> googleBaseImageValidator.validate(p, googleBaseImage)); }
From source file:org.nekorp.workflow.desktop.servicio.bridge.customers.DomicilioFiscalBridge.java
private String getSafeValue(String value) { if (StringUtils.isEmpty(value)) { return ""; } else {/*from w w w. ja v a 2 s. c o m*/ return value; } }
From source file:org.shaigor.rest.retro.client.oauth.RedirectController.java
@RequestMapping("/oauth/redirect") /**// ww w. j av a2 s. c o m * Action on grant code * @param code - grant code * @param state - oauth state * @param request - http request just in case * @return view name */ public ModelAndView redirect(@RequestParam("code") String code, @RequestParam("state") String state, HttpServletRequest request) { if (!StringUtils.isEmpty(code)) { oauthRestTemplate.getOAuth2ClientContext().getAccessTokenRequest().setAuthorizationCode(code); } if (!StringUtils.isEmpty(state)) { oauthRestTemplate.getOAuth2ClientContext().getAccessTokenRequest().setStateKey(state); } oauthRestTemplate.getAccessToken(); request.setAttribute(OAUTH2_REST_TEMPLATE, oauthRestTemplate); return new ModelAndView("redirect:/index.jsp"); }