Example usage for java.lang Boolean equals

List of usage examples for java.lang Boolean equals

Introduction

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

Prototype

public boolean equals(Object obj) 

Source Link

Document

Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.

Usage

From source file:no.abmu.questionnaire.service.QuestionnaireServiceHelperH3Impl.java

private void boolFromReportDataToJasperReport(Map<String, Object> m, QuestionnaireData questionnaireData,
        int startIndex, int stopIndex) {

    String fieldName;/* w w w.ja v a  2 s .c o  m*/
    BooleanFieldData booleanFieldData;
    Boolean booleanFieldDataValue;
    Boolean yes = true;
    Boolean no = false;

    for (int i = startIndex; i <= stopIndex; i++) {
        fieldName = intTo3DigitString(i);
        booleanFieldData = (BooleanFieldData) questionnaireData.getFieldData(fieldName);

        if (booleanFieldData != null) {

            booleanFieldDataValue = booleanFieldData.getValue();
            if (booleanFieldDataValue != null) {
                if (booleanFieldDataValue.equals(yes)) {
                    m.put(fieldName, "Ja");
                } else if (booleanFieldDataValue.equals(no)) {
                    m.put(fieldName, "Nei");
                }
            }
        }
    }
}

From source file:org.apache.maven.dotnet.AbstractCilRuleBasedMojo.java

/**
 * @param solution//  w  w  w. j a va2 s .c o  m
 *          the current solution
 * @return the assembly files generated by this solution (except test ones)
 * @throws MojoFailureException
 */
private List<File> extractAssemblies(VisualStudioSolution solution, Boolean silverlightFilter)
        throws MojoFailureException {
    List<VisualStudioProject> projects = solution.getProjects();
    List<File> assemblies = new ArrayList<File>();

    Set<String> skippedProjectSet = new HashSet<String>();
    if (skippedProjects != null) {
        skippedProjectSet.addAll(Arrays.asList(StringUtils.split(skippedProjects, ',')));
    }

    for (VisualStudioProject visualStudioProject : projects) {
        if (visualStudioProject.isTest()) {
            // We skip all the test assemblies
            getLog().info("Skipping the test project " + visualStudioProject.getName());

        } else if (skippedProjectSet.contains(visualStudioProject.getName())) {
            getLog().info("Skipping project " + visualStudioProject.getName());

        } else if (visualStudioProject instanceof WebVisualStudioProject) {
            // ASP project
            WebVisualStudioProject webProject = (WebVisualStudioProject) visualStudioProject;
            assemblies.addAll(webProject.getGeneratedAssemblies(buildConfigurations));

        } else if (silverlightFilter == null
                || silverlightFilter.equals(visualStudioProject.isSilverlightProject())) {

            final File assembly = visualStudioProject.getArtifact(buildConfigurations);

            if (assembly.exists()) {
                assemblies.add(assembly);
            } else {
                getLog().info("Skipping the non generated assembly: " + assembly);
            }
        }
    }
    return assemblies;
}

From source file:no.abmu.finances.service.hibernate3.FinanceServiceHelperH3Impl.java

private void boolPostDataToMap(Map<String, Object> m, BoolPostData boolPostData, String key) {
    Assert.checkRequiredArgument("m", m);
    Assert.checkRequiredArgument("key", key);

    if (boolPostData != null) {
        Boolean boolPostDataValue = boolPostData.getBoolValue();
        if (boolPostDataValue != null) {
            if (boolPostDataValue.equals(YES)) {
                m.put(key, "Ja");
            } else if (boolPostDataValue.equals(NO)) {
                m.put(key, "Nei");
            }/*from  ww  w. ja  v  a  2s .c  o  m*/
        }
    }
}

From source file:com.ibm.team.build.internal.hjplugin.RTCScm.java

