Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

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

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractLoginPageController.java

protected String getDefaultLoginPage(final boolean loginError, final HttpSession session, final Model model)
        throws CMSItemNotFoundException {
    final LoginForm loginForm = new LoginForm();
    model.addAttribute(loginForm);//from ww w  .  j a  v  a 2 s. c  o  m
    model.addAttribute(new RegisterForm());
    model.addAttribute(new GuestForm());

    final String username = (String) session.getAttribute(SPRING_SECURITY_LAST_USERNAME);
    if (username != null) {
        session.removeAttribute(SPRING_SECURITY_LAST_USERNAME);
    }

    loginForm.setJ_username(username);
    storeCmsPageInModel(model, getCmsPage());
    setUpMetaDataForContentPage(model, (ContentPageModel) getCmsPage());
    model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.INDEX_NOFOLLOW);

    final Breadcrumb loginBreadcrumbEntry = new Breadcrumb("#", getMessageSource().getMessage(
            "header.link.login", null, "header.link.login", getI18nService().getCurrentLocale()), null);
    model.addAttribute("breadcrumbs", Collections.singletonList(loginBreadcrumbEntry));

    if (loginError) {
        model.addAttribute("loginError", Boolean.valueOf(loginError));
        GlobalMessages.addErrorMessage(model, "login.error.account.not.found.title");
    }

    return getView();
}

From source file:com.icesoft.faces.util.CoreUtils.java

private static boolean isRenderPortletStyleClass() {
    if (renderPortletStyleClass == null) {
        String renderStyle = FacesContext.getCurrentInstance().getExternalContext()
                .getInitParameter("com.icesoft.faces.portlet.renderStyles");
        if (renderStyle == null) {
            //default is true
            renderPortletStyleClass = Boolean.TRUE;
        } else {/*  w  ww.ja  v a2  s.  co  m*/
            renderPortletStyleClass = Boolean.valueOf(renderStyle);
        }

    }
    return renderPortletStyleClass.booleanValue();
}

From source file:de.hybris.platform.servicelayer.config.ConfigServiceTest.java

/**
 * General testing whether delegating requests to hybris config works well. Test compares configuration values from
 * jalo with results of configuration values from servicelayer.
 *//*  www  .  ja  va  2  s  . c o m*/
@Test
public void testJaloVsCommons() {
    //take the jalo configuration as master (expected)
    final Map<String, String> values = Registry.getCurrentTenant().getConfig().getAllParameters();

    //and compare with commons configuration (actual) 
    for (final Map.Entry<String, String> entry : values.entrySet()) {
        final String key = entry.getKey();
        final String expected = entry.getValue();
        final String actual = this.configurationService.getConfiguration().getString(key);

        //assert as string 
        Assert.assertEquals(expected, actual);

        //assert convenience methods (boolean)
        if ("true".equals(actual) || "false".equals(actual)) {
            final boolean bExpected = Boolean.parseBoolean(actual);
            final boolean bActual = this.configurationService.getConfiguration().getBoolean(key);
            Assert.assertEquals(Boolean.valueOf(bExpected), Boolean.valueOf(bActual));
        }
    }
}

From source file:com.digitalpebble.storm.crawler.filtering.BasicURLNormalizerTest.java

private URLFilter createFilter(boolean removeAnchor, List<String> queryElementsToRemove) {
    ObjectNode filterParams = new ObjectNode(JsonNodeFactory.instance);
    filterParams.set("queryElementsToRemove", getArrayNode(queryElementsToRemove));
    filterParams.put("removeAnchorPart", Boolean.valueOf(removeAnchor));
    return createFilter(filterParams);
}

From source file:com.openshift.internal.restclient.model.template.Parameter.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((getFrom() == null) ? 0 : getFrom().hashCode())
            + ((getGeneratorName() == null) ? 0 : getGeneratorName().hashCode())
            + ((getName() == null) ? 0 : getName().hashCode())
            + ((getValue() == null) ? 0 : getValue().hashCode()) + Boolean.valueOf(isRequired()).hashCode();
    return result;
}

From source file:bg.vitkinov.edu.services.ImageService.java

@RequestMapping(value = "/img", method = { RequestMethod.POST }, produces = { MediaType.IMAGE_PNG_VALUE,
        MediaType.IMAGE_GIF_VALUE, MediaType.IMAGE_JPEG_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE })
public byte[] convertToInlineTextImage(@RequestHeader(value = "Accept") String acceptType,
        @RequestParam String text, @RequestParam(required = false, defaultValue = "false") String base64,
        @RequestParam(required = false, defaultValue = "Arial-14") String font,
        @RequestParam(required = false, defaultValue = "black") String foreColor,
        @RequestParam(required = false) String backColor) {
    logger.info(acceptType);//from ww w  .  j  ava  2  s  . com
    logger.info("Text: " + text);
    return convert(Boolean.valueOf(base64) ? new String(Base64.getDecoder().decode(text)) : text,
            new TextToGraphicsConverter(createGraphicsProperties(font, foreColor, backColor)),
            GraphicsType.value(acceptType));
}

From source file:se.omegapoint.facepalm.client.config.DatabaseConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setDataSource(dataSource);
    entityManagerFactory.setPackagesToScan("se.omegapoint.facepalm");

    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(Boolean.valueOf(env.getProperty("db.show.sql")));
    vendorAdapter.setGenerateDdl(Boolean.valueOf(env.getProperty("db.generate.ddl")));
    entityManagerFactory.setJpaVendorAdapter(vendorAdapter);

    final Properties additionalProperties = new Properties();
    additionalProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
    entityManagerFactory.setJpaProperties(additionalProperties);

    return entityManagerFactory;
}

From source file:com.lithium.flow.filer.lucene.RecordDoc.java

@Nonnull
public static RecordDoc create(@Nonnull Document doc) throws IOException {
    checkNotNull(doc);//from w  w w  .  jav a  2  s.  co  m

    URI uri = URI.create(doc.get(RECORD_URI));
    String parent = doc.get(RECORD_PARENT);
    String name = doc.get(RECORD_NAME);
    long time = Long.parseLong(doc.get(RECORD_TIME));
    long size = Long.parseLong(doc.get(RECORD_SIZE));
    boolean dir = Boolean.valueOf(doc.get(RECORD_DIR));
    long indexTime = Long.parseLong(doc.get(INDEX_TIME));

    Record record = new Record(uri, parent, name, time, size, dir);
    return new RecordDoc(record, doc, indexTime);
}

From source file:net.sf.eclipsecs.core.config.configtypes.ProjectConfigurationType.java

/**
 * {@inheritDoc}//from   w  ww  .  j  a  v a 2 s. c om
 */
public boolean isConfigurable(ICheckConfiguration checkConfiguration) {
    boolean isConfigurable = true;

    boolean isProtected = Boolean.valueOf(checkConfiguration.getAdditionalData().get(KEY_PROTECT_CONFIG))
            .booleanValue();
    isConfigurable = !isProtected;

    if (!isProtected) {

        // The configuration can be changed when the external configuration
        // file can is writable
        try {
            isConfigurable = FileUtils.toFile(checkConfiguration.getResolvedConfigurationFileURL()).canWrite();
        } catch (CheckstylePluginException e) {
            CheckstyleLog.log(e);
            isConfigurable = false;
        }

    }
    return isConfigurable;
}

From source file:com.natpryce.piazza.pluginConfiguration.ConfigurationController.java

private boolean getBooleanParameter(HttpServletRequest request, String parameterName) {
    String parameter = request.getParameter(parameterName);
    if (parameter == null)
        return false;
    return Boolean.valueOf(parameter);
}