Search in sources :

Example 1 with Actionable

use of org.ovirt.engine.api.model.Actionable in project ovirt-engine by oVirt.

the class V3StorageDomainVmServer method doImport.

@POST
@Consumes({ "application/xml", "application/json" })
@Actionable
@Path("import")
public Response doImport(V3Action action) {
    // to be collapsed during import, but in V4 this has been replaced by a "collapse_snapshots" boolean parameter:
    if (action.isSetVm() && action.getVm().isSetSnapshots()) {
        V3Snapshots snapshots = action.getVm().getSnapshots();
        if (snapshots.isSetCollapseSnapshots() && snapshots.isCollapseSnapshots()) {
            Map<String, String> parameters = CurrentManager.get().getParameters();
            parameters.put("collapse_snapshots", String.valueOf(true));
        }
    }
    return adaptAction(getDelegate()::doImport, action);
}
Also used : V3Snapshots(org.ovirt.engine.api.v3.types.V3Snapshots) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Actionable(org.ovirt.engine.api.model.Actionable)

Example 2 with Actionable

use of org.ovirt.engine.api.model.Actionable in project ovirt-engine by oVirt.

the class ActionsBuilder method build.

public Actions build() {
    Actions actions = null;
    for (Method method : ArrayUtils.concat(service.getMethods(), getInterfaceSignatures(collection))) {
        Path path = method.getAnnotation(Path.class);
        Actionable actionable = method.getAnnotation(Actionable.class);
        if (actionable != null && path != null) {
            Link link = new Link();
            link.setRel(path.value());
            link.setHref(base + URL_SEPARATOR + link.getRel());
            if (actions == null) {
                actions = new Actions();
            }
            actions.getLinks().add(link);
        }
    }
    return actions;
}
Also used : Path(javax.ws.rs.Path) Actions(org.ovirt.engine.api.model.Actions) Actionable(org.ovirt.engine.api.model.Actionable) Method(java.lang.reflect.Method) Link(org.ovirt.engine.api.model.Link)

Aggregations

Path (javax.ws.rs.Path)2 Actionable (org.ovirt.engine.api.model.Actionable)2 Method (java.lang.reflect.Method)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Actions (org.ovirt.engine.api.model.Actions)1 Link (org.ovirt.engine.api.model.Link)1 V3Snapshots (org.ovirt.engine.api.v3.types.V3Snapshots)1