use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.
the class CompletenessAssertorTest method testMissingListSubFieldAlternatives.
@Test
public void testMissingListSubFieldAlternatives() throws Exception {
User user = new User();
user.setRoles(new Roles());
user.getRoles().getRoles().add(new Role());
user.getRoles().getRoles().get(0).setId("0");
user.getRoles().getRoles().add(new Role());
user.getRoles().getRoles().get(1).setDescription("0");
try {
CompletenessAssertor.validateParameters(user, "roles.id|name");
fail("expected WebApplicationException on incomplete model");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "User", "roles.id|name");
}
}
use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.
the class V3GroupInAdapter method adapt.
@Override
public Group adapt(V3Group from) {
Group to = new Group();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDomain()) {
to.setDomain(adaptIn(from.getDomain()));
}
if (from.isSetDomainEntryId()) {
to.setDomainEntryId(from.getDomainEntryId());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNamespace()) {
to.setNamespace(from.getNamespace());
}
if (from.isSetRoles()) {
to.setRoles(new Roles());
to.getRoles().getRoles().addAll(adaptIn(from.getRoles().getRoles()));
}
return to;
}
use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.
the class V3UserInAdapter method adapt.
@Override
public User adapt(V3User from) {
User to = new User();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDepartment()) {
to.setDepartment(from.getDepartment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDomain()) {
to.setDomain(adaptIn(from.getDomain()));
}
if (from.isSetDomainEntryId()) {
to.setDomainEntryId(from.getDomainEntryId());
}
if (from.isSetEmail()) {
to.setEmail(from.getEmail());
}
if (from.isSetGroups()) {
to.setGroups(new Groups());
to.getGroups().getGroups().addAll(adaptIn(from.getGroups().getGroups()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetLastName()) {
to.setLastName(from.getLastName());
}
if (from.isSetLoggedIn()) {
to.setLoggedIn(from.isLoggedIn());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNamespace()) {
to.setNamespace(from.getNamespace());
}
if (from.isSetPassword()) {
to.setPassword(from.getPassword());
}
if (from.isSetPrincipal()) {
to.setPrincipal(from.getPrincipal());
}
if (from.isSetRoles()) {
to.setRoles(new Roles());
to.getRoles().getRoles().addAll(adaptIn(from.getRoles().getRoles()));
}
if (from.isSetUserName()) {
to.setUserName(from.getUserName());
}
return to;
}
use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.
the class V3RolesInAdapter method adapt.
@Override
public Roles adapt(V3Roles from) {
Roles to = new Roles();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getRoles().addAll(adaptIn(from.getRoles()));
return to;
}
use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.
the class CompletenessAssertorTest method testCompleteListSubFieldAlternatives.
@Test
public void testCompleteListSubFieldAlternatives() throws Exception {
User user = new User();
user.setRoles(new Roles());
user.getRoles().getRoles().add(new Role());
user.getRoles().getRoles().get(0).setId("0");
user.getRoles().getRoles().add(new Role());
user.getRoles().getRoles().get(1).setName("0");
CompletenessAssertor.validateParameters(user, "roles.id|name");
}
Aggregations