Search in sources :

Example 11 with Domain

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

the class BackendVmSessionsResource method addLinksIncludingUser.

/**
 * Special handling of adding links to the user and domain of the session.
 */
private void addLinksIncludingUser(Session session) {
    String domainName = session.getUser().getDomain().getName();
    addLinks(session, org.ovirt.engine.api.model.Vm.class);
    session.getUser().setDomain(new Domain());
    session.getUser().getDomain().setName(domainName);
    setSessionUser(session);
}
Also used : Domain(org.ovirt.engine.api.model.Domain)

Example 12 with Domain

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

the class GroupMapper method map.

@Mapping(from = Group.class, to = DbGroup.class)
public static DbGroup map(Group model, DbGroup template) {
    DbGroup entity = template != null ? template : new DbGroup();
    if (model.isSetName()) {
        entity.setName(model.getName());
    }
    if (model.isSetId()) {
        String id = model.getId();
        entity.setId(GuidUtils.asGuid(id));
    }
    if (model.isSetDomain()) {
        Domain domain = model.getDomain();
        if (domain.isSetName()) {
            entity.setDomain(domain.getName());
        }
    }
    if (model.isSetDomainEntryId()) {
        entity.setExternalId(DirectoryEntryIdUtils.decode(model.getDomainEntryId()));
    }
    if (model.isSetNamespace()) {
        entity.setNamespace(model.getNamespace());
    }
    return entity;
}
Also used : DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) Domain(org.ovirt.engine.api.model.Domain)

Example 13 with Domain

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

the class GroupMapper method map.

@Mapping(from = DirectoryGroup.class, to = Group.class)
public static Group map(DirectoryGroup entity, Group template) {
    Group model = template != null ? template : new Group();
    model.setName(entity.getName());
    if (!StringUtils.isEmpty(entity.getDirectoryName())) {
        Domain dom = new Domain();
        dom.setName(entity.getDirectoryName());
        dom.setId(DirectoryEntryIdUtils.encode(dom.getName()));
        model.setDomain(dom);
    }
    model.setId(DirectoryEntryIdUtils.encode(entity.getId()));
    model.setNamespace(entity.getNamespace());
    return model;
}
Also used : Group(org.ovirt.engine.api.model.Group) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) DirectoryGroup(org.ovirt.engine.core.aaa.DirectoryGroup) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) Domain(org.ovirt.engine.api.model.Domain)

Example 14 with Domain

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

the class GroupMapper method map.

@Mapping(from = AuthzGroup.class, to = Group.class)
public static Group map(AuthzGroup authzGroup, Group template) {
    Group model = template != null ? template : new Group();
    model.setId(DirectoryEntryIdUtils.encode(authzGroup.getId()));
    model.setName(authzGroup.getName());
    model.setNamespace(authzGroup.getNamespace());
    if (!StringUtils.isEmpty(authzGroup.getAuthz())) {
        Domain dom = new Domain();
        dom.setName(authzGroup.getAuthz());
        dom.setId(DirectoryEntryIdUtils.encode(dom.getName()));
        model.setDomain(dom);
    }
    return model;
}
Also used : Group(org.ovirt.engine.api.model.Group) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) DirectoryGroup(org.ovirt.engine.core.aaa.DirectoryGroup) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) Domain(org.ovirt.engine.api.model.Domain)

Example 15 with Domain

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

the class DirectoryMapper method map.

@Mapping(from = Directory.class, to = Domain.class)
public static Domain map(Directory dir, Domain template) {
    Domain directory = template != null ? template : new Domain();
    directory.setName(dir.getDomain());
    directory.setId(dir.getId());
    return directory;
}
Also used : Domain(org.ovirt.engine.api.model.Domain)

Aggregations

Domain (org.ovirt.engine.api.model.Domain)15 Group (org.ovirt.engine.api.model.Group)5 DirectoryGroup (org.ovirt.engine.core.aaa.DirectoryGroup)5 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)5 User (org.ovirt.engine.api.model.User)4 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)4 Response (javax.ws.rs.core.Response)3 Test (org.junit.Test)3 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)3 DirectoryUser (org.ovirt.engine.core.aaa.DirectoryUser)3 AuthzGroup (org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup)3 Bios (org.ovirt.engine.api.model.Bios)1 BootMenu (org.ovirt.engine.api.model.BootMenu)1 Cluster (org.ovirt.engine.api.model.Cluster)1 CpuProfile (org.ovirt.engine.api.model.CpuProfile)1 CustomProperties (org.ovirt.engine.api.model.CustomProperties)1 Groups (org.ovirt.engine.api.model.Groups)1 Icon (org.ovirt.engine.api.model.Icon)1 Ip (org.ovirt.engine.api.model.Ip)1 Quota (org.ovirt.engine.api.model.Quota)1