Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:be.e_contract.dssp.client.WSSecuritySOAPHandler.java

@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    if (true == outboundProperty.booleanValue()) {
        try {// w  w w .java  2 s  . c om
            handleOutboundMessage(context);
        } catch (Exception e) {
            LOG.error("outbound exception: " + e.getMessage(), e);
            throw new ProtocolException(e);
        }
    }
    return true;
}

From source file:com.duroty.application.files.actions.DownloadFileAction.java

/**
 * DOCUMENT ME!/*from   w w  w. j av a2  s . c  o  m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Files getFilesInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    FilesHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = FilesUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = FilesUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.glaf.jbpm.action.HibernateNativeSQLAction.java

@SuppressWarnings("unchecked")
public void execute(ExecutionContext ctx) throws Exception {
    logger.debug("-------------------------------------------------------");
    logger.debug("----------------HibernateNativeSQLAction---------------");
    logger.debug("-------------------------------------------------------");

    ContextInstance contextInstance = ctx.getContextInstance();

    Map<String, Object> params = new java.util.HashMap<String, Object>();

    Map<String, Object> variables = contextInstance.getVariables();
    if (variables != null && variables.size() > 0) {
        Set<Entry<String, Object>> entrySet = variables.entrySet();
        for (Entry<String, Object> entry : entrySet) {
            String name = entry.getKey();
            Object value = entry.getValue();
            if (name != null && value != null) {
                params.put(name, value);
            }//from w w w. ja  v  a2  s  .c  om
        }
    }

    boolean executable = true;

    if (StringUtils.isNotEmpty(expression)) {
        if (expression.startsWith("#{") && expression.endsWith("}")) {
            Object value = DefaultExpressionEvaluator.evaluate(expression, params);
            if (value != null) {
                if (value instanceof Boolean) {
                    Boolean b = (Boolean) value;
                    executable = b.booleanValue();
                }
            }
        }
    }

    if (!executable) {
        logger.debug("???false??");
        return;
    }

    params.put("now", new java.util.Date());
    params.put("date", new java.util.Date());
    params.put("timestamp", new java.util.Date());
    params.put("dateTime", new java.util.Date());
    params.put("actorId", ctx.getJbpmContext().getActorId());
    ProcessInstance processInstance = ctx.getProcessInstance();
    params.put("processInstanceId", processInstance.getId());

    Map<String, Object> paramMap = null;

    logger.debug("before replace sql:" + sql);
    logger.debug("params:" + params);
    SqlExecutor sqlExecutor = HibernateUtils.replaceSQL(sql, params);
    String sqlx = sqlExecutor.getSql();
    if (sqlExecutor.getParameter() != null) {
        logger.debug("sqlExecutor.getParameter():" + sqlExecutor.getParameter());
        if (sqlExecutor.getParameter() instanceof Map) {
            paramMap = (Map<String, Object>) sqlExecutor.getParameter();
        }
    }

    if (sqlx.indexOf("#{tableName}") != -1) {
        String tableName = (String) contextInstance.getVariable("tableName");
        if (StringUtils.isNotEmpty(tableName)) {
            sqlx = StringTools.replaceIgnoreCase(sqlx, "#{tableName}", tableName);
        }
    }

    if (sqlx.indexOf("#{") != -1 && sqlx.indexOf("}") != -1) {
        sqlx = (String) DefaultExpressionEvaluator.evaluate(sqlx, params);
    }

    logger.debug(sqlx);
    logger.debug(paramMap);

    Query query = ctx.getJbpmContext().getSession().createSQLQuery(sqlx);
    HibernateUtils.fillParameters(query, paramMap);
    int count = query.executeUpdate();
    if (count < 1) {
        logger.error("sql:" + sqlx);
        logger.error("paramMap:" + paramMap);
        throw new JbpmException("update count is " + count);
    }
}

From source file:gov.nij.er.ui.ERParametersTableModel.java

private String getNodeLabelParameterName() {
    int rowCount = getRowCount();
    for (int r = 0; r < rowCount; r++) {
        Boolean bv = (Boolean) getValueAt(r, 4);
        boolean checked = bv != null && bv.booleanValue();
        if (checked) {
            return (String) getValueAt(r, 0);
        }//from  w  ww  .  j a  v a2s . com
    }
    return null;
}

From source file:hornet.framework.webservice.SOAPLoggingHandler.java

/**
 * log le message SOAP//w  w  w  . ja  v  a 2 s .  c o m
 *
 * @param smc
 *            SOAPMessageContext
 */
private void logSOAP(final SOAPMessageContext smc) {

    final Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (outboundProperty.booleanValue()) {
        LOGGER.debug("\nMessage SOAP envoye:");
    } else {
        LOGGER.debug("\nMessage SOAP recu:");
    }
    final SOAPMessage message = smc.getMessage();
    try {
        // Create transformer
        final TransformerFactory tff = TransformerFactory.newInstance();
        final Transformer tranf = tff.newTransformer();

        // Get reply content
        final Source src = message.getSOAPPart().getContent();

        // Set output transformation
        final ByteArrayOutputStream streamOut = new ByteArrayOutputStream();
        final StreamResult result = new StreamResult(streamOut);
        tranf.transform(src, result);

        LOGGER.debug(streamOut.toString(CharEncoding.UTF_8));
    } catch (final TransformerConfigurationException e) {
        LOGGER.error(ERROR_MSG, e);
    } catch (final SOAPException e) {
        LOGGER.error(ERROR_MSG, e);
    } catch (final TransformerException e) {
        LOGGER.error(ERROR_MSG, e);
    } catch (final UnsupportedEncodingException e) {
        LOGGER.error(ERROR_MSG, e);
    }

}

