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:org.jumpmind.symmetric.service.impl.RouterService.java

protected boolean onlyDefaultRoutersAssigned(Channel channel, String nodeGroupId,
        List<TriggerRouter> triggerRouters) {
    String channelId = channel.getChannelId();
    Boolean onlyDefaultRoutersAssigned = !Constants.CHANNEL_CONFIG.equals(channelId)
            && !channel.isFileSyncFlag() && !channel.isReloadFlag()
            && !Constants.CHANNEL_HEARTBEAT.equals(channelId) ? true : false;
    if (onlyDefaultRoutersAssigned && triggerRouters != null) {
        for (TriggerRouter triggerRouter : triggerRouters) {
            if (triggerRouter.getTrigger().getChannelId().equals(channel.getChannelId())
                    && triggerRouter.getRouter().getNodeGroupLink().getSourceNodeGroupId().equals(nodeGroupId)
                    && !"default".equals(triggerRouter.getRouter().getRouterType())) {
                onlyDefaultRoutersAssigned = false;
            }/*from  w  w w .  j a v  a2s  . c  om*/
        }
    }

    if (!onlyDefaultRoutersAssigned.equals(defaultRouterOnlyLastKnownState.get(channelId))) {
        if (onlyDefaultRoutersAssigned) {
            log.info(
                    "The '{}' channel for the '{}' node group has only default routers assigned to it.  Change data won't be selected during routing",
                    channelId, nodeGroupId);
        }
        defaultRouterOnlyLastKnownState.put(channelId, onlyDefaultRoutersAssigned);
    }
    return onlyDefaultRoutersAssigned;
}

From source file:ro.nextreports.designer.PropertyPanel.java

private Boolean getUniqueWrapText() {
    Boolean wrap = null;
    int n = reportGridCells.size();
    for (int i = 0; i < n; i++) {
        BandElement element = reportGridCells.get(i).getValue();
        if (i == 0) {
            wrap = Boolean.valueOf(element.isWrapText());
            continue;
        }/*ww  w .j  a va  2 s.com*/
        if (!wrap.equals(element.isWrapText())) {
            return null;
        }
    }

    return wrap;
}

From source file:ro.nextreports.designer.PropertyPanel.java

private Boolean getUniqueRepeated() {
    Boolean repeated = null;
    int n = reportGridCells.size();
    for (int i = 0; i < n; i++) {
        BandElement element = reportGridCells.get(i).getValue();
        if (i == 0) {
            repeated = Boolean.valueOf(element.isRepeatedValue());
            continue;
        }//ww  w .  ja v a 2s . co m
        if (!repeated.equals(element.isRepeatedValue())) {
            return null;
        }
    }

    return repeated;
}

From source file:org.fao.geonet.services.user.Update.java

@RequestMapping(value = "/{lang}/admin.user.update", produces = { MediaType.APPLICATION_XML_VALUE,
        MediaType.APPLICATION_JSON_VALUE })
