Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

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

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:de.thorstenberger.examServer.dao.xml.AbstractJAXBDao.java

/**
 * Serializes the object into xml. Will wrap any exception into a {@link RuntimeException}.
 *
 * @param obj//from  ww  w.  j ava 2  s .  c  o  m
 *            the object to save.
 * @throws RuntimeException
 *             wrapping {@link JAXBException} of {@link IOException}
 */
synchronized protected void save(final Object obj) {
    log.debug(String.format("Trying to save xml package to file '%s'", workingPath + "/" + xmlFileName));
    final String txId = startTransaction();
    Marshaller marshaller = null;
    try {

        marshaller = JAXBUtils.getJAXBMarshaller(jc);
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
        final BufferedOutputStream bos = new BufferedOutputStream(
                getFRM().writeResource(txId, this.xmlFileName));
        marshaller.marshal(obj, bos);

        bos.close();
        commitTransaction(txId);
    } catch (final JAXBException e) {
        rollback(txId, e);
        throw new RuntimeException(e);
    } catch (final IOException e) {
        rollback(txId, e);
        throw new RuntimeException(e);
    } catch (final ResourceManagerException e) {
        rollback(txId, e);
        throw new RuntimeException(e);
    } catch (RuntimeException e) {
        rollback(txId, e);
        throw e;
    } finally {
        if (marshaller != null)
            JAXBUtils.releaseJAXBMarshaller(jc, marshaller);
    }
}

From source file:de.thorstenberger.taskmodel.complex.complextaskdef.impl.ComplexTaskDefDAOImpl.java

public void save(ComplexTaskDefRoot ctdr, OutputStream os) throws TaskApiException {
    BufferedOutputStream bos = new BufferedOutputStream(os);

    Marshaller marshaller = null;
    try {/*from   www.  j a  va 2s. c o  m*/
        JAXBContext jc = createJAXBContext();
        marshaller = JAXBUtils.getJAXBMarshaller(jc);
        Validator validator = jc.createValidator();
        ComplexTaskDef ctd = ((ComplexTaskDefRootImpl) ctdr).getJAXBContent();
        validator.validate(ctd);
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
        marshaller.marshal(ctd, bos);

    } catch (JAXBException e) {
        throw new TaskModelPersistenceException(e);
    } finally {
        try {
            bos.close();
        } catch (IOException e) {
            throw new TaskModelPersistenceException(e);
        }
        if (marshaller != null)
            JAXBUtils.releaseJAXBMarshaller(jc, marshaller);
    }

}

From source file:ar.com.fdvs.dj.domain.chart.builder.DJBar3DChartBuilder.java

/**
 * Sets the legend visibility.//from ww  w .  j av  a  2  s.c o m
 *
 * @param showLegend the legend visibility
 **/
public DJBar3DChartBuilder setShowLegend(boolean showLegend) {
    this.chart.getOptions().setShowLegend(new Boolean(showLegend));
    return this;
}

From source file:ar.com.fdvs.dj.domain.chart.builder.DJScatterChartBuilder.java

/**
 * Sets the legend visibility.//from www  . ja va2s.  co  m
 *
 * @param showLegend the legend visibility
 **/
public DJScatterChartBuilder setShowLegend(boolean showLegend) {
    this.chart.getOptions().setShowLegend(new Boolean(showLegend));
    return this;
}

From source file:org.esupportail.dining.web.controllers.EditAdminController.java

@RequestMapping
public ModelAndView renderEditAdminView(HttpServletRequest request) throws Exception {

    ModelMap model = new ModelMap();

    User user = this.authenticator.getUser();
    model.put("user", user);

    // try {//from   w w w .  j  a v a  2  s  .  c om

    /* Get all area in the current feed */

    try {
        Set<String> areaList = new HashSet<String>();
        for (Restaurant r : this.feed.getFeed().getRestaurants()) {
            areaList.add(r.getArea());
        }
        model.put("areaList", areaList);
    } catch (Exception e) {
        // Here we go if the URL isn't set.
    }

    String[] areanames = null;
    List<FeedInformation> feedInfoList = new ArrayList<FeedInformation>();
    ResultSet results = null;
    try {
        results = this.dc.executeQuery("SELECT * FROM PATHFLUX");

        while (results.next()) {
            FeedInformation feedInfo = new FeedInformation(results.getInt("id"), results.getString("name"),
                    results.getString("areaname"), results.getString("urlflux"),
                    results.getBoolean("is_default"));
            feedInfoList.add(feedInfo);
        }

    } catch (SQLException e) {
        // URL isn't set yet...
    }

    try {
        for (FeedInformation fi : feedInfoList) {
            if (fi.isDefault()) {
                String areaname = fi.getAreaname();
                areanames = (areaname == null ? "" : areaname).split(",");
            }
        }
    } catch (Exception e) {
        // URL may be set be default area is not
    }
    model.put("feedList", feedInfoList);
    model.put("defaultArea", areanames);

    /* Action urlFeed set urlError if form URL was not well-formed */
    String hasError = request.getParameter("urlError");
    if (hasError != null) {
        model.put("urlError", hasError);
    }

    /* Action setDefaultArea set urlError if form URL was not well-formed */
    String areaSubmit = request.getParameter("areaSubmit");
    if (areaSubmit != null) {
        model.put("areaSubmit", areaSubmit);
    }

    /* From ForceFeedUpdate */
    if (request.getParameter("update") != null) {
        Boolean isUpdated = new Boolean(request.getParameter("update"));
        if (isUpdated.booleanValue()) {
            model.put("updateFeed", "The feed has been correctly updated");
        } else {
            model.put("updateFeed", "The feed is already up to date");
        }
    }
    return new ModelAndView("editadmin", model);
}

