Example usage for java.util Map clear

List of usage examples for java.util Map clear

Introduction

In this page you can find the example usage for java.util Map clear.

Prototype

void clear();

Source Link

Document

Removes all of the mappings from this map (optional operation).

Usage

From source file:com.bmwcarit.barefoot.markov.KStateTest.java

@Test
public void TestKStateJSON() throws JSONException {
    Map<Integer, MockElem> elements = new HashMap<>();

    KState<MockElem, StateTransition, Sample> state = new KState<>(1, -1);

    {/* www . j a  v  a  2 s. c  om*/
        JSONObject json = state.toJSON();
        state = new KState<>(json, new MockFactory());
    }

    elements.put(0, new MockElem(0, Math.log10(0.3), 0.3, null));
    elements.put(1, new MockElem(1, Math.log10(0.2), 0.2, null));
    elements.put(2, new MockElem(2, Math.log10(0.5), 0.5, null));

    state.update(new HashSet<>(Arrays.asList(elements.get(0), elements.get(1), elements.get(2))),
            new Sample(0));

    {
        JSONObject json = state.toJSON();
        state = new KState<>(json, new MockFactory());

        elements.clear();

        for (MockElem element : state.vector()) {
            elements.put(element.numid(), element);
        }
    }

    elements.put(3, new MockElem(3, Math.log10(0.3), 0.3, elements.get(1)));
    elements.put(4, new MockElem(4, Math.log10(0.2), 0.2, elements.get(1)));
    elements.put(5, new MockElem(5, Math.log10(0.4), 0.4, elements.get(2)));
    elements.put(6, new MockElem(6, Math.log10(0.1), 0.1, elements.get(2)));

    state.update(
            new HashSet<>(Arrays.asList(elements.get(3), elements.get(4), elements.get(5), elements.get(6))),
            new Sample(1));

    {
        JSONObject json = state.toJSON();
        state = new KState<>(json, new MockFactory());

        elements.clear();

        for (MockElem element : state.vector()) {
            elements.put(element.numid(), element);
        }
    }

    elements.put(7, new MockElem(7, Math.log10(0.3), 0.3, elements.get(5)));
    elements.put(8, new MockElem(8, Math.log10(0.2), 0.2, elements.get(5)));
    elements.put(9, new MockElem(9, Math.log10(0.4), 0.4, elements.get(6)));
    elements.put(10, new MockElem(10, Math.log10(0.1), 0.1, elements.get(6)));

    state.update(
            new HashSet<>(Arrays.asList(elements.get(7), elements.get(8), elements.get(9), elements.get(10))),
            new Sample(2));

    {
        JSONObject json = state.toJSON();
        state = new KState<>(json, new MockFactory());

        elements.clear();

        for (MockElem element : state.vector()) {
            elements.put(element.numid(), element);
        }
    }

    elements.put(11, new MockElem(11, Math.log10(0.3), 0.3, null));
    elements.put(12, new MockElem(12, Math.log10(0.2), 0.2, null));
    elements.put(13, new MockElem(13, Math.log10(0.4), 0.4, null));
    elements.put(14, new MockElem(14, Math.log10(0.1), 0.1, null));

    state.update(
            new HashSet<>(
                    Arrays.asList(elements.get(11), elements.get(12), elements.get(13), elements.get(14))),
            new Sample(3));

    state.update(new HashSet<MockElem>(), new Sample(4));

    {
        JSONObject json = state.toJSON();
        KState<MockElem, StateTransition, Sample> state2 = new KState<>(json, new MockFactory());

        assertEquals(state.size(), state2.size());
        assertEquals(5, state2.size());
        assertEquals(state.estimate().numid(), state2.estimate().numid());
        assertEquals(13, state2.estimate().numid());
        assertEquals(state.sequence().size(), state2.sequence().size());
        assertEquals(2, state2.sequence().size());

        List<Integer> sequence = new LinkedList<>(Arrays.asList(9, 13));
        for (int i = 0; i < state.sequence().size() - 1; ++i) {
            assertEquals(state.sequence().get(i).numid(), state2.sequence().get(i).numid());
            assertEquals(sequence.get(i).longValue(), state2.sequence().get(i).numid());
        }
    }
}

From source file:com.weibo.api.motan.protocol.rpc.CompressRpcCodec.java

