Project

General

Profile

Revision 6533

Added by Chris Jones over 9 years ago

IdentifierManager.getSystemMetadata() was missing the number_replicas and replication_allowed fields when building a ReplicationPolicy section of a SystemMetadata document being returned. Add in these two attributes.

View differences:

src/edu/ucsb/nceas/metacat/IdentifierManager.java
244 244
        SystemMetadata sysMeta = new SystemMetadata();
245 245
        String sql = "select guid, date_uploaded, rights_holder, checksum, checksum_algorithm, " +
246 246
          "origin_member_node, authoritive_member_node, date_modified, submitter, object_format, size, " +
247
          "obsoletes, obsoleted_by " +
247
          "replication_allowed, number_replicas, obsoletes, obsoleted_by " +
248 248
          "from systemmetadata where guid = ?";
249 249
        DBConnection dbConn = null;
250 250
        int serialNumber = -1;
251
        Boolean replicationAllowed = new Boolean(false);
252
        BigInteger numberOfReplicas = new BigInteger("-1");
253
        
251 254
        try 
252 255
        {
253 256
            // Get a database connection from the pool
......
270 273
                String submitter = rs.getString(9);
271 274
                String fmtidStr = rs.getString(10);
272 275
                BigInteger size = new BigInteger(rs.getString(11));
273
                String obsoletes = rs.getString(12);
274
                String obsoletedBy = rs.getString(13);
276
                replicationAllowed = new Boolean(rs.getString(12));
277
                numberOfReplicas = new BigInteger(rs.getString(13));
278
                String obsoletes = rs.getString(14);
279
                String obsoletedBy = rs.getString(15);
275 280

  
276 281
                
277 282
                Identifier sysMetaId = new Identifier();
......
343 348
            DBConnectionPool.returnDBConnection(dbConn, serialNumber);
344 349
        }
345 350

  
346
        // look up replication policy
351
        // populate the replication policy
347 352
        ReplicationPolicy replicationPolicy = new ReplicationPolicy();
353
        if ( numberOfReplicas != null  && numberOfReplicas.intValue() != -1 ) {
354
            replicationPolicy.setNumberReplicas(numberOfReplicas.intValue());
355
            
356
        }
357
        
358
        if ( replicationAllowed != null ) {
359
            replicationPolicy.setReplicationAllowed(replicationAllowed);
360
            
361
        }
348 362
        replicationPolicy.setBlockedMemberNodeList(getReplicationPolicy(guid, "blocked"));
349 363
        replicationPolicy.setPreferredMemberNodeList(getReplicationPolicy(guid, "preferred"));
350
		sysMeta.setReplicationPolicy(replicationPolicy);
364
		    sysMeta.setReplicationPolicy(replicationPolicy);
351 365
		
352
		// look up replication status
353
		sysMeta.setReplicaList(getReplicationStatus(guid));
366
		    // look up replication status
367
		    sysMeta.setReplicaList(getReplicationStatus(guid));
354 368
		
355
		// look up access policy
356
		try {
357
			sysMeta.setAccessPolicy(getAccessPolicy(guid));
358
		} catch (AccessException e) {
359
			throw new McdbDocNotFoundException(e);
360
		}
369
		    // look up access policy
370
		    try {
371
		    	sysMeta.setAccessPolicy(getAccessPolicy(guid));
372
		    } catch (AccessException e) {
373
		    	throw new McdbDocNotFoundException(e);
374
		    }
361 375
        
362 376
        return sysMeta;
363 377
    }

Also available in: Unified diff