Example usage for java.lang Boolean TRUE

List of usage examples for java.lang Boolean TRUE

Introduction

In this page you can find the example usage for java.lang Boolean TRUE.

Prototype

Boolean TRUE

To view the source code for java.lang Boolean TRUE.

Click Source Link

Document

The Boolean object corresponding to the primitive value true .

Usage

From source file:org.apache.streams.facebook.test.FacebookActivityActorSerDeTest.java

@Test
public void Tests() throws Exception {
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.TRUE);
    mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
    mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);

    InputStream is = FacebookActivityActorSerDeTest.class.getResourceAsStream("/testpage.json");
    Joiner joiner = Joiner.on(" ").skipNulls();
    is = new BoundedInputStream(is, 10000);
    String json;//from   w  w w .ja  v a2 s. com

    json = joiner.join(IOUtils.readLines(is));
    LOGGER.debug(json);

    Page page = mapper.readValue(json, Page.class);

    Activity activity = serializer.deserialize(page);

    LOGGER.debug(mapper.writeValueAsString(activity));
}

From source file:org.qi4j.library.http.MutualSecureJettyServiceTest.java

public void assemble(ModuleAssembly module) throws AssemblyException {
    new EntityTestAssembler().assemble(module);
    new SecureJettyServiceAssembler().assemble(module);
    // START SNIPPET: config
    SecureJettyConfiguration config = module.forMixin(SecureJettyConfiguration.class).declareDefaults();
    config.hostName().set("127.0.0.1");
    config.port().set(HTTPS_PORT);/*from  w  ww .j  ava 2 s . c o  m*/

    config.keystorePath().set(SERVER_KEYSTORE_PATH);
    config.keystoreType().set("JCEKS");
    config.keystorePassword().set(KS_PASSWORD);

    config.truststorePath().set(TRUSTSTORE_PATH);
    config.truststoreType().set("JCEKS");
    config.truststorePassword().set(KS_PASSWORD);

    config.wantClientAuth().set(Boolean.TRUE);
    // END SNIPPET: config

    addServlets(serve("/hello").with(HelloWorldServletService.class)).to(module);
}

From source file:Main.java

static Boolean[] toObject(final boolean[] array) {
    if (array == null) {
        return null;
    } else if (array.length == 0) {
        return new Boolean[0];
    }/* w  ww  .j a  va2 s .c o  m*/
    final Boolean[] result = new Boolean[array.length];
    for (int i = 0; i < array.length; i++) {
        result[i] = (array[i] ? Boolean.TRUE : Boolean.FALSE);
    }
    return result;
}

From source file:org.apache.streams.facebook.test.FacebookPostSerDeTest.java

@Test
public void Tests() {
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.TRUE);
    mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
    mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);

    InputStream is = FacebookPostSerDeTest.class.getResourceAsStream("/testpost.json");
    Joiner joiner = Joiner.on(" ").skipNulls();
    is = new BoundedInputStream(is, 10000);
    String json;/*w w  w  . j a va 2  s  . c  om*/

    try {
        json = joiner.join(IOUtils.readLines(is));
        LOGGER.debug(json);

        Post ser = mapper.readValue(json, Post.class);

        String de = mapper.writeValueAsString(ser);

        LOGGER.debug(de);

        Post serde = mapper.readValue(de, Post.class);

        Assert.assertEquals(ser, serde);

        LOGGER.debug(mapper.writeValueAsString(serde));

        Activity activity = new Activity();
        FacebookActivityUtil.updateActivity(ser, activity);

        assertNotNull(activity);
        assertNotNull(activity.getActor().getId());
        assertNotNull(activity.getActor().getDisplayName());
        assertNotNull(activity.getId());
        assert (activity.getVerb().equals("post"));
        assertNotNull(activity.getObject());
        assertNotNull(activity.getUpdated());
        assertNotNull(activity.getPublished());
        assertEquals(activity.getProvider().getId(), "id:providers:facebook");
        assertEquals(activity.getProvider().getDisplayName(), "Facebook");
        assertEquals(activity.getLinks().size(), 1);
        assertNotNull(activity.getAdditionalProperties().get("extensions"));

    } catch (Exception e) {
        System.out.println(e);
        e.printStackTrace();
        Assert.fail();
    }
}

