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:com.lexicalintelligence.admin.add.AddRequest.java

public AddResponse execute() {
    List<BasicNameValuePair> params = Collections
            .singletonList(new BasicNameValuePair(getName(), StringUtils.join(items, ",")));
    AddResponse addResponse;// w w  w  .  j  a  va  2  s  . c  o m
    Reader reader = null;
    try {
        HttpResponse response = client.getHttpClient().execute(new HttpGet(client.getUrl() + PATH + getPath()
                + "?" + URLEncodedUtils.format(params, StandardCharsets.UTF_8)));
        reader = new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8);
        addResponse = new AddResponse(Boolean.valueOf(IOUtils.toString(reader)));
    } catch (Exception e) {
        addResponse = new AddResponse(false);
        log.error(e);
    } finally {
        try {
            reader.close();
        } catch (Exception e) {
            log.error(e);
        }
    }
    return addResponse;
}

From source file:io.ecarf.core.cloud.task.coordinator.LoadBigDataFilesTask.java

@Override
public void run() throws IOException {

    log.info("Processing import into big data table: " + table + ", with encode: " + encode);

    List<StorageObject> objects = this.getCloudService().listCloudStorageObjects(bucket);

    List<String> files = new ArrayList<>();

    for (StorageObject object : objects) {
        String filename = object.getName();
        if (filename.endsWith(Constants.PROCESSED_FILES)) {
            files.add(object.getUri());/*from w w  w.  j a va  2 s .c  o m*/
        } else {
            log.warn("Skipping file: " + filename);
        }
    }

    BigDataTable bigDataTable;

    if (Boolean.valueOf(encode)) {

        bigDataTable = TableUtils.getBigQueryEncodedTripleTable(table);

    } else {

        bigDataTable = TableUtils.getBigQueryTripleTable(table);
    }

    String jobId = this.getCloudService().loadCloudStorageFilesIntoBigData(files, bigDataTable, true);

    log.info("Successfully imported data into big table, completed jodId: " + jobId);
}

From source file:com.lexicalintelligence.admin.remove.RemoveEntryRequest.java

@Override
public RemoveResponse execute() {
    RemoveResponse removeResponse;//from   ww w  .  j ava  2s . c om

    List<BasicNameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair("name", entry.getName()));
    params.add(new BasicNameValuePair("synonym", entry.getSynonym()));

    Reader reader = null;
    try {
        HttpResponse response = client.getHttpClient().execute(new HttpGet(client.getUrl() + PATH + getPath()
                + "?" + URLEncodedUtils.format(params, StandardCharsets.UTF_8)));
        reader = new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8);
        removeResponse = new RemoveResponse(Boolean.valueOf(IOUtils.toString(reader)));
    } catch (Exception e) {
        removeResponse = new RemoveResponse(false);
        log.error(e);
    } finally {
        try {
            reader.close();
        } catch (Exception e) {

        }
    }
    return removeResponse;
}

From source file:com.smartling.api.sdk.file.commandline.UploadFile.java

private static UploadFileParams getParameters(String[] args) {
    Validate.isTrue(args.length >= 6, "Invalid number of arguments");
    UploadFileParams uploadParams = new UploadFileParams();
    uploadParams.setProductionMode(Boolean.valueOf(args[0]));
    uploadParams.setApiKey(args[1]);/*from  w  w  w.  j  a va2 s . c o  m*/
    uploadParams.setProjectId(args[2]);
    uploadParams.setPathToFile(args[3]);
    uploadParams.setFileType(args[4]);
    uploadParams.setApproveContent(null == args[5] ? null : Boolean.valueOf(args[5]));

    if (args.length == 7)
        uploadParams.setCallbackUrl(args[6]);

    return uploadParams;
}

From source file:org.jasig.portlet.notice.controller.emergency.EmergencyAlertController.java