@Override
protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project, Launcher launcher,
        FilePath workspacePath, TaskListener listener, SCMRevisionState revisionState)
        throws IOException, InterruptedException {
    // if #requiresWorkspaceForPolling is false, expect that launcher and workspacePath are null

    listener.getLogger().println(Messages.RTCScm_checking_for_changes());

    // check to see if there are incoming changes
    try {/*from  w  w  w . j  a  v a  2s . com*/
        RTCFacadeWrapper facade = RTCFacadeFactory
                .getFacade(getDescriptor().getMasterBuildToolkit(getBuildTool(), listener), null);
        Boolean changesIncoming = (Boolean) facade.invoke("incomingChanges", //$NON-NLS-1$
                new Class[] { String.class, // serverURI
                        String.class, // userId
                        String.class, // password
                        File.class, // passwordFile
                        int.class, // timeout
                        String.class, // buildWorkspace
                        Object.class, }, // listener
                getServerURI(), getUserId(), getPassword(), getPasswordFileFile(), getTimeout(),
                getBuildWorkspace(), listener);
        if (changesIncoming.equals(Boolean.TRUE)) {
            listener.getLogger().println(Messages.RTCScm_changes_found());
            return PollingResult.SIGNIFICANT;
        } else {
            listener.getLogger().println(Messages.RTCScm_no_changes_found());
            return PollingResult.NO_CHANGES;
        }

    } catch (InvocationTargetException e) {
        Throwable eToReport = e.getCause();
        if (eToReport == null) {
            eToReport = e;
        }
        PrintWriter writer = listener
                .fatalError(Messages.RTCScm_checking_for_changes_failure(eToReport.getMessage()));
        eToReport.printStackTrace(writer);

        // if we can't check for changes then we can't build it
        throw new AbortException(Messages.RTCScm_checking_for_changes_failure2(eToReport.getMessage()));

    } catch (Exception e) {
        PrintWriter writer = listener.error(Messages.RTCScm_checking_for_changes_failure3(e.getMessage()));
        e.printStackTrace(writer);

        // if we can't check for changes then we can't build it
        throw new AbortException(Messages.RTCScm_checking_for_changes_failure3(e.getMessage()));
    }
}

From source file:org.jahia.modules.rolesmanager.RolesAndPermissionsHandler.java

