Method used to extract commons card data

@param pGpo
global processing options response
@return true if the extraction succeed
@throws CommunicationException communication error
516226
protected boolean extractCommonsCardData(final byte[] pGpo) throws CommunicationException {
		boolean ret = false;
		// Extract data from Message Template 1
		byte data[] = TlvUtil.getValue(pGpo, EmvTags.RESPONSE_MESSAGE_TEMPLATE_1);
		if (data != null) {
			data = ArrayUtils.subarray(data, 2, data.length);
		} else { // Extract AFL data from Message template 2
			ret = extractTrackData(template.get().getCard(), pGpo);
			if (!ret) {
				data = TlvUtil.getValue(pGpo, EmvTags.APPLICATION_FILE_LOCATOR);
			} else {
				extractCardHolderName(pGpo);
			}
		}

		if (data != null) {
			// Extract Afl
			List<Afl> listAfl = extractAfl(data);
			// for each AFL
			for (Afl afl : listAfl) {
				// check all records
				for (int index = afl.getFirstRecord(); index <= afl.getLastRecord(); index++) {
					byte[] info = template.get().getProvider()
							.transceive(new CommandApdu(CommandEnum.READ_RECORD, index, afl.getSfi() << 3 | 4, 0).toBytes());
					// Extract card data
					if (ResponseUtils.isSucceed(info)) {
						extractCardHolderName(info);
						if (extractTrackData(template.get().getCard(), info)) {
							return true;
						}
					}
				}
			}
		}
		return ret;
	}
1265799
def op_extract(op_name, data, senders, inputs, outputs, block_id, vtxindex, txid):
    
    global EXTRACT_METHODS

    if op_name not in EXTRACT_METHODS.keys():
        raise Exception("No such operation '%s'" % op_name)

    method = EXTRACT_METHODS[op_name]
    op_data = method( data, senders, inputs, outputs, block_id, vtxindex, txid )
    return op_data
24219
@Override
	public void receivePong(Tree message) {

		// Verify protocol version
		if (checkVersion) {
			String ver = message.get("ver", "unknown");
			if (!PROTOCOL_VERSION.equals(ver)) {
				logger.warn("Invalid protocol version (" + ver + ")!");
				return;
			}
		}

		// Get response's unique ID
		String id = message.get("id", (String) null);
		if (id == null || id.isEmpty()) {
			logger.warn("Missing \"id\" property!", message);
			return;
		}

		// Get stored promise
		PendingPromise pending = promises.remove(id);
		if (pending == null) {
			logger.warn("Unknown (maybe timeouted) response received!", message);
			return;
		}

		// Resolve Promise
		pending.promise.complete(message);
	}
405919
public boolean reallocateMsgs()
  {
     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
       SibTr.entry(tc, "reallocateMsgs");
     
     boolean success = true;

     // Reallocate the messages on the outputhandler to spread the load over
     // the localisations
     try
     {     
       if (getOutputHandler() instanceof PtoPOutputHandler) 
       {
         ((PtoPOutputHandler)getOutputHandler()).reallocateMsgs(getDestinationHandler(), false, false);
       }
       else
         success = false;
     }
     catch (SIException e)
     {
       // No FFDC code needed
       success = false;
     }     
     
     if (success)
     {     
       // If non-empty, then do not delete yet
       long itemCount = -1;
       long availableCount = -1;
       long removingCount = -1;
       
       try
       {
         itemCount = getStatistics().getTotalItemCount();
         availableCount = getStatistics().getAvailableItemCount();
         removingCount = getStatistics().getRemovingItemCount();
       }
       catch(MessageStoreException e)
       {
         // FFDC
         FFDCFilter.processException(
             e,
             "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPXmitMsgsItemStream.reallocateMsgs",
             "1:160:1.56",
             this);  
         
         SibTr.exception(tc, e); 
       }   
       
       if (itemCount > 0)
       {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
           SibTr.debug(tc, "Messages remain on stream: " + itemCount + " : " +
               availableCount + " : " +
               removingCount);
         
         success = false;
       }
       else
       {
         if (isToBeDeleted() || destinationHandler.isToBeDeleted())
         {
           ExternalAutoCommitTransaction transaction = getDestinationHandler().
                                                        getTxManager().
                                                        createAutoCommitTransaction();
           try
           {
             removeItemStream(transaction, NO_LOCK_ID);
           }
           catch (MessageStoreException e)
           {
             
             // MessageStoreException shouldn't occur so FFDC.
             FFDCFilter.processException(
               e,
               "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPXmitMsgsItemStream.reallocateMsgs",
               "1:193:1.56",
               this);
    
             SibTr.exception(tc, e);
              
             success = false;
           }
         }
       }
     }
       
     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
       SibTr.exit(tc, "reallocateMsgs", new Boolean(success));
    
     return success;
  }