/**
 * response body ?//  w  w w .j av a 2s  . c om
 * 
 * <pre>
* 
* body:
* 
*     byte[] :  serialize (result) or serialize (exception)
* 
* </pre>
 *
 * @param channel
 * @param value
 * @return
 * @throws IOException
 */
private byte[] encodeResponse(Channel channel, Response value) throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    ObjectOutput output = createOutput(outputStream);
    Serialization serialization = ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(
            channel.getUrl().getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()));

    byte flag = 0;

    output.writeLong(value.getProcessTime());

    if (value.getException() != null) {
        output.writeUTF(value.getException().getClass().getName());
        serialize(output, value.getException(), serialization);
        flag = MotanConstants.FLAG_RESPONSE_EXCEPTION;
    } else if (value.getValue() == null) {
        flag = MotanConstants.FLAG_RESPONSE_VOID;
    } else {
        output.writeUTF(value.getValue().getClass().getName());
        serialize(output, value.getValue(), serialization);
        // v2?responseattachment
        Map<String, String> attachments = value.getAttachments();
        if (attachments != null) {
            String signed = attachments.get(ATTACHMENT_SIGN);
            String unSigned = attachments.get(UN_ATTACHMENT_SIGN);
            attachments.clear(); // attachment????

            if (StringUtils.isNotBlank(signed)) {
                attachments.put(ATTACHMENT_SIGN, signed);
            }
            if (StringUtils.isNotBlank(unSigned)) {
                attachments.put(UN_ATTACHMENT_SIGN, unSigned);
            }
        }
        if (attachments != null && !attachments.isEmpty()) {// ??
            addAttachment(output, attachments);
        } else {
            // empty attachments
            output.writeShort(0);
        }
        flag = MotanConstants.FLAG_RESPONSE_ATTACHMENT; // v2flag
    }

    output.flush();

    byte[] body = outputStream.toByteArray();

    output.close();
    Boolean usegz = channel.getUrl().getBooleanParameter(URLParamType.usegz.getName(),
            URLParamType.usegz.getBooleanValue());
    int minGzSize = channel.getUrl().getIntParameter(URLParamType.mingzSize.getName(),
            URLParamType.mingzSize.getIntValue());
    return encode(compress(body, usegz, minGzSize), flag, value.getRequestId());
}

From source file:com.linkedin.helix.tools.ClusterSetup.java

public static Map<String, Object> buildInternalIdealState(IdealState state) {
    // Try parse the partition number from name DB_n. If not, sort the partitions and
    // assign id/*w w w .ja  v  a2s.c  om*/
    Map<String, Integer> partitionIndex = new HashMap<String, Integer>();
    Map<String, String> reversePartitionIndex = new HashMap<String, String>();
    boolean indexInPartitionName = true;
    for (String partitionId : state.getPartitionSet()) {
        int lastPos = partitionId.lastIndexOf("_");
        if (lastPos < 0) {
            indexInPartitionName = false;
            break;
        }
        try {
            String idStr = partitionId.substring(lastPos + 1);
            int partition = Integer.parseInt(idStr);
            partitionIndex.put(partitionId, partition);
            reversePartitionIndex.put(state.getResourceName() + "_" + partition, partitionId);
        } catch (Exception e) {
            indexInPartitionName = false;
            partitionIndex.clear();
            reversePartitionIndex.clear();
            break;
        }
    }

    if (indexInPartitionName == false) {
        List<String> partitions = new ArrayList<String>();
        partitions.addAll(state.getPartitionSet());
        Collections.sort(partitions);
        for (int i = 0; i < partitions.size(); i++) {
            partitionIndex.put(partitions.get(i), i);
            reversePartitionIndex.put(state.getResourceName() + "_" + i, partitions.get(i));
        }
    }

    Map<String, List<Integer>> nodeMasterAssignmentMap = new TreeMap<String, List<Integer>>();
    Map<String, Map<String, List<Integer>>> combinedNodeSlaveAssignmentMap = new TreeMap<String, Map<String, List<Integer>>>();
    for (String partition : state.getPartitionSet()) {
        List<String> instances = state.getRecord().getListField(partition);
        String master = instances.get(0);
        if (!nodeMasterAssignmentMap.containsKey(master)) {
            nodeMasterAssignmentMap.put(master, new ArrayList<Integer>());
        }
        if (!combinedNodeSlaveAssignmentMap.containsKey(master)) {
            combinedNodeSlaveAssignmentMap.put(master, new TreeMap<String, List<Integer>>());
        }
        nodeMasterAssignmentMap.get(master).add(partitionIndex.get(partition));
        for (int i = 1; i < instances.size(); i++) {
            String instance = instances.get(i);
            Map<String, List<Integer>> slaveMap = combinedNodeSlaveAssignmentMap.get(master);
            if (!slaveMap.containsKey(instance)) {
                slaveMap.put(instance, new ArrayList<Integer>());
            }
            slaveMap.get(instance).add(partitionIndex.get(partition));
        }
    }

    Map<String, Object> result = new TreeMap<String, Object>();
    result.put("MasterAssignmentMap", nodeMasterAssignmentMap);
    result.put("SlaveAssignmentMap", combinedNodeSlaveAssignmentMap);
    result.put("replicas", Integer.parseInt(state.getReplicas()));
    result.put("partitions", new Integer(state.getRecord().getListFields().size()));
    result.put("reversePartitionIndex", reversePartitionIndex);
    return result;
}

