List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:architecture.ee.web.community.struts2.action.ajax.MyAttachmentAction.java
public List<Attachment> getTargetAttachments() { if (getUser().getUserId() < 1) return Collections.EMPTY_LIST; return attachmentManager.getAttachments(DEFAULT_OBJEDT_TYPE, getUser().getUserId()); }
From source file:com.silverwrist.venice.conf.impl.ConferenceManager.java
public List getConferences(DynamoUser user, VeniceCommunity comm) throws DatabaseException { boolean show_hidden = false; try { // do we want to show hidden conferences? show_hidden = comm.getAcl().testPermission(user, ConfNamespaces.PERMISSIONS_NAMESPACE, "see.hidden"); } // end try//from ww w. j a v a 2 s .com catch (AclNotFoundException e) { // convert the AclNotFoundException DatabaseException de = new DatabaseException(ConferenceManager.class, "ConferenceMessages", "no.community.acl", e); de.setParameter(0, comm.getName()); throw de; } // end catch List in_list = m_ops.getConferences(comm.getCID()); if (in_list.isEmpty()) return Collections.EMPTY_LIST; ArrayList rc = new ArrayList(); Iterator it = in_list.iterator(); while (it.hasNext()) { // get each data element and convert it Map d = (Map) (it.next()); if (show_hidden || !(((Boolean) (d.get(ConferenceManagerOps.KEY_HIDE))).booleanValue())) { // skip hidden conferences if we don't have the "show hidden" permission ConferenceImpl conf = loadConference(d); rc.add(new LinkedConferenceImpl(m_ops.getLinkedConferenceOps(), conf, comm, m_srm, d)); } // end if } // end while if (rc.isEmpty()) return Collections.EMPTY_LIST; rc.trimToSize(); return Collections.unmodifiableList(rc); }
From source file:hudson.util.spring.DefaultBeanConfiguration.java
public DefaultBeanConfiguration(String name) { this(name, null, Collections.EMPTY_LIST); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
/** * @throws Exception if the test fails// ww w . j ava 2 s. c om */ @Test public void click_onClickHandler_javascriptDisabled() 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='http://www.foo2.com' id='a2' " + "onClick='alert(\"clicked\")'>link to foo2</a>\n" + "<a href='http://www.foo3.com' id='a3'>link to foo3</a>\n" + "</body></html>"; final WebClient client = getWebClient(); client.getOptions().setJavaScriptEnabled(false); final List<String> collectedAlerts = new ArrayList<>(); client.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); final MockWebConnection webConnection = new MockWebConnection(); webConnection.setDefaultResponse(htmlContent); client.setWebConnection(webConnection); final HtmlPage page = client.getPage(getDefaultUrl()); final HtmlAnchor anchor = page.getHtmlElementById("a2"); assertEquals(Collections.EMPTY_LIST, collectedAlerts); final HtmlPage secondPage = anchor.click(); assertEquals(Collections.EMPTY_LIST, collectedAlerts); final List<?> expectedParameters = Collections.EMPTY_LIST; assertEquals("url", "http://www.foo2.com/", secondPage.getUrl()); assertSame("method", HttpMethod.GET, webConnection.getLastMethod()); assertEquals("parameters", expectedParameters, webConnection.getLastParameters()); assertNotNull(secondPage); }
From source file:pe.gob.mef.gescon.web.ui.PoliticaMB.java
public void save(ActionEvent event) { try {//from ww w . j ava 2s . c om if (CollectionUtils.isEmpty(this.getListaPolitica())) { this.setListaPolitica(Collections.EMPTY_LIST); } Politica politica = new Politica(); politica.setNmoduloid(this.getModuloid()); politica.setVnombre(this.getNombre()); politica.setVdescripcion(this.getDescripcion()); if (!errorValidation(politica)) { politica.setVnombre(StringUtils.upperCase(this.getNombre().trim())); politica.setVdescripcion(StringUtils.capitalize(this.getDescripcion().trim())); LoginMB loginMB = (LoginMB) JSFUtils.getSessionAttribute("loginMB"); User user = loginMB.getUser(); PoliticaService service = (PoliticaService) ServiceFinder.findBean("PoliticaService"); politica.setNpoliticaid(service.getNextPK()); politica.setNactivo(BigDecimal.ONE); politica.setDfechacreacion(new Date()); politica.setVusuariocreacion(user.getVlogin()); service.saveOrUpdate(politica); this.setListaPolitica(service.getPoliticas()); this.cleanAttributes(); RequestContext.getCurrentInstance().execute("PF('newDialog').hide();"); } } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); } }
From source file:com.ge.predix.acs.privilege.management.PrivilegeManagementServiceImplTest.java
@SuppressWarnings("unchecked") @Test(expectedExceptions = PrivilegeManagementException.class) public void testAppendEmptyResources() { this.service.appendResources(Collections.EMPTY_LIST); }
From source file:com.ace.erp.service.sys.impl.ResourceServiceImpl.java
/** * ??Menu?/*from w ww . j a va 2s. c o m*/ * * @param resources * @return */ public List<Menu> convertToMenus(List<Resource> resources) { if (resources.size() == 0) { return Collections.EMPTY_LIST; } //?,? Menu root = convertToMenu(resources.remove(resources.size() - 1)); recursiveMenu(root, resources); List<Menu> menus = root.getChildren(); removeNoLeafMenu(menus); return menus; }
From source file:com.googlecode.jtiger.modules.ecside.core.RetrievalUtils.java
static Collection retrieveCollectionAsObject(WebContext context, String collection, String scope) throws Exception { Object obj = RetrievalUtils.retrieve(context, collection, scope); if (obj instanceof Collection) { return (Collection) obj; } else if (obj instanceof Map) { return ((Map) obj).values(); } else {/*from w ww .j a va2 s . c o m*/ if (logger.isDebugEnabled()) { logger.debug("The object is not of type Collection."); } return Collections.EMPTY_LIST; } }
From source file:com.sun.faces.context.FacesContextImpl.java
public Iterator getMessages() { assertNotReleased();/*w w w . j av a 2 s .c o m*/ if (null == componentMessageLists) { return (Collections.EMPTY_LIST.iterator()); } // Get an Iterator over the ArrayList instances List messages = getMergedMessageLists(); if (messages.size() > 0) { return messages.iterator(); } else { return Collections.EMPTY_LIST.iterator(); } }
From source file:com.streamsets.pipeline.stage.processor.xmlflattener.TestXMLFlatteningProcessor.java
@Test public void testSingleRecordNoAttrsNS() throws Exception { String xml = getXML(""); Record expected = RecordCreator.create(); expected.set(Field.create(createExpectedRecord("", "", "", ".", "#", "", false, true))); doTest(xml, "contact", ImmutableList.of(expected), Collections.EMPTY_LIST, OnRecordError.DISCARD, true, false, false, false);/*from w ww .ja v a 2 s. c o m*/ }