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:com.aurel.track.fieldType.runtime.custom.check.CustomCheckBoxSingleRT.java

/**
 * Set the specific attribute on the TAttributeValueBean
 *//*from  w  w w . j a v a 2 s  .  c o  m*/
public void setSpecificAttribute(TAttributeValueBean tAttributeValueBean, Object attribute) {
    Boolean booleanAttribute = null;
    try {
        booleanAttribute = (Boolean) attribute;
    } catch (Exception e) {
        LOGGER.error("Wrong attribute type " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (booleanAttribute != null && booleanAttribute.booleanValue() == true) {
        tAttributeValueBean.setCharacterValue(BooleanFields.TRUE_VALUE);
    } else {
        tAttributeValueBean.setCharacterValue(BooleanFields.FALSE_VALUE);
    }
}

From source file:com.day.cq.wcm.foundation.forms.FormsHelper.java

/**
 * Are we generating client validation?/*from w ww . j a  va2  s.com*/
 * @param req Request
 * @return true or false
 */
public static boolean doClientValidation(final SlingHttpServletRequest req) {
    checkInit(req);
    Boolean value = (Boolean) req.getAttribute(REQ_ATTR_CLIENT_VALIDATION);
    if (value == null) {
        value = Boolean.FALSE;
    }
    return value.booleanValue();
}

From source file:be.ff.gui.web.struts.action.ActionPlugInChain.java

/**
 * Returns the next plug-in in the chain, that has not executed yet and that is not disabled for this action.
 *
 * @param mapping the <code>ActionMapping</code> as provided by the Struts framework
 *
 * @return the next <code>ActionPlugIn</code> in the chain, that has not executed yet
 *///ww w  .j a  va2  s .co m
private ActionPlugIn getNextActionFilter(ActionMapping mapping, HttpServletRequest request) {
    // the action path for the current action
    String currentActionPath = ActionPluginUtil.getActionPath(request);

    if (currentActionPath == null) {
        String requestURL = request.getRequestURI();
        currentActionPath = requestURL.substring(requestURL.lastIndexOf('/'));
        currentActionPath = currentActionPath.substring(0, currentActionPath.lastIndexOf('.'));
        log.warn("'getRequestURL() == null' / 'getRequestURI() == " + requestURL
                + "' ==>  Verificar se est correto !!!");
    }

    if (log.isDebugEnabled()) {
        log.debug("Avaliando o mapping.getPath()='" + mapping.getPath() + "' / actionPath='" + currentActionPath
                + "'...");
    }

    ActionPlugIn nextActionPlugIn = null;
    while (nextActionPlugIn == null) {
        ActionPlugInDefinition nextDef = null;

        if (++registerIndex < activeActionPlugInRegister.size()) {
            nextDef = (ActionPlugInDefinition) activeActionPlugInDefinitionRegister.get(registerIndex);
        } else {
            break;
        }

        if (nextDef != null) {
            boolean ativaPlugin = false;

            // Plugin DESABILITADO para a ao em questo ?
            // Boolean plugInDisabledForAction = nextDef.hasDisabledActionPath(currentActionPath);
            if (!currentActionPath.equals(mapping.getPath())) {
                log.warn("mapping.getPath()='" + mapping.getPath() + "'  diferente de actionPath='"
                        + currentActionPath + "'.");
            }
            Boolean plugInDisabledForAction = nextDef.hasDisabledActionPath(mapping.getPath());
            if (log.isDebugEnabled()) {
                log.debug("... para a definio=" + nextDef.getClassName() + ", desabilitado="
                        + plugInDisabledForAction);
            }

            if (plugInDisabledForAction == null) {
                // Plugin HABILITADO para a ao em questo ?
                Boolean plugInEnabledForAction = nextDef.hasEnabledActionPath(currentActionPath);
                if (log.isDebugEnabled()) {
                    log.debug("... para a definio=" + nextDef.getClassName() + ", habilitado="
                            + plugInEnabledForAction);
                }

                if (plugInEnabledForAction != null && plugInEnabledForAction.booleanValue()) {
                    // Ativar plugin
                    ativaPlugin = true;
                }
            } else if (!plugInDisabledForAction.booleanValue()) {
                // Ativar plugin
                ativaPlugin = true;
            }

            if (ativaPlugin) {
                nextActionPlugIn = (ActionPlugIn) activeActionPlugInRegister.get(registerIndex);
            }
        }
    }

    if (log.isDebugEnabled()) {
        log.debug("nextActionPlugIn=" + nextActionPlugIn);
    }

    return nextActionPlugIn;
}

From source file:com.xavax.json.JSON.java

/**
 * Get the boolean field with the specified name. If the field is missing
 * or null, return the specified default value.
 *
 * @param key  the name of the field./*from  w w  w. j  ava  2 s .  c o  m*/
 * @param defaultValue  the value to return if the field is null.
 * @return the boolean field with the specified name.
 */
public boolean getBoolean(final String key, final boolean defaultValue) {
    final Boolean flag = getBoolean(key);
    return flag == null ? defaultValue : flag.booleanValue();
}

From source file:org.focusns.web.modules.profile.ProjectUserWidget.java

@RequestMapping("/user-avatar/download")
public ResponseEntity<byte[]> doAvatar(@RequestParam Long userId, @RequestParam(required = false) Boolean temp,
        @RequestParam(required = false) Integer width, @RequestParam(required = false) Integer height,
        WebRequest webRequest) throws IOException {
    ////from w w w.j  ava 2s  . c  om
    boolean notModified = false;
    InputStream inputStream = null;
    //
    ProjectUser projectUser = projectUserService.getProjectUser(userId);
    Object[] avatarCoordinates = CoordinateHelper.getAvatarCoordinates(projectUser);
    if (temp != null && temp.booleanValue()) {
        long lastModified = storageService.checkTempResource(avatarCoordinates);
        if (lastModified > 0 && webRequest.checkNotModified(lastModified)) {
            notModified = true;
        } else {
            inputStream = storageService.loadTempResource(avatarCoordinates);
        }
    } else if (width == null || height == null) {
        long lastModified = storageService.checkResource(avatarCoordinates);
        if (lastModified > 0 && webRequest.checkNotModified(lastModified)) {
            notModified = true;
        } else {
            inputStream = storageService.loadResource(avatarCoordinates);
        }
    } else {
        Object size = width + "x" + height;
        long lastModified = storageService.checkSizedResource(size, avatarCoordinates);
        if (lastModified > 0 && webRequest.checkNotModified(lastModified)) {
            notModified = true;
        } else {
            inputStream = storageService.loadSizedResource(size, avatarCoordinates);
        }
    }
    //
    if (notModified) {
        return new ResponseEntity<byte[]>(HttpStatus.NOT_MODIFIED);
    }
    //
    return WebUtils.getResponseEntity(FileCopyUtils.copyToByteArray(inputStream), MediaType.IMAGE_PNG);
}

From source file:com.qpark.eip.core.model.analysis.config.EipModelAnalysisPersistenceConfig.java

/**
 * Get the generateDdl parameter to be set into the
 * {@link AbstractJpaVendorAdapter}.//from w w w .java 2 s.  c om
 *
 * @return the generateDdl parameter to be set into the
 *         {@link AbstractJpaVendorAdapter}.
 */
private boolean isJpaVendorAdapterGenerateDdl() {
    Boolean value = this.jpaVendorAdapterConfiguration.getJpaVendorAdapterGenerateDdl();
    if (value == null) {
        if (this.jpaVendorAdapterConfiguration.getJpaVendorAdpaterDatabasePlatform()
                .equals("org.hibernate.dialect.HSQLDialect")
                || this.jpaVendorAdapterConfiguration.getJpaVendorAdpaterDatabasePlatform()
                        .equals(Database.HSQL.name())) {
            value = Boolean.TRUE;
        } else {
            value = Boolean.FALSE;
        }
    }
    return value.booleanValue();
}

From source file:com.alvexcore.repo.AlvexVersionableAspect.java

/**
 * On add aspect policy behaviour//  www  .  j av a 2  s  . c  om
 * 
 * @param nodeRef
 * @param aspectTypeQName
 */
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) {
    if (this.nodeService.exists(nodeRef) == true
            && this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true
            && aspectTypeQName.equals(ContentModel.ASPECT_VERSIONABLE) == true) {
        boolean initialVersion = true;
        Boolean value = (Boolean) this.nodeService.getProperty(nodeRef, ContentModel.PROP_INITIAL_VERSION);
        if (value != null) {
            initialVersion = value.booleanValue();
        }
        // else this means that the default value has not been set the versionable aspect we applied pre-1.2

        if (initialVersion == true) {
            @SuppressWarnings("unchecked")
            Map<NodeRef, NodeRef> versionedNodeRefs = (Map<NodeRef, NodeRef>) AlfrescoTransactionSupport
                    .getResource(KEY_VERSIONED_NODEREFS);
            if (versionedNodeRefs == null || versionedNodeRefs.containsKey(nodeRef) == false) {
                // Create the initial-version
                Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(1);

                // If a major version is requested, indicate it in the versionProperties map
                String versionType = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_VERSION_TYPE);
                if (versionType == null || !versionType.equals(VersionType.MINOR.toString())) {
                    versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
                }

                versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_INITIAL_VERSION));

                createVersionImpl(nodeRef, versionProperties);
            }
        }
    }
}

