List of usage examples for org.springframework.util CollectionUtils isEmpty
public static boolean isEmpty(@Nullable Map<?, ?> map)
From source file:com.turbospaces.spaces.tx.TransactionModificationContext.java
private static void notifyByTemplate(final Map<EntryKeyLockQuard, WriteTakeEntry> map, final SpaceNotificationListener listener, final CacheStoreEntryWrapper template, final SpaceStore memoryManager, final boolean returnAsBytes) { if (!CollectionUtils.isEmpty(map)) for (final WriteTakeEntry entry : map.values()) if (entry.getObj().getClass() .isAssignableFrom(template.getPersistentEntity().getOriginalPersistentEntity().getType())) { Object[] templatePropertyValues = template.asPropertyValuesArray(); Object[] entryPropertyValues = entry.getPropertyValues(); if (SpaceUtility.macthesByPropertyValues(templatePropertyValues, entryPropertyValues)) { assert entry.getObj() != null; memoryManager.getSpaceConfiguration().getListeningExecutorService().execute(new Runnable() { @Override public void run() { listener.handleNotification( returnAsBytes ? entry.getPointer().getSerializedDataBuffer() : entry.getObj(), entry.getSpaceOperation()); }// w ww . j av a 2s .co m }); } } }
From source file:admin.service.SimpleJobService.java
@Override public JobParameters getLastJobParameters(String jobName) throws NoSuchJobException { Collection<JobExecution> executions = jobExecutionDao.getJobExecutions(jobName, 0, 1); JobExecution lastExecution = null;/* w w w. java 2 s.c o m*/ if (!CollectionUtils.isEmpty(executions)) { lastExecution = executions.iterator().next(); } JobParameters oldParameters = new JobParameters(); if (lastExecution != null) { oldParameters = lastExecution.getJobParameters(); } return oldParameters; }
From source file:com.bfd.harpc.registry.ZkClientRegistry.java
/** * ?? <br>//from w w w . j a v a2 s. co m * <br> * ??zookeeper?PathChildrenCache,?{@link PathChildrenCache} * <p> * * @throws RpcException */ private void build() throws RpcException { List<String> childrenList = null; String path = configPath + Constants.ZK_SEPARATOR_DEFAULT + Constants.ZK_NAMESPACE_SERVERS; try { childrenList = zookeeper.getChildren().forPath(path); } catch (Exception e) { String message = MessageFormat.format("Get children node error in the path : {0}", path); LOGGER.error(message, e); throw new RpcException(message, e); } if (CollectionUtils.isEmpty(childrenList)) { LOGGER.error("Not find a service in zookeeper!"); throw new RpcException("Not find a service in zookeeper!"); } List<ServerNode> current = new ArrayList<ServerNode>(); for (String children : childrenList) { current.addAll(ServerNodeUtils.transfer(children)); } freshContainer(current); }
From source file:org.sakuli.datamodel.TestSuite.java
/** * @return all {@link TestCase}s as {@link SortedSet} or a empty set if no test cases are specified. *///from w ww . j av a 2 s.c o m public SortedSet<TestCase> getTestCasesAsSortedSet() { if (!CollectionUtils.isEmpty(testCases)) { return new TreeSet<>(testCases.values()); } return new TreeSet<>(); }
From source file:com.microsoft.exchange.impl.ExchangeResponseUtilsImpl.java
@Override public Set<BaseFolderType> parseGetFolderResponse(GetFolderResponse getFolderResponse) { confirmSuccess(getFolderResponse);// ww w . j a v a 2 s . c o m Set<BaseFolderType> folders = new HashSet<BaseFolderType>(); ArrayOfResponseMessagesType responseMessages = getFolderResponse.getResponseMessages(); List<JAXBElement<? extends ResponseMessageType>> getFolderResponseMessages = responseMessages .getCreateItemResponseMessagesAndDeleteItemResponseMessagesAndGetItemResponseMessages(); for (JAXBElement<? extends ResponseMessageType> responseMessage : getFolderResponseMessages) { FolderInfoResponseMessageType folderInfo = (FolderInfoResponseMessageType) responseMessage.getValue(); List<BaseFolderType> f = folderInfo.getFolders().getFoldersAndCalendarFoldersAndContactsFolders(); if (!CollectionUtils.isEmpty(f)) { folders.addAll(f); } } return folders; }
From source file:pe.gob.mef.gescon.web.ui.EntidadMB.java
public void setSelectedRow(ActionEvent event) { try {//www .j av a 2 s .c om if (event != null) { int index = Integer.parseInt((String) JSFUtils.getRequestParameter("index")); if (!CollectionUtils.isEmpty(this.getFilteredListaEntidad())) { this.setSelectedEntidad(this.getFilteredListaEntidad().get(index)); } else { this.setSelectedEntidad(this.getListaEntidad().get(index)); } this.setFilteredListaEntidad(new ArrayList()); UbigeoEntidadService ubigeoService = (UbigeoEntidadService) ServiceFinder .findBean("UbigeoEntidadService"); listaProvincia = new Items( ubigeoService.getProvinciasPorDepartamento(this.getSelectedEntidad().getVdepartamento()), null, "cdepartamento", "vdescripcion").getItems(); listaDistrito = new Items(ubigeoService.getDistritosPorProvincia( this.getSelectedEntidad().getVdepartamento(), this.getSelectedEntidad().getVprovincia()), null, "cprovincia", "vdescripcion").getItems(); } } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); } }
From source file:com.qpark.eip.core.failure.FailureAssert.java
/** * Assert that a Map has entries; that is, it must not be <code>null</code> * and must have at least one entry./*from w w w . ja v a2 s. c o m*/ * * <pre class="code"> * Assert.notEmpty(map, "Map must have entries"); * </pre> * * @param map * the map to check * @param errorCode * the error code to use if the assertion fails * @throws IllegalArgumentException * if the map is <code>null</code> or has no entries */ public static void notEmpty(final Map<?, ?> map, final String errorCode) { if (CollectionUtils.isEmpty(map)) { BaseFailureHandler.throwFailureException(errorCode); } }
From source file:jails.http.MediaType.java
/** * Create a new {@link MediaType} for the given type, subtype, and parameters. * @param type the primary type/*from ww w. j a v a 2 s . co m*/ * @param subtype the subtype * @param parameters the parameters, may be <code>null</code> * @throws IllegalArgumentException if any of the parameters contain illegal characters */ public MediaType(String type, String subtype, Map<String, String> parameters) { Assert.hasLength(type, "'type' must not be empty"); Assert.hasLength(subtype, "'subtype' must not be empty"); checkToken(type); checkToken(subtype); this.type = type.toLowerCase(Locale.ENGLISH); this.subtype = subtype.toLowerCase(Locale.ENGLISH); if (!CollectionUtils.isEmpty(parameters)) { Map<String, String> m = new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH); for (Map.Entry<String, String> entry : parameters.entrySet()) { String attribute = entry.getKey(); String value = entry.getValue(); checkParameters(attribute, value); m.put(attribute, unquote(value)); } this.parameters = Collections.unmodifiableMap(m); } else { this.parameters = Collections.emptyMap(); } }
From source file:com.frank.search.solr.repository.query.SolrQueryMethod.java
/** * @return true if {@link com.frank.search.solr.repository.Query#filters()} is not empty */// ww w. ja va 2 s. com public boolean hasFilterQuery() { if (hasQueryAnnotation()) { return !CollectionUtils.isEmpty(getFilterQueries()); } return false; }