Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

In this page you can find the example usage for java.util Collections EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:eu.domibus.common.dao.MessageLogDao.java

public List<String> getUndownloadedUserMessagesOlderThan(Date date, String mpc) {
    final TypedQuery<String> query = em
            .createNamedQuery("MessageLogEntry.findUndownloadedUserMessagesOlderThan", String.class);
    query.setParameter("DATE", date);
    query.setParameter("MPC", mpc);
    try {/*from  www .  java 2  s.c o m*/
        return query.getResultList();
    } catch (NoResultException e) {
        return Collections.EMPTY_LIST;
    }
}

From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java

/**
 * @throws Exception if the test fails/*w ww.ja va  2s  .c  o m*/
 */
@Test
public void click_javascriptUrl() throws Exception {
    final String htmlContent = "<html><head><title>foo</title></head><body>\n"
            + "<a href='http://www.foo1.com' id='a1'>link to foo1</a>\n"
            + "<a href='javascript:alert(\"clicked\")' id='a2'>link to foo2</a>\n"
            + "<a href='http://www.foo3.com' id='a3'>link to foo3</a>\n" + "</body></html>";
    final List<String> collectedAlerts = new ArrayList<>();
    final HtmlPage page = loadPage(htmlContent, collectedAlerts);

    final HtmlAnchor anchor = page.getHtmlElementById("a2");

    assertEquals(Collections.EMPTY_LIST, collectedAlerts);

    final HtmlPage secondPage = anchor.click();

    assertEquals(new String[] { "clicked" }, collectedAlerts);
    assertSame(page, secondPage);
}

From source file:eu.trentorise.smartcampus.mobility.service.NotificationHelper.java

private void notify(Notification n, String appId) {
    long when = System.currentTimeMillis();
    n.setTimestamp(when);/*from  w w  w.j av  a  2s  .c om*/
    try {
        connector().sendAppNotification(n, appId, Collections.EMPTY_LIST, tokenHelper.getToken());
    } catch (CommunicatorConnectorException e) {
        e.printStackTrace();
        logger.error("Failed to send notifications: " + e.getMessage(), e);
    }
}

From source file:hudson.plugins.jobConfigHistory.JobConfigHistoryRootAction.java

/**
 * Returns the configuration history entries for all jobs or deleted jobs in
 * this Hudson instance./* www  .  ja  va  2  s .  com*/
 *
 * @param type
 *            Whether we want to see all jobs or just the deleted jobs.
 * @return List of config infos.
 * @throws IOException
 *             if one of the history entries might not be read.
 */
List<ConfigInfo> getJobConfigs(String type) throws IOException {
    if (!hasJobConfigurePermission() && !hasReadExtensionPermission()) {
        return Collections.EMPTY_LIST;
    } else {
        return new ConfigInfoCollector(type, getOverviewHistoryDao()).collect("");
    }
}

From source file:knowledgeMiner.DisjointnessDisambiguator.java

public Collection<DefiniteAssertion> getConsistentAssertions() {
    if (caseNumber_ == -1)
        return Collections.EMPTY_LIST;
    return consistentAssertions_;
}

From source file:pe.gob.mef.gescon.web.ui.MaestroMB.java

public void save(ActionEvent event) {
    try {//from   w  w w .  ja v  a2 s. c om
        if (CollectionUtils.isEmpty(this.getListaMaestro())) {
            this.setListaMaestro(Collections.EMPTY_LIST);
        }
        Maestro maestro = new Maestro();
        maestro.setVnombre(this.getNombre().trim().toUpperCase());
        maestro.setVdescripcion(StringUtils.capitalize(this.getDescripcion().trim()));
        if (!errorValidation(maestro)) {
            LoginMB loginMB = (LoginMB) JSFUtils.getSessionAttribute("loginMB");
            User user = loginMB.getUser();
            MaestroService service = (MaestroService) ServiceFinder.findBean("MaestroService");
            maestro.setNmaestroid(service.getNextPK());
            maestro.setNactivo(BigDecimal.ONE);
            maestro.setVusuariocreacion(user.getVlogin());
            maestro.setDfechacreacion(new Date());
            service.saveOrUpdate(maestro);
            this.setListaMaestro(service.getMaestros());
            this.cleanAttributes();
            RequestContext.getCurrentInstance().execute("PF('newDialog').hide();");
        }
    } catch (Exception e) {
        log.error(e.getMessage());
        e.printStackTrace();
    }
}