From source file:io.wcm.caconfig.editor.impl.ConfigDataServlet.java

@SuppressWarnings("null")
private JSONObject toJson(ConfigurationData config, Boolean inherited, String fullConfigName)
        throws JSONException {
    JSONObject result = new JSONObject();

    result.putOpt("configName", config.getConfigName());
    result.putOpt("collectionItemName", config.getCollectionItemName());
    result.putOpt("overridden", config.isOverridden());
    if (inherited != null) {
        result.put("inherited", inherited.booleanValue());
    }/*w  w w  . j  a  va 2s.  c  o m*/

    JSONArray props = new JSONArray();
    for (String propertyName : config.getPropertyNames()) {
        ValueInfo<?> item = config.getValueInfo(propertyName);
        PropertyMetadata<?> itemMetadata = item.getPropertyMetadata();

        JSONObject prop = new JSONObject();
        prop.putOpt("name", item.getName());

        // special handling for nested configs and nested config collections
        if (itemMetadata != null && itemMetadata.isNestedConfiguration()) {
            JSONObject metadata = new JSONObject();
            metadata.putOpt("label", itemMetadata.getLabel());
            metadata.putOpt("description", itemMetadata.getDescription());
            metadata.putOpt("properties", toJson(itemMetadata.getProperties()));
            prop.put("metadata", metadata);

            if (itemMetadata.getType().isArray()) {
                ConfigurationData[] configDatas = (ConfigurationData[]) item.getValue();
                if (configDatas != null) {
                    JSONObject nestedConfigCollection = new JSONObject();
                    StringBuilder collectionConfigName = new StringBuilder();
                    if (config.getCollectionItemName() != null) {
                        collectionConfigName
                                .append(configurationPersistenceStrategy.getCollectionItemConfigName(
                                        fullConfigName + "/" + config.getCollectionItemName(),
                                        config.getResourcePath()));
                    } else {
                        collectionConfigName.append(configurationPersistenceStrategy
                                .getConfigName(fullConfigName, config.getResourcePath()));
                    }
                    collectionConfigName.append("/").append(itemMetadata.getConfigurationMetadata().getName());
                    nestedConfigCollection.put("configName", collectionConfigName.toString());
                    JSONArray items = new JSONArray();
                    for (ConfigurationData configData : configDatas) {
                        items.put(toJson(configData, false, collectionConfigName.toString()));
                    }
                    nestedConfigCollection.put("items", items);
                    prop.put("nestedConfigCollection", nestedConfigCollection);
                }
            } else {
                ConfigurationData configData = (ConfigurationData) item.getValue();
                if (configData != null) {
                    prop.put("nestedConfig", toJson(configData, null,
                            fullConfigName + "/" + itemMetadata.getConfigurationMetadata().getName()));
                }
            }
        }

        // property data and metadata
        else {
            prop.putOpt("value", toJsonValue(item.getValue()));
            prop.putOpt("effectiveValue", toJsonValue(item.getEffectiveValue()));
            prop.putOpt("configSourcePath", item.getConfigSourcePath());
            prop.putOpt("default", item.isDefault());
            prop.putOpt("inherited", item.isInherited());
            prop.putOpt("overridden", item.isOverridden());

            if (itemMetadata != null) {
                JSONObject metadata = new JSONObject();
                if (itemMetadata.getType().isArray()) {
                    metadata.put("type", ClassUtils
                            .primitiveToWrapper(itemMetadata.getType().getComponentType()).getSimpleName());
                    metadata.put("multivalue", true);
                } else {
                    metadata.put("type", ClassUtils.primitiveToWrapper(itemMetadata.getType()).getSimpleName());
                }
                metadata.putOpt("defaultValue", toJsonValue(itemMetadata.getDefaultValue()));
                metadata.putOpt("label", itemMetadata.getLabel());
                metadata.putOpt("description", itemMetadata.getDescription());
                metadata.putOpt("properties", toJson(itemMetadata.getProperties()));
                prop.put("metadata", metadata);
            }
        }
        props.put(prop);
    }
    result.put("properties", props);

    return result;
}