private void addPermissionsForScope(RoleBean roleBean, String scope, Map<String, List<String>> permIdsMap,
        Map<String, List<String>> inheritedPermIdsMap) throws RepositoryException {
    final Map<String, Map<String, Map<String, PermissionBean>>> permissions = roleBean.getPermissions();
    if (!permissions.containsKey(scope)) {
        permissions.put(scope, new LinkedHashMap<String, Map<String, PermissionBean>>());
    }//  ww  w .  j a  va 2s.  c o m
    List<JCRNodeWrapper> allPermissions = getAllPermissions();

    String type = null;
    final Map<String, List<String>> globalPermissionsGroups = roleTypes.getPermissionsGroups();
    final Map<String, List<String>> permissionsGroupsForRoleType = roleBean.getRoleType()
            .getPermissionsGroups();

    if (scope.equals("current")) {
        if (roleBean.getRoleType().getDefaultNodeTypes() != null
                && roleBean.getRoleType().getDefaultNodeTypes().size() == 1) {
            type = roleBean.getRoleType().getDefaultNodeTypes().get(0);
        }
    } else {
        if (scope.equals("currentSite")) {
            type = "jnt:virtualsite";
        } else if (scope.startsWith("/")) {
            try {
                type = getSession().getNode(scope).getPrimaryNodeTypeName();
            } catch (PathNotFoundException e) {
                logger.debug("Error retrieving scope", e);
            } catch (RepositoryException e) {
                logger.error("Error retrieving scope", e);
            }
        }
    }
    if (type == null || (!globalPermissionsGroups.containsKey(type)
            && (permissionsGroupsForRoleType == null || !permissionsGroupsForRoleType.containsKey(type)))) {
        type = "nt:base";
    }
    if (permissionsGroupsForRoleType != null && permissionsGroupsForRoleType.containsKey(type)) {
        for (String s : permissionsGroupsForRoleType.get(type)) {
            permissions.get(scope).put(s, new TreeMap<String, PermissionBean>());
        }
    } else {
        for (String s : globalPermissionsGroups.get(type)) {
            permissions.get(scope).put(s, new TreeMap<String, PermissionBean>());
        }
    }

    Map<String, PermissionBean> mappedPermissions = new HashMap<String, PermissionBean>();

    Map<String, String> allGroups = new HashMap<String, String>();
    for (String s : permissions.get(scope).keySet()) {
        for (String s1 : Arrays.asList(s.split(","))) {
            allGroups.put(s1, s);
        }
    }

    // Create mapped permissions
    for (Map.Entry<String, List<String>> entry : roleTypes.getPermissionsMapping().entrySet()) {
        String[] splitPath = entry.getKey().split("/");
        String permissionGroup = splitPath[2];
        if (allGroups.containsKey(permissionGroup)) {
            Map<String, PermissionBean> p = permissions.get(scope).get(allGroups.get(permissionGroup));
            PermissionBean bean = new PermissionBean();
            bean.setUuid(null);
            bean.setParentPath(StringUtils.substringBeforeLast(entry.getKey(), "/"));
            bean.setName(StringUtils.substringAfterLast(entry.getKey(), "/"));
            String localName = StringUtils.substringAfterLast(entry.getKey(), "/");
            if (localName.contains(":")) {
                localName = StringUtils.substringAfter(localName, ":");
            }
            String title = StringUtils
                    .capitalize(localName.replaceAll("([A-Z])", " $0").replaceAll("[_-]", " ").toLowerCase());
            final String rbName = localName.replaceAll("-", "_");
            bean.setTitle(
                    Messages.getInternal("label.permission." + rbName, LocaleContextHolder.getLocale(), title));
            bean.setDescription(Messages.getInternal("label.permission." + rbName + ".description",
                    LocaleContextHolder.getLocale(), ""));
            bean.setPath(entry.getKey());
            bean.setDepth(splitPath.length - 1);
            bean.setMappedPermissions(new TreeMap<String, PermissionBean>());
            if (p.containsKey(bean.getParentPath())) {
                p.get(bean.getParentPath()).setHasChildren(true);
            }

            p.put(entry.getKey(), bean);

            for (String s : entry.getValue()) {
                createMappedPermission(s, bean, mappedPermissions);
            }
        }
    }

    // Create standard permissions
    for (JCRNodeWrapper permissionNode : allPermissions) {
        JCRNodeWrapper permissionGroup = getPermissionGroupNode(permissionNode);
        final String permissionPath = getPermissionPath(permissionNode);

        if (!mappedPermissions.containsKey(permissionPath)
                && mappedPermissions.containsKey(getPermissionPath(permissionNode.getParent()))) {
            final PermissionBean bean = mappedPermissions.get(getPermissionPath(permissionNode.getParent()));
            createMappedPermission(permissionPath, bean, mappedPermissions);
        }

        if (allGroups.containsKey(permissionGroup.getName())
                && !mappedPermissions.containsKey(permissionPath)) {
            Map<String, PermissionBean> p = permissions.get(scope)
                    .get(allGroups.get(permissionGroup.getName()));
            if (!p.containsKey(permissionPath) || permissionNode.getPath().startsWith("/permissions")) {
                PermissionBean bean = new PermissionBean();
                setPermissionBeanProperties(permissionNode, bean);
                if (p.containsKey(bean.getParentPath())) {
                    p.get(bean.getParentPath()).setHasChildren(true);
                }
                p.put(permissionPath, bean);
                setPermissionFlags(permissionNode, p, bean, permIdsMap.get(scope),
                        inheritedPermIdsMap.get(scope), p.get(bean.getParentPath()));
            }
        }
        if (mappedPermissions.containsKey(permissionPath)) {
            PermissionBean bean = mappedPermissions.get(permissionPath);

            Map<String, PermissionBean> p = permissions.get(scope)
                    .get(allGroups.get(bean.getPath().split("/")[2]));
            setPermissionFlags(permissionNode, p, bean, permIdsMap.get(scope), inheritedPermIdsMap.get(scope),
                    p.get(bean.getParentPath()));
        }
    }

    // Auto expand permissions where mapped permissions are partially set
    for (Map<String, Map<String, PermissionBean>> map : roleBean.getPermissions().values()) {
        for (Map<String, PermissionBean> map2 : map.values()) {
            final Collection<PermissionBean> values = new ArrayList<PermissionBean>(map2.values());
            for (PermissionBean bean : values) {
                if (bean.getMappedPermissions() != null) {
                    Boolean lastValue = null;
                    for (PermissionBean value : bean.getMappedPermissions().values()) {
                        if (lastValue == null) {
                            lastValue = value.isSuperSet() || value.isSet();
                        }
                        if (!lastValue.equals(value.isSuperSet() || value.isSet())) {
                            bean.setMappedPermissionsExpanded(true);
                            bean.setSet(false);
                            bean.setSuperSet(false);
                            bean.setPartialSet(true);
                            break;
                        }
                    }
                    if (bean.isMappedPermissionsExpanded()) {
                        for (PermissionBean mapped : bean.getMappedPermissions().values()) {
                            map2.put(mapped.getPath(), mapped);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.clustercontrol.repository.factory.FacilitySelector.java

/**
 * ?????<BR>/*  ww w.  j a  va  2s.  co m*/
 * 
 * @param parentTree ???
 * @param scopeOnly ?????true, ?????false
 * @param validFlg /null?????
 * @throws HinemosUnknown 
 */
private static void getFacilityTreeRecursive(FacilityTreeItem tree, boolean scopeOnly, Boolean validFlg)
        throws HinemosUnknown {
    if (tree == null)
        throw new HinemosUnknown("tree is null");
    m_log.debug("getFacilityTreeRecursive()" + " tree = " + (tree.getData().getFacilityId()) + " loginuser = "
            + (String) HinemosSessionContext.instance().getProperty(HinemosSessionContext.LOGIN_USER_ID));

    /** ? */
    // ??????
    if (tree.getData().getFacilityType() == FacilityConstant.TYPE_NODE) {
        // ??????????
        if (scopeOnly) {
            return;
        }
        // /??null????
        if (validFlg != null && !validFlg.equals(tree.getData().getValid())) {
            return;
        }
    }
    FacilityTreeItem[] itemChildren = tree.getChildrenArray();
    if (itemChildren != null) {
        for (FacilityTreeItem item : itemChildren) {
            getFacilityTreeRecursive(item, scopeOnly, validFlg);
        }
    }
}

From source file:no.abmu.finances.service.hibernate3.FinanceServiceHelperH3Impl.java

private ReportStatus createReportStatus(OrganisationUnitForBrowsing orgForBrowse, MainReportData reportData,
        String finishFieldNumber) {

    Boolean yes = new Boolean(true);

    if (reportData == null) {
        return new ReportStatusImpl(orgForBrowse);
    }/*from   ww  w . j av a2s.c  om*/

    BoolPostData boolPostData = (BoolPostData) reportData.getPostData(finishFieldNumber);
    if (boolPostData == null) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST);
    }

    Boolean boolPostDataValue = boolPostData.getBoolValue();
    if (boolPostDataValue == null) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST);
    }

    if (boolPostDataValue.equals(yes)) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_FINISH);
    } else {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_NOT_FINISH);
    }

}

