Example usage for java.util Collections singleton

List of usage examples for java.util Collections singleton

Introduction

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

Prototype

public static <T> Set<T> singleton(T o) 

Source Link

Document

Returns an immutable set containing only the specified object.

Usage

From source file:com.hp.autonomy.frontend.find.idol.beanconfiguration.IdolSecurityCustomizerImpl.java

private AuthenticationProvider communityAuthenticationProvider() {
    final Role user = new Role.Builder().setName(UserConfiguration.IDOL_USER_ROLE)
            .setPrivileges(Collections.singleton("login")).build();

    return new CommunityAuthenticationProvider(configService, userService,
            new Roles(Collections.singletonList(user)), Collections.singleton("login"),
            grantedAuthoritiesMapper);//from w ww . j a  v  a 2s. c o m
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.authenticate.ProgramLoginTest.java

private static UserAccount createUserAccount(String uri, String name, String password, int loginCount) {
    UserAccount user = new UserAccount();
    user.setEmailAddress(name);/*  www.j  av a 2s. c  o m*/
    user.setUri(uri);
    user.setPermissionSetUris(Collections.singleton(PermissionSets.URI_DBA));
    user.setMd5Password(Authenticator.applyMd5Encoding(password));
    user.setLoginCount(loginCount);
    user.setPasswordChangeRequired(loginCount == 0);
    return user;
}

From source file:net.sourceforge.fenixedu.domain.reports.GraduationReportFile.java

@Override
public void renderReport(Spreadsheet spreadsheet) {
    spreadsheet.setHeader("nmero aluno");
    spreadsheet.setHeader("nome");
    setDegreeHeaders(spreadsheet);/*  ww w . j a  v a 2 s.  c  o  m*/
    spreadsheet.setHeader("ciclo");
    spreadsheet.setHeader("Nota Concluso Secundrio");
    spreadsheet.setHeader("Nota Seriao");
    spreadsheet.setHeader("ano de ingresso");
    spreadsheet.setHeader("ano lectivo concluso");
    spreadsheet.setHeader("data concluso");
    spreadsheet.setHeader("nmero de anos para concluso");
    spreadsheet.setHeader("mdia final");
    spreadsheet.setHeader("morada");
    spreadsheet.setHeader("cdigo postal");
    spreadsheet.setHeader("cidade");
    spreadsheet.setHeader("pas");
    spreadsheet.setHeader("telefone");
    spreadsheet.setHeader("telemovel");
    spreadsheet.setHeader("email");
    spreadsheet.setHeader("sexo");
    spreadsheet.setHeader("data nascimento");

    final Set<ExecutionYear> toInspectSet = getExecutionYear() == null
            ? getRootDomainObject().getExecutionYearsSet()
            : Collections.singleton(getExecutionYear());

    for (final ExecutionYear toInspect : toInspectSet) {
        for (final ConclusionProcess conclusionProcess : toInspect.getConclusionProcessesConcludedSet()) {
            if (checkDegreeType(getDegreeType(), conclusionProcess)) {
                reportGraduate(spreadsheet, conclusionProcess);
            }
        }
    }
}

From source file:com.heliosdecompiler.helios.gui.controller.PathEditorController.java

@FXML
private void cancelEdit(ListView.EditEvent<String> event) {
    list.getItems().removeAll(Collections.singleton(""));
}

From source file:com.careerly.common.support.msgconverter.CsvHttpMessageConverter.java

@Override
protected void writeInternal(CsvResponse t, HttpOutputMessage outputMessage)
        throws IOException, HttpMessageNotWritableException {
    ServletServerHttpResponse response = (ServletServerHttpResponse) outputMessage;
    response.getServletResponse().setCharacterEncoding("UTF-8");
    outputMessage.getHeaders().set("Content-Disposition", "attachment; filename=\"" + t.getFileName() + "\"");
    BufferedWriter bw = new BufferedWriter(
            new OutputStreamWriter(outputMessage.getBody(), Charset.forName("UTF-8")));
    try {//  w ww .j av  a  2  s . c o m
        for (List<String> line : Iterables.concat(Collections.singleton(t.getHead()), t.getBody())) {
            for (int i = 0; i < line.size(); i++) {
                if (line.get(i) != null) {
                    bw.write("\"");
                    bw.write(line.get(i));
                    bw.write("\"");
                }
                if (i < line.size() - 1) {
                    bw.write(seperator);
                }
            }
            bw.newLine();
        }
    } finally {
        bw.close();
    }
}

From source file:ch.rasc.wampspring.EventMessenger.java

/**
 * Send an {@link EventMessage} to every client that is currently subscribed to the
 * provided topicURI except the one provided with the excludeSessionId parameter.
 *
 * @param topicURI the name of the topic
 * @param event the payload of the {@link EventMessage}
 * @param excludeWebSocketSessionId a WebSocket session id that will be excluded
 *///from   w  w w. ja v a 2s  .  co m
public void sendToAllExcept(String topicURI, Object event, String excludeWebSocketSessionId) {
    sendToAllExcept(topicURI, event, Collections.singleton(excludeWebSocketSessionId));
}

From source file:cereal.examples.thrift.ThriftPersonTest.java

@Test(timeout = 30 * 1000)
public void testSerialization() throws Exception {
    Registry registry = new RegistryImpl();
    ThriftPersonMapping mapping = new ThriftPersonMapping();
    registry.add(mapping);//w w w  .  j  a  va  2 s.c o m

    Person p = new Person();
    p.setFirstName("Bob");
    p.setMiddleName("Joe");
    p.setLastName("Franklin");
    p.setAge(30);
    p.setHeight(72);
    p.setWeight(220);

    String tableName = test.getMethodName();
    Connector conn = mac.getConnector("root", PASSWORD);
    conn.tableOperations().create(tableName);

    try (Store store = new StoreImpl(registry, conn, tableName)) {
        store.write(Collections.singleton(p));
        store.flush();

        Text row = mapping.getRowId(p);

        Person copy = store.read(row, Person.class);

        assertEquals(p, copy);
    }
}

From source file:io.pravega.test.integration.MultiReadersEndToEndTest.java

@Test(timeout = 30000)
public void testReadersLessThanSegments() throws Exception {
    runTest(Collections.singleton("teststream2"), 2, 3);
    runTestUsingMock(Collections.singleton("teststream2"), 2, 3);
}

From source file:com.mauersu.util.redis.DefaultSetOperations.java

public Long differenceAndStore(K key, K otherKey, K destKey) {
    return differenceAndStore(key, Collections.singleton(otherKey), destKey);
}