Example usage for java.lang Boolean parseBoolean

List of usage examples for java.lang Boolean parseBoolean

Introduction

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

Prototype

public static boolean parseBoolean(String s) 

Source Link

Document

Parses the string argument as a boolean.

Usage

From source file:com.haulmont.cuba.gui.xml.layout.loaders.SideMenuLoader.java

protected void loadSelectOnClick(SideMenu component, Element element) {
    String selectOnClick = element.attributeValue("selectOnClick");
    if (StringUtils.isNotEmpty(selectOnClick)) {
        component.setSelectOnClick(Boolean.parseBoolean(selectOnClick));
    }//from w w  w . j av  a2 s. c om
}

From source file:com.clican.pluto.dataprocess.engine.processes.ParamProcessor.java

public void process(ProcessorContext context) throws DataProcessException {
    try {/*from  ww w. j av a  2s.co  m*/
        if (paramBeanList != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            for (ParamBean pb : paramBeanList) {
                ParamType pt = ParamType.convert(pb.getType());
                Object value = null;
                if (pt == ParamType.STRING) {
                    value = pb.getParamValue();
                } else if (pt == ParamType.CLAZZ) {
                    value = Class.forName(pb.getParamValue());
                } else if (pt == ParamType.DATE) {
                    if (StringUtils.isNotEmpty(pb.getPattern())) {
                        value = new SimpleDateFormat(pb.getPattern()).parse(pb.getParamValue());
                    } else {
                        value = sdf.parse(pb.getParamValue());
                    }
                } else if (pt == ParamType.DOUBLE) {
                    value = Double.parseDouble(pb.getParamValue());
                } else if (pt == ParamType.LONG) {
                    value = Long.parseLong(pb.getParamValue());
                } else if (pt == ParamType.INTEGER) {
                    value = Integer.parseInt(pb.getParamValue());
                } else if (pt == ParamType.BOOLEAN) {
                    value = Boolean.parseBoolean(pb.getParamValue());
                } else if (pt == ParamType.LIST) {
                    List<String> list = new ArrayList<String>();
                    for (String s : pb.getParamValue().split(",")) {
                        list.add(s.trim());
                    }
                    value = list;
                } else {
                    throw new DataProcessException("?");
                }
                if (pb.isOverride()) {
                    context.setAttribute(pb.getParamName(), value);
                } else {
                    if (!context.contains(pb.getParamName())) {
                        context.setAttribute(pb.getParamName(), value);
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new DataProcessException("??", e);
    }

}

From source file:ensen.controler.DBpediaSpotlightClient.java

public List<EnsenDBpediaResource> ensenExtract(Text text, String file) throws AnnotationException {

    if (Boolean.parseBoolean(PropertiesManager.getProperty("UseDBpediaSpotlightCandidate")))
        return extractCandidats(text);
    else//from  w w  w  .  j  av a2 s  .c  o  m
        return extractAnnotation(text, PropertiesManager.getProperty("CONFIDENCE"),
                PropertiesManager.getProperty("SUPPORT"), file);

}

From source file:eu.prestoprime.plugin.p4.AccessTasks.java

@WfService(name = "make_consumer_segment", version = "2.2.0")
public void execute(Map<String, String> sParams, Map<String, String> dParamsString,
        Map<String, File> dParamFile) throws TaskExecutionFailedException {

    if (!Boolean.parseBoolean(dParamsString.get("isSegmented"))) {

        // retrieve static params
        String destVolume = sParams.get("dest.path.volume").trim();
        String destFolder = sParams.get("dest.path.folder").trim();

        // retrieve dynamic params
        String dipID = dParamsString.get("dipID");
        String inputFilePath = dParamsString.get("source.file.path");
        String mimeType = dParamsString.get("source.file.mimetype");
        int startFrame = Integer.parseInt(dParamsString.get("start.frame"));
        int stopFrame = Integer.parseInt(dParamsString.get("stop.frame"));

        String outputFolder = destVolume + File.separator + destFolder;

        try {/* ww w  . j  a v a2 s  .  c  o  m*/

            if (dipID == null)
                throw new TaskExecutionFailedException("Missing AIP ID to extract fragment");

            if (mimeType == null)
                throw new TaskExecutionFailedException("Missing MIME Type to extract fragment");

            DIP dip = P4DataManager.getInstance().getDIPByID(dipID);

            if (inputFilePath == null) {

                // trying to retrieve file path from DIP, last chance...

                List<String> videoFileList = dip.getAVMaterial(mimeType, "FILE");

                if (videoFileList.size() == 0) {

                    throw new TaskExecutionFailedException("Missing input file path to extract fragment");

                } else {

                    inputFilePath = videoFileList.get(0);

                }

            }

            File targetDir = new File(outputFolder);
            targetDir.mkdirs();

            if (!targetDir.canWrite())
                throw new TaskExecutionFailedException("Unable to write to output dir " + outputFolder);

            String targetFileName = dipID + "." + startFrame + "." + stopFrame + "."
                    + FilenameUtils.getExtension(inputFilePath);
            File targetFile = new File(targetDir, targetFileName);

            int startSec = startFrame / 25;
            int endSec = stopFrame / 25;
            int durationSec = endSec - startSec;

            String start = Integer.toString(startSec);
            String duration = Integer.toString(durationSec);

            List<String> formats = dip.getDCField(DCField.format);

            StringBuilder formatSB = new StringBuilder();

            for (String format : formats) {

                formatSB.append(format + "\t");

            }

            // extract fragment using ffmbc
            FFmbc ffmbc = new FFmbc();
            ffmbc.extractSegment(inputFilePath, targetFile.getAbsolutePath(), start, duration, mimeType,
                    formatSB.toString(), "2");

            dParamsString.put("isSegmented", "true");
            dParamsString.put("segment.file.path", targetFileName);

            logger.debug("Consumer copy available at: " + targetFile.getAbsolutePath());

        } catch (DataException e) {
            e.printStackTrace();
            throw new TaskExecutionFailedException("Unable to retrieve DIP with id: " + dipID);
        } catch (IPException e) {
            e.printStackTrace();
            throw new TaskExecutionFailedException("Unable to retrieve MQ file");
        } catch (ToolException e) {
            e.printStackTrace();
            throw new TaskExecutionFailedException("Unable to extract segment with FFMBC");
        }
    }
}

From source file:com.sworddance.util.CreateTracking.java

public static void initialize(String propertySetting) {
    CREATE_TRACK_ALL = Boolean.parseBoolean(propertySetting);
    classNames.clear();/*from   w w  w .j  a  v a  2s  . com*/
    createTracking.clear();
    classNameMatching = null;
    if (!CREATE_TRACK_ALL && isNotBlank(propertySetting)) {
        // if we are not tracking all classes then go through list of classes we are tracking.
        // stored in the system property CREATE_TRACKING_SYSTEM_PROPERTY (create-tracking)
        StringBuilder patternBuilder = new StringBuilder();
        String[] classNamesArr = propertySetting.split(",");
        for (String className : NotNullIterator.<String>newNotNullIterator(classNamesArr)) {
            if (StringUtils.isNotBlank(className)) {
                String trimmedClassName = className.trim();
                if (trimmedClassName.indexOf('.') < 0) {
                    // no package name so probably simple name.
                    // therefore look for any package. ( leading . or $ for inner class )
                    patternBuilder.append("(?:.*(?:\\.|\\$))").append(trimmedClassName);
                    patternBuilder.append("|");
                }
                patternBuilder.append(trimmedClassName);
                classNames.add(trimmedClassName);
            }
        }
        classNameMatching = Pattern.compile(patternBuilder.toString());
    }
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.AbstractOptionsBaseLoader.java

@Override
protected void loadDatasource(DatasourceComponent component, Element element) {
    String multiselect = element.attributeValue("multiselect");
    if (StringUtils.isNotEmpty(multiselect)) {
        ((OptionsField) component).setMultiSelect(Boolean.parseBoolean(multiselect));
    }// w  w w  . j av  a 2s.  c o  m

    String datasource = element.attributeValue("optionsDatasource");
    if (!StringUtils.isEmpty(datasource)) {
        Datasource ds = context.getDsContext().get(datasource);
        ((T) component).setOptionsDatasource((CollectionDatasource) ds);
    }

    super.loadDatasource(component, element);
}

From source file:io.galeb.router.services.JmxReporterService.java

@Bean
public JmxReporter jmxReporter() {
    final MetricRegistry register = new MetricRegistry();
    register.register("ActiveConnections", (Gauge<Long>) () -> undertow.getListenerInfo().stream()
            .mapToLong(l -> l.getConnectorStatistics().getActiveConnections()).sum());
    register.register("ActiveRequests", (Gauge<Long>) () -> undertow.getListenerInfo().stream()
            .mapToLong(l -> l.getConnectorStatistics().getActiveRequests()).sum());
    register.register("RequestCount", (Gauge<Long>) this::getRequestCount);
    register.register("BytesReceived", (Gauge<Long>) this::getBytesReceived);
    register.register("BytesSent", (Gauge<Long>) this::getBytesSent);
    final JmxReporter jmxReporter = JmxReporter.forRegistry(register).inDomain(MBEAN_DOMAIN).build();
    if (Boolean.parseBoolean(SystemEnv.ENABLE_UNDERTOW_JMX.getValue())) {
        jmxReporter.start();/*  w  w w .  java2 s  .  c  om*/
    }
    return jmxReporter;
}

From source file:org.orderofthebee.addons.support.tools.repo.LogFileGet.java

/**
 *
 * {@inheritDoc}//from   w w w  .  ja  va 2  s .c o m
 */
@Override
public void execute(final WebScriptRequest req, final WebScriptResponse res) throws IOException {
    final String servicePath = req.getServicePath();
    final String matchPath = req.getServiceMatch().getPath();
    final String filePath = servicePath.substring(servicePath.indexOf(matchPath) + matchPath.length());

    final Map<String, Object> model = new HashMap<>();
    final Status status = new Status();
    final Cache cache = new Cache(this.getDescription().getRequiredCache());
    model.put("status", status);
    model.put("cache", cache);

    final String attachParam = req.getParameter("a");
    final boolean attach = attachParam != null && Boolean.parseBoolean(attachParam);

    final File file = this.validateFilePath(filePath);
    this.delegate.streamContent(req, res, file, file.lastModified(), attach, file.getName(), model);
}

From source file:com.gopivotal.cloudfoundry.test.core.MemoryUtils.java

/**
 * Generates an {@link OutOfMemoryError} if the {@code FAIL_OOM} environment variable is {@code true}. Otherwise
 * does nothing.// ww w.  ja v a 2  s  . co  m
 *
 * @return
 */
@PostConstruct
public byte[][] outOfMemoryOnStart() {
    String value = this.environment.get("FAIL_OOM");

    if ((value != null) && Boolean.parseBoolean(value)) {
        return outOfMemory();
    }

    return null;
}

From source file:library.functions.WebFunctions.java

public WebFunctions() {
    record = Boolean.parseBoolean(getData().commonData("record"));
    resultcount = 0;
}