From source file:org.apache.axis.encoding.SerializationContextImpl.java

/**
 * Construct SerializationContextImpl with associated writer and MessageContext
 * @param writer java.io.Writer// w w  w. j  a  va  2  s  .  c o  m
 * @param msgContext is the MessageContext
 */
public SerializationContextImpl(Writer writer, MessageContext msgContext)
{
    this.writer = writer;
    this.msgContext = msgContext;

    Handler optionSource = null ;
    if ( msgContext != null ) {
        soapConstants = msgContext.getSOAPConstants();

        // optionSource = msgContext.getService();
        if (optionSource == null)
            optionSource = msgContext.getAxisEngine();

        // Use whatever schema is associated with this MC
        schemaVersion = msgContext.getSchemaVersion();

        Boolean shouldSendDecl = (Boolean)optionSource.getOption(
                                              AxisEngine.PROP_XML_DECL);
        if (shouldSendDecl != null)
            sendXMLDecl = shouldSendDecl.booleanValue();

        Boolean shouldSendMultiRefs =
              (Boolean)msgContext.getProperty(AxisEngine.PROP_DOMULTIREFS);

        if (shouldSendMultiRefs == null)
            shouldSendMultiRefs =
                    (Boolean)optionSource.getOption(AxisEngine.PROP_DOMULTIREFS);

        if (shouldSendMultiRefs != null)
            doMultiRefs = shouldSendMultiRefs.booleanValue();

        Boolean shouldSendMinimized =
            (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_MINIMIZED_ELEMENTS);

        if (shouldSendMinimized != null)
            sendMinimizedElements = shouldSendMinimized.booleanValue();

        // The SEND_TYPE_ATTR and PROP_SEND_XSI options indicate
        // whether the elements should have xsi:type attributes.
        // Only turn this off is the user tells us to
        if ( !msgContext.isPropertyTrue(Call.SEND_TYPE_ATTR, true ))
            sendXSIType = false ;

        Boolean opt = (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_XSI);
        if ((opt != null) && (opt.equals(Boolean.FALSE))) {
                sendXSIType = false ;
        }

        // A Literal use operation overrides the above settings. Don't
        // send xsi:type, and don't do multiref in that case.
        OperationDesc operation = msgContext.getOperation();
        if (operation != null) {
            if (operation.getUse() != Use.ENCODED) {
                sendXSIType = false;
                doMultiRefs = false;
            }
        } else {
            // A Literal use service overrides the above settings. 
            SOAPService service = msgContext.getService();
            if (service != null) {
                if (service.getUse() != Use.ENCODED) {
                    sendXSIType = false;
                    doMultiRefs = false;
                }
            }
        }
    }

    // Set up preferred prefixes based on current schema, soap ver, etc.
    initialize();
}

