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.exoplatform.addons.es.index.impl.ElasticIndexingOperationProcessor.java

@Override
public void addConnector(IndexingServiceConnector indexingServiceConnector, Boolean override) {
    if (getConnectors().containsKey(indexingServiceConnector.getType()) && override.equals(false)) {
        LOG.error("Impossible to add connector {}. A connector with the same name has already been registered.",
                indexingServiceConnector.getType());
    } else {/*from w  w  w.ja va2  s.  c o m*/
        getConnectors().put(indexingServiceConnector.getType(), indexingServiceConnector);
        LOG.info("An Indexing Connector has been added: {}", indexingServiceConnector.getType());
    }
}

From source file:org.sloth.web.report.EditReportController.java

/**
 * Handles the {@code POST} request and saves the changes made to the
 * {@code Report}./*  ww  w  .j a va 2  s .  co  m*/
 */
@RequestMapping(method = RequestMethod.POST)
public String handlePost(@PathVariable Long id, @ModelAttribute(PROCESSED_ATTRIBUTE) Boolean processed,
        @ModelAttribute(REPORT_ATTRIBUTE) Report report, BindingResult result, SessionStatus status,
        HttpSession session, HttpServletResponse response) throws IOException {
    if (isAuth(session)) {
        if (report == null) {
            return notFoundView(response);
        } else if (!isAdmin(session) && !processed.equals(Boolean.valueOf(report.isProcessed()))) {
            return forbiddenView(response);
        } else if (isAdmin(session) || isOwnReport(session, report)) {
            this.reportValidator.validate(report, result);
            if (result.hasErrors()) {
                return VIEW;
            }
            status.setComplete();
            try {
                this.observationService.updateReport(report);
            } catch (Exception e) {
                logger.warn("Unexpected Exception", e);
                return internalErrorView(response);
            } finally {
                status.setComplete();
            }
            return "redirect:/r";
        }
    }
    return forbiddenView(response);
}

From source file:org.egov.wtms.web.controller.application.ChangeOfUseController.java