From source file:be.fedict.eid.idp.webapp.XSSProtectionFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    Boolean xssProtection = this.configuration.getValue(ConfigProperty.XSS_PROTECTION, Boolean.class);
    if (null != xssProtection) {
        if (xssProtection.equals(Boolean.TRUE)) {
            HttpServletResponse httpServletResponse = (HttpServletResponse) response;
            httpServletResponse.setHeader("X-XSS-Protection", "1; mode=block");
        }/* w w w. j  a v a 2 s . com*/
    }
    chain.doFilter(request, response);
}

From source file:com.mobileman.projecth.web.util.DoctorUtils.java

/**
 * @param model/*from www.  java2  s . c  o m*/
 * @param data
 * @param user
 */
public static void loadDoctorHeader(Model model, DataHolder data, User user) {

    if (Doctor.class.isInstance(user)) {
        MedicalInstitution mi = Doctor.class.cast(user).getMedicalInstitution();
        String miString = MedicalInstitutionUtil.fmtMedicalInstitution(mi);
        model.addAttribute("medicalInstitution", miString);
        if (mi != null) {
            model.addAttribute("medicalInstitutionPhoneNmr",
                    (mi.getPhoneNumber() != null ? mi.getPhoneNumber().format() : ""));
            model.addAttribute("medicalInstitutionFaxNmr",
                    (mi.getFaxNumber() != null ? mi.getFaxNumber().format() : ""));
        }

    }
    model.addAttribute("visitorCanSeeUserData", Boolean.TRUE);

    String gend = UserUtil.fmtGender(user);
    LocaleService localeService = InitController.getWebApplicationContext().getBean(LocaleService.class);
    model.addAttribute("user_gender", gend.trim().length() == 0 ? localeService.getUnknowMessage() : gend);
    model.addAttribute("user_avatar", PatientUtils.computeAvatar(user.getSex()));
    model.addAttribute("user_age", PatientUtils.computeAge(user.getBirthday()));

}

From source file:NumberUtil.java

/**
 * Convert an Object to a  Boolean./*  w w  w .  j a  v a 2 s.c o m*/
 */
public static Boolean toBoolean(Object value) {
    if (value == null)
        return null;
    if (value instanceof Boolean)
        return (Boolean) value;

    if ("TRUE".equalsIgnoreCase(value.toString()))
        return Boolean.TRUE;
    if ("".equals(value.toString()))
        return null;

    return Boolean.FALSE;
}

From source file:com.bg.jtown.social.twitter.TweetAfterConnectInterceptor.java

public void preConnect(ConnectionFactory<Twitter> provider, MultiValueMap<String, String> parameters,
        WebRequest request) {/* w w w. j  a v  a2 s  .  c om*/
    if (StringUtils.hasText(request.getParameter(POST_TWEET_PARAMETER))) {
        request.setAttribute(POST_TWEET_ATTRIBUTE, Boolean.TRUE, WebRequest.SCOPE_SESSION);
    }
}

From source file:jp.co.ctc_g.jse.core.csv.DownloadFile.java

/**
 * ??/* ww  w  .  j a  va 2s.  c  o m*/
 * @param tempFileName ???
 */
public DownloadFile(String tempFileName) {
    this.tempFileName = tempFileName;
    this.delete = Boolean.TRUE;
}

From source file:no.asgari.civilization.server.model.Undo.java

/**
 * Will vote yes for the player since they initiated the request for undo
 *
 * @param numberOfVotesRequired/*www. j  ava  2  s. c  o  m*/
 * @param playerId
 */
public Undo(int numberOfVotesRequired, String playerId) {
    this.numberOfVotesRequired = numberOfVotesRequired;
    done = false;
    vote(playerId, Boolean.TRUE);
}