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:edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions.java

public static boolean returnsUniqueValues(FunctionIdentifier fi) {
    Boolean ruv = builtinUnnestingFunctions.get(getAsterixFunctionInfo(fi));
    if (ruv != null && ruv.booleanValue()) {
        return true;
    } else {//from  w  w  w . ja  v a  2  s .  c om
        return false;
    }
}

From source file:es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoController#modificarNodo(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//* w ww  . ja v  a  2 s  .co m*/
public final void modificarNodo(ActionMapping mapping,
        es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    try {

        String nodo = form.getNodo();
        String url = form.getUrl();
        String puerto = form.getPuerto();
        Long ccaaId = form.getCcaa();
        Long id = form.getId();
        String urlWS = form.getUrlWS();
        String idNodo = form.getIdNodo();

        //cargamos el NodoVO con los datos originales que tiene antes de modificarlo
        NodoVO nodoCargado = new NodoVO();
        nodoCargado = this.getSrvNodoService().obtenerNodo(id);

        // Validaciones de los campos que recogemos del formulario
        Pattern mask = Pattern.compile("[^\\\\?\\\\!\\>\\#\\&\\<\\@\\$\\\'\\\"]+");
        Matcher matcher = null;

        //Validamos el nombre del nodo

        if (nodo == null || nodo.equals("")) {
            log.error("el nombre del nodo no puede estar vacio");
            throw new ValidatorException("{errors.modificarnodo.nodo}");
        }

        matcher = mask.matcher(nodo);
        if (!matcher.matches()) {
            if (log.isDebugEnabled())
                log.debug("nodo caracter ilegal");
            throw new ValidatorException("{errors.modificarnodo.nodo.caracterIlegal}");
        }

        //Validamos la url del nodo

        if (url == null || url.equals("")) {
            log.error("la url del nodo no puede estar vacio");
            throw new ValidatorException("{errors.modificarnodo.url}");
        }

        matcher = mask.matcher(url);
        if (!matcher.matches()) {
            if (log.isDebugEnabled())
                log.debug("nodo caracter ilegal");
            throw new ValidatorException("{errors.modificarnodo.url.caracterIlegal}");
        }

        //Validamos la url del Web Sevices

        if (urlWS == null || urlWS.equals("")) {
            log.error("la url del WebService no puede estar vacio");
            throw new ValidatorException("{errors.modificarnodo.urlWS}");
        }

        if (idNodo == null || idNodo.equals("")) {
            log.error("el identificador del nodo no puede estar vacio");
            throw new ValidatorException("{errors.modificarnodo.idNodo}");
        }

        matcher = mask.matcher(urlWS);
        if (!matcher.matches()) {
            if (log.isDebugEnabled())
                log.debug("nodo caracter ilegal");
            throw new ValidatorException("{errors.modificarnodo.urlWS.caracterIlegal}");
        }

        //Comprobamos que no existe ningun nodo con el nombre introducido para dar de alta

        if (!(nodoCargado.getNodo().equalsIgnoreCase(nodo))) {
            if (this.getSrvNodoService().existeNombreNodo(nodo).booleanValue())
                throw new ValidatorException("{errors.altanodo.nombreNodoYaExiste}");
        }

        //Comprobamos la url del nodo para evitar que un nodo se federe consigo mismo

        String urlHost = AgregaPropertiesImpl.getInstance().getProperty(AgregaProperties.HOST);
        if (log.isDebugEnabled())
            log.debug("El valor de urlHost es " + urlHost);
        if (urlHost.trim().equalsIgnoreCase(url.trim())) {
            if (log.isDebugEnabled())
                log.debug("Se esta intentando federar un nodo consigo mismo");
            throw new ValidatorException("{errors.altanodo.url.federadoConsigoMismo}");
        }

        //Compruebo si ya existen otro nodo en la BD con los mismos valores de url y urlWS

        if (!(nodoCargado.getUrl().equalsIgnoreCase(url))
                && !(nodoCargado.getUrlWS().equalsIgnoreCase(urlWS))) {
            Boolean estaDadoAlta = this.getSrvNodoService().estaDadoAlta(url, urlWS);
            if (log.isDebugEnabled())
                log.debug("estaDadoAlta " + estaDadoAlta);
            if (estaDadoAlta.booleanValue()) {
                if (log.isDebugEnabled())
                    log.debug("esta dado de alta");
                throw new ValidatorException("{errors.altanodo.url.yaEstaDadoAlta}");
            }
        }

        //Comprobamos si se introdcue puerto que este sea numerico
        if (puerto != null && !puerto.matches("[0-9]*"))
            throw new ValidatorException("{errors.altanodo.puerto.NoNumerico}");

        NodoVO nodoVO = new NodoVO();

        nodoVO.setId(id);
        nodoVO.setNodo(nodo);
        nodoVO.setUrl(url);
        nodoVO.setPuerto(puerto);
        nodoVO.setUrlWS(urlWS);
        nodoVO.setIdNodo(idNodo);
        if (ccaaId != null) {
            CcaaVO ccaa = new CcaaVO();
            ccaa.setId(ccaaId);
            nodoVO.setCcaa(ccaa);
        }

        //Comprobamos si al crear el nodo todo ha ido bien o se ha producido algun error
        Integer codigo_devuelto = this.getSrvNodoService().modificarNodo(nodoVO);

        if (codigo_devuelto.intValue() == 1)
            throw new ValidatorException("{errors.altanodo.urlWS.timeout}");

        form.setResultado("ok.modificarnodo");

    } catch (ValidatorException e) {
        throw e;
    } catch (Exception e) {
        log.error("Se ha producido un error al modificar el nodo: " + e);
        form.setResultado("fallo.modificarnodo");
    }

}

