/** * 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()); } } } } }
private DetailedLink decideWhichToDelete(DetailedLink link1, DetailedLink link2) { String link1ParamType = link1.getRequest().getBody().getType(); String link2ParamType = link2.getRequest().getBody().getType(); //Verify for both links that body is not mandatory if ( ( (link1.getRequest().getBody().isRequired() != null) && (link2.getRequest().getBody().isRequired() != null) ) && ( (Boolean.FALSE.equals(link1.getRequest().getBody().isRequired())) && (Boolean.FALSE.equals(link2.getRequest().getBody().isRequired())) ) ) { if (link1ParamType!=null && link2ParamType==null) { return link2; } if (link1ParamType==null && link2ParamType!=null) { return link1; } } return null; } }