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.darkware.wpman.util.serialization.ThemeEnabledDeserializer.java

@Override
public Boolean deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext)
        throws IOException, JsonProcessingException {
    // Make sure the value isn't already a boolean-ish string.
    String strValue = jsonParser.getValueAsString();

    if ("network".equals(strValue))
        return Boolean.TRUE;
    if ("no".equals(strValue))
        return Boolean.FALSE;

    return Boolean.FALSE;
}

From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.PaymentDetailsValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final PaymentDetailsForm form = (PaymentDetailsForm) object;

    final Calendar start = CalendarHelper.parseDate(form.getStartMonth(), form.getStartYear());
    final Calendar expiration = CalendarHelper.parseDate(form.getExpiryMonth(), form.getExpiryYear());

    if (start != null && expiration != null && start.after(expiration)) {
        errors.rejectValue("startMonth", "payment.startDate.invalid");
    }/*  ww  w.j a  v a2  s.c  om*/

    final boolean editMode = StringUtils.isNotBlank(form.getPaymentId());
    if (editMode || Boolean.TRUE.equals(form.getNewBillingAddress())) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.titleCode", "address.title.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.firstName",
                "address.firstName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.lastName",
                "address.lastName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line1", "address.line1.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.townCity",
                "address.townCity.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.postcode",
                "address.postcode.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.countryIso",
                "address.country.invalid");
        // ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line2", "address.line2.invalid"); // for some addresses this field is required by cybersource
    }
}

From source file:ch.ralscha.extdirectspring.store.BookService.java

@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ, group = "store")
public ExtDirectStoreResult<Book> readWithPaging(ExtDirectStoreReadRequest request) {
    long total = request.getPage() + request.getLimit() + request.getStart();
    return new ExtDirectStoreResult<Book>().setTotal(total).setRecords(read()).setSuccess(Boolean.TRUE);
}

From source file:ch.ralscha.extdirectspring.util.ExtDirectSpringUtilTest.java

@Test
public void testEqual() {
    assertThat(ExtDirectSpringUtil.equal(1, 1)).isTrue();
    assertThat(ExtDirectSpringUtil.equal(1, 2)).isFalse();

    assertThat(ExtDirectSpringUtil.equal(true, true)).isTrue();
    assertThat(ExtDirectSpringUtil.equal(false, false)).isTrue();

    assertThat(ExtDirectSpringUtil.equal(true, false)).isFalse();
    assertThat(ExtDirectSpringUtil.equal(false, true)).isFalse();
    assertThat(ExtDirectSpringUtil.equal(false, null)).isFalse();

    assertThat(ExtDirectSpringUtil.equal(Boolean.TRUE, Boolean.TRUE)).isTrue();
    assertThat(ExtDirectSpringUtil.equal(Boolean.FALSE, Boolean.FALSE)).isTrue();

    assertThat(ExtDirectSpringUtil.equal(Boolean.TRUE, Boolean.FALSE)).isFalse();
    assertThat(ExtDirectSpringUtil.equal(Boolean.FALSE, Boolean.TRUE)).isFalse();
    assertThat(ExtDirectSpringUtil.equal(Boolean.FALSE, null)).isFalse();

    assertThat(ExtDirectSpringUtil.equal("a", "a")).isTrue();
    assertThat(ExtDirectSpringUtil.equal("a", "b")).isFalse();
    assertThat(ExtDirectSpringUtil.equal(null, "a")).isFalse();
    assertThat(ExtDirectSpringUtil.equal("a", null)).isFalse();
    assertThat(ExtDirectSpringUtil.equal(null, null)).isTrue();
}

From source file:httpRequests.GetPost.java

private Boolean OneAPIAvailable() {
    for (Boolean b : currentAvailability)
        if (b)//  w ww.jav a2  s.c  o m
            return Boolean.TRUE;
    return Boolean.FALSE;
}

From source file:com.atypon.wayf.request.ResponseWriterTest.java