@RequestMapping(value = "/changeOfUse/changeOfUse-create", method = RequestMethod.POST)
public String create(@Valid @ModelAttribute final WaterConnectionDetails changeOfUse,
        final BindingResult resultBinder, final RedirectAttributes redirectAttributes,
        final HttpServletRequest request, final Model model, @RequestParam final String workFlowAction,
        final BindingResult errors) {
    final Boolean isCSCOperator = waterTaxUtils.isCSCoperator(securityUtils.getCurrentUser());
    final Boolean citizenPortalUser = waterTaxUtils.isCitizenPortalUser(securityUtils.getCurrentUser());
    final Boolean loggedInMeesevaUser = waterTaxUtils.isMeesevaUser(securityUtils.getCurrentUser());
    final Boolean isAnonymousUser = waterTaxUtils.isAnonymousUser(securityUtils.getCurrentUser());
    model.addAttribute("isAnonymousUser", isAnonymousUser);
    if (loggedInMeesevaUser && request.getParameter("meesevaApplicationNumber") != null)
        changeOfUse.setMeesevaApplicationNumber(request.getParameter("meesevaApplicationNumber"));
    model.addAttribute("citizenPortalUser", citizenPortalUser);
    if (!isCSCOperator && !citizenPortalUser && !loggedInMeesevaUser && !isAnonymousUser) {
        final Boolean isJuniorAsstOrSeniorAsst = waterTaxUtils
                .isLoggedInUserJuniorOrSeniorAssistant(securityUtils.getCurrentUser().getId());
        if (!isJuniorAsstOrSeniorAsst)
            throw new ValidationException("err.creator.application");
    }//from w  w w.  j  ava2  s .com
    final List<ApplicationDocuments> applicationDocs = new ArrayList<>();
    final WaterConnectionDetails connectionUnderChange = waterConnectionDetailsService
            .findByConsumerCodeAndConnectionStatus(changeOfUse.getConnection().getConsumerCode(),
                    ConnectionStatus.ACTIVE);
    final WaterConnectionDetails parent = waterConnectionDetailsService.getParentConnectionDetails(
            connectionUnderChange.getConnection().getPropertyIdentifier(), ConnectionStatus.ACTIVE);
    String message = "";
    if (parent != null)
        message = changeOfUseService.validateChangeOfUseConnection(parent);
    String consumerCode = "";
    if (!message.isEmpty() && !"".equals(message)) {
        if (changeOfUse.getConnection().getParentConnection() != null)
            consumerCode = changeOfUse.getConnection().getParentConnection().getConsumerCode();
        else
            consumerCode = changeOfUse.getConnection().getConsumerCode();
        return "redirect:/application/changeOfUse/" + consumerCode;
    }
    int i = 0;
    if (!changeOfUse.getApplicationDocs().isEmpty())
        for (final ApplicationDocuments applicationDocument : changeOfUse.getApplicationDocs()) {
            if (applicationDocument.getDocumentNumber() == null
                    && applicationDocument.getDocumentDate() != null) {
                final String fieldError = "applicationDocs[" + i + "].documentNumber";
                resultBinder.rejectValue(fieldError, "documentNumber.required");
            }
            if (applicationDocument.getDocumentNumber() != null
                    && applicationDocument.getDocumentDate() == null) {
                final String fieldError = "applicationDocs[" + i + "].documentDate";
                resultBinder.rejectValue(fieldError, "documentDate.required");
            } else if (connectionDetailService.validApplicationDocument(applicationDocument))
                applicationDocs.add(applicationDocument);
            i++;
        }
    if (ConnectionType.NON_METERED.equals(changeOfUse.getConnectionType()))
        waterConnectionDetailsService.validateWaterRateAndDonationHeader(changeOfUse);
    if (resultBinder.hasErrors()) {
        final WaterConnectionDetails parentConnectionDetails = waterConnectionDetailsService
                .getActiveConnectionDetailsByConnection(changeOfUse.getConnection());
        loadBasicData(model, parentConnectionDetails, changeOfUse, changeOfUse,
                changeOfUse.getMeesevaApplicationNumber());
        final WorkflowContainer workflowContainer = new WorkflowContainer();
        workflowContainer.setAdditionalRule(changeOfUse.getApplicationType().getCode());
        prepareWorkflow(model, changeOfUse, workflowContainer);
        model.addAttribute("approvalPosOnValidate", request.getParameter(APPROVAL_POSITION));
        model.addAttribute("additionalRule", changeOfUse.getApplicationType().getCode());
        model.addAttribute("validationmessage", resultBinder.getFieldErrors().get(0).getField() + " = "
                + resultBinder.getFieldErrors().get(0).getDefaultMessage());
        model.addAttribute("stateType", changeOfUse.getClass().getSimpleName());
        model.addAttribute("currentUser", waterTaxUtils.getCurrentUserRole(securityUtils.getCurrentUser()));

        return CHANGEOFUSE_FORM;

    }
    if (changeOfUse.getState() == null)
        changeOfUse.setStatus(waterTaxUtils.getStatusByCodeAndModuleType(
                WaterTaxConstants.APPLICATION_STATUS_CREATED, WaterTaxConstants.MODULETYPE));

    changeOfUse.getApplicationDocs().clear();
    changeOfUse.setApplicationDocs(applicationDocs);

    processAndStoreApplicationDocuments(changeOfUse);

    Long approvalPosition = 0l;
    String approvalComent = "";

    if (request.getParameter("approvalComent") != null)
        approvalComent = request.getParameter("approvalComent");

    if (request.getParameter(APPROVAL_POSITION) != null && !request.getParameter(APPROVAL_POSITION).isEmpty())
        approvalPosition = Long.valueOf(request.getParameter(APPROVAL_POSITION));
    final Boolean applicationByOthers = waterTaxUtils.getCurrentUserRole(securityUtils.getCurrentUser());

    if (applicationByOthers != null && applicationByOthers.equals(true) || citizenPortalUser
            || isAnonymousUser) {
        final Position userPosition = waterTaxUtils
                .getZonalLevelClerkForLoggedInUser(changeOfUse.getConnection().getPropertyIdentifier());
        if (userPosition != null)
            approvalPosition = userPosition.getId();
        else {
            final WaterConnectionDetails parentConnectionDetails = waterConnectionDetailsService
                    .getActiveConnectionDetailsByConnection(changeOfUse.getConnection());
            loadBasicData(model, parentConnectionDetails, changeOfUse, changeOfUse, null);
            final WorkflowContainer workflowContainer = new WorkflowContainer();
            workflowContainer.setAdditionalRule(changeOfUse.getApplicationType().getCode());
            prepareWorkflow(model, changeOfUse, workflowContainer);
            model.addAttribute("additionalRule", changeOfUse.getApplicationType().getCode());
            model.addAttribute("stateType", changeOfUse.getClass().getSimpleName());
            model.addAttribute("currentUser", waterTaxUtils.getCurrentUserRole(securityUtils.getCurrentUser()));
            errors.rejectValue("connection.propertyIdentifier", "err.validate.connection.user.mapping",
                    "err.validate.connection.user.mapping");
            model.addAttribute("noJAORSAMessage", "No JA/SA exists to forward the application.");
            return CHANGEOFUSE_FORM;
        }
    }
    changeOfUse.setApplicationDate(new Date());
    if (isAnonymousUser)
        changeOfUse.setSource(ONLINE);
    else if (isCSCOperator)
        changeOfUse.setSource(CSC);
    else if (citizenPortalUser
            && (changeOfUse.getSource() == null || StringUtils.isBlank(changeOfUse.getSource().toString())))
        changeOfUse.setSource(waterTaxUtils.setSourceOfConnection(securityUtils.getCurrentUser()));
    else if (loggedInMeesevaUser) {
        changeOfUse.setSource(MEESEVA);
        if (changeOfUse.getMeesevaApplicationNumber() != null)
            changeOfUse.setApplicationNumber(changeOfUse.getMeesevaApplicationNumber());
    } else
        changeOfUse.setSource(Source.SYSTEM);
    changeOfUseService.createChangeOfUseApplication(changeOfUse, approvalPosition, approvalComent,
            changeOfUse.getApplicationType().getCode(), workFlowAction);

    if (loggedInMeesevaUser)
        return "redirect:/application/generate-meesevareceipt?transactionServiceNumber="
                + changeOfUse.getApplicationNumber();
    else
        return "redirect:/application/citizeenAcknowledgement?pathVars=" + changeOfUse.getApplicationNumber();
}

