Import accounts from a flatfile.

@param sender The command sender so we can send back messages.
@return True if the convert is done. Else false.
9923
private boolean importFlatFile(String sender) {
        boolean result = false;

        try {
            List<String> file = new ArrayList<>();
            String str;
            while ((str = flatFileReader.readLine()) != null) {
                file.add(str);
            }
            flatFileReader.close();
            List<User> userList = new ArrayList<>();
            for (String aFile : file) {
                String[] info = aFile.split(" ");
                try {
                    double balance = Double.parseDouble(info[1].split(":")[1]);
                    userList.add(new User(info[0], balance));
                } catch (NumberFormatException e) {
                    Common.getInstance().sendConsoleMessage(Level.SEVERE, "User " + info[0] + " have a invalid balance" + info[1]);
                } catch (ArrayIndexOutOfBoundsException e) {
                    Common.getInstance().sendConsoleMessage(Level.WARNING, "Line not formatted correctly. I read:" + Arrays.toString(info));
                }
            }
            addAccountToString(sender, userList);
            result = true;
        } catch (IOException e) {
            Common.getInstance().getLogger().severe("A error occured while reading the iConomy database file! Message: " + e.getMessage());
        }
        return result;
    }
637722
public static boolean transferQuery(AlipayFundTransOrderQueryModel model) throws AlipayApiException {
		AlipayFundTransOrderQueryResponse response = transferQueryToResponse(model);
		if (response.isSuccess()) {
			return true;
		}
		return false;
	}
874013
public void transferTo(Decoder newDecoder) {
		newDecoder.io = io;
		newDecoder.nextBuffer = nextBuffer;
		newDecoder.currentBuffer = currentBuffer;
	}
1066479
private void transferComplete(ShardFiles shardFiles) {
        _log.debug("Transfer complete: id={}, file={}", _taskId, shardFiles.getFirstFile());
        closeShardFiles(shardFiles);
        _openTransfers.dec();
    }
663558
@Override
    public boolean importTransaction(String globalId, int expires) throws SystemException {

        //The first thing we need to do is distinguish between local and remote invocations. If the UOW currently associated
        //with the thread is a global txn then we know the invocation must be local. The other case is where the remote servers
        //web container has begun a local txn in the absence of the global context. We do know that there was a global txn on 
        //invocation else there wouldn't even be a cc available.
        final UOWCoordinator uowCoord = _uowc.getUOWCoord();
        _threadUOWCoord.set(uowCoord);

        if (uowCoord != null && uowCoord.isGlobal()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "The Web Service request is a local invocation");

            ((DistributableTransaction) uowCoord).resumeAssociation();
            return false;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "The Web Service request is a remote invocation");

        try {
            TMHelper.checkTMState();
        } catch (NotSupportedException e) {
            final SystemException se = new SystemException();
            se.initCause(e);
            throw se;
        }

        //The web container will start a local tran as there will not be a global context
        //on thread. We need to suspend this before attaching the global tran
        final LocalTransactionCoordinator ltc = LocalTranCurrentSet.instance().suspend();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "Suspended LTC", ltc);

        boolean createdNewTransaction = false;

        DistributableTransaction tx = getTransactionForID(globalId);

        if (tx == null) {
            tx = new EmbeddableTransactionImpl(expires, globalId);
            createdNewTransaction = true;

            new TransactionWrapper((EmbeddableTransactionImpl) tx);
        }

        _threadImportedTran.set(tx);

        // Add association to police single thread per tran
        tx.addAssociation();

        // Resume transaction on this thread
        try {
            _tm.resume((Transaction) tx);
        } catch (Exception e) {
            SystemException se = new SystemException();
            se.initCause(e);
            throw se;
        }

        return createdNewTransaction;
    }
549176
<T> boolean isExportEntityInvalid(final List<T> t) {
        return (BasicCollectionUtils.isEmpty(t) || isExportEntityInvalid(t.get(0)));
    }
820486
public void setMailFromDefault(String sender) {

        m_mailFromDefault = sender;
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_DEFAULT_SENDER_1, m_mailFromDefault));
        }
    }
1325737
public function postMessage($sender, $recipient, $message)
    {
        if (!isset($this->database[$recipient])) {
            $this->database[$recipient] = [];
        } elseif ($this->maxMessages
            && count($this->database[$recipient]) >= $this->maxMessages) {
            return false;
        }

        $this->database[$recipient][] = [
            'timestamp' => date('Y-m-d H:i:s'),
            'sender' => $sender,
            'message' => $message,
        ];

        return true;
    }