@RenderMapping()
public ModelAndView showAlert(PortletRequest req) {

    final Map<String, Object> model = new HashMap<String, Object>();
    final PortletPreferences prefs = req.getPreferences();

    final boolean usePortalJsLibs = Boolean.valueOf(prefs.getValue(USE_PPORTAL_JS_LIBS_PREFERENCE, "true")); // default is true
    model.put("usePortalJsLibs", usePortalJsLibs);

    final String portalJsNamespace = prefs.getValue(PPORTAL_JS_NAMESPACE_PREFERENCE, "up"); // Matches the current convention in uPortal
    model.put("portalJsNamespace", portalJsNamespace);

    final boolean autoAdvance = Boolean.valueOf(prefs.getValue(AUTO_ADVANCE_PREFERENCE, null)); // default is false
    model.put("autoAdvance", autoAdvance);

    if (log.isTraceEnabled()) {
        log.trace("Showing alerts, usePortalJsLibs=" + usePortalJsLibs + ", portalJsNamespace="
                + portalJsNamespace + ", autoAdvance=" + autoAdvance);
    }//from   www .  j a v a 2 s  .  c om

    final UUID uuid = UUID.randomUUID();
    model.put("uuid", uuid);

    return new ModelAndView(VIEW_SHOW_ALERTS, model);

}

From source file:com.soulgalore.crawler.run.CrawlToFile.java

CrawlToFile(String[] args) throws ParseException {
    super(args);//from  w  w  w. ja  va 2s  .  com
    fileName = getLine().getOptionValue("filename", DEFAULT_FILENAME);
    errorFileName = getLine().getOptionValue("errorfilename", DEFAULT_ERROR_FILENAME);
    verbose = Boolean.valueOf(getLine().getOptionValue("verbose", "false"));

}

From source file:com.intuit.wasabi.repository.cassandra.ClientConfiguration.java

@Override
public Boolean useSSL() {
    return Boolean.valueOf(getProperty("useSSL", properties, FALSE.toString()));
}

From source file:com.graphaware.server.foundation.context.GraphAwareWebContextCreator.java

private void configureStatsCollector(AnnotationConfigWebApplicationContext context, Config config) {
    if (Boolean.valueOf(config.getParams().getOrDefault(GA_API_STATS_DISABLE_SETTING, "false"))) {
        context.getEnvironment().setActiveProfiles("stats-null");
    } else {//from   w  ww.  ja va  2 s .c o  m
        context.getEnvironment().setActiveProfiles("stats-google");
    }
}

From source file:com.rapid7.diskstorage.dynamodb.TestGraphUtil.java

private TestGraphUtil() {
    partitions = Integer.valueOf(System.getProperty("dynamodb-partitions", String.valueOf(1)));
    Preconditions.checkArgument(partitions > 0);
    unlimitedIops = Boolean
            .valueOf(System.getProperty("dynamodb-unlimited-iops", String.valueOf(Boolean.TRUE)));
    controlPlaneRate = Integer.valueOf(System.getProperty("dynamodb-control-plane-rate", String.valueOf(1)));
    Preconditions.checkArgument(controlPlaneRate > 0);
}

From source file:de.hybris.platform.security.captcha.ReCaptchaAspect.java

public Object prepare(final ProceedingJoinPoint joinPoint) throws Throwable {
    final List<Object> args = Arrays.asList(joinPoint.getArgs());
    final HttpServletRequest request = (HttpServletRequest) CollectionUtils.find(args,
            PredicateUtils.instanceofPredicate(HttpServletRequest.class));

    if (request != null) {
        final boolean captcaEnabledForCurrentStore = isCaptcaEnabledForCurrentStore();
        request.setAttribute("captcaEnabledForCurrentStore", Boolean.valueOf(captcaEnabledForCurrentStore));
        if (captcaEnabledForCurrentStore) {
            request.setAttribute("recaptchaPublicKey",
                    getSiteConfigService().getProperty(RECAPTCHA_PUBLIC_KEY_PROPERTY));
        }/* w  w w  .  j  a va 2 s.co  m*/
    }
    return joinPoint.proceed();
}