private int insertUnassignedGroup() throws SQLException {
  PreparedStatement groupStatement;
  final int ruleid=insertUnassignedRule();
  final int evaluationOrder=getNumOfGroups() + 1;
  String unassignedGroupSqlStatement="INSERT INTO " + GROUPS_TABLE + " (GROUP_NAME, "+ "GROUP_TYPE, DATA_TYPE, RULE_INTERNAL_ID, EVALUATION_ORDER) "+ "VALUES ('%s', %d, %d, %d, %d)";
  unassignedGroupSqlStatement=String.format(unassignedGroupSqlStatement,UNASSIGNED_GROUP,UNASSIGNED_GROUP_TYPE,UNASSIGNED_DATA_TYPE,ruleid,evaluationOrder);
  groupStatement=prepareStatement(unassignedGroupSqlStatement,new String[]{"GROUP_INTERNAL_ID"});
  groupStatement.execute();
  return getInternalId(groupStatement);
}

private int insertUnassignedGroup ( ) throws SQLException { PreparedStatement groupStatement ; final int ruleid = insertUnassignedRule ( ) ; final int evaluationOrder = getNumOfGroups ( ) + 1 ; String unassignedGroupSqlStatement = "INSERT INTO " + GROUPS_TABLE + " (GROUP_NAME, " + "GROUP_TYPE, DATA_TYPE, RULE_INTERNAL_ID, EVALUATION_ORDER) " + "VALUES ('%s', %d, %d, %d, %d)" ; unassignedGroupSqlStatement = String . format ( unassignedGroupSqlStatement , UNASSIGNED_GROUP , UNASSIGNED_GROUP_TYPE , UNASSIGNED_DATA_TYPE , ruleid , evaluationOrder ) ; groupStatement = prepareStatement ( unassignedGroupSqlStatement , new String [ ] { "GROUP_INTERNAL_ID" } ) ; groupStatement . execute ( ) ; return getInternalId ( groupStatement ) ; }
this method returns the group internal id of the unassigned group . first , we add the unassigned rule into the rules table , retrieve the rule internal id , and uses this id as one of the column values when inserting the analysis group . after the execution is done , we get the generated keys which returns the internal id of the newly inserted unassigned analysis group .