855697
private void transfer(Entry[] src, Entry[] dest)
    {
        for (int j = 0; j < src.length; ++j)
        {
            Entry e = src[j];
            src[j] = null;
            while (e != null)
            {
                Entry next = e.getState().next;
                Object key = e.get();
                if (key == null)
                {
                    e.setNext(null);  // Help GC
                    size--;
                }
                else
                {
                    int i = indexFor(e.getHash(), dest.length);
                    e.setNext(dest[i]);
                    dest[i] = e;
                }
                e = next;
            }
        }
    }
247099
private boolean importDatabase(String sender) {
        Connection connection = null;
        PreparedStatement statement = null;
        try {
            connection = db.getConnection();
            if (getDbConnectInfo().get("tablename") != null) {
                statement = connection.prepareStatement("SELECT * FROM " + getDbConnectInfo().get("tablename"));
            } else {
                statement = connection.prepareStatement(IConomyTable.SELECT_ENTRY);
            }
            ResultSet set = statement.executeQuery();
            List<User> userList = new ArrayList<>();
            while (set.next()) {
                userList.add(new User(set.getString("username"), set.getDouble("balance")));
            }
            addAccountToString(sender, userList);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            Tools.closeJDBCStatement(statement);
            Tools.closeJDBCConnection(connection);
        }
        return true;
    }
478549
@Override
    public void addConverter(Class<?> from, Class<?> to, Converter converter) {
        Map toMap = fromMap.get(from);
        if (toMap == null) {
            toMap = new HashMap<Class<?>, Map<Class<?>, Converter>>();
            fromMap.put(from, toMap);
        }
        toMap.put(to, converter);
    }
804569
def export(self, filename, exporter=None):
        
        filename = nativestring(filename)
        if exporter is None:
            ext = os.path.splitext(filename)[1]
            exporter = self.exporter(ext)
        
        if exporter:
            return exporter.exportTree(self, filename)
        else:
            return False
898007
public OvhSender serviceName_senders_sender_GET(String serviceName, String sender) throws IOException {
		String qPath = "/sms/{serviceName}/senders/{sender}";
		StringBuilder sb = path(qPath, serviceName, sender);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhSender.class);
	}
868069
protected EntityImporter buildEntityImporter(String upload, Class<?> clazz) {
    try {
      UploadedFile file = get(upload, UploadedFile.class);
      if (null == file) {
        logger.error("cannot get upload file {}.", upload);
        return null;
      }
      String fileName = get(upload + "FileName");
      InputStream is = new FileInputStream((File) file.getContent());
      String formatName = Strings.capitalize(Strings.substringAfterLast(fileName, "."));
      Option<TransferFormat> format = Enums.get(TransferFormat.class, formatName);
      return (format.isDefined()) ? ImporterFactory.getEntityImporter(format.get(), is, clazz, null) : null;
    } catch (Exception e) {
      logger.error("error", e);
      return null;
    }
  }
147261
private void transfer(SingleEntry[] src, SingleEntry[] dest)
    {
        for (int j = 0; j < src.length; ++j)
        {
            SingleEntry e = src[j];
            src[j] = null;
            while (e != null)
            {
                SingleEntry next = e.pkNext;
                Object key = e.get();
                if (key == null)
                {
                    e.pkNext = null;  // Help GC
                    size--;
                }
                else
                {
                    int i = indexFor(e.pkHash, dest.length);
                    e.pkNext = dest[i];
                    dest[i] = e;
                }
                e = next;
            }
        }
    }
92262
private static void transferImpl(BitReader reader, BitWriter writer, long count) {
		while (count >= 64) {
			//TODO could benefit from reading into a larger buffer here - eg bytes?
			long bits = reader.readLong(64);
			writer.write(bits, 64);
			count -= 64;
		}
		if (count != 0L) {
			long bits = reader.readLong((int) count);
			writer.write(bits, (int) count);
		}
	}
1332347
private boolean shouldImport(TypeName typeName) {
        // don't import classes from the java.lang package
        String pkg = typeName.getPackageName();
        String simpleName = typeName.getSimpleName();
        boolean exclude = (pkg.equals("java.lang") || pkg.equals("")) && getJavaDefaultTypes().contains(simpleName);
        return !exclude;
    }