test_class.declarator: expectedException = ExpectedException.none()
test_class.modifier: @Rule
    public
test_class.original_string: @Rule
    public ExpectedException expectedException = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: expectedException
test_class.declarator: actionDao
test_class.modifier: private
test_class.original_string: private ActionDao actionDao;
test_class.type: ActionDao
test_class.var_name: actionDao
test_class.file: smart-metastore/src/test/java/org/smartdata/metastore/dao/TestActionDao.java
test_class.identifier: TestActionDao
test_class.superclass: extends TestDaoUtil
test_case.body: @Test
    public void testGetAPageOfAction() {
      Map<String, String> args = new HashMap<>();
      ActionInfo actionInfo = new ActionInfo(1, 1,
          "cache", args, "Test",
          "Test", false, 123213213L, true, 123123L,
          100);
      ActionInfo actionInfo1 = new ActionInfo(2, 1,
          "cache", args, "Test",
          "Test", false, 123213213L, true, 123123L,
          100);
      ActionInfo actionInfo2 = new ActionInfo(3, 1,
          "cache", args, "Test",
          "Test", false, 123213213L, true, 123123L,
          100);
      ActionInfo actionInfo3 = new ActionInfo(4, 1,
          "cache", args, "Test",
          "Test", false, 123213213L, true, 123123L,
          100);
  
      actionDao.insert(new ActionInfo[]{actionInfo, actionInfo1, actionInfo2, actionInfo3});
  
      List<String> order = new ArrayList<>();
      order.add("aid");
      List<Boolean> desc = new ArrayList<>();
      desc.add(false);
      Assert.assertTrue(actionDao.getAPageOfAction(2, 1, order, desc).get(0).equals(actionInfo2));
    }
test_case.class_method_signature: TestActionDao.testGetAPageOfAction()
test_case.full_signature: @Test public void testGetAPageOfAction()
test_case.identifier: testGetAPageOfAction
test_case.invocations: insert add add assertTrue equals get getAPageOfAction
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetAPageOfAction()
focal_class.declarator: TABLE_NAME = "action"
focal_class.modifier: private static final
focal_class.original_string: private static final String TABLE_NAME = "action";
focal_class.type: String
focal_class.var_name: TABLE_NAME
focal_class.declarator: RUNNING_TIME = "running_time"
focal_class.modifier: private static final
focal_class.original_string: private static final String RUNNING_TIME = "running_time";
focal_class.type: String
focal_class.var_name: RUNNING_TIME
focal_class.declarator: dataSource
focal_class.modifier: private
focal_class.original_string: private DataSource dataSource;
focal_class.type: DataSource
focal_class.var_name: dataSource
focal_class.declarator: tableColumns
focal_class.modifier: private final
focal_class.original_string: private final List<String> tableColumns;
focal_class.type: List<String>
focal_class.var_name: tableColumns
focal_class.file: smart-metastore/src/main/java/org/smartdata/metastore/dao/ActionDao.java
focal_class.identifier: ActionDao
focal_class.class_method_signature: ActionDao.ActionDao(DataSource dataSource)
focal_class.full_signature: public  ActionDao(DataSource dataSource)
focal_class.identifier: ActionDao
focal_class.modifiers: public
focal_class.parameters: (DataSource dataSource)
focal_class.signature:  ActionDao(DataSource dataSource)
focal_class.class_method_signature: ActionDao.getAll()
focal_class.full_signature: public List<ActionInfo> getAll()
focal_class.identifier: getAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getAll()
focal_class.class_method_signature: ActionDao.getCountOfAction()
focal_class.full_signature: public Long getCountOfAction()
focal_class.identifier: getCountOfAction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getCountOfAction()
focal_class.class_method_signature: ActionDao.getById(long aid)
focal_class.full_signature: public ActionInfo getById(long aid)
focal_class.identifier: getById
focal_class.modifiers: public
focal_class.parameters: (long aid)
focal_class.return: ActionInfo
focal_class.signature: ActionInfo getById(long aid)
focal_class.class_method_signature: ActionDao.getByIds(List<Long> aids)
focal_class.full_signature: public List<ActionInfo> getByIds(List<Long> aids)
focal_class.identifier: getByIds
focal_class.modifiers: public
focal_class.parameters: (List<Long> aids)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getByIds(List<Long> aids)
focal_class.class_method_signature: ActionDao.getByCid(long cid)
focal_class.full_signature: public List<ActionInfo> getByCid(long cid)
focal_class.identifier: getByCid
focal_class.modifiers: public
focal_class.parameters: (long cid)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getByCid(long cid)
focal_class.class_method_signature: ActionDao.getByCondition(String aidCondition,
        String cidCondition)
