@@ -0,0 +1,2694 @@
+/*%0A Copyright (C) 2003 EBI, GRL%0A %0A This library is free software; you can redistribute it and/or%0A modify it under the terms of the GNU Lesser General Public%0A License as published by the Free Software Foundation; either%0A version 2.1 of the License, or (at your option) any later version.%0A %0A This library is distributed in the hope that it will be useful,%0A but WITHOUT ANY WARRANTY; without even the implied warranty of%0A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A Lesser General Public License for more details.%0A %0A You should have received a copy of the GNU Lesser General Public%0A License along with this library; if not, write to the Free Software%0A Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0Apackage org.ensembl.healthcheck.testcase.generic;%0A%0Aimport java.sql.Connection;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.DatabaseType;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0A%0A/**%0A * Check that certain seq_region_attribs are present.%0A */%0Apublic class SeqRegionAttribsPresent extends SingleDatabaseTestCase %7B%0A%0A%09private String%5B%5D attribCodes = %7B %22GeneNo_knwCod%22, %22GeneNo_novCod%22 %7D;%0A%0A%09/**%0A%09 * Create a new SeqRegionAttribsPresent healthcheck.%0A%09 */%0A%09public SeqRegionAttribsPresent() %7B%0A%0A%09%09addToGroup(%22release%22);%0A%09%09setDescription(%22Check that certain seq_region_attribs are present.%22);%0A%0A%09%7D%0A%0A%09/**%0A%09 * This only really applies to core databases%0A%09 */%0A%09public void types() %7B%0A%0A%09%09removeAppliesToType(DatabaseType.OTHERFEATURES);%0A%09%09removeAppliesToType(DatabaseType.ESTGENE);%0A%09%09removeAppliesToType(DatabaseType.VEGA);%0A%09%09removeAppliesToType(DatabaseType.CDNA);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Run the test.%0A%09 * %0A%09 * @param dbre%0A%09 *          The database to check.%0A%09 * @return true if the test passes.%0A%09 */%0A%09public boolean run(final DatabaseRegistryEntry dbre) %7B%0A%0A%09%09boolean result = true;%0A%0A%09%09Connection con = dbre.getConnection();%0A%09%09%0A%09%09for (int i = 0; i %3C attribCodes.length; i++) %7B%0A%09%09%09%0A%09%09%09String code = attribCodes%5Bi%5D;%0A%09%09%09int count = getRowCount(con, %22SELECT COUNT(*) FROM attrib_type at, seq_region_attrib sa WHERE sa.attrib_type_id=at.attrib_type_id AND at.code='%22 + code + %22'%22);%0A%09%0A%09%09%09if (count == 0) %7B%0A%09%09%09%09%0A%09%09%09%09ReportManager.problem(this, con, %22No seq_region_attribs of code %22 + code + %22 - there should be some. This may indicate that the seq_region_attribs.pl script needs to be run.%22);%0A%09%09%09%09result = false;%0A%09%09%09%09%0A%09%09%09%7D else %7B%0A%09%09%09%09%0A%09%09%09%09ReportManager.correct(this, con, count + %22 seq_region_attrib entries for %22 + code);%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return result;%0A%0A%09%7D // run%0A%0A%09// -----------------------------------------------------------------%0A%0A%7D // SeqRegionAttribsPresent%0A

Check that certain seq_region_attribs are present.