public @ResponseBody OkResponse run(HttpSession session, HttpServletRequest request,
        @RequestParam(value = Params.OPERATION) String operation,
        @RequestParam(value = Params.ID, required = false) String id,
        @RequestParam(value = Params.USERNAME) String username,
        @RequestParam(value = Params.PASSWORD, required = false) String password,
        @RequestParam(value = Params.PROFILE, required = false) String profile_,
        @RequestParam(value = Params.SURNAME) String surname, @RequestParam(value = Params.NAME) String name,
        @RequestParam(value = Params.ADDRESS, required = false) String address,
        @RequestParam(value = Params.CITY, required = false) String city,
        @RequestParam(value = Params.STATE, required = false) String state,
        @RequestParam(value = Params.ZIP, required = false) String zip,
        @RequestParam(value = Params.COUNTRY, required = false) String country,
        @RequestParam(value = Params.EMAIL) String email,
        @RequestParam(value = Params.ORG, required = false) String organ,
        @RequestParam(value = Params.KIND, required = false) String kind,
        @RequestParam(value = Params.ENABLED) Boolean enabled) throws Exception {
    if (id == null && operation.equalsIgnoreCase(Params.Operation.NEWUSER)) {
        id = "";/*w  w  w  .  ja v  a 2 s.c o  m*/
    }

    List<GroupElem> groups = new LinkedList<>();
    Profile profile = Profile.findProfileIgnoreCase(profile_);

    LoadCurrentUserInfo loadCurrentUserInfo = new LoadCurrentUserInfo(session, id).invoke();
    Profile myProfile = loadCurrentUserInfo.getMyProfile();
    String myUserId = loadCurrentUserInfo.getMyUserId();

    Map<String, String[]> params = request.getParameterMap();

    for (Map.Entry<String, String[]> entry : params.entrySet()) {
        String key = entry.getKey();
        if (key.startsWith("groups_")) {
            for (String s : entry.getValue()) {
                groups.add(new GroupElem(key.substring(7), Integer.valueOf(s)));
            }
        }
    }
    UserRepository userRepository = ApplicationContextHolder.get().getBean(UserRepository.class);

    if (profile == Profile.Administrator) {
        // Check at least 1 administrator is enabled
        if (StringUtils.isNotEmpty(id) && (enabled != null) && (enabled.equals(Boolean.FALSE))) {
            List<User> adminEnabledList = userRepository.findAll(Specifications
                    .where(UserSpecs.hasProfile(Profile.Administrator)).and(UserSpecs.hasEnabled(true)));
            if (adminEnabledList.size() == 1) {
                User adminUser = adminEnabledList.get(0);
                if (adminUser.getId() == Integer.parseInt(id)) {
                    throw new IllegalArgumentException(
                            "Trying to disable all administrator users is not allowed");
                }
            }
        }
    }

    UserGroupRepository userGroupRepository = ApplicationContextHolder.get().getBean(UserGroupRepository.class);

    checkAccessRights(operation, id, username, myProfile, myUserId, groups, userGroupRepository);

    User user = getUser(userRepository, operation, id, username);

    //If it is a useradmin updating,
    //maybe we don't know all the groups the user is part of
    if (!myProfile.equals(Profile.Administrator)) {
        List<Integer> myUserAdminGroups = userGroupRepository.findGroupIds(
                Specifications.where(hasProfile(myProfile)).and(hasUserId(Integer.valueOf(myUserId))));

        List<UserGroup> usergroups = userGroupRepository
                .findAll(Specifications.where(hasUserId(Integer.parseInt(id))));

        //keep unknown groups as is
        for (UserGroup ug : usergroups) {
            if (!myUserAdminGroups.contains(ug.getGroup().getId())) {
                groups.add(new GroupElem(ug.getProfile().name(), ug.getGroup().getId()));
            }
        }
    }

    setPassword(operation, password, user);
    if (operation.equalsIgnoreCase(Params.Operation.RESETPW)) {
        userRepository.save(user);
    } else {
        updateOrSave(operation, username, surname, name, address, city, state, zip, country, email, organ, kind,
                enabled, profile, myProfile, groups, user);
    }

    return new OkResponse();
}

From source file:org.fenixedu.qubdocs.ui.documentpurposetypes.DocumentPurposeTypeInstanceController.java

private List<DocumentPurposeTypeInstance> filterSearchDocumentPurposeTypeInstance(java.lang.String code,
        org.fenixedu.commons.i18n.LocalizedString name,
        org.fenixedu.academic.domain.serviceRequests.documentRequests.DocumentPurposeType documentPurposeType,
        java.lang.Boolean active) {

    return getSearchUniverseSearchDocumentPurposeTypeInstanceDataSet()
            .filter(documentPurposeTypeInstance -> code == null || code.length() == 0
                    || (documentPurposeTypeInstance.getCode() != null
                            && documentPurposeTypeInstance.getCode().length() > 0
                            && documentPurposeTypeInstance.getCode().toLowerCase()
                                    .contains(code.toLowerCase())))
            .filter(documentPurposeTypeInstance -> name == null || name.isEmpty()
                    || name.getLocales().stream()
                            .allMatch(locale -> documentPurposeTypeInstance.getName().getContent(locale) != null
                                    && documentPurposeTypeInstance.getName().getContent(locale).toLowerCase()
                                            .contains(name.getContent(locale).toLowerCase())))
            .filter(documentPurposeTypeInstance -> documentPurposeType == null
                    || documentPurposeType.equals(documentPurposeTypeInstance.getDocumentPurposeType()))
            .filter(documentPurposeTypeInstance -> active == null
                    || active.equals(documentPurposeTypeInstance.getActive()))
            .collect(Collectors.toList());
}

From source file:org.sakaiproject.component.app.messageforums.ui.UIPermissionsManagerImpl.java

