Example usage for org.apache.commons.lang StringUtils center

List of usage examples for org.apache.commons.lang StringUtils center

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils center.

Prototype

public static String center(String str, int size, String padStr) 

Source Link

Document

Centers a String in a larger String of size size.

Usage

From source file:com.sds.acube.ndisc.xadmin.XNDiscAdminMedia.java

/**
 *  ? ?   Console? //from  www  .j  av a2s.  com
 * 
 * @param host HOST 
 * @param port PORT 
 * @param name  
 * @param type  
 * @param path  
 * @param desc  
 * @param maxSize   ?
 * @param volumeId   ?
 */
public void makeMedia(String host, int port, String name, int type, String path, String desc, int maxSize,
        int volumeId) {
    try {
        Media media = new Media();
        media.setName(name);
        media.setType(type);
        media.setPath(path);
        media.setDesc(desc);
        media.setMaxSize(maxSize);
        media.setVolumeId(volumeId);
        media.setCreatedDate(getCreateDate());

        xnapi.XNDisc_Connect(host, port);
        boolean rtn = xnapi.XNDISC_MakeMedia(media);
        if (rtn) {
            StringBuilder medias = new StringBuilder(LINE_SEPERATOR);
            medias.append("").append(StringUtils.rightPad("", 100, "-")).append("?")
                    .append(LINE_SEPERATOR);
            medias.append("").append(StringUtils.center("makeMedia Successfully", 100, " ")).append("")
                    .append(LINE_SEPERATOR);
            medias.append("").append(StringUtils.rightPad("", 100, "-")).append("")
                    .append(LINE_SEPERATOR);
            if (printlog) {
                log.info(medias.toString());
            } else {
                out.print(medias.toString());
            }
        } else {
            logger.log(LoggerIF.LOG_ERROR, "mkmedia() failed !!!!");
        }
    } catch (Exception ex) {
        logger.log(LoggerIF.LOG_ERROR, ex.getMessage());
    } finally {
        try {
            xnapi.XNDisc_Disconnect();
        } catch (NetworkException ne) {
            logger.log(LoggerIF.LOG_ERROR, ne.getMessage());
        } catch (IOException e) {
            logger.log(LoggerIF.LOG_ERROR, e.getMessage());
        }
    }
}

From source file:com.sds.acube.ndisc.xadmin.XNDiscAdminUtil.java

/**
 * XNDisc Admin  /*  ww  w.j av  a  2s  .  c o  m*/
 * 
 * @param mainop ? operation
 * @param processop  operation
 */
