Project

General

Profile

« Previous | Next » 

Revision 5112

Added by daigle over 14 years ago

add getaccesscontrol and setaccess api calls

View differences:

MetacatClient.java
684 684
        return response;
685 685
    }
686 686
    
687
    /**
688
     * get the access control info for a given document id.
689
     *
690
     * @param _docid the docid of the document for which the access should be applied.
691
     *
692
     * @return the metacat access xml
693
     */
694
    public String getAccessControl(String docid) 
695
    	throws InsufficientKarmaException, MetacatException,MetacatInaccessibleException {
696
        //set up properties
697
        Properties prop = new Properties();
698
        prop.put("action", "getaccesscontrol");
699
        prop.put("docid", docid);
700
       
701
        String response = null;
702
        try {
703
            response = sendDataForString(prop, null, null, 0);
704
        } catch (Exception e) {
705
            throw new MetacatInaccessibleException(e.getMessage());
706
        }
707
        
708
        // Check for an error condition
709
        if (response.indexOf("<error>") != -1) {
710
            if (response.indexOf("does not have permission") != -1) {
711
                throw new InsufficientKarmaException(response);
712
            } else {
713
                throw new MetacatException(response);
714
            }
715
        }
716
        return response;
717
    }
687 718
    
688 719
    /**
689 720
     * set the access on an XML document in the repository.

Also available in: Unified diff