focal_class.full_signature: public List<ActionInfo> getByCondition(String aidCondition,
        String cidCondition)
focal_class.identifier: getByCondition
focal_class.modifiers: public
focal_class.parameters: (String aidCondition,
        String cidCondition)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getByCondition(String aidCondition,
        String cidCondition)
focal_class.class_method_signature: ActionDao.getLatestActions(int size)
focal_class.full_signature: public List<ActionInfo> getLatestActions(int size)
focal_class.identifier: getLatestActions
focal_class.modifiers: public
focal_class.parameters: (int size)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getLatestActions(int size)
focal_class.class_method_signature: ActionDao.getLatestActions(String actionName, int size)
focal_class.full_signature: public List<ActionInfo> getLatestActions(String actionName, int size)
focal_class.identifier: getLatestActions
focal_class.modifiers: public
focal_class.parameters: (String actionName, int size)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getLatestActions(String actionName, int size)
focal_class.class_method_signature: ActionDao.getLatestActions(String actionName, int size,
        boolean successful, boolean finished)
focal_class.full_signature: public List<ActionInfo> getLatestActions(String actionName, int size,
        boolean successful, boolean finished)
focal_class.identifier: getLatestActions
focal_class.modifiers: public
focal_class.parameters: (String actionName, int size,
        boolean successful, boolean finished)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getLatestActions(String actionName, int size,
        boolean successful, boolean finished)
focal_class.class_method_signature: ActionDao.getLatestActions(String actionName, boolean successful,
        int size)
focal_class.full_signature: public List<ActionInfo> getLatestActions(String actionName, boolean successful,
        int size)
focal_class.identifier: getLatestActions
focal_class.modifiers: public
focal_class.parameters: (String actionName, boolean successful,
        int size)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getLatestActions(String actionName, boolean successful,
        int size)
