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:org.syncope.core.persistence.dao.impl.UserDAOImpl.java
/** * Find users by derived attribute value. This method could fail if one or * more string literals contained into the derived attribute value provided * derive from identifier (schema name) replacement. When you are going to * specify a derived attribute expression you must be quite sure that string * literals used to build the expression cannot be found into the attribute * values used to replace attribute schema names used as identifiers. * * @param schemaName derived schema name. * @param value derived attribute value. * @return list of users.// ww w. ja v a2 s. c o m * @throws InvalidSearchConditionException in case of errors retrieving * schema names used to buid the derived schema expression. */ @Override public List<SyncopeUser> findByDerAttrValue(final String schemaName, final String value) throws InvalidSearchConditionException { UDerSchema schema = derSchemaDAO.find(schemaName, UDerSchema.class); if (schema == null) { LOG.error("Invalid schema name '{}'", schemaName); return Collections.EMPTY_LIST; } // query string final StringBuilder querystring = new StringBuilder(); boolean subquery = false; for (String clause : getWhereClause(schema.getExpression(), value)) { if (querystring.length() > 0) { subquery = true; querystring.append(" AND a.owner_id IN ( "); } querystring.append("SELECT a.owner_id ").append("FROM UAttr a, UAttrValue v, USchema s ") .append("WHERE ").append(clause); if (subquery) { querystring.append(')'); } } LOG.debug("Execute query {}", querystring); final Query query = entityManager.createNativeQuery(querystring.toString()); final List<SyncopeUser> result = new ArrayList<SyncopeUser>(); SyncopeUser user; for (Object userId : query.getResultList()) { user = find(Long.parseLong(userId.toString())); if (!result.contains(user)) { result.add(user); } } return result; }
From source file:io.undertow.servlet.test.session.ServletSessionTestCase.java
@Test public void testSessionConfigNoCookies() throws IOException { TestHttpClient client = new TestHttpClient(); client.setCookieStore(new CookieStore() { @Override/*from w w w . j av a 2s.co m*/ public void addCookie(Cookie cookie) { } @Override public List<Cookie> getCookies() { return Collections.EMPTY_LIST; } @Override public boolean clearExpired(Date date) { return false; } @Override public void clear() { } }); try { HttpResponse result = client .execute(new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/aa/b;foo=bar")); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); String response = HttpClientUtils.readResponse(result); Assert.assertEquals("1", response); String url = result.getHeaders("url")[0].getValue(); result = client.execute(new HttpGet(url)); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); response = HttpClientUtils.readResponse(result); url = result.getHeaders("url")[0].getValue(); Assert.assertEquals("2", response); result = client.execute(new HttpGet(url)); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); response = HttpClientUtils.readResponse(result); Assert.assertEquals("3", response); } finally { client.getConnectionManager().shutdown(); } }
From source file:com.ebay.cloud.cms.dal.search.impl.field.AbstractSearchField.java
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public List<?> getSearchValue(IEntity entity) { List valueList = Collections.EMPTY_LIST; if (getInnerProperty() != null) { Object proertyValue = entity.getFieldProperty(getFieldName(), fieldProperty.getName()); if (proertyValue != null) { valueList = new ArrayList(); valueList.add(proertyValue); }//w w w .j ava2 s .c om } else if (getInnerField() != null) { if (InternalFieldEnum.ID.getDbName().equals(innerField)) { List<IEntity> fieldValues = (List<IEntity>) entity.getFieldValues(getFieldName()); if (fieldValues != Collections.EMPTY_LIST) { valueList = new ArrayList(); for (IEntity e : fieldValues) { valueList.add(e.getFieldValues(InternalFieldEnum.ID.getName()).get(0)); } } } else { List<?> fieldValues = entity.getFieldValues(getFieldName()); String[] innerFields = StringUtils.split(innerField, "."); if (fieldValues != Collections.EMPTY_LIST) { valueList = new ArrayList(); traverseFields(fieldValues, 0, innerFields, valueList); } } } else { valueList = entity.getFieldValues(getFieldName()); } return valueList; }
From source file:org.syncope.core.persistence.dao.impl.UserSearchDAOImpl.java
@Override public List<SyncopeUser> search(final Set<Long> adminRoles, final NodeCond searchCondition, final int page, final int itemsPerPage) { List<SyncopeUser> result = Collections.EMPTY_LIST; LOG.debug("Search condition:\n{}", searchCondition); if (!searchCondition.checkValidity()) { LOG.error("Invalid search condition:\n{}", searchCondition); } else {/* ww w . j av a2 s. c o m*/ try { result = doSearch(adminRoles, searchCondition, page, itemsPerPage); } catch (Throwable t) { LOG.error("While searching users", t); } } return result; }
From source file:org.syncope.core.workflow.NoOpUserWorkflowAdapter.java
@Override public List<WorkflowFormTO> getForms() { return Collections.EMPTY_LIST; }
From source file:hudson.util.spring.DefaultBeanConfiguration.java
public DefaultBeanConfiguration(String name, Class clazz, boolean prototype) { this(name, clazz, Collections.EMPTY_LIST); this.singleton = !prototype; }
From source file:org.trustedanalytics.user.orgs.OrgsIT.java
@Test public void getOrgsWithSpaces_shouldAskCfForSpacesAndReturnGroupedByOrg() { Page<CcSpace> SPACES_FROM_CF = new Page<>(); SPACES_FROM_CF.setResources(OrgsTestsResources.getSpacesReturnedByCf().getSpaces()); Page<CcOrg> ORGS_FROM_CF = new Page<>(); ORGS_FROM_CF.setResources(OrgsTestsResources.getOrgsReturnedByCf().getOrgs()); final String EXPECTED_ORGS_WITH_SPACES = OrgsTestsResources.getOrgsWithSpacesExpectedToBeReturnedBySc(); Observable<CcOrg> orgs = Observable.from(OrgsTestsResources.getOrgsReturnedByCf().getOrgs()); when(ccClient.getOrgs()).thenReturn(orgs); Observable<CcSpace> spaces = Observable.from(OrgsTestsResources.getSpacesReturnedByCf().getSpaces()); when(ccClient.getSpaces()).thenReturn(spaces); when(detailsFinder.findUserId(Mockito.any())).thenReturn(UUID.randomUUID()); when(ccClient.getManagedOrganizations(any())).thenReturn(Collections.EMPTY_LIST); TestRestTemplate testRestTemplate = new TestRestTemplate(); ResponseEntity<String> response = RestOperationsHelpers.getForEntityWithToken(testRestTemplate, TOKEN, BASE_URL + OrgsController.GENERAL_ORGS_URL); assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); assertThat(response.getBody(), equalTo(EXPECTED_ORGS_WITH_SPACES)); }
From source file:com.sonyericsson.hudson.plugins.multislaveconfigplugin.UIHudsonTest.java
/** * Sets up the tests.// w w w. ja v a 2s. c o m * @throws Exception if so. */ public void setUp() throws Exception { super.setUp(); webClient = createWebClient(); currentPage = webClient.goTo(NodeManageLink.getInstance().getUrlName()); webClient.setThrowExceptionOnScriptError(false); webClient.setThrowExceptionOnFailingStatusCode(false); slave0 = createSlave(); slave1 = createSlave(); slave2 = new DumbSlave("slave2", "This is the description on dumbSlave1", "HOME/slave2", "2", null, "LABEL1 LABEL3", null, null, Collections.EMPTY_LIST); slave3 = new DumbSlave("slave3", "This is the description on dumbSlave2", "home/slave3", "4", null, "label1", null, null, Collections.EMPTY_LIST); hudson.addNode(slave2); hudson.addNode(slave3); }
From source file:net.ontopia.persistence.query.jdo.JDOQuery.java
public List getOrderBy() { if (orderby == null) return Collections.EMPTY_LIST; else return orderby; }
From source file:sdmx.net.service.nsi.Sdmx20NSIQueryable.java
public List<DataflowType> listDataflows() { if (dataflowList != null) { return dataflowList; }/*w ww. j ava 2 s. co m*/ dataflowList = new ArrayList<DataflowType>(); String s = QueryToSdmx20Query.toNSIGetDataStructureListQuery(this.agencyId, soapNamespace); if (SdmxIO.isDumpQuery()) { System.out.println(s); } byte[] b = s.getBytes(); StructureType st = null; try { st = SdmxIO.parseStructure(query("QueryStructureResult", new ByteArrayInputStream(b), b.length)); } catch (IOException ex) { Logger.getLogger(Sdmx20NSIQueryable.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Sdmx20NSIQueryable.class.getName()).log(Level.SEVERE, null, ex); } if (st == null) { dataflowList = null; return Collections.EMPTY_LIST; } dataflowList = st.getStructures().getDataflows().getDataflows(); return dataflowList; }