List of usage examples for org.springframework.util StringUtils isEmpty
public static boolean isEmpty(@Nullable Object str)
From source file:se.inera.intyg.intygstjanst.web.integration.validator.SendCertificateRequestValidator.java
public void validateAndCorrect() throws CertificateValidationException { // First, validate properties at Revoke request level if (StringUtils.isEmpty(sendRequest.getVardReferensId())) { validationErrors.add("No vardReferens found!"); }/*from w ww. j av a 2 s. c o m*/ if (sendRequest.getAvsantTidpunkt() == null) { validationErrors.add("No avsantTidpunkt found!"); } // use commmon validators for common elements new LakarutlatandeEnkelTypeValidator(sendRequest.getLakarutlatande(), validationErrors) .validateAndCorrect(); new VardAdresseringsTypeValidator(sendRequest.getAdressVard(), validationErrors).validateAndCorrect(); if (!validationErrors.isEmpty()) { throw new CertificateValidationException(validationErrors); } }
From source file:com.devicehive.handler.notification.NotificationSearchHandler.java
@Override public Response handle(Request request) { NotificationSearchRequest searchRequest = (NotificationSearchRequest) request.getBody(); NotificationSearchResponse payload = searchRequest.getId() != null && !StringUtils.isEmpty(searchRequest.getGuid()) ? searchSingleNotificationByDeviceAndId(searchRequest.getId(), searchRequest.getGuid()) : searchMultipleNotifications(searchRequest); return Response.newBuilder().withBody(payload).buildSuccess(); }
From source file:com.biz.report.service.impl.ReportServiceImpl.java
@Override public List<Report1DataSet> read(String types, String months, String year) { if (!StringUtils.isEmpty(types) && types.contains("[")) { types = types.substring(1, types.length() - 1); }/*from w w w. j a va 2s .c om*/ String[] typeAr; if (!StringUtils.isEmpty(types) && types.contains(",")) { typeAr = types.split("[,]"); } else { typeAr = new String[] { types }; } if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } String[] monthAr; if (!StringUtils.isEmpty(months) && months.contains(",")) { monthAr = months.split("[,]"); } else { monthAr = new String[] { months }; } int typeCount = typeAr.length; List list = reportDao.read(types, year, months); List<Report1> reportList = new MappingEngine().getList(list); logger.info(reportList.size()); List<Report1DataSet> dataSets = new ArrayList<Report1DataSet>(); for (int i = 0; i < typeCount; i++) { List<DataPoint> dataPoints = constructDataPoints(reportList, typeAr[i].trim(), monthAr, i); dataSets.add(new Report1DataSet("stackedArea", dataPoints, typeAr[i])); } return dataSets; }
From source file:com.ponysdk.impl.spring.server.SpringApplicationManager.java
@Override public void start() { final List<String> files = new ArrayList<>(); final String clientConfigFile = configuration.getClientConfigFile(); if (StringUtils.isEmpty(clientConfigFile)) files.addAll(Arrays.asList("conf/client_application.inc.xml", "etc/client_application.xml")); else//from w w w . j av a 2 s . co m files.add(clientConfigFile); configurations = files.toArray(new String[0]); }
From source file:nz.gate5a.schoolstories.importer.NceaQualificationCreator.java
private BigDecimal bigDecimal(String value) { try {// w ww . j a va 2 s . c o m if (StringUtils.isEmpty(value)) { return null; } return new BigDecimal(value); } catch (NumberFormatException e) { throw new NumberFormatException(value); } }
From source file:com.vcredit.lrh.backend.RabbitConfiguration.java
@Bean public SimpleMessageListenerContainer appLogContainer(ConnectionFactory connectionFactory) { if (!StringUtils.isEmpty(rabbitMQProperties.getLogQueue())) { MessageListenerAdapter listener = new MessageListenerAdapter(aPPLogMessageReceiver, "receiveMessage"); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setQueueNames(rabbitMQProperties.getLogQueue()); container.setMessageListener(listener); return container; } else {//from ww w. ja v a2s. c o m return null; } }
From source file:org.arrow.model.task.impl.ServiceTask.java
/** * {@inheritDoc}/*from ww w .j a va 2 s . c o m*/ */ @Override public Future<Iterable<EventMessage>> executeTask(Execution execution, ExecutionService service) { try { // spring bean name delegate if (!StringUtils.isEmpty(beanName)) { JavaDelegate javaDelegate = service.getJavaDelegateByName(beanName); return javaDelegate.execute(execution); } // spring expression delegate if (!StringUtils.isEmpty(expression)) { Object result = service.evaluateExpression(expression); return tryCast(result); } // class delegate if (!StringUtils.isEmpty(serviceClass)) { JavaDelegate javaDelegate = service.getJavaDelegateByClassName(serviceClass); return javaDelegate.execute(execution); } return FutureUtil.result(); } finally { // mark the task as finished finish(execution, service); } }
From source file:com.codestd.spring.cxf.config.schema.AnnotationBeanDefinitionParser.java
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(beanClass); beanDefinition.setLazyInit(false);/*from w w w.j a va2 s. c o m*/ String id = element.getAttribute("id"); if (id == null || id.length() == 0) { String name = element.getAttribute("name"); if (!StringUtils.isEmpty(name)) id = name; else id = beanClass.getName(); } if (parserContext.getRegistry().containsBeanDefinition(id)) { throw new IllegalStateException("Duplicate spring bean id " + id); } parserContext.getRegistry().registerBeanDefinition(id, beanDefinition); String annotationPackage = element.getAttribute("package"); if (!StringUtils.isEmpty(annotationPackage)) beanDefinition.getPropertyValues().add("annotationPackage", annotationPackage); return beanDefinition; }
From source file:com.biz.report.service.impl.RepReportServiceImpl.java
public List<Report1DataSet> readDataForAreaChart(String reps, String months, String year) { if (!StringUtils.isEmpty(reps) && reps.contains("[")) { reps = reps.substring(1, reps.length() - 1); }//from w w w .ja v a 2 s . c om String[] typeAr; if (!StringUtils.isEmpty(reps) && reps.contains(",")) { typeAr = reps.split("[,]"); } else { typeAr = new String[] { reps }; } if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } String[] monthAr; if (!StringUtils.isEmpty(months) && months.contains(",")) { monthAr = months.split("[,]"); } else { monthAr = new String[] { months }; } int typeCount = typeAr.length; List list = repReportDao.read(reps, months, year); List<Report1> reportList = new MappingEngine().getList(list); logger.info(reportList.size()); List<Report1DataSet> dataSets = new ArrayList<Report1DataSet>(); for (int i = 0; i < typeCount; i++) { List<DataPoint> dataPoints = constructDataPoints(reportList, typeAr[i].trim(), monthAr, i); dataSets.add(new Report1DataSet("stackedArea", dataPoints, typeAr[i])); } return dataSets; }
From source file:com.devicehive.handler.command.CommandSearchHandler.java
@Override public Response handle(Request request) { CommandSearchRequest searchRequest = (CommandSearchRequest) request.getBody(); CommandSearchResponse payload = searchRequest.getId() != null && !StringUtils.isEmpty(searchRequest.getGuid()) ? searchSingleCommandByDeviceAndId(searchRequest.getId(), searchRequest.getGuid()) : searchMultipleCommands(searchRequest); return Response.newBuilder().withBody(payload).buildSuccess(); }