203590
public function getPoi($poi_id)
    {
        if (empty($poi_id)) {
            return false;
        }
        $raw = Json::encode(['poi_id'=>$poi_id]);
        $result = $this->httpRaw(static::WECHAT_GET_POI_URL . 'access_token=' . $this->getAccessToken(), $raw);

        return isset($result['business']) ? $result['business'] : false;
    }
179769
@Override public <C> BraveSpanContext extract(Format<C> format, C carrier) {
    Extractor<TextMap> extractor = formatToExtractor.get(format);
    if (extractor == null) {
      throw new UnsupportedOperationException(format + " not in " + formatToExtractor.keySet());
    }
    TraceContextOrSamplingFlags extractionResult = extractor.extract((TextMap) carrier);
    return BraveSpanContext.create(extractionResult);
  }
760855
public function wxCardPackage(array $card_list, $timestamp = null, $api_ticket = null)
    {
        if (!is_array($card_list)) {
            $this->setError('参数缺失');

            return false;
        }

        if (empty($timestamp) || $timestamp == '') {
            $timestamp = time();
        }

        if (empty($api_ticket) || $api_ticket == '') {
            $api_ticket = $this->cardApiTicket();
        }

        $resultArray = [];
        foreach ($card_list as $key => $value) {
            if (empty($value['code']) || !isset($value['code'])) {
                $value['code'] = '';
            }
            if (empty($value['openid']) || !isset($value['openid'])) {
                $value['openid'] = '';
            }
            $arrays = [$api_ticket, $timestamp, $value['card_id'], $value['code'], $value['openid']];
            sort($arrays, SORT_STRING);
            $string = sha1(implode($arrays));

            $resultArray['cardList'][$key]['cardId']            = $value['card_id'];
            $resultArray['cardList'][$key]['cardExt']['code']   = $value['code'];
            $resultArray['cardList'][$key]['cardExt']['openid'] = $value['openid'];

            $resultArray['cardList'][$key]['cardExt']['timestamp'] = $timestamp;
            $resultArray['cardList'][$key]['cardExt']['signature'] = $string;

            if (!empty($value['outer_id'])) {
                $resultArray['cardList'][$key]['cardExt']['outer_id'] = $value['outer_id'];
            }
            $resultArray['cardList'][$key]['cardExt'] = json_encode($resultArray['cardList'][$key]['cardExt']);
        }
        $resultJson = json_encode($resultArray);

        return $resultJson;
    }
638448
public boolean matchesGlobalId(byte[] globalTransactionId) {
        if (globalTransactionId.length != Xid.MAXGTRIDSIZE) {
            return false;
        }
        for (int i = 8; i < globalTransactionId.length; i++) {
            if (globalTransactionId[i] != baseId[i]) {
                return false;
            }
        }
        // for recovery, only match old transactions
        long id = extractLong(globalTransactionId, 0);
        return (id < start);
    }
10949
public boolean forEachPartition(IterateProcedure<E> p) {
        int curIdx = index.get(values.get(0).id());
        int from;
        int to;
        for (from = 0, to = 0; to < values.size(); to++) {
            int cIdx = index.get(values.get(to).id());
            if (curIdx != cIdx) {
                if (!p.extract(this, curIdx, from, to)) {
                    return false;
                }
                from = to;
                curIdx = cIdx;
            }
        }
        return p.extract(this, curIdx, from, to);
    }
1019856
protected boolean extractTrackData(final EmvCard pEmvCard, final byte[] pData) {
		template.get().getCard().setTrack1(TrackUtils.extractTrack1Data(TlvUtil.getValue(pData, EmvTags.TRACK1_DATA)));
		template.get().getCard().setTrack2(TrackUtils.extractTrack2EquivalentData(TlvUtil.getValue(pData, EmvTags.TRACK_2_EQV_DATA, EmvTags.TRACK2_DATA)));
		return pEmvCard.getTrack1() != null || pEmvCard.getTrack2() != null;
	}