From source file:de.spiritcroc.ownlog.ui.fragment.MultiSelectTagDialog.java

private boolean selectionChangedAt(int position) {
    Boolean init = mTagInitSelection.get(position);
    Boolean current = mTagSelection.get(position);
    return ((init == null) != (current == null)) || (init != null && !init.equals(current));
}

From source file:pt.webdetails.cpf.utils.PluginUtils.java

/**
 * Calls out for resources in the plugin, on the specified path
 *
 * @param elementPath Relative to the plugin directory
 * @param recursive Do we want to enable recursivity?
 * @param pattern regular expression to filter the files
 * @return Files found/*from w  w w .  j  av a2  s . c o m*/
 */
@Override
public Collection<File> getPluginResources(String elementPath, Boolean recursive, String pattern) {

    IOFileFilter fileFilter = TrueFileFilter.TRUE;

    if (pattern != null && !pattern.equals("")) {
        fileFilter = new RegexFileFilter(pattern);
    }

    IOFileFilter dirFilter = recursive.equals(Boolean.TRUE) ? TrueFileFilter.TRUE : null;
    // TODO: why doesn't this use repository access?
    // Get directory name. We need to make sure we're not allowing this to fetch other resources
    String basePath = null;
    String elementFullPath = null;

    try {
        basePath = URLDecoder.decode(FilenameUtils.normalize(getPluginDirectory().getAbsolutePath()),
                CharsetHelper.getEncoding());
        elementFullPath = URLDecoder.decode(FilenameUtils.normalize(basePath + File.separator + elementPath),
                CharsetHelper.getEncoding());
    } catch (UnsupportedEncodingException e) {
        //CharseHelper.getEncoding() returns a valid encoding
    }

    if (!elementFullPath.startsWith(basePath)) {
        logger.warn("PluginUtils.getPluginResources is trying to access a parent path - denied : "
                + elementFullPath);
        return null;
    }

    File dir = new File(elementFullPath);
    if (!dir.exists() || !dir.isDirectory()) {
        return null;
    }

    return FileUtils.listFiles(dir, fileFilter, dirFilter);

}

From source file:org.jbuilt.common.renderkit.html.HtmlRendererUtils.java

public static void renderFormSubmitScript(FacesContext facesContext) throws IOException {

    Map map = facesContext.getExternalContext().getRequestMap();
    Boolean firstScript = (Boolean) map.get(FIRST_SUBMIT_SCRIPT_ON_PAGE);

    if (firstScript == null || firstScript.equals(Boolean.TRUE)) {
        map.put(FIRST_SUBMIT_SCRIPT_ON_PAGE, Boolean.FALSE);
        HtmlRendererUtils.renderFormSubmitScriptIfNecessary(facesContext);

    }//from  w  w  w .j  a v  a2  s . com
}

From source file:com.sapienter.jbilling.server.metafields.MetaFieldHelper.java

/**
 * Usefull method for updating meta fields with validation before entity saving
 * @param entity    target entity//  ww  w  .j a v a2s .co  m
 * @param dto       dto with new data
 */
