コード例 #1
0
ファイル: DataDefinitionImpl.java プロジェクト: qcadoo/qcadoo
 @Override
 public FieldDefinition getField(final String fieldName) {
   if (fields.containsKey(fieldName)) {
     return fields.get(fieldName);
   } else if (priorityField != null && priorityField.getName().equals(fieldName)) {
     return priorityField;
   } else {
     return null;
   }
 }
コード例 #2
0
 private static void informListenerForNewTransactions(
     Block block,
     NewBlockType newBlockType,
     @Nullable List<Sha256Hash> filteredTxHashList,
     @Nullable Map<Sha256Hash, Transaction> filteredTxn,
     StoredBlock newStoredBlock,
     boolean first,
     BlockChainListener listener,
     Set<Sha256Hash> falsePositives)
     throws VerificationException {
   if (block.transactions != null) {
     // If this is not the first wallet, ask for the transactions to be duplicated before being
     // given
     // to the wallet when relevant. This ensures that if we have two connected wallets and a tx
     // that
     // is relevant to both of them, they don't end up accidentally sharing the same object (which
     // can
     // result in temporary in-memory corruption during re-orgs). See bug 257. We only duplicate in
     // the case of multiple wallets to avoid an unnecessary efficiency hit in the common case.
     sendTransactionsToListener(
         newStoredBlock, newBlockType, listener, 0, block.transactions, !first, falsePositives);
   } else if (filteredTxHashList != null) {
     checkNotNull(filteredTxn);
     // We must send transactions to listeners in the order they appeared in the block - thus we
     // iterate over the
     // set of hashes and call sendTransactionsToListener with individual txn when they have not
     // already been
     // seen in loose broadcasts - otherwise notifyTransactionIsInBlock on the hash.
     int relativityOffset = 0;
     for (Sha256Hash hash : filteredTxHashList) {
       Transaction tx = filteredTxn.get(hash);
       if (tx != null) {
         sendTransactionsToListener(
             newStoredBlock,
             newBlockType,
             listener,
             relativityOffset,
             Collections.singletonList(tx),
             !first,
             falsePositives);
       } else {
         if (listener.notifyTransactionIsInBlock(
             hash, newStoredBlock, newBlockType, relativityOffset)) {
           falsePositives.remove(hash);
         }
       }
       relativityOffset++;
     }
   }
 }
コード例 #3
0
ファイル: DataDefinitionImpl.java プロジェクト: qcadoo/qcadoo
 @Override
 public EntityHookDefinition getHook(
     final String type, final String className, final String methodName) {
   EntityHookDefinition hook =
       hooksByMethodPath.get(
           type.toUpperCase(Locale.ENGLISH) + "." + className + "." + methodName);
   checkNotNull(
       hook,
       "Cannot find hook "
           + type.toUpperCase(Locale.ENGLISH)
           + "."
           + className
           + "."
           + methodName
           + " for dataDefinition "
           + this);
   return hook;
 }
コード例 #4
0
ファイル: ServerData.java プロジェクト: mcmyffin/BAI-4-RN
 public synchronized Chatroom getChatroomByName(String chatroom) throws ChatroomNotFoundExeption {
   checkNotNull(chatroom);
   if (chatroom.equals(defaultChatName)) return defaultChat;
   if (!chatrooms.containsKey(chatroom)) throw new ChatroomNotFoundExeption(chatroom);
   return chatrooms.get(chatroom);
 }
コード例 #5
0
ファイル: ServerData.java プロジェクト: mcmyffin/BAI-4-RN
 public synchronized ClientThread getChatClientByUsername(String username)
     throws UsernameNotFoundException {
   checkNotNull(username);
   if (!containsUser(username)) throw new UsernameNotFoundException(username);
   return takenUsernames.get(username);
 }