Example usage for org.apache.commons.collections4 CollectionUtils isEmpty

List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.collections4 CollectionUtils isEmpty.

Prototype

public static boolean isEmpty(final Collection<?> coll) 

Source Link

Document

Null-safe check if the specified collection is empty.

Usage

From source file:com.ejisto.modules.dao.local.LocalMockedFieldsDao.java

@Override
public List<MockedField> loadByContextPathAndClassName(String contextPath, String className) {
    Collection<MockedFieldContainer> fields = getMockedFieldsByClassName(contextPath, className);
    if (CollectionUtils.isEmpty(fields)) {
        return Collections.emptyList();
    }/*from   w  ww. j av  a2 s  . com*/
    return fields.stream().map(new MockedFieldExtractor()).collect(toList());
}

From source file:gov.ca.cwds.cals.service.ComplaintsService.java

/**
 * Get complaints by facility id.// w ww .j  a  v a 2  s  . c  om
 */
public Set<ComplaintDto> getComplaintsByFacilityId(final String facilityNumber) {
    final String licenseNumber = calculateFacilityLicenseNumber(facilityNumber);
    if (licenseNumber == null) {
        return Collections.emptySet();
    }
    List<ComplaintDto> facilityComplaints = aggregateComplaintsFromDifferentSources(licenseNumber);
    if (CollectionUtils.isEmpty(facilityComplaints)) {
        return Collections.emptySet();
    }
    Set<ComplaintDto> sortedSet = new TreeSet<>(ComplaintComparator.getCompositeComparator());
    sortedSet.addAll(facilityComplaints);
    return sortedSet;
}

From source file:com.mirth.connect.server.api.servlets.CodeTemplateServlet.java

@Override
public List<CodeTemplate> getCodeTemplates(Set<String> codeTemplateIds) {
    try {/*w w w  . j a  va2 s.co m*/
        if (CollectionUtils.isEmpty(codeTemplateIds)) {
            codeTemplateIds = null;
        }
        return codeTemplateController.getCodeTemplates(codeTemplateIds);
    } catch (ControllerException e) {
        throw new MirthApiException(e);
    }
}

From source file:nc.noumea.mairie.appock.core.impl.AppUserImplTest.java

@Test
public void findAllWithRole() {

    List<Role> listeRole = new ArrayList<Role>();
    listeRole.add(Role.ROLE_ADMIN);

    creeAppUserEnBase(false, false, listeRole);

    Assert.assertTrue(CollectionUtils.isEmpty(appUserService.findAllWithRole(Role.ROLE_ADMIN, true))); // que les appUser actif (le notre n'est pas actif)

    // On passe le appUser gestionnaire mais toujours "non actif"
    AppUser appUserFromBdd = Lists.newArrayList(appUserRepository.findAll()).get(0);
    appUserFromBdd.setActif(false);/* ww  w  .java  2  s  .  c o m*/
    appUserRepository.save(appUserFromBdd);
    appockEntityManager.flush();

    Assert.assertTrue(CollectionUtils.isEmpty(appUserService.findAllWithRole(Role.ROLE_ADMIN, true)));
    Assert.assertFalse(CollectionUtils.isEmpty(appUserService.findAllWithRole(Role.ROLE_ADMIN, false)));
}

From source file:com.jkoolcloud.tnt4j.streams.custom.dirStream.DefaultStreamingJob.java

/**
 * Initializes and starts configuration defined {@link TNTInputStream}s when job gets invoked by executor service.
 *///  w  ww .j av  a  2s  .c  o m