From source file:com.microsoft.tfs.client.common.license.LicenseManager.java

private void readLicenseMemento() {
    final Memento rootMemento = mementoRepository.load(MEMENTO_NAME);

    if (rootMemento == null) {
        return;/*from  w  w  w.j a  v a 2 s  .  c  o m*/
    }

    final Memento eulaAcceptedMemento = rootMemento.getChild(EULA_MEMENTO_NAME);

    if (eulaAcceptedMemento != null) {
        final Boolean eulaAcceptedValue = eulaAcceptedMemento.getBoolean(EULA_ACCEPTED_KEY_NAME);
        eulaAccepted = (eulaAcceptedValue == null) ? false : eulaAcceptedValue.booleanValue();
    }
}

From source file:com.pactera.edg.am.metamanager.extractor.adapter.mapping.impl.GkDBMappingServiceImpl.java

/**
 * // w ww . j  a  va2 s .  c  o m
 * 
 * @param parentMetadata
 * @param table
 * @param columnMetaModel
 */
protected List<MMMetadata> genColumns(MMMetadata parentMetadata, NamedColumnSet namedColumn,
        MMMetaModel columnMetaModel) {

    List<Column> columns = namedColumn.getColumns();
    if (columns == null || columns.size() == 0) {
        log.warn(":" + parentMetadata.getCode());
        return new ArrayList<MMMetadata>(0);
    }

    // ,?,?
    List<MMMetadata> columnMetadatas = new ArrayList<MMMetadata>(columns.size());
    for (Column column : columns) {
        MMMetadata metadata = new MMMetadata();
        metadata.setCode(column.getName());

        Map<String, String> attrs = column.getAttrs();
        metadata.setParentMetadata(parentMetadata);
        metadata.setClassifierId(columnMetaModel.getCode());
        setAttr(metadata, "comment", attrs.get(ModelElement.REMARKS));
        setAttr(metadata, "definition", column.getColumnDef());
        setAttr(metadata, "sqlSimpleType", column.getTypeName());
        setAttr(metadata, "collengths", String.valueOf(column.getColumnSize()));
        setAttr(metadata, "scale", String.valueOf(column.getDecimalDigits()));
        setAttr(metadata, "precision", String.valueOf(column.getCharOctetLength()));
        setAttr(metadata, "columnId", String.valueOf(column.getOrdinalPosition()));
        setAttr(metadata, "isNullable", column.isNullable() ? "YES" : "NO");
        setAttr(metadata, "initialValue", column.getColumnDef());
        setAttr(metadata, "format", column.getFormat());
        setAttr(metadata, "characterSetName", column.getCharacterSetName());
        Boolean compressible = column.getCompressible();
        setAttr(metadata, "compressible", compressible != null && compressible.booleanValue() ? "YES" : "");

        columnMetaModel.addMetadata(metadata);
        columnMetadatas.add(metadata);
    }
    if (columns.size() > 0) {
        columnMetaModel.setHasMetadata(true);
    }
    return columnMetadatas;

}

From source file:com.autentia.wuija.persistence.event.AnnotationEventListener.java

public boolean onPreUpdate(PreUpdateEvent event) {
    final Boolean veto = (Boolean) invokeAnnotatedMethod(event.getSession(), event.getEntity(),
            PreUpdate.class);
    return (veto == null) ? false : veto.booleanValue();
}

From source file:com.autentia.wuija.persistence.event.AnnotationEventListener.java

public boolean onPreDelete(PreDeleteEvent event) {
    final Boolean veto = (Boolean) invokeAnnotatedMethod(event.getSession(), event.getEntity(),
            PreRemove.class);
    return (veto == null) ? false : veto.booleanValue();
}

From source file:com.aurel.track.fieldType.runtime.matchers.run.StringMatcherRT.java

/**
 * Whether the value matches or not//from  w ww. j a v a2 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 || matchValue == null) {
        return false;
    }
    String attributeValueString = null;
    String matcherValueString = null;
    try {
        attributeValueString = (String) attributeValue;
    } catch (Exception e) {
        LOGGER.warn("Converting the attribute value " + attributeValue + " of type "
                + attributeValue.getClass().getName() + " to String failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        return false;
    }
    try {
        matcherValueString = (String) matchValue;
    } catch (Exception e) {
        LOGGER.warn("Converting the matcher value " + matchValue + " of type " + matchValue.getClass().getName()
                + " to String failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        return false;
    }
    switch (relation) {
    case MatchRelations.EQUAL:
        return attributeValueString.equals(matcherValueString);
    case MatchRelations.NOT_EQUAL:
        return !attributeValueString.equals(matcherValueString);
    case MatchRelations.EQUAL_IGNORE_CASE:
        return attributeValueString.equalsIgnoreCase(matcherValueString);
    case MatchRelations.PERL_PATTERN:
        if (pattern == null) {
            try {
                setPattern(matcherValueString);
            } catch (PatternSyntaxException e) {
                return false;
            }
        }
        Matcher matcher = pattern.matcher(attributeValueString);
        return matcher.find();
    default:
        return false;
    }
}