raml.tools.model.ActionContext Maven / Gradle / Ivy
package raml.tools.model;
import org.raml.model.*;
import org.raml.model.parameter.Header;
import org.raml.model.parameter.QueryParameter;
import org.raml.model.parameter.UriParameter;
import java.util.*;
public class ActionContext {
Action action;
public ActionContext(Action action) {
this.action = action;
}
public ActionType getType() {
return action.getType();
}
public String getDescription() {
return action.getDescription();
}
public Map getHeaders() {
return action.getHeaders();
}
public Map getQueryParameters() {
return action.getQueryParameters();
}
public Map getBody() {
return action.getBody() == null ? Collections.emptyMap() : action.getBody();
}
public Map getResponses() {
if (action.getResponses() == null) {
return Collections.emptyMap();
}
return responseContexts();
}
private Map responseContexts() {
Map responses = new HashMap<>();
for (Map.Entry response : action.getResponses().entrySet()) {
responses.put(response.getKey(), new ResponseContext(response.getValue()));
}
return responses;
}
public Resource getResource() {
return action.getResource();
}
public List getIs() {
return action.getIs();
}
public List getProtocols() {
return action.getProtocols();
}
public List getSecuredBy() {
return action.getSecuredBy();
}
public Map getUriParameters() {
// FIXME should return all uri params, not only the most recent ones
return action.getResource().getUriParameters();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy