List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.UpdateServ.java
/** Set the given client to disconnected status */ protected boolean setDisconnected(int dbId) { try {/* w ww . j a v a2s. co m*/ Integer clientInt = new Integer(dbId); if (!disconnected.containsKey(clientInt)) { log.warn("Cannot update connection status of client " + dbId + " -- client is not connected to any session!"); return false; } Boolean ds = (Boolean) disconnected.get(clientInt); if (!ds.booleanValue()) { disconnected.put(clientInt, Boolean.TRUE); } return true; } catch (Exception e) { log.error("UpdateServ failed to update admin monitor with client " + dbId + " connection status"); } return false; }
From source file:com.funambol.server.cleanup.ClientLogCleanUpAgentTest.java
private boolean invokeArchivationNeeded(ClientLogCleanUpAgent agent) throws Throwable { Boolean result = (Boolean) PrivateAccessor.invoke(agent, "archivationNeeded", null, null); return result.booleanValue(); }
From source file:be.fedict.trust.xkms2.WSSecurityServerHandler.java
/** * {@inheritDoc}//from w w w .ja va 2s .com */ public boolean handleMessage(SOAPMessageContext soapMessageContext) { LOG.debug("handle message"); Boolean outboundProperty = (Boolean) soapMessageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); SOAPMessage soapMessage = soapMessageContext.getMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); if (true == outboundProperty.booleanValue()) { handleOutboundDocument(soapPart, soapMessageContext); } else { handleInboundDocument(soapPart, soapMessageContext); } return true; }
From source file:com.swordlord.gozer.datatypeformat.DataTypeHelper.java
/** * Return compatible class for typedValue based on untypedValueClass * /*from w w w. j a v a2 s . c o m*/ * @param untypedValueClass * @param typedValue * @return */ public static Object fromDataType(Class<?> untypedValueClass, Object typedValue) { Log LOG = LogFactory.getLog(DataTypeHelper.class); if (typedValue == null) { return null; } if (untypedValueClass == null) { return typedValue; } if (ClassUtils.isAssignable(typedValue.getClass(), untypedValueClass)) { return typedValue; } String strTypedValue = null; boolean isStringTypedValue = typedValue instanceof String; Number numTypedValue = null; boolean isNumberTypedValue = typedValue instanceof Number; Boolean boolTypedValue = null; boolean isBooleanTypedValue = typedValue instanceof Boolean; Date dateTypedValue = null; boolean isDateTypedValue = typedValue instanceof Date; if (isStringTypedValue) { strTypedValue = (String) typedValue; } if (isNumberTypedValue) { numTypedValue = (Number) typedValue; } if (isBooleanTypedValue) { boolTypedValue = (Boolean) typedValue; } if (isDateTypedValue) { dateTypedValue = (Date) typedValue; } Object v = null; if (String.class.equals(untypedValueClass)) { v = ObjectUtils.toString(typedValue); } else if (BigDecimal.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createBigDecimal(strTypedValue); } else if (isNumberTypedValue) { v = new BigDecimal(numTypedValue.doubleValue()); } else if (isBooleanTypedValue) { v = new BigDecimal(BooleanUtils.toInteger(boolTypedValue.booleanValue())); } else if (isDateTypedValue) { v = new BigDecimal(dateTypedValue.getTime()); } } else if (Boolean.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = BooleanUtils.toBooleanObject(strTypedValue); } else if (isNumberTypedValue) { v = BooleanUtils.toBooleanObject(numTypedValue.intValue()); } else if (isDateTypedValue) { v = BooleanUtils.toBooleanObject((int) dateTypedValue.getTime()); } } else if (Byte.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = Byte.valueOf(strTypedValue); } else if (isNumberTypedValue) { v = new Byte(numTypedValue.byteValue()); } else if (isBooleanTypedValue) { v = new Byte((byte) BooleanUtils.toInteger(boolTypedValue.booleanValue())); } else if (isDateTypedValue) { v = new Byte((byte) dateTypedValue.getTime()); } } else if (byte[].class.equals(untypedValueClass)) { if (isStringTypedValue) { v = strTypedValue.getBytes(); } } else if (Double.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createDouble(strTypedValue); } else if (isNumberTypedValue) { v = new Double(numTypedValue.doubleValue()); } else if (isBooleanTypedValue) { v = new Double(BooleanUtils.toInteger(boolTypedValue.booleanValue())); } else if (isDateTypedValue) { v = new Double(dateTypedValue.getTime()); } } else if (Float.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createFloat(strTypedValue); } else if (isNumberTypedValue) { v = new Float(numTypedValue.floatValue()); } else if (isBooleanTypedValue) { v = new Float(BooleanUtils.toInteger(boolTypedValue.booleanValue())); } else if (isDateTypedValue) { v = new Float(dateTypedValue.getTime()); } } else if (Short.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createInteger(strTypedValue); } else if (isNumberTypedValue) { v = new Integer(numTypedValue.intValue()); } else if (isBooleanTypedValue) { v = BooleanUtils.toIntegerObject(boolTypedValue.booleanValue()); } else if (isDateTypedValue) { v = new Integer((int) dateTypedValue.getTime()); } } else if (Integer.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createInteger(strTypedValue); } else if (isNumberTypedValue) { v = new Integer(numTypedValue.intValue()); } else if (isBooleanTypedValue) { v = BooleanUtils.toIntegerObject(boolTypedValue.booleanValue()); } else if (isDateTypedValue) { v = new Integer((int) dateTypedValue.getTime()); } } else if (Long.class.equals(untypedValueClass)) { if (isStringTypedValue) { v = NumberUtils.createLong(strTypedValue); } else if (isNumberTypedValue) { v = new Long(numTypedValue.longValue()); } else if (isBooleanTypedValue) { v = new Long(BooleanUtils.toInteger(boolTypedValue.booleanValue())); } else if (isDateTypedValue) { v = new Long(dateTypedValue.getTime()); } } else if (java.sql.Date.class.equals(untypedValueClass)) { if (isNumberTypedValue) { v = new java.sql.Date(numTypedValue.longValue()); } else if (isDateTypedValue) { v = new java.sql.Date(dateTypedValue.getTime()); } } else if (java.sql.Time.class.equals(untypedValueClass)) { if (isNumberTypedValue) { v = new java.sql.Time(numTypedValue.longValue()); } else if (isDateTypedValue) { v = new java.sql.Time(dateTypedValue.getTime()); } } else if (java.sql.Timestamp.class.equals(untypedValueClass)) { if (isNumberTypedValue) { v = new java.sql.Timestamp(numTypedValue.longValue()); } else if (isDateTypedValue) { v = new java.sql.Timestamp(dateTypedValue.getTime()); } } else if (Date.class.equals(untypedValueClass)) { if (isNumberTypedValue) { v = new Date(numTypedValue.longValue()); } else if (isStringTypedValue) { try { v = DateFormat.getDateInstance().parse(strTypedValue); } catch (ParseException e) { LOG.error("Unable to parse the date : " + strTypedValue); LOG.debug(e.getMessage()); } } } return v; }
From source file:gov.nih.nci.cabig.caaers.dao.query.AbstractQuery.java
public void filterByRetiredStatus(String alias, Boolean status) { andWhere(alias + ".retiredIndicator = :" + generateParam(status.booleanValue())); }
From source file:com.aurel.track.fieldType.runtime.matchers.run.DateMatcherRT.java
/** * Whether the value matches or not//from w w w .ja va 2 s. co m * @param attributeValue * @return */ @Override public boolean match(Object attributeValue) { Boolean nullMatch = nullMatcher(attributeValue); if (nullMatch != null) { return nullMatch.booleanValue(); } if (attributeValue == null) { return false; } //probably no value specified if (dayBegin == null && dayEnd == null) { return true; } Date attributeValueDate = null; try { attributeValueDate = (Date) attributeValue; } catch (Exception e) { LOGGER.error("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to Date failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } switch (relation) { case MatchRelations.EQUAL_DATE: case MatchRelations.THIS_WEEK: case MatchRelations.THIS_MONTH: case MatchRelations.LAST_WEEK: case MatchRelations.LAST_MONTH: //for dates without time value (for ex. startDate, endDate) the equality should be also tested return (attributeValueDate.getTime() == dayBegin.getTime() || attributeValueDate.after(dayBegin)) && attributeValueDate.before(dayEnd); case MatchRelations.NOT_EQUAL_DATE: //dayEnd is already the next day so the equality should be also tested return attributeValueDate.before(dayBegin) || attributeValueDate.after(dayEnd) || attributeValueDate.getTime() == dayEnd.getTime(); case MatchRelations.GREATHER_THAN_DATE: case MatchRelations.IN_MORE_THAN_DAYS: return attributeValueDate.after(dayEnd) || attributeValueDate.getTime() == dayEnd.getTime(); case MatchRelations.LESS_THAN_DAYS_AGO: return (attributeValueDate.after(dayEnd) || attributeValueDate.getTime() == dayEnd.getTime()) && attributeValueDate.before(new Date()); case MatchRelations.GREATHER_THAN_EQUAL_DATE: case MatchRelations.LESS_THAN_EQUAL_DAYS_AGO: case MatchRelations.IN_MORE_THAN_EQUAL_DAYS: return attributeValueDate.after(dayBegin) || attributeValueDate.getTime() == dayBegin.getTime(); case MatchRelations.LESS_THAN_DATE: case MatchRelations.MORE_THAN_DAYS_AGO: return attributeValueDate.before(dayBegin); case MatchRelations.IN_LESS_THAN_DAYS: return (attributeValueDate.before(dayBegin) || attributeValueDate.getTime() == dayBegin.getTime()) && attributeValueDate.after(new Date()); case MatchRelations.LESS_THAN_EQUAL_DATE: case MatchRelations.MORE_THAN_EQUAL_DAYS_AGO: case MatchRelations.IN_LESS_THAN_EQUAL_DAYS: return attributeValueDate.before(dayEnd); case MatchRelations.LATER_AS_LASTLOGIN: if (dayBegin == null) { //the very first logging return true; } return attributeValueDate.after(dayBegin); default: return false; } }
From source file:com.icesoft.faces.component.panelpositioned.PanelPositionedRenderer.java
private boolean isChanged(FacesContext context) { Boolean b = (Boolean) context.getExternalContext().getRequestMap() .get(PanelPositionedRenderer.class.getName()); if (b != null && b.booleanValue()) { return true; }// w w w . j a va 2s . c o m return false; }
From source file:calliope.db.CouchConnection.java
/** * Check that the database response is OK * @param response the json response from the MongoDB * @return true if its OK was 1.0 or the response has an _id field *///www .j a v a 2s . c o m private boolean checkResponse(String response) { JSONDocument jdoc = JSONDocument.internalise(response); Boolean ok = (Boolean) jdoc.get(OK); return ok != null && ok.booleanValue() && !jdoc.containsKey(ERROR); }
From source file:com.aurel.track.user.LogoffAction.java
/** * This method is automatically called if the associated action is * triggered./*from w ww . j a v a2 s . co m*/ */ private String execute2(boolean checkForMobile) throws Exception { Boolean ready = (Boolean) ServletActionContext.getServletContext().getAttribute(ApplicationStarter.READY); if (ready == null || ready.booleanValue() == false) { return "loading"; } TPersonBean user = null; if (session != null) { user = (TPersonBean) session.get(Constants.USER_KEY); } HttpServletRequest request = ServletActionContext.getRequest(); HttpSession httpSession = request.getSession(); Locale locale = request.getLocale(); if (locale == null) { locale = Locale.getDefault(); } if (user != null) { locale = user.getLocale(); } // Process this users logoff LogoffBL.doLogoff(session, httpSession, locale); StringBuilder sb = LogoffBL.createInitData(httpSession, checkForMobile, request, isMobileApplication, mobileApplicationVersionNo, locale); initData = sb.toString(); if (ApplicationBean.getInstance().getInstallProblem() != null) { String extJSLocale = LocaleHandler.getExistingExtJSLocale(locale); httpSession.setAttribute("EXTJSLOCALE", extJSLocale); List<String> errors = ApplicationBean.getInstance().getInstallProblem(); setActionErrors(errors); return ERROR; } BanProcessor bp = BanProcessor.getBanProcessor(); if (bp.isBanned(request.getRemoteAddr())) { clearFieldErrors(); accessLogger.info("LOGON: Access attempt from banned IP " + request.getRemoteAddr() + " at " + new Date().toString()); return "banned"; } if (isMobileApplication) { if (logOutMobile) { StringBuilder sbMobile = new StringBuilder(); sbMobile.append("{"); JSONUtility.appendBooleanValue(sbMobile, "success", true, true); sbMobile.append("}"); JSONUtility.encodeJSON(ServletActionContext.getResponse(), sbMobile.toString()); } else { ServletActionContext.getResponse().addHeader("Access-Control-Allow-Origin", "*"); JSONUtility.encodeJSON(ServletActionContext.getResponse(), sb.toString()); } return null; } if (mayBeMobile) { return "successMobile"; } return SUCCESS; }
From source file:gate.corpora.FastInfosetDocumentFormat.java
/** * Unpack markup from any XML format. The XML elements are translated to * annotations on the Original markups annotation set. * //from w w w .j a v a 2 s . c om * @param doc * the document to process * @throws DocumentFormatException */ private void unpackGeneralXmlMarkup(Document doc, RepositioningInfo repInfo, RepositioningInfo ampCodingInfo, StatusListener statusListener) throws DocumentFormatException { boolean docHasContentButNoValidURL = hasContentButNoValidUrl(doc); XmlDocumentHandler xmlDocHandler = null; try { // Create a new Xml document handler xmlDocHandler = new XmlDocumentHandler(doc, this.markupElementsMap, this.element2StringMap); // Register a status listener with it xmlDocHandler.addStatusListener(statusListener); // set repositioning object xmlDocHandler.setRepositioningInfo(repInfo); // set the object with ampersand coding positions xmlDocHandler.setAmpCodingInfo(ampCodingInfo); // create the parser SAXDocumentParser newxmlParser = new SAXDocumentParser(); // Set up the factory to create the appropriate type of parser // Fast Infoset doesn't support validating which is good as we would want // it off any way, but we do want it to be namesapace aware newxmlParser.setFeature("http://xml.org/sax/features/namespaces", true); newxmlParser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); newxmlParser.setContentHandler(xmlDocHandler); newxmlParser.setErrorHandler(xmlDocHandler); newxmlParser.setDTDHandler(xmlDocHandler); newxmlParser.setEntityResolver(xmlDocHandler); // Parse the XML Document with the appropriate encoding Reader docReader = null; try { InputSource is; if (docHasContentButNoValidURL) { // no URL, so parse from string is = new InputSource(new StringReader(doc.getContent().toString())); } else if (doc instanceof TextualDocument) { // textual document - load with user specified encoding String docEncoding = ((TextualDocument) doc).getEncoding(); // don't strip BOM on XML. docReader = new InputStreamReader(doc.getSourceUrl().openStream(), docEncoding); is = new InputSource(docReader); // must set system ID to allow relative URLs (e.g. to a DTD) to // work is.setSystemId(doc.getSourceUrl().toString()); } else { // let the parser decide the encoding is = new InputSource(doc.getSourceUrl().toString()); } newxmlParser.parse(is); } finally { // make sure the open streams are closed if (docReader != null) docReader.close(); } ((DocumentImpl) doc).setNextAnnotationId(xmlDocHandler.getCustomObjectsId()); } catch (SAXException e) { doc.getFeatures().put("parsingError", Boolean.TRUE); Boolean bThrow = (Boolean) doc.getFeatures().get(GateConstants.THROWEX_FORMAT_PROPERTY_NAME); if (bThrow != null && bThrow.booleanValue()) { throw new DocumentFormatException(e); } else { Out.println("Warning: Document remains unparsed. \n" + "\n Stack Dump: "); e.printStackTrace(Out.getPrintWriter()); } } catch (IOException e) { throw new DocumentFormatException("I/O exception for " + doc.getSourceUrl(), e); } finally { if (xmlDocHandler != null) xmlDocHandler.removeStatusListener(statusListener); } }