From source file:org.linagora.linshare.core.service.impl.UploadRequestServiceImpl.java

private boolean checkBoolean(BooleanValueFunctionality func, Boolean current) {
    if (func.getActivationPolicy().getStatus()) {
        logger.debug(func.getIdentifier() + " is activated");
        Boolean defaultValue = func.getValue();
        if (func.getDelegationPolicy() != null && func.getDelegationPolicy().getStatus()) {
            logger.debug(func.getIdentifier() + " has a delegation policy");
            if (current != null) {
                return current;
            }/*from   w w w  .  ja  v  a 2s .  co m*/
            return defaultValue;
        } else {
            // there is no delegation, the current value should be the
            // system value or null
            logger.debug(func.getIdentifier() + " does not have a delegation policy");
            if (current != null) {
                if (!current.equals(defaultValue)) {
                    logger.warn("the current value " + current.toString() + " is different than system value "
                            + defaultValue);
                }
            }
            return defaultValue;
        }
    } else {
        logger.debug(func.getIdentifier() + " is not activated");
        if (current != null) {
            logger.warn("the current value " + current.toString() + " should be null for the functionality "
                    + func.toString());
        }
        return false;
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao.java

/**
 * Convenience method for use with functional datatype properties.
 * //from  w  ww.  j  a v  a 2  s  . c  o  m
 * Pass keepOnlyIfTrue if a lack of a value in the model indicates false.  
 * See ObjectPropertyDaoJena and PROPERTY_OFFERCREATENEWOPTIONANNOT for an
 * example.
 */
protected void updatePropertyBooleanValue(Resource res, Property dataprop, Boolean value, Model model,
        boolean keepOnlyIfTrue) {
    if (dataprop != null) {
        Boolean existingValue = null;
        Statement stmt = res.getProperty(dataprop);
        if (stmt != null) {
            RDFNode object = stmt.getObject();
            if (object != null && object.isLiteral()) {
                existingValue = ((Literal) object).getBoolean();
            }
        }
        if ((existingValue != null && value == null)
                || (existingValue != null && value != null && !(existingValue.equals(value)))
                || (existingValue != null && existingValue == false && keepOnlyIfTrue)) {
            model.removeAll(res, dataprop, null);
        }
        if ((existingValue == null && value != null)
                || (existingValue != null && value != null && !(existingValue.equals(value)))) {
            if (keepOnlyIfTrue) {
                if (value == true) {
                    model.add(res, dataprop, model.createTypedLiteral(value));
                }
            } else {
                model.add(res, dataprop, model.createTypedLiteral(value));
            }
        }
    }
}