From source file:com.microsoft.tfs.client.common.ui.teambuild.commands.CreateUploadZipCommand.java

private boolean isExcluded(final String localItem, final boolean isFolder, final String startLocalItem) {
    if (ignoreFile != null) {
        if (ignoreFile.getFullPath().equalsIgnoreCase(localItem)) {
            return true;
        }//from   www  . j av a2 s  . c om
        final AtomicReference<String> innerAppliedExclusion = new AtomicReference<String>();
        final Boolean isExcluded = ignoreFile.isExcluded(localItem, isFolder, startLocalItem,
                innerAppliedExclusion);
        if (isExcluded != null) {
            return isExcluded.booleanValue();
        }
    }
    return false;
}

From source file:com.alvexcore.repo.workflow.canReassignTask.java

public boolean isTaskReassignable(WorkflowTask task, String username) {
    task = getTaskById(task.getId()); // Refresh the task.

    // if the task is complete it is not reassignable
    if (task.getState() == WorkflowTaskState.COMPLETED) {
        return false;
    }/*  ww  w .  jav a  2  s  . c o  m*/

    // if a task does not have an owner it can not be reassigned
    if (task.getProperties().get(ContentModel.PROP_OWNER) == null) {
        return false;
    }

    // if the task has the 'reassignable' property set to false it can not be reassigned
    Map<QName, Serializable> properties = task.getProperties();
    Boolean reassignable = (Boolean) properties.get(WorkflowModel.PROP_REASSIGNABLE);
    if (reassignable != null && reassignable.booleanValue() == false) {
        return false;
    }

    // if the task has pooled actors and an owner it can not be reassigned (it must be released)
    Collection<?> actors = (Collection<?>) properties.get(WorkflowModel.ASSOC_POOLED_ACTORS);
    String owner = (String) properties.get(ContentModel.PROP_OWNER);
    if (actors != null && !actors.isEmpty() && owner != null) {
        return false;
    }

    RunAsWork<Boolean> work = new canReassignTask(serviceRegistry, orgchartService, task, username);
    boolean canReassign = AuthenticationUtil.runAsSystem(work);
    if (canReassign || isAdminUser(username)) {
        return true;
    }

    return false;
}

From source file:org.syncope.console.pages.Login.java

private boolean isSelfRegistrationAllowed() {
    Boolean result = null;
    try {/*from   w  w w  .ja v  a  2  s . com*/
        result = restTemplate.getForObject(baseURL + "user/request/create/allowed", Boolean.class);
    } catch (HttpClientErrorException e) {
        LOG.error("While seeking if self registration is allowed", e);
    }

    return result == null ? false : result.booleanValue();
}

From source file:com.octo.captcha.service.AbstractManageableCaptchaService.java

