Example usage for java.lang Integer longValue

List of usage examples for java.lang Integer longValue

Introduction

In this page you can find the example usage for java.lang Integer longValue.

Prototype

public long longValue() 

Source Link

Document

Returns the value of this Integer as a long after a widening primitive conversion.

Usage

From source file:org.obm.push.mail.MailBackendImpl.java

@Override
public Long getEmailUidFromServerId(ServerId serverId) {
    Integer itemIdFromServerId = serverId.getItemId();
    if (itemIdFromServerId != null) {
        return itemIdFromServerId.longValue();
    } else {//from w  w w  .j a  v  a  2 s .c om
        return null;
    }
}

From source file:org.mifos.accounts.struts.action.EditStatusAction.java

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        @SuppressWarnings("unused") HttpServletResponse response) throws Exception {

    EditStatusActionForm actionForm = (EditStatusActionForm) form;
    actionForm.setSelectedItems(null);//from   w ww.ja  v  a  2 s .  c  om
    actionForm.setNotes(null);
    actionForm.setNewStatusId(null);
    actionForm.setFlagId(null);
    actionForm.setQuestionGroups(null);
    actionForm.setTransactionDate(DateUtils.makeDateAsSentFromBrowser());

    request.getSession().removeAttribute(Constants.BUSINESS_KEY);
    UserContext userContext = getUserContext(request);
    Integer accountId = Integer.valueOf(actionForm.getAccountId());
    AccountBO accountBO = new AccountBusinessService().getAccount(accountId);

    java.util.Date lastPaymentDate = new java.util.Date(0);
    AccountPaymentEntity lastPayment = accountBO.findMostRecentNonzeroPaymentByPaymentDate();
    if (lastPayment != null) {
        lastPaymentDate = lastPayment.getPaymentDate();
    }
    actionForm.setLastPaymentDate(lastPaymentDate);

    if (accountBO.isLoanAccount()) {
        // NOTE - not using dto values at present but available when ui is refactored away from jsp
        AccountStatusDto accountStatuses = this.loanAccountServiceFacade
                .retrieveAccountStatuses(accountId.longValue());

        LoanBO loanAccount = this.loanDao.findById(accountId);

        EditStatusActionForm editStatusActionForm = (EditStatusActionForm) form;
        editStatusActionForm.setAccountTypeId(AccountTypes.LOAN_ACCOUNT.getValue().toString());
        editStatusActionForm.setCurrentStatusId(loanAccount.getAccountState().getId().toString());
        editStatusActionForm.setGlobalAccountNum(loanAccount.getGlobalAccountNum());
        editStatusActionForm.setAccountName(loanAccount.getLoanOffering().getPrdOfferingName());
        editStatusActionForm.setInput("loan");
    }
    if (accountBO.isSavingsAccount()) {

        // NOTE - not using dto values at present but available when ui is refactored away from jsp
        AccountStatusDto accountStatuses = this.savingsServiceFacade
                .retrieveAccountStatuses(accountId.longValue());

        SavingsBO savingsAccount = this.savingsDao.findById(accountId.longValue());

        EditStatusActionForm editStatusActionForm = (EditStatusActionForm) form;
        editStatusActionForm.setAccountTypeId(AccountTypes.SAVINGS_ACCOUNT.getValue().toString());
        editStatusActionForm.setCurrentStatusId(savingsAccount.getAccountState().getId().toString());
        editStatusActionForm.setGlobalAccountNum(savingsAccount.getGlobalAccountNum());
        editStatusActionForm.setAccountName(savingsAccount.getSavingsOffering().getPrdOfferingName());
        editStatusActionForm.setInput("savings");
    }
    List<AccountStateEntity> accountStatuses = new AccountBusinessService()
            .getStatusList(accountBO.getAccountState(), accountBO.getType(), userContext.getLocaleId());

    for (AccountStateEntity customerStatusEntity : accountStatuses) {
        for (AccountStateFlagEntity flag : customerStatusEntity.getFlagSet()) {
            String statusMessageText = ApplicationContextProvider.getBean(MessageLookup.class)
                    .lookup(flag.getLookUpValue().getPropertiesKey());
            flag.setStatusFlagMessageText(statusMessageText);
        }
    }

    SessionUtils.setAttribute(Constants.BUSINESS_KEY, accountBO, request);
    SessionUtils.setCollectionAttribute(SavingsConstants.STATUS_LIST, accountStatuses, request);
    return mapping.findForward(ActionForwards.load_success.toString());
}

From source file:org.mifosplatform.infrastructure.scheduledemail.service.EmailCampaignWritePlatformCommandHandlerImpl.java

private void insertDirectCampaignIntoEmailOutboundTable(final String emailParams, final String emailSubject,
        final String messageTemplate, final String campaignName, final Long campaignId) {
    try {//from   w  w w .  j av a  2 s.c o  m
        HashMap<String, String> campaignParams = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        HashMap<String, String> queryParamForRunReport = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        List<HashMap<String, Object>> runReportObject = this
                .getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);

        if (runReportObject != null) {
            for (HashMap<String, Object> entry : runReportObject) {
                String message = this.compileEmailTemplate(messageTemplate, campaignName, entry);
                Integer clientId = (Integer) entry.get("id");
                EmailCampaign emailCampaign = this.emailCampaignRepository.findOne(campaignId);
                Client client = this.clientRepository.findOne(clientId.longValue());
                String emailAddress = client.emailAddress();

                if (emailAddress != null && isValidEmail(emailAddress)) {
                    EmailMessage emailMessage = EmailMessage.pendingEmail(null, client, null, emailCampaign,
                            emailSubject, message, emailAddress, campaignName);
                    this.emailMessageRepository.save(emailMessage);
                }
            }
        }
    } catch (final IOException e) {
        // TODO throw something here
    }

}