public static void updateMetaFieldsWithValidation(Integer languageId, Integer entityId, Integer accountTypeId,
        MetaContent entity, MetaContent dto, Boolean global) {
    List<EntityType> entityTypes = new LinkedList(Arrays.asList(entity.getCustomizedEntityType()));
    if (entityTypes.contains(EntityType.ACCOUNT_TYPE)) {
        entityTypes.remove(EntityType.ACCOUNT_TYPE);
    }

    Map<String, MetaField> availableMetaFields = MetaFieldBL.getAvailableFields(entityId,
            entityTypes.toArray(new EntityType[entityTypes.size()]));

    for (String fieldName : availableMetaFields.keySet()) {
        MetaFieldValue newValue = dto.getMetaField(fieldName, null);
        MetaFieldValue prevValue = entity.getMetaField(fieldName, null);
        if (newValue == null) { // try to search by id, may be temp fix
            MetaField metaFieldName = availableMetaFields.get(fieldName);
            newValue = dto.getMetaField(metaFieldName.getId());
        }
        // TODO: (VCA) - we want the null values for the validation
        // if ( null != newValue && null != newValue.getValue() ) {

        if (newValue != null) {
            entity.setMetaField(entityId, null, fieldName, newValue.getValue());
        } else if ((global != null) && global.equals(Boolean.TRUE) && (prevValue != null)) {
            /*
             * if user edits a global category and retains its global scope
             * then don't filter out null meta-fields and retain previous values
             * */
            entity.setMetaField(entityId, null, fieldName, prevValue.getValue());
        } else {
            /*
             * if user edits a global category and marks it as non-global only then filter out null meta-fields
             * */
            entity.setMetaField(entityId, null, fieldName, null);
        }
        // } //else {
        //no point creating null/empty-value records in db
        //}
    }

    // Updating and validating of ait meta fields is done in a separate method
    for (MetaFieldValue value : entity.getMetaFields()) {
        MetaFieldBL.validateMetaField(languageId, value.getField(), value, entity);
    }

    removeEmptyMetaFields(entity);
}

From source file:org.nuxeo.apidoc.browse.NuxeoArtifactWebObject.java

@GET
@Produces("text/html")
@Path("createForm")
public Object doAddDoc(@QueryParam("inline") Boolean inline, @QueryParam("type") String type) {
    NuxeoArtifact nxItem = getNxArtifact();
    List<String> versions = getSnapshotManager().getAvailableVersions(ctx.getCoreSession(), nxItem);
    DocumentationItem docItem = new SimpleDocumentationItem(nxItem);
    String targetView = "../docForm";
    if (inline != null && inline.equals(Boolean.TRUE)) {
        targetView = "../../docItemForm";
    }// w w w .  jav  a 2  s .c  o m
    return getView(targetView).arg("nxItem", nxItem).arg("mode", "create").arg("docItem", docItem)
            .arg("versions", versions).arg("selectedTab", "docView").arg("preselectedType", type);
}

