use of org.apache.commons.collections4.CollectionUtils.isNotEmpty in project BroadleafCommerce by BroadleafCommerce.
the class MergePersistenceUnitManager method exceptionIfEntityMarkerNotFound.
/**
* Detects the presence of the {@link EntityMarkerClassTransformer} and throws an exception if this is misconfigured. If there
* are no class transformes within {@link #mergedClassTransformers} then this does nothing
*/
protected void exceptionIfEntityMarkerNotFound() {
if (CollectionUtils.isNotEmpty(mergedClassTransformers)) {
boolean foundEntityMarkerTransformer = IterableUtils.find(mergedClassTransformers, new Predicate<BroadleafClassTransformer>() {
@Override
public boolean evaluate(BroadleafClassTransformer object) {
return EntityMarkerClassTransformer.class.isAssignableFrom(object.getClass());
}
}) != null;
if (!foundEntityMarkerTransformer) {
BeanDefinition transformersBeanDef = ((BeanDefinitionRegistry) applicationContext.getAutowireCapableBeanFactory()).getBeanDefinition("blMergedClassTransformers");
String msg = "The EntityMarkerClassTransformer was not detected as registered in the the list of blMergedClassTransformers. This is" + " usually caused the blMergedClassTransformers being overridden in a different configuration. Without this transformer Broadleaf" + " is unable to validate whether or not class transformation happened as expected. This bean was registered as " + transformersBeanDef + " but it should have been detected as registerd in bl-common-applicationContext.xml. Change the definition in " + transformersBeanDef.getResourceDescription() + " to instead utilize the EarlyStageMergeBeanPostProcessor in XML or an @Merge(targetRef=\"blMergedClassTransformers\" early = true) in a Java configuration class";
throw new IllegalStateException(msg);
}
}
}
use of org.apache.commons.collections4.CollectionUtils.isNotEmpty in project engine by craftercms.
the class SiteItemServiceImpl method getSiteItem.
@Override
public SiteItem getSiteItem(String url, ItemProcessor processor, Predicate<Item> predicate) {
if (CollectionUtils.isNotEmpty(defaultPredicates)) {
List<Predicate<Item>> predicates = new ArrayList<>(defaultPredicates);
if (predicate != null) {
predicates.add(predicate);
}
predicate = PredicateUtils.allPredicate(predicates);
}
if (CollectionUtils.isNotEmpty(defaultProcessors)) {
ItemProcessorPipeline processorPipeline = new ItemProcessorPipeline(new ArrayList<>(defaultProcessors));
if (processor != null) {
processorPipeline.addProcessor(processor);
}
processor = processorPipeline;
}
Item item = storeService.findItem(getSiteContext().getContext(), null, url, processor);
if (item != null && (predicate == null || predicate.evaluate(item))) {
return createItemWrapper(item);
} else {
return null;
}
}
use of org.apache.commons.collections4.CollectionUtils.isNotEmpty in project nifi by apache.
the class ControllerFacade method setComponentDetails.
private void setComponentDetails(final ProvenanceEventDTO dto) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final Connectable connectable = root.findLocalConnectable(dto.getComponentId());
if (connectable != null) {
dto.setGroupId(connectable.getProcessGroup().getIdentifier());
dto.setComponentName(connectable.getName());
return;
}
final RemoteGroupPort remoteGroupPort = root.findRemoteGroupPort(dto.getComponentId());
if (remoteGroupPort != null) {
dto.setGroupId(remoteGroupPort.getProcessGroupIdentifier());
dto.setComponentName(remoteGroupPort.getName());
return;
}
final Connection connection = root.findConnection(dto.getComponentId());
if (connection != null) {
dto.setGroupId(connection.getProcessGroup().getIdentifier());
String name = connection.getName();
final Collection<Relationship> relationships = connection.getRelationships();
if (StringUtils.isBlank(name) && CollectionUtils.isNotEmpty(relationships)) {
name = StringUtils.join(relationships.stream().map(relationship -> relationship.getName()).collect(Collectors.toSet()), ", ");
}
dto.setComponentName(name);
return;
}
}
use of org.apache.commons.collections4.CollectionUtils.isNotEmpty in project archiva by apache.
the class FileTypes method getFileTypePatterns.
/**
* Get the list of patterns for a specified filetype.
* You will always get a list. In this order.
* <ul>
* <li>The Configured List</li>
* <li>The Default List</li>
* <li>A single item list of <code>"**/*"</code></li>
* </ul>
*
* @param id the id to lookup.
* @return the list of patterns.
*/
public List<String> getFileTypePatterns(String id) {
Configuration config = archivaConfiguration.getConfiguration();
Predicate selectedFiletype = new FiletypeSelectionPredicate(id);
RepositoryScanningConfiguration repositoryScanningConfiguration = config.getRepositoryScanning();
if (repositoryScanningConfiguration != null) {
FileType filetype = IterableUtils.find(config.getRepositoryScanning().getFileTypes(), selectedFiletype);
if ((filetype != null) && CollectionUtils.isNotEmpty(filetype.getPatterns())) {
return filetype.getPatterns();
}
}
List<String> defaultPatterns = defaultTypeMap.get(id);
if (CollectionUtils.isEmpty(defaultPatterns)) {
return Collections.singletonList("**/*");
}
return defaultPatterns;
}
use of org.apache.commons.collections4.CollectionUtils.isNotEmpty in project syncope by apache.
the class DynRealmWrapper method getDynMembershipConds.
public Map<String, String> getDynMembershipConds() {
final Map<String, String> res = new HashMap<>();
if (this.dynClauses != null && !this.dynClauses.isEmpty()) {
this.dynClauses.entrySet().stream().filter(entry -> (CollectionUtils.isNotEmpty(entry.getValue()))).forEachOrdered(entry -> {
AbstractFiqlSearchConditionBuilder builder = AnyTypeKind.USER.name().equals(entry.getKey()) ? SyncopeClient.getUserSearchConditionBuilder() : AnyTypeKind.GROUP.name().equals(entry.getKey()) ? SyncopeClient.getGroupSearchConditionBuilder() : SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey());
String fiql = SearchUtils.buildFIQL(entry.getValue(), builder);
if (fiql != null) {
res.put(entry.getKey(), fiql);
}
});
}
return res;
}
Aggregations