Search in sources :

Example 1 with GetSystemOptionParameters

use of org.ovirt.engine.core.common.queries.GetSystemOptionParameters in project ovirt-engine by oVirt.

the class BackendSystemOptionResource method get.

@Override
public SystemOption get() {
    ConfigValues config;
    try {
        config = ConfigValues.valueOf(id);
    } catch (IllegalArgumentException ex) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    GetSystemOptionParameters parameters = new GetSystemOptionParameters(config);
    String version = ParametersHelper.getParameter(httpHeaders, uriInfo, VERSION);
    if (version != null && !version.isEmpty()) {
        parameters.setOptionVersion(version);
    }
    QueryReturnValue result = runQuery(QueryType.GetSystemOption, parameters);
    if (result.getReturnValue() == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    return LinkHelper.addLinks(SystemOptionsMapper.map(result.getReturnValue(), id));
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) WebApplicationException(javax.ws.rs.WebApplicationException) GetSystemOptionParameters(org.ovirt.engine.core.common.queries.GetSystemOptionParameters) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues)

Aggregations

WebApplicationException (javax.ws.rs.WebApplicationException)1 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)1 GetSystemOptionParameters (org.ovirt.engine.core.common.queries.GetSystemOptionParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1