/**
 * Method to validate a response to the challenge corresponding to the given ticket and remove the coresponding
 * captcha from the store.//from ww w  . j a  va 2s .c om
 *
 * @param ID the ticket provided by the buildCaptchaAndGetID method
 *
 * @return true if the response is correct, false otherwise.
 *
 * @throws CaptchaServiceException if the ticket is invalid
 */
public Boolean validateResponseForID(String ID, Object response) throws CaptchaServiceException {

    Boolean valid = super.validateResponseForID(ID, response);
    //remove from local after because validate may throw an exception if id is not found
    this.times.remove(ID);
    //update stats
    if (valid.booleanValue()) {
        numberOfCorrectResponse++;
    } else {
        numberOfUncorrectResponse++;
    }
    return valid;
}

From source file:cordova.plugin.RequestLocationAccuracy.java

private boolean hasPermission(String permission) throws Exception {
    boolean hasPermission = true;
    Method method = null;//  w ww  .  j  av  a  2 s.c  o  m
    try {
        method = cordova.getClass().getMethod("hasPermission", permission.getClass());
        Boolean bool = (Boolean) method.invoke(cordova, permission);
        hasPermission = bool.booleanValue();
    } catch (NoSuchMethodException e) {
        Log.w(TAG, "Cordova v" + CordovaWebView.CORDOVA_VERSION
                + " does not support runtime permissions so defaulting to GRANTED for " + permission);
    }
    return hasPermission;
}

From source file:org.apache.servicemix.wsn.jms.JmsSubscription.java

protected boolean doFilter(Element content) {
    if (contentFilter != null) {
        if (!contentFilter.getDialect().equals(XPATH1_URI)) {
            throw new IllegalStateException("Unsupported dialect: " + contentFilter.getDialect());
        }//from  w w w  . j a va2  s  . c  o  m
        try {
            XPathFactory xpfactory = XPathFactory.newInstance();
            XPath xpath = xpfactory.newXPath();
            XPathExpression exp = xpath.compile(contentFilter.getContent().get(0).toString());
            Boolean ret = (Boolean) exp.evaluate(content, XPathConstants.BOOLEAN);
            return ret.booleanValue();
        } catch (XPathExpressionException e) {
            log.warn("Could not filter notification", e);
        }
        return false;
    }
    return true;
}

From source file:com.rsmart.kuali.kfs.cr.document.service.impl.GlTransactionServiceImpl.java

/**
 * Generate GlPendingTransaction/*from   w  w  w .  j  av  a 2  s.  c  om*/
 * 
 * @param paymentGroup
 * @param financialDocumentTypeCode
 * @param stale
 */