public boolean isRead(Long topicId, Boolean isTopicDraft, Boolean isForumDraft, String userId, String siteId) {

    try {//w  ww  .  jav a 2 s.  c o m
        if (checkBaseConditions(null, null, userId, "/site/" + siteId)) {
            return true;
        }
        Iterator iter = getTopicItemsByUser(topicId, userId, siteId);
        while (iter.hasNext()) {
            DBMembershipItem item = (DBMembershipItem) iter.next();
            if (item.getPermissionLevel().getRead().booleanValue() && isForumDraft.equals(Boolean.FALSE)
            //            && forum.getLocked().equals(Boolean.FALSE)
                    && isTopicDraft.equals(Boolean.FALSE))
            //            && topic.getLocked().equals(Boolean.FALSE))
            {
                return true;
            }
        }

    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        return false;
    }
    return false;
}

From source file:org.sakaiproject.component.app.messageforums.ui.UIPermissionsManagerImpl.java

public boolean isModeratePostings(Long topicId, Boolean isForumLocked, Boolean isForumDraft,
        Boolean isTopicLocked, Boolean isTopicDraft, String userId, String siteId) {
    // NOTE: the forum or topic being locked should not affect a user's ability to moderate,
    // so logic related to the locked status was removed
    if (checkBaseConditions(null, null, userId, "/site/" + siteId)) {
        return true;
    }/*from ww  w . j ava2s .c o  m*/
    try {
        if (checkBaseConditions(null, null, userId, "/site/" + siteId)) {
            return true;
        }

        if (isTopicDraft == null || isTopicDraft.equals(Boolean.TRUE)) {
            LOG.debug("This topic is at draft stage " + topicId);
        }
        Iterator iter = getTopicItemsByUser(topicId, userId, siteId);
        while (iter.hasNext()) {
            DBMembershipItem item = (DBMembershipItem) iter.next();
            if (item.getPermissionLevel().getModeratePostings().booleanValue()
                    && isForumDraft.equals(Boolean.FALSE) && isTopicDraft.equals(Boolean.FALSE)) {
                return true;
            }
        }

    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        return false;
    }
    return false;
}

From source file:org.opendaylight.netvirt.openstack.netvirt.impl.NeutronL3Adapter.java

private boolean isPortSecurityEnableUpdated(NeutronPort neutronPort) {
    LOG.trace("isPortSecurityEnableUpdated: {}", neutronPort);
    if (neutronPort == null) {
        return false;
    }/* w  w w.  ja v a  2  s .c o m*/

    NeutronPort originalPort = neutronPort.getOriginalPort();
    if (originalPort == null) {
        return false;
    }

    Boolean originalPortSecurityEnabled = originalPort.getPortSecurityEnabled();
    if (originalPortSecurityEnabled == null) {
        return false;
    }

    return !originalPortSecurityEnabled.equals(neutronPort.getPortSecurityEnabled());
}

From source file:org.wso2.carbon.apimgt.gateway.mediators.XMLSchemaValidator.java

/**
 * This mediate method validates the xml request message.
 *
 * @param messageContext This message context contains the request message properties of the relevant
 *                       API which was enabled the XML_Validator message mediation in flow.
 * @return A boolean value.True if successful and false if not.
 *//*ww  w .  j  a va 2 s . c om*/