662932
public boolean process()
	{
		if (toProcess.size() <= 0)
			return false;

		BlockPos pos = toProcess.removeFirst();
		process(pos);
		if (onProcess != null)
			onProcess.accept(world, pos);

		return true;
	}
468769
@Override
    public OutputHandler getLocalPostMedPtoPOH(boolean localMessage,
                                               boolean forcePut,
                                               boolean singleServer)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc,
                        "getLocalPostMedPtoPOH",
                        new Object[] { new Boolean(localMessage),
                                      new Boolean(forcePut),
                                      new Boolean(singleServer) });

        // Return null for pubsub
        OutputHandler result = null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getLocalPostMedPtoPOH", result);

        return result;
    }
1033693
@Override
  public final void process(final Map<String, Object> pAddParam,
    final IRequestData pRequestData) throws Exception {
    this.prcAccEntitiesPage.process(pAddParam, pRequestData);
    pRequestData.setAttribute("typeCodeSubaccMap",
      this.srvTypeCode.getTypeCodeMap());
  }
1176401
public void card(String openId, String cardId, String from) {
        Map<String, Object> request = initMessage(openId, "wxcard", from);
        request.put("wxcard", new Card(cardId));

        String url = WxEndpoint.get("url.care.message.send");
        wxClient.post(url, JsonMapper.defaultMapper().toJson(request));
    }
43632
protected void readEF_BLOG(final Application pApplication) throws CommunicationException{
		List<EmvTransactionRecord> list = new ArrayList<EmvTransactionRecord>();
		SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
		SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
		// Read each records
		for (int i = 1; i < 16 ; i++) {
			byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.READ_RECORD, i, 0xEC, 0).toBytes());
			// Check response
			if (ResponseUtils.isSucceed(data)) {
				if (data.length < 35){
					continue;
				}
				EmvTransactionRecord record = new EmvTransactionRecord();
				record.setCurrency(CurrencyEnum.EUR);
				record.setTransactionType(getType(data[0]));
				record.setAmount(Float.parseFloat(BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(data, 21, 24))) / 100L);

				try {
					record.setDate(dateFormat.parse(String.format("%02x.%02x.%02x%02x", data[32], data[31], data[29], data[30])));
					record.setTime(timeFormat.parse(String.format("%02x:%02x:%02x", data[33], data[34], data[35])));
				} catch (ParseException e) {
					LOGGER.error(e.getMessage(), e);
				}
				list.add(record);
			} else {
				break;
			}
		}
		pApplication.setListTransactions(list);
	}
783045
void gatherProtocol(int maxPos) throws IOException {
        // protocol buffer has max capacity, shouldn't need resizing
        try {
            while(this.bufferPosition < maxPos) {
                byte b = this.buffer[this.bufferPosition];
                this.bufferPosition++;

                if (gotCR) {
                    if (b == NatsConnection.LF) {
                        this.protocolBuffer.flip();
                        this.mode = Mode.PARSE_PROTO;
                        this.gotCR = false;
                        break;
                    } else {
                        throw new IllegalStateException("Bad socket data, no LF after CR");
                    }
                } else if (b == NatsConnection.CR) {
                    this.gotCR = true;
                } else {
                    if (!protocolBuffer.hasRemaining()) {
                        this.protocolBuffer = this.connection.enlargeBuffer(this.protocolBuffer, 0); // just double it
                    }
                    this.protocolBuffer.put(b);
                }
            }
        } catch (IllegalStateException | NumberFormatException | NullPointerException ex) {
            this.encounteredProtocolError(ex);
        }
    }
1094567
protected boolean postDatagram (PresentsConnection conn, Message msg)
        throws Exception
    {
        _flattener.reset();

        // flatten the message using the connection's sequencer
        DatagramSequencer sequencer = conn.getDatagramSequencer();
        sequencer.writeDatagram(msg);

        // if the message is too big, we must fall back to sending it through the stream channel
        if (_flattener.size() > Client.MAX_DATAGRAM_SIZE) {
            return false;
        }

        // note the actual transport
        msg.noteActualTransport(Transport.UNRELIABLE_UNORDERED);

        // extract as a byte array
        byte[] data = _flattener.toByteArray();

        // slap it on the queue
        _dataq.append(Tuple.newTuple(conn, data));

        return true;
    }