From source file:org.sloth.web.report.EditReportController.java

/**
 * Handles the {@code GET} request and sets up the form.
 *///from   w  w  w.  j av  a  2 s .  c  o  m
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleGet(@PathVariable Long id, HttpSession session, HttpServletResponse response)
        throws IOException {
    if (isAuth(session)) {
        Report report = observationService.getReport(id);
        if (report == null) {
            return notFoundMAV(response);
        }

        if (isAdmin(session) || isOwnReport(session, report)) {
            ModelAndView mav = new ModelAndView(VIEW);
            mav.addObject(PROCESSED_ATTRIBUTE, new Boolean(report.isProcessed()));
            mav.addObject(REPORT_ATTRIBUTE, report);
            return mav;
        }

    }
    return forbiddenMAV(response);
}

From source file:hu.bme.mit.trainbenchmark.benchmark.config.BenchmarkConfig.java

@Override
public void processArguments(final String[] args) throws ParseException {
    super.processArguments(args);

    // queries argument -> testCases list
    query = Query.valueOf(cmd.getOptionValue("query").toUpperCase());

    final String modificationMethodString = cmd.getOptionValue("modificationMethod");
    if (modificationMethodString != null) {
        switch (modificationMethodString) {
        case "constant":
            modificationMethod = ModificationMethod.CONSTANT;
            break;
        case "resultSet":
            modificationMethod = ModificationMethod.RESULT_SET;
            break;
        default:/* w ww.  j  a  va 2  s  .co  m*/
            throw new ParseException("Invalid modification method specified");
        }
    } else {
        modificationMethod = ModificationMethod.CONSTANT;
    }

    final String iterationCountString = cmd.getOptionValue("iterationCount");
    if (iterationCountString != null) {
        iterationCount = new Integer(iterationCountString);
    } else {
        iterationCount = 10;
    }

    final String runIndexString = cmd.getOptionValue("runIndex");
    if (runIndexString != null) {
        runIndex = new Integer(runIndexString);
    } else {
        runIndex = -1;
    }

    modificationConstant = 1;
    modificationConstant = determineModificationConstant("modificationConstant");

    final String benchmarkModeString = cmd.getOptionValue("benchmarkMode");
    if (benchmarkModeString != null) {
        benchmarkMode = new Boolean(benchmarkModeString);
    } else {
        benchmarkMode = false;
    }
}

From source file:ThreadViewer.java

private void createPendingCellData() {
    Thread[] thread = findAllThreads();
    Object[][] cell = new Object[thread.length][columnCount];

    for (int i = 0; i < thread.length; i++) {
        Thread t = thread[i];//  w  ww . jav a  2 s  .c  o  m
        Object[] rowCell = cell[i];

        rowCell[0] = new Integer(t.getPriority());
        rowCell[1] = new Boolean(t.isAlive());
        rowCell[2] = new Boolean(t.isDaemon());
        rowCell[3] = new Boolean(t.isInterrupted());
        rowCell[4] = t.getThreadGroup().getName();
        rowCell[5] = t.getName();
    }

    synchronized (dataLock) {
        pendingCellData = cell;
    }
}

From source file:net.sf.ginp.setup.SetupManagerImpl.java

/**
 * @see net.sf.ginp.setup.SetupManager#validConfigLoc(java.lang.String)
 *//*from  ww  w .j a  v a2s  . co  m*/
public final Boolean validConfigLoc(final String path) {
    File pathDir = new File(path);

    if (!pathDir.isDirectory()) {
        return new Boolean(false);
    }

    if (!pathDir.canWrite()) {
        return new Boolean(false);
    }

    if (!pathDir.canRead()) {
        return new Boolean(false);
    }

    return new Boolean(true);
}

From source file:ar.com.fdvs.dj.domain.chart.builder.DJTimeSeriesChartBuilder.java

/**
 * Sets the legend visibility./*w w  w.j av  a 2s.  c om*/
 *
 * @param showLegend the legend visibility
 **/
public DJTimeSeriesChartBuilder setShowLegend(boolean showLegend) {
    this.chart.getOptions().setShowLegend(new Boolean(showLegend));
    return this;
}