Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2010 MediaShelf <http://www.yourmediashelf.com/> This file is part of fedora-client. fedora-client is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. fedora-client is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with fedora-client. If not, see <http://www.gnu.org/licenses/>.
 
 
 package com.yourmediashelf.fedora.client.request;
 
Builder for the ListMethods method.

Author(s):
Edwin Shin
 
 public class ListMethods extends FedoraRequest<ListMethods> {
 
     private final String pid;
 
     private final String sdefPid;

    

Parameters:
pid persistent identifier of the digital object
sdefPid persistent identifier of the SDef defining the methods
 
     public ListMethods(String pidString sdefPid) {
         this. = pid;
         this. = sdefPid;
     }

    

Parameters:
pid persistent identifier of the digital object
 
     public ListMethods(String pid) {
         this(pidnull);
     }
 
     public ListMethods asOfDateTime(String asOfDateTime) {
         addQueryParam("asOfDateTime"asOfDateTime);
         return this;
     }

    

The format of the response. Defaults to "xml".

The Fedora REST API default is "html", but fedora-client will set "xml" as the default in order to parse the response. If "html" is selected, the caller is responsible for parsing the raw HTTP response as most of the FedoraResponse convenience methods rely on an XML response.

Parameters:
format The response format, either "xml" or "html"
Returns:
this builder
 
     public ListMethods format(String format) {
         addQueryParam("format"format);
         return this;
     }
 
     @Override
     public ListMethodsResponse execute() throws FedoraClientException {
         return (ListMethodsResponsesuper.execute();
     }
 
     @Override
     public ListMethodsResponse execute(FedoraClient fedora)
             throws FedoraClientException {
         // default to xml for the format, so we can parse the results
         if (getFirstQueryParam("format") == null) {
             addQueryParam("format""xml");
         }
         WebResource wr = resource(fedora);
         String path;
         if ( == null) {
             path = String.format("objects/%s/methods");
         } else {
             path = String.format("objects/%s/methods%s");
         }
 
         ClientResponse cr =
                wr.path(path).queryParams(getQueryParams()).get(
                        ClientResponse.class);
        return new ListMethodsResponse(cr);
    }
New to GrepCode? Check out our FAQ X