code: protected boolean internalValidateResource(CmsDbContext dbc, CmsResource resource, int publishTag)
      throws CmsDataAccessException {
  
          Connection conn = null;
          PreparedStatement stmt = null;
          ResultSet res = null;
          boolean exists = false;
  
          try {
              conn = m_sqlManager.getConnection(dbc);
              stmt = m_sqlManager.getPreparedStatement(conn, "C_HISTORY_EXISTS_RESOURCE");
              stmt.setString(1, resource.getResourceId().toString());
              stmt.setInt(2, publishTag);
              res = stmt.executeQuery();
  
              exists = res.next();
          } catch (SQLException e) {
              throw new CmsDbSqlException(
                  Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
                  e);
          } finally {
              m_sqlManager.closeAll(dbc, conn, stmt, res);
          }
          return exists;
      }
docs: Tests if a history resource does exist.<p>
  
  @param dbc the current database context
  @param resource the resource to test
  @param publishTag the publish tag of the resource to test
  
  @return <code>true</code> if the resource already exists, <code>false</code> otherwise
  
  @throws CmsDataAccessException if something goes wrong