Example #1
0
  @Test
  public void testDataRowIntPk() throws Exception {
    createTwoArtists();

    DataRow a3 = SelectById.dataRowQuery(Artist.class, 3).selectOne(context);
    assertNotNull(a3);
    assertEquals("artist3", a3.get("ARTIST_NAME"));

    DataRow a2 = SelectById.dataRowQuery(Artist.class, 2).selectOne(context);
    assertNotNull(a2);
    assertEquals("artist2", a2.get("ARTIST_NAME"));
  }
Example #2
0
  /**
   * プロジェクト進捗率を取得します。 最上位のタスクより進捗率を計算します。
   *
   * @param projectId プロジェクトID
   * @return 紐づく全タスク情報
   */
  public static int getProjectProgressRate(Integer projectId) {

    try {

      List<DataRow> result = getProjectProgress(projectId);

      if (result == null) {
        return 0;
      }

      DataRow row = result.get(0);
      Object per = row.get("result_per");
      if (per == null) {
        return 0;
      }

      return Integer.valueOf(row.get("result_per").toString());

    } catch (Exception ex) {
      logger.error("Exception", ex);
      return 0;
    }
  }
    public void nextRows(Query query, List<?> dataRows) {

      // process selected object, issue an update query
      if (dataRows == null || dataRows.size() == 0) {
        throw new CayenneRuntimeException(
            "Error generating PK : entity not supported: " + entityName);
      }

      if (dataRows.size() > 1) {
        throw new CayenneRuntimeException(
            "Error generating PK : too many rows for entity: " + entityName);
      }

      DataRow lastPk = (DataRow) dataRows.get(0);
      id = (Number) lastPk.get("NEXT_ID");
    }