From source file:com.netsteadfast.greenstep.bsc.service.logic.impl.EmployeeLogicServiceImpl.java

private void checkInformationRelated(AccountVO account, EmployeeVO employee)
        throws ServiceException, Exception {
    if (account == null || super.isBlank(account.getAccount()) || employee == null
            || super.isBlank(employee.getEmpId())) {
        return;//  w  w w.j  a va  2s .  c  o  m
    }
    Map<String, Object> params = new HashMap<String, Object>();

    // tb_sys_msg_notice
    params.put("toAccount", account.getAccount());
    if (this.sysMsgNoticeService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // tb_sys_calendar_note
    params.clear();
    params.put("account", account.getAccount());
    if (this.sysCalendarNoteService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_kpi_empl
    params.clear();
    params.put("empId", employee.getEmpId());
    if (this.kpiEmplService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_pdca_owner
    if (this.pdcaOwnerService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_pdca_item_owner
    if (this.pdcaItemOwnerService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_pdca_measure_freq
    params.clear();
    params.put("empId", employee.getEmpId());
    if (this.pdcaMeasureFreqService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_tsa_measure_freq
    if (this.tsaMeasureFreqService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    // bb_degree_feedback_assign
    params.clear();
    params.put("ownerId", employee.getEmpId());
    if (this.degreeFeedbackAssignService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }
    params.clear();
    params.put("raterId", employee.getEmpId());
    if (this.degreeFeedbackAssignService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

    if (this.foundChild(employee)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }

}

From source file:com.esd.ps.EmployerController.java

/**
 * //  w ww.ja  v  a 2  s.  co m
 * @return
 */
@RequestMapping(value = "/getMarkTimeMethod", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getMarkTimeMethodPOST() {
    Map<String, Object> map = new HashMap<>();
    List<markTimeMethod> list = markTimeMethodService.getAll();
    map.clear();
    map.put("list", list);
    return map;
}

From source file:com.linkedin.pinot.queries.RealtimeQueriesSentinelTest.java

@Test
public void test1() throws RecognitionException, Exception {
    final Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>();
    String query = "select sum('count') from testTable where column13='1540094560' group by column3 top 100 limit 0";
    Map<Object, Double> fromAvro = new HashMap<Object, Double>();
    fromAvro.put(null, 2.0D);/* ww w. j  av a  2 s.  co m*/
    fromAvro.put("", 1.2469280068E10D);
    fromAvro.put("F", 127.0D);
    fromAvro.put("A", 20.0D);
    fromAvro.put("H", 29.0D);
    final BrokerRequest brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(query);
    InstanceRequest instanceRequest = new InstanceRequest(485, brokerRequest);
    instanceRequest.setSearchSegments(new ArrayList<String>());
    instanceRequest.getSearchSegments().add("testTable_testTable");
    QueryRequest queryRequest = new QueryRequest(instanceRequest);
    DataTable instanceResponse = QUERY_EXECUTOR.processQuery(queryRequest);
    instanceResponseMap.clear();
    instanceResponseMap.put(new ServerInstance("localhost:0000"), instanceResponse);
    BrokerResponseNative brokerResponse = REDUCE_SERVICE.reduceOnDataTable(brokerRequest, instanceResponseMap);
    JSONArray actual = brokerResponse.toJson().getJSONArray("aggregationResults").getJSONObject(0)
            .getJSONArray("groupByResult");
    assertGroupByResults(actual, fromAvro);
}

From source file:com.taobao.tair.impl.DefaultTairManager.java

private Result<List<Object>> doMLock(int namespace, List<? extends Object> keys, int lockType, String descStr,
        Map<Object, ResultCode> failKeysMap) {
    if ((namespace < 0) || (namespace > TairConstant.NAMESPACE_MAX)) {
        return new Result<List<Object>>(ResultCode.NSERROR);
    }/*from w  w  w  . jav  a 2 s.  c o m*/

    if (failKeysMap != null) {
        failKeysMap.clear();
    }
    List<Object> sucList = null;
    Set<Object> uniqueKeys = new HashSet<Object>();

    for (Object key : keys) {
        uniqueKeys.add(key);
    }

    int sucRespSize = 0;
    int maxConfigVersion = 0;
    int retCode;

    // just one by one
    for (Object key : uniqueKeys) {
        RequestLockPacket packet = new RequestLockPacket(transcoder);
        packet.setNamespace((short) namespace);
        packet.setLockType(lockType);
        packet.setKey(key);
        int ec = packet.encode();

        if (ec == 1) {
            log.error("key too larget");
            if (failKeysMap != null) {
                failKeysMap.put(key, ResultCode.KEYTOLARGE);
            }
            continue;
        }

        BasePacket returnPacket = sendRequest(key, packet);

        if ((returnPacket != null) && returnPacket instanceof ReturnPacket) {
            if (((ReturnPacket) returnPacket).getConfigVersion() > maxConfigVersion) {
                maxConfigVersion = ((ReturnPacket) returnPacket).getConfigVersion();
            }
            retCode = ((ReturnPacket) returnPacket).getCode();
        } else {
            retCode = ResultCode.CONNERROR.getCode();
            log.warn("receive wrong packet type: " + returnPacket);
            if (failCounter.incrementAndGet() > 100) {
                configServer.checkConfigVersion(0);
                failCounter.set(0);
                log.warn("connection failed happened 100 times, sync configuration");
            }
        }

        if (retCode == ResultCode.SUCCESS.getCode()) {
            if (sucList == null) {
                sucList = new ArrayList<Object>();
            }
            sucList.add(key);
            ++sucRespSize;
        } else if (failKeysMap != null) {
            failKeysMap.put(key, ResultCode.valueOf(retCode));
        }
    }
    configServer.checkConfigVersion(maxConfigVersion);

    ResultCode rc = null;
    if (sucRespSize == uniqueKeys.size()) {
        rc = ResultCode.SUCCESS;
    } else {
        if (log.isDebugEnabled()) {
            log.error(descStr + "partly success: request key size: " + uniqueKeys.size() + ", fail "
                    + (uniqueKeys.size() - sucRespSize));
        }
        rc = ResultCode.PARTSUCC;
    }

    return new Result<List<Object>>(rc, sucList);
}

From source file:net.sf.appstatus.web.pages.LoggersPage.java

@Override
public void doGet(StatusWebHandler webHandler, HttpServletRequest req, HttpServletResponse resp)
        throws UnsupportedEncodingException, IOException {
    LOGGER.debug("doGet");
    if (StringUtils.isNotBlank(req.getParameter("name")) && StringUtils.isNotBlank(req.getParameter("level"))) {
        LoggerConfig logger2Change = new LoggerConfig(req.getParameter("name"), req.getParameter("level"));
        LOGGER.debug("Change log level : {} - {}", logger2Change.getName(), logger2Change.getLevel());
        webHandler.getAppStatus().getLoggersManager().update(logger2Change);
    }//from   www .j av a2  s .  c om
    setup(resp, "text/html");
    ServletOutputStream os = resp.getOutputStream();
    Map<String, String> valuesMap = new HashMap<String, String>();
    // build sbLoggersTable
    StrBuilder sbLoggersTable = new StrBuilder();
    List<LoggerConfig> loggers = webHandler.getAppStatus().getLoggersManager().getLoggers();
    if (HtmlUtils.generateBeginTable(sbLoggersTable, loggers.size())) {
        HtmlUtils.generateHeaders(sbLoggersTable, "", "Name", "Levels", "", "", "", "");
        for (LoggerConfig logger : loggers) {
            HtmlUtils.generateRow(sbLoggersTable, Resources.STATUS_PROP, logger.getName(),
                    getButton(LEVEL_TRACE, logger), getButton(ILoggersManager.LEVEL_DEBUG, logger),
                    getButton(LEVEL_INFO, logger), getButton(LEVEL_WARN, logger),
                    getButton(LEVEL_ERROR, logger));
        }
        HtmlUtils.generateEndTable(sbLoggersTable, loggers.size());
    }
    // generating content
    valuesMap.put("loggersTable", sbLoggersTable.toString());
    valuesMap.put("loggerCount", String.valueOf(loggers.size()));
    String content = HtmlUtils.applyLayout(valuesMap, PAGECONTENTLAYOUT);
    valuesMap.clear();
    valuesMap.put("content", content);
    // generating page
    os.write(getPage(webHandler, valuesMap).getBytes(ENCODING));
}

From source file:com.esd.ps.EmployerController.java

/**
 * ?/*from   w  ww.  j  a  va2 s.  com*/
 * 
 * @param packId
 * @param markTimeMethod
 * @return
 */
@RequestMapping(value = "/updateMarkTimeMethod", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> updateMarkTimeMethodGET() {
    Map<String, Object> map = new HashMap<>();
    List<markTimeMethod> markTimeMethodList = markTimeMethodService.getAll();
    map.clear();
    map.put("markTimeMethodList", markTimeMethodList);
    return map;
}

From source file:edu.ku.kuali.kra.timeandmoney.service.impl.TimeAndMoneyHistoryServiceImpl.java

@SuppressWarnings("unchecked")
public void getTimeAndMoneyHistory(String awardNumber, Map<Object, Object> timeAndMoneyHistory,
        List<Integer> columnSpan) throws WorkflowException {
    Map<String, Object> fieldValues1 = new HashMap<String, Object>();
    Map<String, Object> fieldValues3 = new HashMap<String, Object>();
    Map<String, Object> fieldValues3a = new HashMap<String, Object>();
    Map<String, Object> fieldValues5 = new HashMap<String, Object>();

    Map<String, Object> fieldValues4 = new HashMap<String, Object>();

    AwardAmountTransaction awardAmountTransaction = null;
    timeAndMoneyHistory.clear();
    Award award = awardVersionService.getWorkingAwardVersion(awardNumber);
    List<TimeAndMoneyDocument> docs = null;
    int key = 150;
    int j = -1;/*w  w  w.jav a2  s  .c o  m*/

    award.refreshReferenceObject("awardDocument");
    // to get all docs, we must pass the root award number for the subject award.
    fieldValues1.put("rootAwardNumber", getRootAwardNumberForDocumentSearch(award.getAwardNumber()));
    docs = (List<TimeAndMoneyDocument>) businessObjectService.findMatching(TimeAndMoneyDocument.class,
            fieldValues1);
    Collections.sort(docs);
    timeAndMoneyHistory.put(buildForwardUrl(award.getAwardDocument().getDocumentNumber()),
            award.getAwardDescriptionLine());
    for (TimeAndMoneyDocument tempDoc : docs) {
        TimeAndMoneyDocument doc = (TimeAndMoneyDocument) documentService
                .getByDocumentHeaderId(tempDoc.getDocumentNumber());
        List<AwardAmountTransaction> awardAmountTransactions = doc.getAwardAmountTransactions();
        // we don't want canceled docs in history.
        if (doc.getDocumentHeader().hasWorkflowDocument()) {
            if (!doc.getDocumentHeader().getWorkflowDocument().isCanceled()) {
                // capture initial transaction
                // we only want display this once.
                for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) {
                    if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) {
                        if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) {
                            if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(),
                                    awardAmountInfo.getTimeAndMoneyDocumentNumber())) {
                                if (awardAmountTransactions.size() > 0) {
                                    awardAmountTransaction = awardAmountTransactions.get(0);
                                    timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()),
                                            award.getAwardDescriptionLine());
                                }
                                fieldValues5.put("destinationAwardNumber", awardAmountInfo.getAwardNumber());
                                fieldValues5.put("transactionId", 0);
                                fieldValues5.put("timeAndMoneyDocumentNumber",
                                        awardAmountInfo.getTimeAndMoneyDocumentNumber());
                                fieldValues5.put("transactionDetailType",
                                        TransactionDetailType.PRIMARY.toString());
                                List<TransactionDetail> transactionDetailsA = ((List<TransactionDetail>) businessObjectService
                                        .findMatchingOrderBy(TransactionDetail.class, fieldValues5,
                                                "sourceAwardNumber", true));
                                if (transactionDetailsA.size() > 0) {
                                    TransactionDetail transactionDetail = transactionDetailsA.get(0);
                                    timeAndMoneyHistory.put(0, awardAmountInfo);
                                    timeAndMoneyHistory.put(key, transactionDetail);
                                    key++;
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                    }
                }

                // capture money transactions
                for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) {
                    if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) {
                        if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) {
                            if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(),
                                    awardAmountInfo.getTimeAndMoneyDocumentNumber())) {
                                if (awardAmountTransactions.size() > 0) {
                                    awardAmountTransaction = awardAmountTransactions.get(0);
                                    timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()),
                                            award.getAwardDescriptionLine());
                                }
                                List<TransactionDetail> transactionDetails = new ArrayList<TransactionDetail>();
                                // get all Transaction Details for a node. It can be the source or a destination of the transaction.
                                fieldValues3.put("sourceAwardNumber", awardAmountInfo.getAwardNumber());
                                fieldValues3.put("transactionId", awardAmountInfo.getTransactionId());
                                fieldValues3.put("timeAndMoneyDocumentNumber",
                                        awardAmountInfo.getTimeAndMoneyDocumentNumber());
                                fieldValues5.put("transactionDetailType",
                                        TransactionDetailType.PRIMARY.toString());

                                fieldValues3a.put("destinationAwardNumber", awardAmountInfo.getAwardNumber());
                                fieldValues3a.put("transactionId", awardAmountInfo.getTransactionId());
                                fieldValues3a.put("timeAndMoneyDocumentNumber",
                                        awardAmountInfo.getTimeAndMoneyDocumentNumber());
                                fieldValues5.put("transactionDetailType",
                                        TransactionDetailType.PRIMARY.toString());

                                // should only return one transaction detail because we are making transaction ID unique when we set
                                // to Pending Transaction ID in ActivePendingTransactionService.
                                List<TransactionDetail> transactionDetailsA = ((List<TransactionDetail>) businessObjectService
                                        .findMatchingOrderBy(TransactionDetail.class, fieldValues3,
                                                "sourceAwardNumber", true));
                                List<TransactionDetail> transactionDetailsB = ((List<TransactionDetail>) businessObjectService
                                        .findMatchingOrderBy(TransactionDetail.class, fieldValues3a,
                                                "sourceAwardNumber", true));
                                transactionDetails.addAll(transactionDetailsA);
                                transactionDetails.addAll(transactionDetailsB);
                                int i = 0;
                                for (TransactionDetail transactionDetail : transactionDetails) {
                                    timeAndMoneyHistory.put(awardAmountInfo.getTransactionId(),
                                            awardAmountInfo);
                                    timeAndMoneyHistory.put(key, transactionDetail);
                                    key++;
                                    i++;
                                }
                                columnSpan.add(i);
                            }
                        }
                    }
                }
            }
        }
        // capture date transactions
        for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) {
            if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) {
                if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) {
                    if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(),
                            awardAmountInfo.getTimeAndMoneyDocumentNumber())) {
                        if (awardAmountInfo.getTransactionId() == null) {
                            if (awardAmountTransactions.size() > 0) {
                                awardAmountTransaction = awardAmountTransactions.get(0);
                                timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()),
                                        award.getAwardDescriptionLine());
                            }
                            fieldValues4.put("sourceAwardNumber", awardAmountInfo.getAwardNumber());
                            fieldValues4.put("transactionId", "-1");
                            fieldValues4.put("timeAndMoneyDocumentNumber",
                                    awardAmountInfo.getTimeAndMoneyDocumentNumber());
                            fieldValues5.put("transactionDetailType", TransactionDetailType.PRIMARY.toString());

                            // Can return multiple transaction details because we are defaulting the transaction ID to -1
                            // in Date change transactions.
                            List<TransactionDetail> dateTransactionDetails = ((List<TransactionDetail>) businessObjectService
                                    .findMatchingOrderBy(TransactionDetail.class, fieldValues4,
                                            "sourceAwardNumber", true));
                            int i = 0;
                            for (TransactionDetail transactionDetail : dateTransactionDetails) {
                                timeAndMoneyHistory.put(j, awardAmountInfo);// this is just for display only.
                                timeAndMoneyHistory.put(key, transactionDetail);
                                key++;
                                i++;
                                j--;// Map enforces unique key when adding to timeAndMoneyHistory. Must be negative so it does not conflict with
                                // transaction ID of money transactions.
                            }
                            columnSpan.add(i);
                            break;
                        }
                    }
                }
            }
        }

    }
}