use of org.ovirt.engine.api.restapi.invocation.Current in project ovirt-engine by oVirt.
the class AbstractBackendActionableResource method actionAsync.
protected Response actionAsync(ActionReturnValue actionResult, Action action) {
action.setAsync(true);
String ids = asString(actionResult.getVdsmTaskIdList());
action.setId(ids);
Current current = CurrentManager.get();
String path = current.getRelativePath();
action.setHref(path + "/" + ids);
addOrUpdateLink(action, "parent", path.substring(0, path.lastIndexOf("/")));
addOrUpdateLink(action, "replay", path);
CreationStatus status = getAsynchronousStatus(actionResult);
if (status != null) {
action.setStatus(status.value());
}
return Response.status(ACCEPTED_STATUS).entity(action).build();
}
use of org.ovirt.engine.api.restapi.invocation.Current in project ovirt-engine by oVirt.
the class UsageFinder method getLinkPrefix.
private String getLinkPrefix(ServiceTreeNode node) {
Current current = CurrentManager.get();
StringBuilder buffer = new StringBuilder();
buffer.append(current.getRoot());
buffer.append("/ovirt-engine/apidoc#services/");
buffer.append(processNodeName(node));
buffer.append("/methods/");
return buffer.toString();
}
use of org.ovirt.engine.api.restapi.invocation.Current in project ovirt-engine by oVirt.
the class AbstractBackendBaseTest method setUp.
@Before
public void setUp() {
interactions.clear();
DbUser currentUser = new DbUser();
currentUser.setFirstName(USER);
currentUser.setLastName(USER);
currentUser.setDomain(DOMAIN);
currentUser.setNamespace(NAMESPACE);
currentUser.setId(GUIDS[0]);
Current current = new Current();
current.setUser(currentUser);
current.setSessionId(SESSION_ID);
current.setRoot(URI_ROOT);
current.setPrefix(BASE_PATH);
current.setPath("");
current.setVersion("4");
current.setVersionSource(VersionSource.DEFAULT);
current.setBackend(backend);
CurrentManager.put(current);
locales = new ArrayList<>();
when(httpHeaders.getAcceptableLanguages()).thenReturn(locales);
accepts = new ArrayList<>();
when(httpHeaders.getRequestHeader("Accept")).thenReturn(accepts);
List<String> filterValue = new ArrayList<>();
filterValue.add("false");
when(httpHeaders.getRequestHeader(USER_FILTER_HEADER)).thenReturn(filterValue);
mapperLocator = new MappingLocator();
mapperLocator.populate();
locale = Locale.getDefault();
Locale.setDefault(Locale.GERMANY);
messageBundle = new MessageBundle();
messageBundle.setPath(BUNDLE_PATH);
messageBundle.populate();
init();
}
use of org.ovirt.engine.api.restapi.invocation.Current in project ovirt-engine by oVirt.
the class BackendApiResourceTest method setUp.
@Before
public void setUp() {
backend = mock(BackendLocal.class);
currentUser = new DbUser();
currentUser.setLoginName(USER);
currentUser.setDomain(DOMAIN);
current = new Current();
current.setUser(currentUser);
current.setSessionId(SESSION_ID);
current.setRoot(URI_ROOT);
current.setPrefix(BASE_PATH);
current.setPath("");
current.setVersion("4");
current.setVersionSource(VersionSource.DEFAULT);
current.setBackend(backend);
CurrentManager.put(current);
MessageBundle messageBundle = new MessageBundle();
messageBundle.setPath(BUNDLE_PATH);
messageBundle.populate();
resource.setMessageBundle(messageBundle);
httpHeaders = mock(HttpHeaders.class);
List<Locale> locales = new ArrayList<>();
when(httpHeaders.getAcceptableLanguages()).thenReturn(locales);
List<String> filterValue = new ArrayList<>();
filterValue.add("false");
when(httpHeaders.getRequestHeader(USER_FILTER_HEADER)).thenReturn(filterValue);
resource.setHttpHeaders(httpHeaders);
}
use of org.ovirt.engine.api.restapi.invocation.Current in project ovirt-engine by oVirt.
the class V3ApiOutAdapter method makeCapabilitiesLink.
private V3Link makeCapabilitiesLink() {
// Calculate the href:
Current current = CurrentManager.get();
String href = current.getAbsolutePath("capabilities");
// Make the link:
V3Link link = new V3Link();
link.setRel("capabilities");
link.setHref(href);
return link;
}
Aggregations