focal_class.class_method_signature: ActionDao.getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_class.full_signature: public List<ActionInfo> getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_class.identifier: getAPageOfAction
focal_class.modifiers: public
focal_class.parameters: (long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_class.class_method_signature: ActionDao.getAPageOfAction(long start, long offset)
focal_class.full_signature: public List<ActionInfo> getAPageOfAction(long start, long offset)
focal_class.identifier: getAPageOfAction
focal_class.modifiers: public
focal_class.parameters: (long start, long offset)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getAPageOfAction(long start, long offset)
focal_class.class_method_signature: ActionDao.searchAction(String path, long start, long offset, List<String> orderBy,
        List<Boolean> isDesc, long[] retTotalNumActions)
focal_class.full_signature: public List<ActionInfo> searchAction(String path, long start, long offset, List<String> orderBy,
        List<Boolean> isDesc, long[] retTotalNumActions)
focal_class.identifier: searchAction
focal_class.modifiers: public
focal_class.parameters: (String path, long start, long offset, List<String> orderBy,
        List<Boolean> isDesc, long[] retTotalNumActions)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> searchAction(String path, long start, long offset, List<String> orderBy,
        List<Boolean> isDesc, long[] retTotalNumActions)
focal_class.class_method_signature: ActionDao.getLatestActions(String actionType, int size,
        boolean finished)
focal_class.full_signature: public List<ActionInfo> getLatestActions(String actionType, int size,
        boolean finished)
focal_class.identifier: getLatestActions
focal_class.modifiers: public
focal_class.parameters: (String actionType, int size,
        boolean finished)
focal_class.return: List<ActionInfo>
focal_class.signature: List<ActionInfo> getLatestActions(String actionType, int size,
        boolean finished)
focal_class.class_method_signature: ActionDao.delete(long aid)
focal_class.full_signature: public void delete(long aid)
focal_class.identifier: delete
focal_class.modifiers: public
focal_class.parameters: (long aid)
focal_class.return: void
focal_class.signature: void delete(long aid)
focal_class.class_method_signature: ActionDao.deleteCmdletActions(long cid)
focal_class.full_signature: public void deleteCmdletActions(long cid)
focal_class.identifier: deleteCmdletActions
focal_class.modifiers: public
focal_class.parameters: (long cid)
focal_class.return: void
focal_class.signature: void deleteCmdletActions(long cid)
focal_class.class_method_signature: ActionDao.batchDeleteCmdletActions(final List<Long> cids)
focal_class.full_signature: public int[] batchDeleteCmdletActions(final List<Long> cids)
focal_class.identifier: batchDeleteCmdletActions
focal_class.modifiers: public
focal_class.parameters: (final List<Long> cids)
focal_class.return: int[]
focal_class.signature: int[] batchDeleteCmdletActions(final List<Long> cids)
focal_class.class_method_signature: ActionDao.deleteAll()
focal_class.full_signature: public void deleteAll()
focal_class.identifier: deleteAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void deleteAll()
focal_class.class_method_signature: ActionDao.insert(ActionInfo actionInfo)
focal_class.full_signature: public void insert(ActionInfo actionInfo)
focal_class.identifier: insert
focal_class.modifiers: public
focal_class.parameters: (ActionInfo actionInfo)
focal_class.return: void
focal_class.signature: void insert(ActionInfo actionInfo)
focal_class.class_method_signature: ActionDao.insert(ActionInfo[] actionInfos)
focal_class.full_signature: public void insert(ActionInfo[] actionInfos)
focal_class.identifier: insert
focal_class.modifiers: public
focal_class.parameters: (ActionInfo[] actionInfos)
focal_class.return: void
focal_class.signature: void insert(ActionInfo[] actionInfos)
focal_class.class_method_signature: ActionDao.replace(final ActionInfo[] actionInfos)
focal_class.full_signature: public int[] replace(final ActionInfo[] actionInfos)
focal_class.identifier: replace
focal_class.modifiers: public
focal_class.parameters: (final ActionInfo[] actionInfos)
focal_class.return: int[]
focal_class.signature: int[] replace(final ActionInfo[] actionInfos)
focal_class.class_method_signature: ActionDao.update(final ActionInfo actionInfo)
focal_class.full_signature: public int update(final ActionInfo actionInfo)
focal_class.identifier: update
focal_class.modifiers: public
focal_class.parameters: (final ActionInfo actionInfo)
focal_class.return: int
focal_class.signature: int update(final ActionInfo actionInfo)
focal_class.class_method_signature: ActionDao.update(final ActionInfo[] actionInfos)
focal_class.full_signature: public int[] update(final ActionInfo[] actionInfos)
focal_class.identifier: update
focal_class.modifiers: public
focal_class.parameters: (final ActionInfo[] actionInfos)
focal_class.return: int[]
focal_class.signature: int[] update(final ActionInfo[] actionInfos)
focal_class.class_method_signature: ActionDao.getMaxId()
focal_class.full_signature: public long getMaxId()
focal_class.identifier: getMaxId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getMaxId()
focal_class.class_method_signature: ActionDao.toMap(ActionInfo actionInfo)
focal_class.full_signature: private Map<String, Object> toMap(ActionInfo actionInfo)
focal_class.identifier: toMap
focal_class.modifiers: private
focal_class.parameters: (ActionInfo actionInfo)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> toMap(ActionInfo actionInfo)
focal_method.body: public List<ActionInfo> getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc) {
      JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
      boolean ifHasAid = false;
      String sql = "SELECT * FROM " + TABLE_NAME + " ORDER BY ";
  
      for (int i = 0; i < orderBy.size(); i++) {
        String ob = orderBy.get(i);
        if (!tableColumns.contains(ob)) {
          continue;
        }
  
        if (ob.equals("aid")) {
          ifHasAid = true;
        }
  
        if (ob.equals(RUNNING_TIME)) {
          sql = sql + "(finish_time - create_time)";
        } else {
          sql = sql + ob;
        }
        if (isDesc.size() > i) {
          if (isDesc.get(i)) {
            sql = sql + " desc ";
          }
          sql = sql + ",";
        }
      }
  
      if (!ifHasAid) {
        sql = sql + "aid,";
      }
  
      //delete the last char
      sql = sql.substring(0, sql.length() - 1);
      //add limit
      sql = sql + " LIMIT " + start + "," + offset + ";";
      return jdbcTemplate.query(sql, new ActionRowMapper());
    }
focal_method.class_method_signature: ActionDao.getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_method.full_signature: public List<ActionInfo> getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_method.identifier: getAPageOfAction
focal_method.invocations: size get contains equals equals size get substring length query
focal_method.modifiers: public
focal_method.parameters: (long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)
focal_method.return: List<ActionInfo>
focal_method.signature: List<ActionInfo> getAPageOfAction(long start, long offset, List<String> orderBy,
        List<Boolean> isDesc)