@Test
public void testHasMore() {
    RequestContextAccessor/*from  w  w w.  j  a  va  2s .co m*/
            .set(new RequestContext().setRequestUrl("http://localhost:8080/list?param1=1&limit=30&offset=0")
                    .setOffset(0).setLimit(30).setHasAnotherDbPage(Boolean.TRUE));
    String link = responseWriter._getLinkHeaderValue();
    assertEquals("<http://localhost:8080/list?param1=1&limit=30&offset=30>; rel=\"next\"", link);
}

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

public static void changePassword(User user, HttpServletRequest request, Model model, UserService service,
        ConfigurationService configurationService) {

    try {//from   www  .  j  a v  a  2  s .c om
        //String oldPassword = request.getParameter("oldpassword");
        String password = request.getParameter("password");
        String password2 = request.getParameter("password2");
        if (StringUtils.isNotBlank(password)) {
            if (!password.equals(password2)) {
                model.addAttribute("passwordnotsame", true);
            } else {
                service.changePassword(user.getId(), password);
                model.addAttribute("passwordchanged", true);
            }
        }
    } catch (LoginException lex) {
        switch (lex.getReason()) {
        case PASSWORD_TOO_LONG:
            model.addAttribute("errorpassword_too_long", Boolean.TRUE);
            model.addAttribute("max_password_length", configurationService.getMaxPasswordLength());
            break;
        case PASSWORD_TOO_SHORT:
            model.addAttribute("errorpassword_too_short", Boolean.TRUE);
            model.addAttribute("min_password_length", configurationService.getMinPasswordLength());
            break;
        default:
            model.addAttribute("passworderror", true);
        }
    } catch (Exception ex) {
        model.addAttribute("passworderror", true);
    }
}

From source file:gDao.util.SimpleDaoTestInjectHandler.java

@Override
public void beforeTestMethod(final TestContext testContext) throws Exception {
    if (Boolean.TRUE.equals(testContext.getAttribute(REINJECT_DEPENDENCIES_ATTRIBUTE))) {
        if (logger.isDebugEnabled()) {
            logger.debug("Reinjecting dependencies for test context [" + testContext + "].");
        }//  w w  w.  ja  v a2 s  . c  om
        injectDependencies(testContext);
    }
}

From source file:net.sf.json.spring.web.servlet.view.JsonViewTest.java

public void testRenderObjectGraph() throws Exception {
    JsonView view = new JsonView();
    Map model = new HashMap();
    model.put("bool", Boolean.TRUE);
    model.put("integer", new Integer(1));
    model.put("str", "string");
    Map bean = new HashMap();
    bean.put("name", "mybean");
    bean.put("bools", new boolean[] { true, false });
    model.put("bean", bean);

    view.render(model, servletRequest, servletResponse);
    jsTester.eval(toJsScript(servletResponse));

    jsTester.assertNotNull("json");
    jsTester.assertIsObject("json");
    jsTester.assertEquals("json.bool", "true");
    jsTester.assertEquals("json.integer", "1");
    jsTester.assertEquals("json.str", "'string'");
    jsTester.assertIsObject("json.bean");
    jsTester.assertIsArray("json.bean.bools");
    jsTester.assertEquals("2", "json.bean.bools.length");
    jsTester.assertEquals("'mybean'", "json.bean.name");
}

From source file:jp.primecloud.auto.common.component.FreeMarkerGeneratorTest.java

@Test
public void test1() throws Exception {
    Map<String, Object> rootMap = new HashMap<String, Object>();
    rootMap.put("aaa", "AAA");
    rootMap.put("bbb", "BBB");
    rootMap.put("enable", Boolean.TRUE);
    rootMap.put("num", 12345.6789);

    Model model = new Model();
    model.setEnabled(true);/*  ww  w . j  a va  2  s . co  m*/
    rootMap.put("model", model);

    String data = generator.generate("test1.ftl", rootMap);

    File file = new File("target/tmp/test1.txt");
    FileUtils.writeStringToFile(file, data, "UTF-8");
}