From source file:gobblin.cluster.GobblinClusterKillTest.java

@Test(groups = { "disabledOnTravis" })
public void testKillWorker() throws TimeoutException, InterruptedException {
    Collection<File> matches = Collections.EMPTY_LIST;

    final File writerOutputDir = new File(_testDirPath + "/writer-output/gobblin/util/test/HelloWorldSource/");
    final File jobOutputDir = new File(_testDirPath + "/job-output/gobblin/util/test/HelloWorldSource/");
    final File testJobFile = new File(_jobDirPath + "/GobblinClusterKillTestJob.conf");

    // Job file should exist
    Assert.assertTrue(testJobFile.exists());

    AssertWithBackoff.create().logger(LOG).timeoutMs(ASSERT_TIMEOUT).maxSleepMs(ASSERT_MAX_SLEEP)
            .backoffFactor(1.5).assertTrue(new Predicate<Void>() {
                @Override/*from   w  w  w  .j av  a  2s.c om*/
                public boolean apply(Void input) {
                    if (writerOutputDir.exists()) {
                        return FileUtils.listFiles(writerOutputDir, new String[] { "txt" }, true).size() >= 25;
                    } else {
                        return false;
                    }
                }
            }, "Waiting for writer output");

    LOG.info("{} matches found before disconnecting worker",
            FileUtils.listFiles(writerOutputDir, new String[] { "txt" }, true).size());

    _clusterWorkers[0].disconnectHelixManager();

    AssertWithBackoff.create().logger(LOG).timeoutMs(ASSERT_TIMEOUT).maxSleepMs(ASSERT_MAX_SLEEP)
            .backoffFactor(1.5).assertTrue(new Predicate<Void>() {
                @Override
                public boolean apply(Void input) {
                    if (jobOutputDir.exists()) {
                        return FileUtils.listFiles(jobOutputDir, new String[] { "txt" }, true).size() >= 100;
                    } else {
                        return false;
                    }
                }
            }, "Waiting for job-completion");

    // Job file should have been deleted
    Thread.sleep(5000);
    Assert.assertFalse(testJobFile.exists());
}

From source file:com.atlassian.jira.web.dispatcher.JiraWebworkActionDispatcher.java

/**
 * Service a request. The request is first checked to see if it is a multi-part. If it is, then the request is
 * wrapped so WW will be able to work with the multi-part as if it was a normal request. Next, we will process all
 * actions until an action returns a non-action which is usually a view. For each action in a chain, the action's
 * context will be first set and then the action will be instantiated. Next, the previous action if this action
 * isn't the first in the chain will have its attributes copied to the current action.
 *
 * @param httpServletRequest HttpServletRequest
 * @param httpServletResponse HttpServletResponse
 *//*from   w  ww  . j ava 2 s. c  o m*/
