class DbRule extends AbstractDbDataDao<Rule> {

  public static String getJson(final DbPreparedStatement preparedStatement,
                               final int limit)
      throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException {
    final ArrayNode arrayNode = JsonHandler.createArrayNode();
    try {
      preparedStatement.executeQuery();
      int nb = 0;
      while (preparedStatement.getNext()) {
        final DbRule rule = getFromStatement(preparedStatement);
        final ObjectNode node = rule.getInternalJson();
        arrayNode.add(node);
        nb++;
        if (nb >= limit) {
          break;
        }
      }
    } finally {
      preparedStatement.realClose();
    }
    // \n is not correctly parsed within HTML so put double \\n in fine
    return WaarpStringUtils
        .cleanJsonForHtml(JsonHandler.writeAsString(arrayNode));
  }

  public  DbRule(final String idRule, final String ids, final int mode,
                final String recvPath, final String sendPath,
                final String archivePath, final String workPath,
                final String rpreTasks, final String rpostTasks,
                final String rerrorTasks, final String spreTasks,
                final String spostTasks, final String serrorTasks);
  public  DbRule(final String idRule);
  public  DbRule(final Rule rule);
  public  DbRule(final String idrule, String[] idsArrayRef, final int mode,
                final String recvpath, final String sendpath,
                final String archivepath, final String workpath,
                final String[][] rpretasksArray,
                final String[][] rposttasksArray,
                final String[][] rerrortasksArray,
                final String[][] spretasksArray,
                final String[][] sposttasksArray,
                final String[][] serrortasksArray);
  public  DbRule(final ObjectNode source);
  private  DbRule();

}