Пример #1
0
 public LinkBuilder requestParameter(final String requestParameter) {
   org.ovirt.engine.api.model.Body body = new org.ovirt.engine.api.model.Body();
   body.setType(requestParameter);
   Request request = new Request();
   request.setBody(body);
   link.setRequest(request);
   return this;
 }
Пример #2
0
 /**
  * Adds to a link the parameters that are common to all actions, like {@code async} and {@code
  * grace_period.expiry}. These parameters will be added to all the signatures that have a body of
  * type {@code Action}.
  *
  * @param link the link where the parameters will be added
  */
 private void addCommonActionParameters(DetailedLink link) {
   Request request = link.getRequest();
   if (request != null) {
     org.ovirt.engine.api.model.Body body = request.getBody();
     if (body != null) {
       String type = body.getType();
       if (ACTION.equals(type)) {
         List<ParametersSet> parametersSets = body.getParametersSets();
         for (ParametersSet parametersSet : parametersSets) {
           List<Parameter> parameters = parametersSet.getParameters();
           parameters.add(newGracePeriodParameter());
           parameters.add(newAsyncActionParameter());
         }
       }
     }
   }
 }
Пример #3
0
 /**
  * Adds to a link the a URL parameter, creating all the intermediate objects if they don't exist.
  *
  * @param link the link where the parameters will be added
  * @param parameter the parameter to add
  */
 private void addUrlParameter(DetailedLink link, Parameter parameter) {
   Request request = link.getRequest();
   if (request == null) {
     request = new Request();
     link.setRequest(request);
   }
   Url url = request.getUrl();
   if (url == null) {
     url = new Url();
     request.setUrl(url);
   }
   List<ParametersSet> parametersSets = url.getParametersSets();
   ParametersSet parametersSet;
   if (parametersSets.isEmpty()) {
     parametersSet = new ParametersSet();
     parametersSets.add(parametersSet);
   } else {
     parametersSet = parametersSets.get(0);
   }
   parametersSet.getParameters().add(parameter);
 }