public void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
        throws ServletException, IOException {
    Pair<HttpServletRequest, HttpServletResponse> wrap = wrap(httpServletRequest, httpServletResponse);

    httpServletRequest = wrap.first();
    httpServletResponse = wrap.second();

    // If the CLEANUP attribute is NOT set or is set to true - do the cleanup
    //
    // This is set into the request by ActionCleanupDelayFilter always!
    //
    boolean doCleanup = (httpServletRequest.getAttribute(CLEANUP) == null
            || httpServletRequest.getAttribute(CLEANUP).equals(Boolean.TRUE));

    GenericDispatcher gd = null;
    try {
        String actionName = getActionName(httpServletRequest);

        gd = prepareDispatcher(httpServletRequest, httpServletResponse, actionName);

        ActionResult ar = null;
        try {
            gd.executeAction();
            ar = gd.finish();
        } catch (XsrfFailureException e) {
            // if we fail the XSRF check then we use a servlet FORWARD to the session timeout page.
            httpServletRequest.getRequestDispatcher(XsrfErrorAction.FORWARD_PATH).forward(httpServletRequest,
                    httpServletResponse);
        } catch (WebSudoSessionException websudoException) {
            // We want websudo session for this action and we dont have it.
            ar = new ActionResult(Action.LOGIN,
                    "/secure/admin/WebSudoAuthenticate!default.jspa?webSudoDestination="
                            + getDestinationUrl(httpServletRequest),
                    Collections.EMPTY_LIST, null);
        } catch (ActionNotFoundException e) {
            log.debug("Action '{}' was not found, returning 404", e.getActionName());
            sendErrorImpl(httpServletResponse, 404, null);
        } catch (LookupAliasActionFactoryProxy.UnauthorisedActionException unauthorisedActionException) {
            httpServletRequest
                    .getRequestDispatcher("/login.jsp?permissionViolation=true&os_destination="
                            + getDestinationUrl(httpServletRequest))
                    .forward(httpServletRequest, httpServletResponse);
        } catch (Exception e) {
            onActionRecoverableThrowable(httpServletResponse, actionName, e);
        }

        if (ar != null && ar.getActionException() != null) {
            onActionException(actionName, ar);
        }

        // check if no view exists
        if (ar != null && ar.getResult() != null && ar.getView() == null
                && !ar.getResult().equals(Action.NONE)) {
            onNoViewDefined(httpServletResponse, actionName, ar);
        }

        if (ar != null && ar.getView() != null && ar.getActionException() == null) {
            viewDispatcher.dispatchView(httpServletRequest, httpServletResponse, doCleanup, ar, actionName);
        }
    } finally {
        performFinallyCleanup(httpServletRequest, doCleanup, gd);
    }
}

From source file:com.streamsets.pipeline.stage.processor.xmlflattener.TestXMLFlatteningProcessor.java

@Test
public void testOutputField() throws Exception {
    String xml = getXML("");
    Record expected = RecordCreator.create();
    expected.set(Field.create(createExpectedRecord("", "", "", "_", ".", "output", true, true)));
    doTest(xml, "contact", "_", ".", "output", ImmutableList.of(expected), Collections.EMPTY_LIST,
            OnRecordError.DISCARD, false, false, false, false);
}

From source file:net.jcreate.home.common.BaseDAO.java

public DataModel queryPage(final String pObjectQuery, final String pCountQuery, final TemplateContext pContext,
        NavRequest pNavRequest) throws DataAccessException {
    Assert.notNull(pObjectQuery, "HQL?null");
    Assert.notNull(pCountQuery, "HQL?null");
    Assert.notNull(pNavRequest, "?null");

    SortInfo sortInfo = null;/*  w  ww.ja v a  2  s.c o  m*/
    if (pNavRequest.getSortProperty() != null) {
        sortInfo = new DefaultSortInfo(pNavRequest.getSortProperty(), pNavRequest.getSortDir());
    } else {
        sortInfo = EmptySortInfo.getInstance();
    }
    final int start = pNavRequest.getStart();
    final int pageSize = pNavRequest.getPageSize();
    int totalSize = queryCount(pCountQuery, pContext);
    DefaultPageInfo pageInfo = new DefaultPageInfo(start, totalSize, pNavRequest.getPageSize());
    List data = null;
    if (totalSize > 0) {
        data = queryPage(pObjectQuery, pContext, start, pageSize);
    } else {
        data = Collections.EMPTY_LIST;
    }
    DataModel result = new CollectionDataModel(data, sortInfo, pageInfo);
    return result;
}