@Override
public void run() {
    // StreamsAgent.runFromAPI(streamCfgFile);

    // TODO: configuration from ZooKeeper

    try {
        StreamsConfigLoader cfg = new StreamsConfigLoader(streamCfgFile);
        Collection<TNTInputStream<?, ?>> streams = cfg.getStreams();

        if (CollectionUtils.isEmpty(streams)) {
            throw new IllegalStateException(StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME,
                    "StreamsAgent.no.activity.streams"));
        }

        ThreadGroup streamThreads = new ThreadGroup(DefaultStreamingJob.class.getName() + "Threads"); // NON-NLS
        StreamThread ft;

        DefaultStreamListener dsl = new DefaultStreamListener();

        for (TNTInputStream<?, ?> stream : streams) {
            stream.addStreamListener(dsl);

            stream.output().setProperty(OutputProperties.PROP_TNT4J_CONFIG_FILE, tnt4jCfgFilePath);

            ft = new StreamThread(streamThreads, stream,
                    String.format("%s:%s", stream.getClass().getSimpleName(), stream.getName())); // NON-NLS
            ft.start();
        }
    } catch (Exception e) {
        LOGGER.log(OpLevel.ERROR, String.valueOf(e.getLocalizedMessage()), e);
    }
}

From source file:com.baifendian.swordfish.dao.model.ExecutionNode.java

/**
 * ?//from ww w  .  jav a  2s.  c om
 *
 * @param appLinkList :  app links
 */
public void addAppLinkList(List<String> appLinkList) {
    if (appLinkList == null) {
        return;
    }

    if (CollectionUtils.isEmpty(this.appLinkList)) {
        setAppLinkList(appLinkList);
        return;
    }

    this.appLinkList.addAll(appLinkList);
    this.appLinks = JsonUtil.toJsonString(this.appLinkList);
}

From source file:com.mirth.connect.server.api.servlets.EngineServlet.java

@Override
public void undeployChannels(Set<String> channelIds, boolean returnErrors) {
    if (CollectionUtils.isEmpty(channelIds)) {
        channelIds = engineController.getDeployedIds();
    }//w  w w.  j  a  va2 s  .c  o m
    ErrorTaskHandler handler = new ErrorTaskHandler();
    engineController.undeployChannels(redactChannelIds(channelIds), context, handler);
    if (returnErrors && handler.isErrored()) {
        throw new MirthApiException(handler.getError());
    }
}

From source file:nc.noumea.mairie.appock.services.impl.DatePrevisionnelleCommandeServiceImpl.java

@Override
public DatePrevisionnelleCommande getNextDatePrevisionnelleCommandeANotifier(LocalDateTime dateTime) {
    List<DatePrevisionnelleCommande> listeDatePrevisionnelleCommande = datePrevisionnelleCommandeRepository
            .findAllByDatePrevisionnelleAfterAndNotificationEnvoyeOrderByDatePrevisionnelleAsc(dateTime, false);
    return CollectionUtils.isEmpty(listeDatePrevisionnelleCommande) ? null
            : listeDatePrevisionnelleCommande.get(0);
}

From source file:io.github.valters.xsdiff.format.SemanticDiffFormatter.java

public void printPartRemoved(final String text, final SemanticNodeChanges changes, final DiffOutput output) {

    final TrieBuilder trie = Trie.builder().removeOverlaps();
    for (final String part : changes.getRemovedNodes()) {
        trie.addKeyword(part);/*from   www  . j  a  v  a 2  s  .  c o  m*/
    }
    for (final String part : changes.getNodeWithRemovedAttributes()) {
        trie.addKeyword(part);
    }
    final Collection<Emit> emits = trie.build().parseText(text);

    int prevFragment = 0;
    for (final Emit emit : emits) {
        final String clearPartBefore = text.substring(prevFragment, emit.getStart());
        output.clearPart(clearPartBefore);
        final String nodeText = emit.getKeyword();
        // check if we need to go deeper
        final Set<String> attrFragments = changes.getRemovedAttributesForNode(nodeText);
        if (CollectionUtils.isEmpty(attrFragments)) {
            output.removedPart(nodeText);
        } else {
            printAttributeHighlights(nodeText, attrFragments, fragment -> output.removedPart(fragment));
        }

        prevFragment = emit.getEnd() + 1;
    }

    final String clearPartAfter = text.substring(prevFragment, text.length());
    output.clearPart(clearPartAfter);
}

From source file:cherry.example.web.home.NaviControllerImpl.java

private String restoreHistory(NaviForm form) {
    if (CollectionUtils.isEmpty(form.getHistory())) {
        return null;
    }// w w  w  . ja va2 s . c o m
    return form.getHistory().remove(form.getHistory().size() - 1);
}