From source file:org.apache.fineract.infrastructure.scheduledemail.service.EmailCampaignWritePlatformCommandHandlerImpl.java

@Override
public PreviewCampaignMessage previewMessage(final JsonQuery query) {
    PreviewCampaignMessage campaignMessage = null;
    final AppUser currentUser = this.context.authenticatedUser();
    this.emailCampaignValidator.validatePreviewMessage(query.json());
    final String emailParams = this.fromJsonHelper.extractStringNamed("paramValue", query.parsedJson());
    final String textMessageTemplate = this.fromJsonHelper.extractStringNamed("emailMessage",
            query.parsedJson());// w ww .  ja  v a2 s. co m

    final Long campaignId = this.fromJsonHelper.extractLongNamed("campaignId", query.parsedJson());

    EmailCampaign emailCampaign = null;
    HashMap<String, String> reportStretchyParams = null;

    if (campaignId != null) {
        emailCampaign = this.emailCampaignRepository.findOne(campaignId);
        reportStretchyParams = this.validateStretchyReportParamMap(emailCampaign.getStretchyReportParamMap());
    }

    try {
        HashMap<String, String> campaignParams = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        HashMap<String, String> queryParamForRunReport = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        List<HashMap<String, Object>> runReportObject = this
                .getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);
        // preview attachment report params

        if (runReportObject != null) {
            for (HashMap<String, Object> entry : runReportObject) {
                // add string object to campaignParam object
                String textMessage = this.compileEmailTemplate(textMessageTemplate, "EmailCampaign", entry);
                if (!textMessage.isEmpty()) {
                    final Integer totalMessage = runReportObject.size();
                    String reportStretchyParam = null;
                    Object var = "id";
                    Integer clientId = (Integer) entry.get(var);
                    final Client client = this.clientRepositoryWrapper
                            .findOneWithNotFoundDetection(clientId.longValue());
                    if (reportStretchyParams != null) {
                        HashMap<String, String> reportParams = this
                                .replaceStretchyParamsWithActualClientParams(reportStretchyParams, client);
                        this.replaceStretchyParamsWithActualLoansOrSavingsParam(reportStretchyParams, client); // add loans or savings id to report params only one object
                        if (reportParams != null) {
                            reportStretchyParam = reportParams.toString();
                        }
                    }
                    campaignMessage = new PreviewCampaignMessage(textMessage, totalMessage,
                            reportStretchyParam);
                    break;
                }
            }
        }
    } catch (final IOException e) {
        // TODO throw something here
    }

    return campaignMessage;

}

From source file:org.apache.fineract.infrastructure.scheduledemail.service.EmailCampaignWritePlatformCommandHandlerImpl.java

private void insertDirectCampaignIntoEmailOutboundTable(final String emailParams, final String emailSubject,
        final String messageTemplate, final String campaignName, final Long campaignId) {
    try {/*ww w  . j  av  a  2  s .  c  o  m*/
        HashMap<String, String> campaignParams = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        HashMap<String, String> queryParamForRunReport = new ObjectMapper().readValue(emailParams,
                new TypeReference<HashMap<String, String>>() {
                });

        List<HashMap<String, Object>> runReportObject = this
                .getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);

        if (runReportObject != null) {
            for (HashMap<String, Object> entry : runReportObject) {
                String message = this.compileEmailTemplate(messageTemplate, campaignName, entry);
                Integer clientId = (Integer) entry.get("id");
                EmailCampaign emailCampaign = this.emailCampaignRepository.findOne(campaignId);
                Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId.longValue());
                String emailAddress = client.emailAddress();

                if (emailAddress != null && isValidEmail(emailAddress)) {
                    EmailMessage emailMessage = EmailMessage.pendingEmail(null, client, null, emailCampaign,
                            emailSubject, message, emailAddress, campaignName);
                    this.emailMessageRepository.save(emailMessage);
                }
            }
        }
    } catch (final IOException e) {
        // TODO throw something here
    }

}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>+</code> operator applied to nullable int and long values. */
public static Long plus(Integer b0, Long b1) {
    return (b0 == null || b1 == null) ? null : (b0.longValue() + b1.longValue());
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>-</code> operator applied to nullable int and long values. */
public static Long minus(Integer b0, Long b1) {
    return (b0 == null || b1 == null) ? null : (b0.longValue() - b1.longValue());
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>/</code> operator applied to nullable int and long values. */
public static Long divide(Integer b0, Long b1) {
    return (b0 == null || b1 == null) ? null : (b0.longValue() / b1.longValue());
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>*</code> operator applied to nullable int and long values. */
public static Long multiply(Integer b0, Long b1) {
    return (b0 == null || b1 == null) ? null : (b0.longValue() * b1.longValue());
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>+</code> operator applied to nullable long and int values. */
public static Long plus(Long b0, Integer b1) {
    return (b0 == null || b1 == null) ? null : (b0.longValue() + b1.longValue());
}