List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:com.germinus.easyconf.ComponentProperties.java
public boolean getBoolean(String key, Filter filter) { Boolean value = getBoolean(key, filter, null); validateValue(key, value);/* ww w . j a v a 2 s . com*/ return value.booleanValue(); }
From source file:com.redhat.lightblue.metadata.parser.JSONMetadataParserTest.java
License:asdf
@Test public void putValueBoolean() { ObjectNode parent = new ObjectNode(factory); String name = "foo"; Boolean value = Boolean.TRUE; parser.putValue(parent, name, value); JsonNode x = parent.get(name);//w w w . ja v a 2 s .com Assert.assertNotNull(x); Assert.assertEquals(value.booleanValue(), x.booleanValue()); }
From source file:userinterface.graph.SeriesSettings.java
public void updateSeries() { // We don't want series to change while we are updating. synchronized (graph.getSeriesLock()) { int seriesIndex = graph.getJFreeChartIndex(key); if (seriesIndex >= 0) { /* Set series colour. */ if (renderer.getSeriesPaint(seriesIndex) == null || !renderer.getSeriesPaint(seriesIndex).equals(seriesColour)) { renderer.setSeriesPaint(seriesIndex, seriesColour.getColorValue()); }/* www . j a v a2s . c om*/ /* Set series heading. */ if (!graph.getXYSeries(key).getKey().equals(seriesHeading.getStringValue())) { graph.changeSeriesName(key, seriesHeading.getStringValue()); try { seriesHeading.setValue(graph.getXYSeries(key).getKey()); } catch (SettingException e) { } } /* Set showPoints. */ Boolean pointsVisibleFlag = renderer.getSeriesShapesVisible(seriesIndex); if (pointsVisibleFlag == null || pointsVisibleFlag.booleanValue() != showPoints.getBooleanValue()) { renderer.setSeriesShapesVisible(seriesIndex, showPoints.getBooleanValue()); } /* Set seriesShape. */ Shape shape = renderer.getSeriesShape(seriesIndex); int shapeIndex = seriesShape.getCurrentIndex(); if (!ShapeUtilities.equal(shape, SHAPES[shapeIndex])) renderer.setSeriesShape(seriesIndex, SHAPES[shapeIndex]); /* Set showLines. */ Boolean linesVisibleFlag = renderer.getSeriesLinesVisible(seriesIndex); if (linesVisibleFlag == null || linesVisibleFlag.booleanValue() != showLines.getBooleanValue()) { renderer.setSeriesLinesVisible(seriesIndex, showLines.getBooleanValue()); } /* Set stroke - hard to check*/ if (lineStyle.getCurrentIndex() == SOLID) // solid { BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } else if (lineStyle.getCurrentIndex() == DASHED) // Just dash { float dash[] = { 2.0f, 3.0f }; BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 1.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } else // Funny dash { float dash[] = { 1.0f, 3.0f, 5.0f, 3.0f }; BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 0.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } } icon = new GraphSeriesIcon(renderer.getSeriesShape(seriesIndex), renderer.getSeriesStroke(seriesIndex), seriesColour.getColorValue(), showLines.getBooleanValue(), showPoints.getBooleanValue()); icon.setOpaque(false); icon.setMinimumSize(new Dimension(20, 10)); icon.setMaximumSize(new Dimension(50, 20)); icon.setPreferredSize(new Dimension(30, 10)); } }
From source file:com.vangent.hieos.logbrowser.servlets.GetTableServlet.java
/** * * @param req//from w ww .j av a 2 s . c om * @param res */ public void doPost(HttpServletRequest req, HttpServletResponse res) { Log log = new Log(); try { HttpSession session = req.getSession(true); session.setAttribute("systemType", "new"); //String currentSqlCommand_ = (String)session.getAttribute("currentSqlCommand") ; Boolean isAdmin_ = (Boolean) session.getAttribute("isAdmin"); if (isAdmin_ == null) { isAdmin = false; } else { isAdmin = isAdmin_.booleanValue(); } currentIP = req.getRemoteAddr(); String sort = req.getParameter("sort"); String option = req.getParameter("option"); String page = req.getParameter("page"); if (page == null) { page = (String) session.getAttribute("page"); } String numberResultsByPage = req.getParameter("nbResByPage"); String currentSqlCommand; Integer numberOfResults = -1; // Write XML to response. res.setContentType("text/javascript"); if (option != null && option.equals("count")) { countResults(session, log.getConnection()); numberOfResults = (Integer) session.getAttribute("numberOfResults"); numberResultsByPage = (String) session.getAttribute("numberResultsByPage"); page = (String) session.getAttribute("page"); StringBuffer buffer = new StringBuffer(); buffer.append("{ \"result\" : \n"); buffer.append(new JSONStringer().object().key("pageNumber").value(page).key("numberResultsByPage") .value(numberResultsByPage).key("numberOfResults").value(numberOfResults).endObject() .toString()); buffer.append("}"); res.getWriter().println(buffer.toString()); } else if (sort == null) { getOptions(req, session); sqlCommandProcessing(session, (Integer) session.getAttribute("optionNumber"), page, numberResultsByPage); currentSqlCommand = (String) (session.getAttribute("currentSqlCommand")); logger.debug("GetTableServlet: sqlRequest : " + currentSqlCommand + "\n"); session.setAttribute("page", page); session.setAttribute("numberResultsByPage", numberResultsByPage); /* AMS - FIXME. Description: The response fields returned by the query, currentSqlCommand, are formatted using fieldsAndFormats - a map where field name is the key and the referenced object is a java.text.Format object. Currently, the "Timestamp" field is being formatted using "java.text.DateFormat". Fix: 1) Setting up fields and formats should not be done here. It should be done in the init method. 2) fieldsAndFormats are related to the query and they are currently not in cohesive units - fieldsAndFormats is being set up in this class whereas the query is being pulled from web.xml's init-param. */ Map fieldsAndFormats = new HashMap(); Format fmt = new SimpleDateFormat("EEE d MMM - HH:mm:ss"); fieldsAndFormats.put("Timestamp", fmt); Connection con = log.getConnection(); executeCurrentSqlCommand(con, currentSqlCommand, fieldsAndFormats); res.getWriter().write(toJSon(-1, -2)); } else if (sort != null) { res.getWriter().write(sortColomn(sort)); } else { throw new Exception("Error case unknown not sort either display table"); } } catch (SQLException e) { getError(e, res); logger.fatal(e.getMessage()); } catch (FileNotFoundException e) { getError(e, res); logger.fatal(e.getMessage()); } catch (NumberFormatException e) { getError(e, res); logger.fatal(e.getMessage()); } catch (IOException e) { getError(e, res); logger.fatal(e.getMessage()); } catch (Exception e) { getError(e, res); logger.fatal(e.getMessage()); } finally { try { log.closeConnection(); } catch (LoggerException ex) { Logger.getLogger(GetTableServlet.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:userinterface.graph.SeriesSettings.java
public SeriesSettings(Graph graph, Graph.SeriesKey key) { this.graph = graph; this.key = key; this.chart = graph.getChart(); this.plot = chart.getXYPlot(); /* This should really be checked first. */ this.renderer = (XYLineAndShapeRenderer) plot.getRenderer(); seriesHeading = new SingleLineStringSetting("heading", "heading", "The heading for this series, as displayed in the legend.", this, true); seriesColour = new ColorSetting("colour", Color.black, "The colour for all lines and points in this series.", this, true); showPoints = new BooleanSetting("show points", new Boolean(true), "Should points be displayed for this series?", this, true); String[] choices = { "Circle", "Square", "Triangle", "Horizontal Rectangle", "Vertical Rectangle", "None" }; seriesShape = new ChoiceSetting("point shape", choices, choices[0], "The shape of points for this series.", this, true); showLines = new BooleanSetting("show lines", new Boolean(true), "Should lines be displayed for this series?", this, true); lineWidth = new DoubleSetting("line width", new Double(1.0), "The line width for this series.", this, true, new RangeConstraint("0.0,")); String[] styles = { "---------", "- - - - -", "- -- - --" }; lineStyle = new ChoiceSetting("line style", styles, styles[0], "The line style for this series.", this, true);//from w w w.j a v a 2 s. c o m /** JFreeChart is smart enough to choose sensible values for colours, shapes etc. Lets try to use these if we can. */ synchronized (graph.getSeriesLock()) { int seriesIndex = graph.getJFreeChartIndex(key); if (seriesIndex >= 0) { /* Set series colour. */ if (renderer.lookupSeriesPaint(seriesIndex) instanceof Color) { try { seriesColour.setValue((Color) renderer.getSeriesPaint(seriesIndex)); } catch (SettingException e) { } } /* Set series heading. */ try { seriesHeading.setValue(graph.getXYSeries(key).getKey()); } catch (SettingException e) { } /* Set showPoints. */ try { // just do it. Boolean pointsVisibleFlag = true; showPoints.setValue(new Boolean(pointsVisibleFlag == null || pointsVisibleFlag.booleanValue())); } catch (SettingException e) { } /* Set seriesShape. */ Shape shape = renderer.lookupSeriesShape(seriesIndex); try { boolean foundShape = false; for (int i = CIRCLE; i < NONE; i++) { if (ShapeUtilities.equal(shape, SHAPES[i])) { seriesShape.setSelectedIndex(i); foundShape = true; break; } } if (!foundShape) seriesShape.setSelectedIndex(NONE); } catch (SettingException e) { e.printStackTrace(); } /* Set showLines. */ try { Boolean linesVisibleFlag = true; showLines.setValue(new Boolean(linesVisibleFlag == null || linesVisibleFlag.booleanValue())); } catch (SettingException e) { } } } updateSeries(); }
From source file:net.sourceforge.czt.gnast.Gnast.java
/** * Resolves the given template file in one of the template directories (checks if it exists). * /*w w w . j a va 2 s.c o m*/ * @param fileName * @return */ @Override public String resolvePath(String fileName) { Boolean cachedResolved = pathResolvedCache.get(fileName); if (cachedResolved != null) { if (cachedResolved.booleanValue()) { // cached and resolvable return fileName; } else { // cached, but not resolvable return null; } } // not cached - try resolving boolean resolved = canResolvePath(fileName); // cache pathResolvedCache.put(fileName, resolved); return resolved ? fileName : null; }
From source file:com.aurel.track.fieldType.runtime.custom.check.CustomCheckBoxSingleRT.java
/** * Get the localized string to be shown/*from w ww . j av a2 s. c om*/ * The value can be of type Boolean or String depending on the * previous operation: loaded from the database or set through submit * @param value * @param locale * @return */ @Override public String getShowValue(Object value, Locale locale) { if (value != null) { String keySuffix = BooleanFields.FALSE_VALUE; //if the attribute value of the workItem (or workItemOld) was loaded from the database //than it is set to a boolean value (see getSpecificAttribute()) //So try converting it to a Boolean Boolean boolValue = null; try { boolValue = (Boolean) value; } catch (Exception e) { LOGGER.debug("Casting the value type " + value.getClass().getName() + " to Boolean failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (boolValue != null && boolValue.booleanValue() == true) { keySuffix = BooleanFields.TRUE_VALUE; } String localizedLabel = LocalizeUtil .getLocalizedTextFromApplicationResources("common.boolean." + keySuffix, locale); if (localizedLabel != null && localizedLabel.length() > 0) { return localizedLabel; } } return ""; }
From source file:com.grizzly.rest.GenericRestCall.java
/** * Put here any calls to tasks to do after the execution of the thread. * It allows to retrieve the boolean result of the rest call in an asynchronous way. * * @param result the result of the doInBackground operation. *//*from www. j a v a 2s . co m*/ @Override protected void onPostExecute(Boolean result) { if (pd != null) { pd.dismiss(); } this.result = result.booleanValue(); if (context != null) { getFromSolidCache(); } if (result) { if (taskCompletion != null) { taskCompletion.onTaskCompleted(jsonResponseEntity); } } else { if (context != null && taskCompletion != null) { //TODO: create a more generic naming approach if (getFromSolidCache()) { taskCompletion.onTaskCompleted(jsonResponseEntity); } } else { if (taskFailure != null) { try { taskFailure.onTaskFailed(jsonResponseEntityClass.newInstance(), failure); } catch (InstantiationException e) { //e.printStackTrace(); } catch (IllegalAccessException e) { ////e.printStackTrace(); } } } } }
From source file:com.alvexcore.repo.AlvexVersionableAspect.java
/** * On update properties policy behaviour * /*w ww . jav a 2 s. c o m*/ * If applicable and "cm:autoVersionOnUpdateProps" is TRUE then version the node on properties update (even if no content updates) * * @since 3.2 */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) { if ((this.nodeService.exists(nodeRef) == true) && !LockUtils.isLockedAndReadOnly(nodeRef, lockService) && (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true) && (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) == false)) { onUpdatePropertiesBehaviour.disable(); try { Map<NodeRef, NodeRef> versionedNodeRefs = (Map) AlfrescoTransactionSupport .getResource(KEY_VERSIONED_NODEREFS); if (versionedNodeRefs == null || versionedNodeRefs.containsKey(nodeRef) == false) { // Determine whether the node is auto versionable (for property only updates) or not boolean autoVersion = false; Boolean value = (Boolean) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); if (value != null) { // If the value is not null then autoVersion = value.booleanValue(); } boolean autoVersionProps = false; value = (Boolean) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION_PROPS); if (value != null) { // If the value is not null then autoVersionProps = value.booleanValue(); } if ((autoVersion == true) && (autoVersionProps == true)) { // Check for explicitly excluded props. // If only they change, then do not auto-version. // (It's exactly the difference with default VersionableAspect.) if (excludedOnUpdatePropQNames.size() > 0) { int diffSize = findChangedProps(before, after); // return if no difference actually (after excludedOnUpdatePropQNames are removed) if (diffSize == 0) return; // drop through and auto-version } // Commenting it out, // since it results in 2 identical node copies on the first props update. // Older version should keep 'before' props. // nodeService.setProperties(nodeRef, before); // Create the auto-version Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(4); versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION_PROPS)); versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); createVersionImpl(nodeRef, versionProperties); // Commenting it out together with the line above. // New version should get 'after' props. // nodeService.setProperties(nodeRef, after); } } } finally { onUpdatePropertiesBehaviour.enable(); } } }
From source file:org.hdiv.webflow.mvc.servlet.ServletMvcViewHDIV.java
/** * Determines if model validation should execute given the Transition that matched the current user event being * processed. Returns true unless the <code>validate</code> attribute of the Transition has been set to false, or * model data binding errors occurred and the global <code>validateOnBindingErrors</code> flag is set to false. * Subclasses may override.//from w w w . ja v a 2 s . c o m * @param model the model data binding would be performed on * @param transition the matched transition * @return true if binding should occur, false if not */ private boolean shouldValidate(Object model, TransitionDefinition transition) { Boolean validateAttribute = getValidateAttribute(transition); if (validateAttribute != null) { return validateAttribute.booleanValue(); } else { AttributeMap flowExecutionAttributes = requestContext.getFlowExecutionContext().getAttributes(); Boolean validateOnBindingErrors = flowExecutionAttributes.getBoolean("validateOnBindingErrors"); if (validateOnBindingErrors != null) { if (!validateOnBindingErrors.booleanValue() && mappingResults.hasErrorResults()) { return false; } } return true; } }