Project

General

Profile

« Previous | Next » 

Revision 7447

Fix a minor bug in listObjects() where total was set incorrectly when total was set incorrectly when count=0. The definition of total in the D1 architecture docs says 'The total number of entries in the source list from which the slice was extracted.' With count=0, we assume the total is the total count from the entire object store. Needs testing.

View differences:

src/edu/ucsb/nceas/metacat/IdentifierManager.java
1466 1466
                f3 = true;
1467 1467
            }
1468 1468

  
1469
            if (replicaStatus) {
1469
            if (!replicaStatus) {
1470 1470
                String currentNodeId = PropertyService.getInstance().getProperty("dataone.nodeId");
1471 1471
                if (!f1 && !f2 && !f3) {
1472 1472
                    sql += " where authoritive_member_node != '" +
......
1514 1514
            // logMetacat.debug("LISTOBJECTS QUERY: " + stmt.toString());
1515 1515

  
1516 1516
            ResultSet rs = stmt.executeQuery();
1517
        	
1518
            // get the total object count
1519
            String totalQuery = "select count(*) from systemmetadata";
1520
            PreparedStatement statement = dbConn.prepareStatement(totalQuery);
1521
            ResultSet totalResult = statement.executeQuery();
1522
        	total = totalResult.getInt(1);
1523

  
1517 1524
            // handle special count = 0 query here
1518 1525
            if (count == 0) {
1519
            	while (rs.next()) {
1520
            		total = rs.getInt(1);
1521
            		break;
1522
            	}
1523 1526
            	ol.setStart(start);
1524 1527
                ol.setCount(count);
1525 1528
                ol.setTotal(total);

Also available in: Unified diff