From source file:com.diversityarrays.dal.db.kddart.KddartDalDatabase.java

public KddartDalDatabase(Closure<String> progress, boolean test, URI uri, String username, String password,
        Boolean autoSwitchGroup) throws DalDbException {
    super("KDDart-DAL@" + uri.toString());

    this.dalUrl = uri.toString();
    this.dalUsername = username;
    this.dalPassword = password;
    this.autoSwitchGroupOnLogin = autoSwitchGroup == null ? false : autoSwitchGroup.booleanValue();

    entityClassByName.put("genus", Genus.class);
    entityClassByName.put("genotype", Genotype.class);

    if (test) {//from   w w w . j  a  v a 2  s .c om
        DALClient client = new DefaultDALClient(dalUrl);
        try {
            progress.execute("Attempting login to " + dalUrl);
            client.login(username, password);
        } catch (DalException e) {
            throw new DalDbException(e);
        } catch (IOException e) {
            throw new DalDbException(e);
        } finally {
            client.logout();
        }
    }
}

From source file:de.willuhn.jameica.hbci.passports.pintan.Controller.java

/**
 * Liefert eine Checkbox, mit der eingestellt werden kann, ob chipTAN USB verwendet werden soll.
 * @return eine Checkbox, mit der eingestellt werden kann, ob chipTAN USB verwendet werden soll.
 * @throws RemoteException//from  w w  w  . j av a  2  s. com
 */
