当前位置: 首页>>代码示例>>Java>>正文


Java Pair.getSecond方法代码示例

本文整理汇总了Java中nl.strohalm.cyclos.utils.Pair.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getSecond方法的具体用法?Java Pair.getSecond怎么用?Java Pair.getSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nl.strohalm.cyclos.utils.Pair的用法示例。


在下文中一共展示了Pair.getSecond方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeQuery

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected List<?> executeQuery(final ActionContext context) {
    final MembersReportHandler reportHandler = getReportHandler();
    final Pair<MembersTransactionsReportDTO, Iterator<MemberTransactionSummaryReportData>> pair = reportHandler.handleTransactionsSummary(context);
    final MembersTransactionsReportDTO dto = pair.getFirst();
    final Iterator<MemberTransactionSummaryReportData> reportIterator = pair.getSecond();
    final Iterator iterator = IteratorUtils.filteredIterator(reportIterator, new Predicate() {
        @Override
        public boolean evaluate(final Object element) {
            final MemberTransactionSummaryReportData data = (MemberTransactionSummaryReportData) element;
            if (dto.isIncludeNoTraders()) {
                return true;
            }
            return data.isHasData();
        }
    });
    return new IteratorListImpl(iterator);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:20,代码来源:ExportMembersTransactionsReportToCsvAction.java

示例2: executeQuery

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected List<?> executeQuery(final ActionContext context) {
    final MembersReportHandler reportHandler = getReportHandler();
    final Pair<MembersTransactionsReportDTO, Iterator<MemberTransactionDetailsReportData>> pair = reportHandler.handleTransactionsDetails(context);
    final MembersTransactionsReportDTO dto = pair.getFirst();
    final Iterator<MemberTransactionDetailsReportData> reportIterator = pair.getSecond();
    final Iterator iterator = IteratorUtils.filteredIterator(reportIterator, new Predicate() {
        @Override
        public boolean evaluate(final Object element) {
            final MemberTransactionDetailsReportData data = (MemberTransactionDetailsReportData) element;
            if (dto.isIncludeNoTraders()) {
                return true;
            }
            return data.getAmount() != null;
        }
    });
    return new IteratorListImpl(iterator);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:20,代码来源:ExportMembersTransactionsDetailsToCsvAction.java

示例3: doChargeback

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
private ChargebackResult doChargeback(final Transfer transfer) {

        final Pair<ChargebackStatus, Transfer> preprocessResult = preprocessChargeback(transfer);
        ChargebackStatus status = preprocessResult.getFirst();
        Transfer chargebackTransfer = preprocessResult.getSecond();

        // Do the chargeback
        if (status == null) {
            chargebackTransfer = paymentServiceLocal.chargeback(transfer);
            status = ChargebackStatus.SUCCESS;
        }

        if (!status.isSuccessful()) {
            webServiceHelper.error("Chargeback result: " + status);
        }

        Member member = WebServiceContext.getMember();
        // Build the result
        if (status == ChargebackStatus.SUCCESS || status == ChargebackStatus.TRANSFER_ALREADY_CHARGEDBACK) {
            AccountHistoryTransferVO originalVO = null;
            AccountHistoryTransferVO chargebackVO = null;
            try {
                final AccountOwner owner = member == null ? transfer.getToOwner() : member;
                originalVO = accountHelper.toVO(owner, transfer, null);
                chargebackVO = accountHelper.toVO(owner, chargebackTransfer, null);
            } catch (Exception e) {
                webServiceHelper.error(e);
                if (applicationServiceLocal.getLockedAccountsOnPayments() == LockedAccountsOnPayments.NONE) {
                    // The chargeback is committed on the same transaction so it will be rolled back by this exception, then status is given by this
                    // exception.
                    status = ChargebackStatus.TRANSFER_CANNOT_BE_CHARGEDBACK;
                }
                // When the locking method is not NONE, the chargeback is committed on a new transaction so we'll preserve the status.
            }
            return new ChargebackResult(status, originalVO, chargebackVO);
        } else {
            return new ChargebackResult(status, null, null);
        }
    }
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:40,代码来源:PaymentWebServiceImpl.java

示例4: handleUnknownException

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
/**
 * Handles {@link Exception}s
 */
@ExceptionHandler(Exception.class)
@ResponseBody
public ServerErrorVO handleUnknownException(final Exception ex, final HttpServletResponse response) throws IOException {
    Pair<ServerErrorVO, Integer> error = RestHelper.resolveError(ex);
    int errorCode = error.getSecond();
    if (errorCode == HttpServletResponse.SC_INTERNAL_SERVER_ERROR) {
        LOG.error("Error on REST call", ex);
    }
    response.setStatus(errorCode);
    return error.getFirst();
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:BaseRestController.java

示例5: getSecondFromPairCollection

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
/**
 * takes the second elements of a <code>Collection</code> of <code>Pair</code>s, and returns them in a List
 * 
 * @param <S> the type of the frist element of the <code>Pair</code>s in the input collection
 * @param <T> the type of the second element of the <code>Pair</code>s in the input collection
 * @param collection the input <code>Collection</code> with <code>Pair</code>s
 * @return a List with only the second elements of the <code>Pair</code>s.
 */
public static <S, T> List<T> getSecondFromPairCollection(final Collection<Pair<S, T>> collection) {
    final List<T> seconds = new ArrayList<T>();
    for (final Pair<S, T> pair : collection) {
        final T t = pair.getSecond();
        seconds.add(t);
    }
    return seconds;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:17,代码来源:ListOperations.java

示例6: getTopTenFromPairList

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
/**
 * Common method for getting the personal top ten from a Pair List. Fits for all top tens.
 * 
 * @param <S> The first element Type of the Pair which is in the <code>rawDataPairList</code>. This extends <code>Entity</code> and is
 * <code>Member</code> for grossProduct and Number of transactions, and <code>User</code> for logins.
 * @param <T> The second element Type of the Pair which is in the <code>rawDataPairList</code>. This type extends <code>Number</code> and contains
 * the score of the member.
 * @param rawDataPairList. The List with results. The List contains <code>Pair</code>s, where the first element represents the member, and the
 * second element the score of that member.
 * @param baseKey a String representing the base key for the language resource bundle.
 * @param queryParameters a <code>StatisticalActivityQuery</code> containing the parameters of the form.
 * @return a <code>StatisticalResultDTO</code> containing all information to build the table in the jsp.
 */
private <S extends Entity, T extends Number> StatisticalResultDTO getTopTenFromPairList(final List<Pair<S, T>> rawDataPairList, final String baseKey, final StatisticalActivityQuery queryParameters) {
    int last = 10;
    if (rawDataPairList.size() < last) {
        last = rawDataPairList.size();
    }
    // determine if there are any more members beyond number 10 having the same score as number 10
    int extraItems = 0;
    if (last == 10) {
        final List<T> loginTimes = ListOperations.getSecondFromPairCollection(rawDataPairList);
        final int lastIndex = loginTimes.lastIndexOf(loginTimes.get(9));
        if (lastIndex > 9) {
            extraItems = lastIndex - 9;
        }
    }
    final String[] rowHeaders = new String[last + (extraItems > 0 ? 1 : 0)];
    final StatisticalResultDTO.ResourceKey[] rowKeys = new StatisticalResultDTO.ResourceKey[last + (extraItems > 0 ? 1 : 0)];
    final Number[][] tableData = new Number[last + (extraItems > 0 ? 1 : 0)][1];
    for (int i = 0; i < last; i++) {
        final Pair<S, T> pair = rawDataPairList.get(i);
        tableData[i][0] = pair.getSecond();
        rowKeys[i] = new StatisticalResultDTO.ResourceKey("");
        final S entity = pair.getFirst();
        if (entity instanceof Member) {
            rowHeaders[i] = "" + (i + 1) + " - " + ((Member) entity).getName();
        } else {
            rowHeaders[i] = "" + (i + 1) + " - " + ((User) entity).getUsername();
        }
        // if there are more members with the same score as number 10, add an extra item saying how many
        if (i == 9 && extraItems > 0) {
            tableData[10][0] = pair.getSecond();
            rowKeys[10] = new StatisticalResultDTO.ResourceKey("reports.stats.activity.topten.andMore", new Object[] { extraItems });
        }
    }
    StatisticalResultDTO result = null;
    if (last > 0) {
        result = new StatisticalResultDTO(tableData);
        result.setBaseKey(baseKey);
        result.setRowKeys(rowKeys);
        for (int i = 0; i < rowHeaders.length - (extraItems > 0 ? 1 : 0); i++) {
            result.setRowHeader(rowHeaders[i], i);
        }
        result.setColumnKeys(new String[] { baseKey + ".col1" });
        passGroupFilter(result, queryParameters);
        passPaymentFilter(result, queryParameters);
    } else {
        result = StatisticalResultDTO.noDataAvailable(baseKey);
    }
    return result;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:63,代码来源:StatisticalActivityServiceImpl.java

示例7: getSecondNumberFromPairCollection

import nl.strohalm.cyclos.utils.Pair; //导入方法依赖的package包/类
/**
 * takes the second elements of a <code>Collection</code> of <code>Pair</code>s, and returns them in a List. Same as
 * <code>getSecondFromPairCollection</code>, but returns a List<Number>, where <code>getSecondFromPairList</code> returns the type of second
 * element of the Pair
 * 
 * @param <S> the type of the first element of the <code>Pair</code>s in the input collection
 * @param <T> the type of the second element of the <code>Pair</code>s in the input collection, must extend <code>Number</code>.
 * @param collection the input <code>Collection</code> with <code>Pair</code>s
 * @return a List<Number> with only the second elements of the <code>Pair</code>s.
 */
public static <S, T extends Number> List<Number> getSecondNumberFromPairCollection(final Collection<Pair<S, T>> collection) {
    final List<Number> seconds = new ArrayList<Number>();
    for (final Pair<S, T> pair : collection) {
        final T t = pair.getSecond();
        seconds.add(t);
    }
    return seconds;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:ListOperations.java


注:本文中的nl.strohalm.cyclos.utils.Pair.getSecond方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。