private static void printAdminUsage(String mainop, String processop) {

    clearConsoleOutput();

    List<String> ops = new ArrayList<String>();
    if (StringUtils.isEmpty(mainop)) {
        ops.add("file");
        ops.add("media");
        ops.add("vol");
        ops.add("id");
    } else {
        ops.add(mainop);
    }
    if (StringUtils.isEmpty(processop)) {
        ops.add("ls");
        ops.add("mk");
        ops.add("rm");
        ops.add("wh");
        ops.add("ch");
        ops.add("reg");
        ops.add("get");
        ops.add("enc");
        ops.add("dec");
    } else {
        ops.add(processop);
    }

    StringBuilder usage = new StringBuilder(LINE_SEPERATOR);
    usage.append("").append(StringUtils.rightPad("", PRINT_COLUMN_SIZE, "-")).append("?")
            .append(LINE_SEPERATOR);
    usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
            .append(LINE_SEPERATOR);
    usage.append("").append(StringUtils.center(XNDISC_ADMIN_UTIL_VERSION, PRINT_COLUMN_SIZE, " "))
            .append("").append(LINE_SEPERATOR);
    usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
            .append(LINE_SEPERATOR);
    usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, "-")).append("")
            .append(LINE_SEPERATOR);
    usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
            .append(LINE_SEPERATOR);

    if (ops.contains("vol")) {
        usage.append("").append(StringUtils.rightPad("      VOLUME Usage", PRINT_COLUMN_SIZE, " "))
                .append("").append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        if (ops.contains("mk")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.MKVOL.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
            usage.append("").append(StringUtils.rightPad("  - " + XNDiscAdminUsage.ACCESSTYPE.getUsage(),
                    PRINT_COLUMN_SIZE, " ")).append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("ls")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.LSVOL.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("rm")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.RMVOL.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("ch")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.CHVOL.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
            usage.append("").append(StringUtils.rightPad("  - " + XNDiscAdminUsage.ACCESSTYPE.getUsage(),
                    PRINT_COLUMN_SIZE, " ")).append("").append(LINE_SEPERATOR);
        }
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("", PRINT_COLUMN_SIZE, "-")).append("")
                .append(LINE_SEPERATOR);
    }
    if (ops.contains("media")) {
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("      MEDIA Usage", PRINT_COLUMN_SIZE, " "))
                .append("").append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        if (ops.contains("mk")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.MKMEDIA.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
            usage.append("").append(StringUtils.rightPad("  - " + XNDiscAdminUsage.MEDIATYPE.getUsage(),
                    PRINT_COLUMN_SIZE, " ")).append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("ls")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.LSMEDIA.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("rm")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.RMMEDIA.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("ch")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.CHMEDIA.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
            usage.append("").append(StringUtils.rightPad("  - " + XNDiscAdminUsage.MEDIATYPE.getUsage(),
                    PRINT_COLUMN_SIZE, " ")).append("").append(LINE_SEPERATOR);
        }
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("", PRINT_COLUMN_SIZE, "-")).append("")
                .append(LINE_SEPERATOR);
    }
    if (ops.contains("file")) {
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("      FILE Usage", PRINT_COLUMN_SIZE, " "))
                .append("").append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        if (ops.contains("ls")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.LSFILE.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("reg")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.REGFILE.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("get")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.GETFILE.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("wh")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.WHFILE.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("rm")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.RMFILE.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("", PRINT_COLUMN_SIZE, "-")).append("")
                .append(LINE_SEPERATOR);
    }
    if (ops.contains("id")) {
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.rightPad("      ID Usage", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
        if (ops.contains("enc")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.IDENC.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        if (ops.contains("dec")) {
            usage.append("")
                    .append(StringUtils.rightPad(XNDiscAdminUsage.IDDEC.getUsage(), PRINT_COLUMN_SIZE, " "))
                    .append("").append(LINE_SEPERATOR);
        }
        usage.append("").append(StringUtils.center("", PRINT_COLUMN_SIZE, " ")).append("")
                .append(LINE_SEPERATOR);
    }
    usage.append("").append(StringUtils.rightPad("", PRINT_COLUMN_SIZE, "-")).append("")
            .append(LINE_SEPERATOR);
    usage.append(LINE_SEPERATOR);
    if (printlog) {
        logger.info(usage.toString());
    } else {
        out.print(usage.toString());
    }
}

From source file:net.big_oh.common.jdbc.JdbcProxyExerciser.java

private static void exercisePreparedBatchInsert(Connection con) throws SQLException {
    logger.info(StringUtils.center("exercise prepared batch insert", 100, "-"));

    PreparedStatement preparedStmnt = null;
    try {/*  w  w w  .j a  v  a  2s .  c  om*/
        preparedStmnt = con.prepareStatement("INSERT INTO TEST_TABLE VALUES ( ? )");
        preparedStmnt.setString(1, "value4");
        preparedStmnt.addBatch();
        preparedStmnt.setString(1, "value5");
        preparedStmnt.addBatch();
        preparedStmnt.executeBatch();
    } finally {
        DbUtils.closeQuietly(preparedStmnt);
    }
}

From source file:com.titankingdoms.dev.titanchat.command.defaults.HelpCommand.java

@Override
public void execute(CommandSender sender, String[] args) {
    TopicManager manager = plugin.getTopicManager();

    Topic topic = manager.getGeneralIndex();
    int page = 1;
    int pageWidth = manager.getConfig().getInt("page.width", 50);
    int pageHeight = manager.getConfig().getInt("page.height", 9);

    if (args != null && args.length > 0) {
        for (String arg : args) {
            if (!NumberUtils.isNumber(arg)) {
                if (topic instanceof Index) {
                    topic = ((Index) topic).getTopic(arg);

                    if (topic == null) {
                        sendMessage(sender, "&4Topic not found");
                        return;
                    }/*from  w w  w .  ja va2s  .  c o  m*/

                    if (!Vault.hasPermission(sender, "TitanChat.topic." + topic.getName())) {
                        sendMessage(sender, "&4You do not have permission to view this topic");
                        return;
                    }

                } else {
                    break;
                }

            } else {
                page = NumberUtils.toInt(arg);
                break;
            }
        }
    }

    String[][] pages = ChatUtils.paginate(Format.colourise(topic.getInformation()), pageWidth, pageHeight);
    String header = topic.getName() + " (" + page + "/" + pages.length + ")";

    if (page < 1)
        page = 1;

    if (page > pages.length)
        page = pages.length;

    sendMessage(sender, "&b" + StringUtils.center(" " + header + " ", pageWidth, '='));
    sendMessage(sender, pages[page - 1]);
}

From source file:com.rogue.regexblock.command.subcommands.HelpCommand.java

private String formatTitle(String title, ChatColor barcolor, ChatColor titlecolor) {
    String BAR = "--------------------------------------------------------";
    return StringUtils.center("[" + titlecolor + title + barcolor + "]", BAR.length(), '-');
}

From source file:net.big_oh.common.jdbc.JdbcProxyExerciser.java

private static void exerciseRegularSelect(Connection con) throws SQLException {
    logger.info(StringUtils.center("exercise regular select", 100, "-"));

    Statement stmt = null;// w ww . j  a  v  a  2  s.  co m
    ResultSet rs = null;
    try {
        stmt = con.createStatement();
        rs = stmt.executeQuery("SELECT * FROM TEST_TABLE");
        while (rs.next()) {
            System.out.println(rs.getString("TEST_COLUMN"));
        }
    } finally {
        DbUtils.closeQuietly(rs);
        DbUtils.closeQuietly(stmt);
    }

}

From source file:com.sds.acube.ndisc.xadmin.XNDiscAdminVolume.java

/**
 *   Console? //from   www. j  ava  2 s. c  o  m
 * 
 * @param volumelist  
 */
private void showVolumeInfo(ArrayList<Volume> volumelist) {
    int size = (volumelist == null) ? 0 : volumelist.size();
    Volume volume = null;
    StringBuilder volumes = new StringBuilder(LINE_SEPERATOR);
    volumes.append("").append(StringUtils.center("", 5, "-"));
    volumes.append("");
    volumes.append(StringUtils.center("", 121, "-"));
    volumes.append("");
    volumes.append(StringUtils.center("", 10, "-"));
    volumes.append("");
    volumes.append(StringUtils.center("", 14, "-"));
    volumes.append("?").append(LINE_SEPERATOR);
    volumes.append("").append(StringUtils.center("ID", 5, " "));
    volumes.append("");
    volumes.append(StringUtils.center("Volume Name", 121, " "));
    volumes.append("");
    volumes.append(StringUtils.center("Access", 10, " "));
    volumes.append("");
    volumes.append(StringUtils.center("Create Date", 14, " "));
    volumes.append("").append(LINE_SEPERATOR);

    if (size == 0) {
        int colidx = 0;
        volumes.append("").append(StringUtils.center("", 5, "-"));
        volumes.append("");
        colidx++;
        volumes.append(StringUtils.center("", 121, "-"));
        volumes.append("");
        colidx++;
        volumes.append(StringUtils.center("", 10, "-"));
        volumes.append("");
        colidx++;
        volumes.append(StringUtils.center("", 14, "-"));
        volumes.append("").append(LINE_SEPERATOR);
        volumes.append("").append(StringUtils.center(" No Data Found.", PRINT_COLUMN_SIZE + colidx, " "))
                .append("").append(LINE_SEPERATOR);
    } else {
        volumes.append("").append(StringUtils.center("", 5, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 121, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 10, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 14, "-"));
        volumes.append("").append(LINE_SEPERATOR);
    }

    for (int i = 0; i < size; i++) {
        volume = volumelist.get(i);
        volumes.append("").append(StringUtils.center(Integer.toString(volume.getId()), 5, " "));
        volumes.append("");
        volumes.append(StringUtils.rightPad(getName(volume.getName(), 121), 121, " "));
        volumes.append("");
        volumes.append(StringUtils.center(
                (StringUtils.isEmpty(volume.getAccessable()) ? "N/A" : volume.getAccessable()), 10, " "));
        volumes.append("");
        volumes.append(StringUtils.center(
                (StringUtils.isEmpty(volume.getCreatedDate()) ? "N/A" : volume.getCreatedDate()), 14, " "));
        volumes.append("").append(LINE_SEPERATOR);
        if ((i < size - 1) && (i <= MAX_LIST_SIZE)) {
            volumes.append("").append(StringUtils.center("", 5, "-"));
            volumes.append("");
            volumes.append(StringUtils.center("", 121, "-"));
            volumes.append("");
            volumes.append(StringUtils.center("", 10, "-"));
            volumes.append("");
            volumes.append(StringUtils.center("", 14, "-"));
            volumes.append("").append(LINE_SEPERATOR);
        }
        if (i > MAX_LIST_SIZE) {
            break;
        }
    }
    if (size == 0) {
        volumes.append("").append(StringUtils.center("", 5, "-"));
        volumes.append("-");
        volumes.append(StringUtils.center("", 121, "-"));
        volumes.append("-");
        volumes.append(StringUtils.center("", 10, "-"));
        volumes.append("-");
        volumes.append(StringUtils.center("", 14, "-"));
        volumes.append("").append(LINE_SEPERATOR);
    } else {
        volumes.append("").append(StringUtils.center("", 5, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 121, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 10, "-"));
        volumes.append("");
        volumes.append(StringUtils.center("", 14, "-"));
        volumes.append("").append(LINE_SEPERATOR);
    }
    volumes.append(size + " row selected.").append(LINE_SEPERATOR).append(LINE_SEPERATOR);
    if (printlog) {
        log.info(volumes.toString());
    } else {
        out.print(volumes.toString());
    }
}

From source file:net.big_oh.common.jdbc.JdbcProxyExerciser.java

private static void exercisePreparedSelect(Connection con) throws SQLException {
    logger.info(StringUtils.center("exercise prepared select", 100, "-"));

    PreparedStatement preparedStmnt = null;
    ResultSet rs = null;/*w  w  w .  j a  v  a2  s  .  c  om*/
    try {
        preparedStmnt = con.prepareStatement("SELECT * FROM TEST_TABLE WHERE TEST_COLUMN = ?");
        preparedStmnt.setString(1, "value1");
        rs = preparedStmnt.executeQuery();
        while (rs.next()) {
            System.out.println(rs.getString("TEST_COLUMN"));
        }
    } finally {
        DbUtils.closeQuietly(rs);
        DbUtils.closeQuietly(preparedStmnt);
    }
}

From source file:net.big_oh.common.jdbc.JdbcProxyExerciser.java

private static void cleanOutTestTable(Connection con) throws SQLException {
    logger.info(StringUtils.center("clean out the test table", 100, "-"));

    Statement stmt = null;/* w  w w.j av  a2 s  .  co m*/
    try {
        stmt = con.createStatement();
        stmt.executeUpdate("TRUNCATE TABLE TEST_TABLE");
    } finally {
        DbUtils.closeQuietly(stmt);
    }
}

From source file:com.sds.acube.ndisc.xadmin.XNDiscAdminMedia.java

/**
 *   Console? /*from  w  w  w  .  j  a va 2s . com*/
 * 
 * @param mediaList  
 */
private void showMediaInfo(ArrayList<Media> mediaList) {
    int size = (mediaList == null) ? 0 : mediaList.size();
    Media media = null;
    StringBuilder medias = new StringBuilder(LINE_SEPERATOR);
    medias.append("").append(StringUtils.center("", 5, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 48, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 5, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 49, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 14, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 12, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 12, "-"));
    medias.append("");
    medias.append(StringUtils.center("", 5, "-"));
    medias.append("?").append(LINE_SEPERATOR);

    medias.append("").append(StringUtils.center("ID", 5, " "));
    medias.append("");
    medias.append(StringUtils.center("Media Name", 48, " "));
    medias.append("");
    medias.append(StringUtils.center("Type", 5, " "));
    medias.append("");
    medias.append(StringUtils.center("Path", 49, " "));
    medias.append("");
    medias.append(StringUtils.center("Create Date", 14, " "));
    medias.append("");
    medias.append(StringUtils.center("Max Size", 12, " "));
    medias.append("");
    medias.append(StringUtils.center("Size", 12, " "));
    medias.append("");
    medias.append(StringUtils.center("Vol", 5, " "));
    medias.append("").append(LINE_SEPERATOR);

    if (size == 0) {
        int colidx = 0;
        medias.append("").append(StringUtils.center("", 5, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 48, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 49, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 14, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        colidx++;
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("").append(LINE_SEPERATOR);
        medias.append("").append(StringUtils.center(" No Data Found.", PRINT_COLUMN_SIZE + colidx, " "))
                .append("").append(LINE_SEPERATOR);
    } else {
        medias.append("").append(StringUtils.center("", 5, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 48, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 49, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 14, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("").append(LINE_SEPERATOR);
    }

    for (int i = 0; i < size; i++) {
        media = (Media) mediaList.get(i);
        medias.append("").append(StringUtils.center(Integer.toString(media.getId()), 5, " "));
        medias.append("");
        medias.append(StringUtils.rightPad(getName(media.getName(), 48), 48, " "));
        medias.append("");
        medias.append(StringUtils.center(Integer.toString(media.getType()), 5, " "));
        medias.append("");
        medias.append(StringUtils.rightPad(getName(media.getPath(), 49), 49, " "));
        medias.append("");
        medias.append(StringUtils.center(
                (StringUtils.isEmpty(media.getCreatedDate()) ? "N/A" : media.getCreatedDate()), 14, " "));
        medias.append("");
        medias.append(StringUtils.center(Long.toString(media.getMaxSize()), 12, " "));
        medias.append("");
        medias.append(StringUtils.center(Long.toString(media.getSize()), 12, " "));
        medias.append("");
        medias.append(StringUtils.center(Integer.toString(media.getVolumeId()), 5, " "));
        medias.append("").append(LINE_SEPERATOR);
        if ((i < size - 1) && (i <= MAX_LIST_SIZE)) {
            medias.append("").append(StringUtils.center("", 5, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 48, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 5, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 49, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 14, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 12, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 12, "-"));
            medias.append("");
            medias.append(StringUtils.center("", 5, "-"));
            medias.append("").append(LINE_SEPERATOR);
        }
        if (i > MAX_LIST_SIZE) {
            break;
        }
    }
    if (size == 0) {
        medias.append("").append(StringUtils.center("", 5, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 48, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 49, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 14, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("-");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("").append(LINE_SEPERATOR);
    } else {
        medias.append("").append(StringUtils.center("", 5, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 48, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 49, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 14, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 12, "-"));
        medias.append("");
        medias.append(StringUtils.center("", 5, "-"));
        medias.append("").append(LINE_SEPERATOR);
    }
    medias.append(size + " row selected.").append(LINE_SEPERATOR).append(LINE_SEPERATOR);
    if (printlog) {
        log.info(medias.toString());
    } else {
        out.print(medias.toString());
    }
}