public boolean mediate(MessageContext messageContext) {
    if (logger.isDebugEnabled()) {
        logger.debug("XML validation mediator is activated...");
    }
    InputStream inputStreamSchema;
    InputStream inputStreamXml;
    Map<String, InputStream> inputStreams = null;
    Boolean xmlValidationStatus;
    Boolean schemaValidationStatus;
    APIMThreatAnalyzer apimThreatAnalyzer = null;
    String apiContext;
    String requestMethod;
    String contentType;
    boolean validRequest = true;
    org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext)
            .getAxis2MessageContext();
    requestMethod = axis2MC.getProperty(ThreatProtectorConstants.HTTP_REQUEST_METHOD).toString();
    Object contentTypeObject = axis2MC.getProperty(ThreatProtectorConstants.CONTENT_TYPE);
    if (contentTypeObject != null) {
        contentType = contentTypeObject.toString();
    } else {
        contentType = axis2MC.getProperty(ThreatProtectorConstants.SOAP_CONTENT_TYPE).toString();
    }
    apiContext = messageContext.getProperty(ThreatProtectorConstants.API_CONTEXT).toString();
    if (!APIConstants.SupportedHTTPVerbs.GET.name().equalsIgnoreCase(requestMethod)
            && (ThreatProtectorConstants.APPLICATION_XML.equals(contentType)
                    || ThreatProtectorConstants.TEXT_XML.equals(contentType))) {
        try {
            inputStreams = GatewayUtils.cloneRequestMessage(messageContext);
            if (inputStreams != null) {
                Object messageProperty = messageContext.getProperty(APIMgtGatewayConstants.XML_VALIDATION);
                if (messageProperty != null) {
                    xmlValidationStatus = Boolean.valueOf(messageProperty.toString());
                    if (xmlValidationStatus.equals(true)) {
                        XMLConfig xmlConfig = configureSchemaProperties(messageContext);
                        ConfigurationHolder.addXmlConfig(xmlConfig);
                        apimThreatAnalyzer = AnalyzerHolder.getAnalyzer(contentType);
                        inputStreamXml = inputStreams.get(ThreatProtectorConstants.XML);
                        apimThreatAnalyzer.analyze(inputStreamXml, apiContext);
                    }
                }
                messageProperty = messageContext.getProperty(APIMgtGatewayConstants.SCHEMA_VALIDATION);
                if (messageProperty != null) {
                    schemaValidationStatus = Boolean.valueOf(messageProperty.toString());
                    if (schemaValidationStatus.equals(true)) {
                        inputStreamSchema = inputStreams.get(ThreatProtectorConstants.SCHEMA);
                        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStreamSchema);
                        validateSchema(messageContext, bufferedInputStream);
                    }
                }
            }
        } catch (APIMThreatAnalyzerException e) {
            validRequest = false;
            logger.error(APIMgtGatewayConstants.BAD_REQUEST, e);
            GatewayUtils.handleThreat(messageContext, ThreatProtectorConstants.HTTP_SC_CODE, e.getMessage());

        } catch (IOException e) {
            logger.error(APIMgtGatewayConstants.BAD_REQUEST, e);
            GatewayUtils.handleThreat(messageContext, ThreatProtectorConstants.HTTP_SC_CODE, e.getMessage());
        }
        //return analyzer to the pool
        AnalyzerHolder.returnObject(apimThreatAnalyzer);
    } else {
        if (log.isDebugEnabled()) {
            log.debug("XML Schema Validator: " + APIMgtGatewayConstants.REQUEST_TYPE_FAIL_MSG);
        }
    }
    GatewayUtils.setOriginalInputStream(inputStreams, axis2MC);
    if (validRequest) {
        try {
            RelayUtils.buildMessage(axis2MC);
        } catch (IOException | XMLStreamException e) {
            logger.error("Error occurred while parsing the payload.", e);
            GatewayUtils.handleThreat(messageContext, APIMgtGatewayConstants.HTTP_SC_CODE, e.getMessage());
        }
    }
    return true;
}

From source file:velocitekProStartAnalyzer.MainWindow.java

private void setStartTime(String startTime) {
    Boolean flagTimeIsInPoints = false;
    Boolean flag = false;//  ww  w. j a v a 2  s.c o  m
    if (startTime.equals(null)) {
        return;
    }

    JDBCPointDao jdbcPointDao = new JDBCPointDao();
    jdbcPointDao.getConnection(dbName);
    try {
        jdbcPointDao.connection.setAutoCommit(false);
    } catch (SQLException e1) {
        e1.printStackTrace();
    }

    for (PointDto pointDto : JDBCPointDao.points) {
        String time = pointDto.getPointDateHHmmss();
        time = time.substring(0, time.length() - 3);
        if (time.equals(startTime)) {
            flagTimeIsInPoints = true;
            break;
        }
    }
    if (flagTimeIsInPoints.equals(true)) {
        for (PointDto pointDto : JDBCPointDao.points) {
            String time = pointDto.getPointDateHHmmss();
            time = time.substring(0, time.length() - 3);
            jdbcPointDao.deleteSelected(pointDto.getPointID());
            flag = true;
            if (time.equals(startTime)) {
                break;
            }
        }
        try {
            if (flag = true) {
                JDBCPointDao.pointsOld.clear();
                JDBCPointDao.pointsOld.addAll(JDBCPointDao.points);
            }
            jdbcPointDao.connection.commit();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    jdbcPointDao.closeConnection();
}