public void mergeUauthors(String userid, String aid1, String aid2) throws DataAccessException {
    // dont do antyhing if it's the same aid
    if ((aid1 == null) || (aid2 == null) || aid1.equals(aid2)) return;
    UniqueAuthor uauth1 = uauthDAO.getAuthor(aid1);
    UniqueAuthor uauth2 = uauthDAO.getAuthor(aid2);
    // dont do anything if one of aid is invalid...
    if ((uauth1 == null) || (uauth2 == null)) return;

    // start backing up
    int version = getMaxVersion.run(aid1) + 1;
    KeyHolder key = backupUauthor.removePapers(userid, uauth2, version, CSXConstants.USER_VERSION);
    int update_id = key.getKey().intValue();
    // get list of authors record affected...
    List<Integer> authors = uauthDAO.getAuthorRecords(aid2);
    for (Integer author_id : authors) {
      backupAuthors.changeAuthors(update_id, author_id);
    }
    // done backing up..

    // move papers to uauth1
    uauthDAO.moveAuthorRecords(aid1, authors);
    uauthDAO.updateAuthNdocs(aid1);
    uauthDAO.updateAuthNcites(aid1);
    uauthDAO.updateAuthNdocs(aid2);
  }
  ///////////////////////////////////////////////////////
  // UniqueAuthorVersion DAO
  public void updateUauthorInfo(String userid, String aid, String new_canname, String new_affil)
      throws DataAccessException {
    UniqueAuthor uauth = uauthDAO.getAuthor(aid);
    if (uauth == null) return;
    if ((new_canname == null)
        || new_canname.equals("")) // canname cannot be null or empty string...
    return;
    // if the information didn't change....dont do anything
    if (uauth.getCanname().equals(new_canname) && uauth.getAffil().equals(new_affil)) return;

    // backup oldinfo to version table
    int version = getMaxVersion.run(aid) + 1;
    backupUauthor.changeInfo(userid, uauth, version, CSXConstants.USER_VERSION);

    // update information
    uauth.setCanname(new_canname);
    uauth.setAffil(new_affil);
    uauthDAO.updateAuthInfo(uauth); // update new infomation
  }
  public void removeUauthorPapers(String userid, String aid, List<Integer> papers)
      throws DataAccessException {
    if ((aid == null) || (papers.size() == 0)) return;
    UniqueAuthor uauth = uauthDAO.getAuthor(aid);
    if (uauth == null) return;

    // start backing up
    int version = getMaxVersion.run(aid) + 1;
    KeyHolder key = backupUauthor.removePapers(userid, uauth, version, CSXConstants.USER_VERSION);
    int update_id = key.getKey().intValue();
    // get list of authors record affected...
    List<Integer> authors = uauthDAO.getAuthorRecordsByPapers(aid, papers);
    for (Integer author_id : authors) {
      System.out.println("AID:" + author_id);
      backupAuthors.changeAuthors(update_id, author_id);
    }
    // done backing up..

    // remove papers...
    uauthDAO.moveAuthorRecords(Integer.toString(CSXConstants.USER_REMOVED), authors);
    uauthDAO.updateAuthNdocs(aid);
    uauthDAO.updateAuthNcites(aid);
  }