private void generateGlPendingTransaction(PaymentGroup paymentGroup, String financialDocumentTypeCode,
        boolean stale) {
    List<PaymentAccountDetail> accountListings = new ArrayList<PaymentAccountDetail>();

    for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
        accountListings.addAll(paymentDetail.getAccountDetail());
    }

    GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();

    for (PaymentAccountDetail paymentAccountDetail : accountListings) {
        GlPendingTransaction glPendingTransaction = new GlPendingTransaction();
        glPendingTransaction.setSequenceNbr(new KualiInteger(sequenceHelper.getSequenceCounter()));
        glPendingTransaction
                .setFdocRefTypCd(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode());
        glPendingTransaction
                .setFsRefOriginCd(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode());
        glPendingTransaction.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);

        Date transactionTimestamp = new Date(dateTimeService.getCurrentDate().getTime());
        glPendingTransaction.setTransactionDt(transactionTimestamp);

        AccountingPeriod fiscalPeriod = accountingPeriodService
                .getByDate(new java.sql.Date(transactionTimestamp.getTime()));
        glPendingTransaction.setUniversityFiscalYear(fiscalPeriod.getUniversityFiscalYear());
        glPendingTransaction.setUnivFiscalPrdCd(fiscalPeriod.getUniversityFiscalPeriodCode());
        glPendingTransaction.setSubAccountNumber(paymentAccountDetail.getSubAccountNbr());
        glPendingTransaction.setChartOfAccountsCode(paymentAccountDetail.getFinChartCode());
        glPendingTransaction.setFdocNbr(paymentGroup.getDisbursementNbr().toString());

        // Set doc type and origin code
        glPendingTransaction.setFinancialDocumentTypeCode(financialDocumentTypeCode);
        glPendingTransaction.setFsOriginCd(CRConstants.CR_FDOC_ORIGIN_CODE);

        String clAcct = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class,
                CRConstants.CLEARING_ACCOUNT);
        String obCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class,
                CRConstants.CLEARING_OBJECT_CODE);
        String coaCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class,
                CRConstants.CLEARING_COA);

        // Use clearing parameters if stale
        String accountNbr = stale ? clAcct : paymentAccountDetail.getAccountNbr();
        String finObjectCode = stale ? obCode : paymentAccountDetail.getFinObjectCode();
        String finCoaCd = stale ? coaCode : paymentAccountDetail.getFinChartCode();

        Boolean relieveLiabilities = paymentGroup.getBatch().getCustomerProfile().getRelieveLiabilities();
        if ((relieveLiabilities != null) && (relieveLiabilities.booleanValue())
                && paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode() != null) {
            OffsetDefinition offsetDefinition = SpringContext.getBean(OffsetDefinitionService.class)
                    .getByPrimaryId(glPendingTransaction.getUniversityFiscalYear(),
                            glPendingTransaction.getChartOfAccountsCode(),
                            paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode(),
                            glPendingTransaction.getFinancialBalanceTypeCode());

            glPendingTransaction.setAccountNumber(accountNbr);
            glPendingTransaction.setChartOfAccountsCode(finCoaCd);
            glPendingTransaction.setFinancialObjectCode(
                    offsetDefinition != null ? offsetDefinition.getFinancialObjectCode() : finObjectCode);
            glPendingTransaction.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
        } else {
            glPendingTransaction.setAccountNumber(accountNbr);
            glPendingTransaction.setChartOfAccountsCode(finCoaCd);
            glPendingTransaction.setFinancialObjectCode(finObjectCode);
            glPendingTransaction.setFinancialSubObjectCode(paymentAccountDetail.getFinSubObjectCode());
        }

        glPendingTransaction.setProjectCd(paymentAccountDetail.getProjectCode());

        if (paymentAccountDetail.getAccountNetAmount().bigDecimalValue().signum() >= 0) {
            glPendingTransaction.setDebitCrdtCd(KFSConstants.GL_CREDIT_CODE);
        } else {
            glPendingTransaction.setDebitCrdtCd(KFSConstants.GL_DEBIT_CODE);
        }
        glPendingTransaction.setAmount(paymentAccountDetail.getAccountNetAmount().abs());

        String trnDesc;

        String payeeName = paymentGroup.getPayeeName();
        trnDesc = payeeName.length() > 40 ? payeeName.substring(0, 40) : StringUtils.rightPad(payeeName, 40);

        String poNbr = paymentAccountDetail.getPaymentDetail().getPurchaseOrderNbr();
        if (StringUtils.isNotBlank(poNbr)) {
            trnDesc += " " + (poNbr.length() > 9 ? poNbr.substring(0, 9) : StringUtils.rightPad(poNbr, 9));
        }

        String invoiceNbr = paymentAccountDetail.getPaymentDetail().getInvoiceNbr();
        if (StringUtils.isNotBlank(invoiceNbr)) {
            trnDesc += " " + (invoiceNbr.length() > 14 ? invoiceNbr.substring(0, 14)
                    : StringUtils.rightPad(invoiceNbr, 14));
        }

        if (trnDesc.length() > 40) {
            trnDesc = trnDesc.substring(0, 40);
        }

        glPendingTransaction.setDescription(trnDesc);

        glPendingTransaction.setOrgDocNbr(paymentAccountDetail.getPaymentDetail().getOrganizationDocNbr());
        glPendingTransaction.setOrgReferenceId(paymentAccountDetail.getOrgReferenceId());
        glPendingTransaction.setFdocRefNbr(paymentAccountDetail.getPaymentDetail().getCustPaymentDocNbr());

        // update the offset account if necessary
        SpringContext.getBean(FlexibleOffsetAccountService.class).updateOffset(glPendingTransaction);

        this.businessObjectService.save(glPendingTransaction);

        sequenceHelper.increment();
    }

}