Project

General

Profile

« Previous | Next » 

Revision 9249

Added by Jing Tao almost 9 years ago

Use the NodeReference object to replace the replicaStatus to restrict the listObjects method.

View differences:

MNodeService.java
928 928
    @Override
929 929
    public ObjectList listObjects(Session session, Date startTime, Date endTime, ObjectFormatIdentifier objectFormatId, Identifier identifier, Boolean replicaStatus, Integer start,
930 930
            Integer count) throws NotAuthorized, InvalidRequest, NotImplemented, ServiceFailure, InvalidToken {
931

  
932
        return super.listObjects(session, startTime, endTime, objectFormatId, identifier, replicaStatus, start, count);
931
        NodeReference nodeId = null;
932
        if(!replicaStatus) {
933
            //not include those objects whose authoritative node is not this mn
934
            nodeId = new NodeReference();
935
            try {
936
                String currentNodeId = PropertyService.getInstance().getProperty("dataone.nodeId"); // return only pids for which this mn
937
                nodeId.setValue(currentNodeId);
938
            } catch(Exception e) {
939
                throw new ServiceFailure("1580", e.getMessage());
940
            }
941
        }
942
        return super.listObjects(session, startTime, endTime, objectFormatId, identifier, nodeId, start, count);
933 943
    }
934 944

  
935 945
    /**

Also available in: Unified diff