public CheckboxInput getChipTANUSB() throws RemoteException {
    if (this.useUsb != null)
        return this.useUsb;

    final Boolean b = this.getConfig().isChipTANUSB();
    this.useUsb = new CheckboxInput(b == null || b.booleanValue());
    this.useUsb.setName(i18n.tr("Kartenleser per USB zur TAN-Erzeugung verwenden"));

    final Listener l = new Listener() {

        @Override
        public void handleEvent(Event event) {
            try {
                Boolean newValue = (Boolean) getChipTANUSB().getValue();

                if (event != null && event.type == SWT.Selection) {
                    // Wir kamen aus dem Gray-State. Der User hat entschieden
                    org.eclipse.swt.widgets.Button bt = (org.eclipse.swt.widgets.Button) useUsb.getControl();
                    if (bt.getGrayed()) {
                        bt.setGrayed(false);
                        bt.setSelection(true);
                        newValue = Boolean.TRUE;
                    }
                }

                if (event != null)
                    getCardReaders().setEnabled(newValue != null && newValue.booleanValue());
                else
                    getCardReaders().setEnabled(b != null && b.booleanValue());

                // Bei chipTAN USB wird die TAN grundsaetzlich angezeigt
                if (newValue != null && newValue.booleanValue()
                        && (event == null || event.type == SWT.Selection)) {
                    Boolean showTan = (Boolean) getShowTan().getValue();
                    if (showTan == null || !showTan.booleanValue()) {
                        getShowTan().setValue(true);
                        String msg = i18n.tr(
                                "Anzeige der TANs aktiviert, damit Sie die korrekte bertragung vom Kartenleser prfen knnen");
                        Application.getMessagingFactory()
                                .sendMessage(new StatusBarMessage(msg, StatusBarMessage.TYPE_INFO));
                    }
                }
            } catch (RemoteException re) {
                Logger.error("error while updating cardreader field", re);
            }
        }
    };

    // einmal initial ausloesen
    l.handleEvent(null);

    this.useUsb.addListener(l);
    return this.useUsb;
}