From source file:oscar.oscarEncounter.pageUtil.EctIncomingEncounterAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws IOException, ServletException {

    UtilDateUtilities dateConvert = new UtilDateUtilities();
    oscar.oscarSecurity.CookieSecurity cs = new oscar.oscarSecurity.CookieSecurity();
    EctSessionBean bean = new EctSessionBean();
    if (cs.FindThisCookie(request.getCookies(), CookieSecurity.providerCookie)) { //pass security???
        if (request.getParameter("appointmentList") != null) {
            bean = (EctSessionBean) request.getSession().getAttribute("EctSessionBean");
            bean.setUpEncounterPage(request.getParameter("appointmentNo"));
            bean.template = "";
        } else if (request.getParameter("demographicSearch") != null) {
            //Coming in from the demographicSearch page
            bean = (EctSessionBean) request.getSession().getAttribute("EctSessionBean");
            //demographicNo is passed from search screen
            bean.demographicNo = request.getParameter("demographicNo");
            //no curProviderNo when viewing eCharts from search screen
            //bean.curProviderNo="";
            //no reason when viewing eChart from search screen
            bean.reason = "";
            //userName is already set
            //bean.userName=request.getParameter("userName");
            //no appointmentDate from search screen keep old date
            //bean.appointmentDate="";
            //no startTime from search screen
            bean.startTime = "";
            //no status from search screen
            bean.status = "";
            //no date from search screen-keep old date
            //bean.date="";
            bean.check = "myCheck";
            bean.setUpEncounterPage();//  w  w  w .j a va2s .  c o m
            request.getSession().setAttribute("EctSessionBean", bean);
        } else {
            bean = new EctSessionBean();
            bean.currentDate = UtilDateUtilities.StringToDate(request.getParameter("curDate"));

            if (bean.currentDate == null) {
                bean.currentDate = UtilDateUtilities.Today();
            }

            bean.providerNo = request.getParameter("providerNo");
            if (bean.providerNo == null) {
                bean.providerNo = (String) request.getSession().getAttribute("user");
            }
            bean.demographicNo = request.getParameter("demographicNo");
            bean.appointmentNo = request.getParameter("appointmentNo");
            bean.curProviderNo = request.getParameter("curProviderNo");
            bean.reason = request.getParameter("reason");
            bean.encType = request.getParameter("encType");
            bean.userName = request.getParameter("userName");
            if (bean.userName == null) {
                bean.userName = ((String) request.getSession().getAttribute("userfirstname")) + " "
                        + ((String) request.getSession().getAttribute("userlastname"));
            }

            bean.myoscarMsgId = request.getParameter("myoscarmsg");
            if (request.getParameter("myoscarmsg") != null) {
                ResourceBundle props = ResourceBundle.getBundle("oscarResources", request.getLocale());
                try {
                    MessageTransfer messageTransfer = MyOscarMessagesHelper.readMessage(request.getSession(),
                            Long.parseLong(bean.myoscarMsgId));
                    String messageBeingRepliedTo = "";
                    String dateStr = "";
                    if (request.getParameter("remyoscarmsg") != null) {
                        MessageTransfer messageTransferOrig = MyOscarMessagesHelper.readMessage(
                                request.getSession(), Long.parseLong(request.getParameter("remyoscarmsg")));
                        dateStr = StringEscapeUtils.escapeHtml(DateUtils
                                .formatDateTime(messageTransferOrig.getSendDate(), request.getLocale()));
                        messageBeingRepliedTo = props.getString("myoscar.msg.From") + ": "
                                + StringEscapeUtils.escapeHtml(messageTransferOrig.getSenderPersonLastName()
                                        + ", " + messageTransferOrig.getSenderPersonFirstName())
                                + " (" + dateStr + ")\n" + messageTransferOrig.getContents()
                                + "\n-------------\n" + props.getString("myoscar.msg.Reply") + ":\n";
                    } else {
                        dateStr = StringEscapeUtils.escapeHtml(
                                DateUtils.formatDateTime(messageTransfer.getSendDate(), request.getLocale()));
                        messageBeingRepliedTo = props.getString("myoscar.msg.From")
                                + ": " + StringEscapeUtils.escapeHtml(messageTransfer.getSenderPersonLastName()
                                        + ", " + messageTransfer.getSenderPersonFirstName())
                                + " (" + dateStr + ")\n";
                    }
                    bean.reason = props.getString("myoscar.msg.SubjectPrefix") + " - "
                            + messageTransfer.getSubject();
                    bean.myoscarMsgId = messageBeingRepliedTo
                            + StringEscapeUtils.escapeHtml(messageTransfer.getContents()) + "\n";
                } catch (Exception myoscarEx) {
                    bean.oscarMsg = "myoscar message was not retrieved";
                    log.error("ERROR retrieving message", myoscarEx);
                }

            }

            bean.appointmentDate = request.getParameter("appointmentDate");
            bean.startTime = request.getParameter("startTime");
            bean.status = request.getParameter("status");
            bean.date = request.getParameter("date");
            bean.check = "myCheck";
            bean.oscarMsgID = request.getParameter("msgId");
            bean.setUpEncounterPage();
            request.getSession().setAttribute("EctSessionBean", bean);
            request.getSession().setAttribute("eChartID", bean.eChartId);
            if (request.getParameter("source") != null) {
                bean.source = request.getParameter("source");
            }

        }
    } else {
        return (mapping.findForward("failure"));
    }

    ArrayList newDocArr = (ArrayList) request.getSession().getServletContext().getAttribute("newDocArr");
    Boolean useNewEchart = (Boolean) request.getSession().getServletContext().getAttribute("useNewEchart");

    String proNo = (String) request.getSession().getAttribute("user");
    if (proNo != null && newDocArr != null && Collections.binarySearch(newDocArr, proNo) >= 0) {
        return (mapping.findForward("success2"));
    } else if (useNewEchart != null && useNewEchart.equals(Boolean.TRUE)) {
        return (mapping.findForward("success2"));
    } else {
        return (mapping.findForward("success"));
    }

}

From source file:org.openmrs.module.pmtct.web.controller.PmtctMaternityController.java

private Double changeBoolean(Boolean b) {
    if (b.equals(true))
        return 1.0;
    else//from   ww w .  j  av  a  2  s .co m
        return 0.0;
}