use of org.ovirt.engine.core.common.businessentities.TagsUserGroupMap in project ovirt-engine by oVirt.
the class TagDaoTest method testGetTagUserGroupByGroupIdAndTagId.
@Test
public void testGetTagUserGroupByGroupIdAndTagId() {
TagsUserGroupMap result = dao.getTagUserGroupByGroupIdAndByTagId(existingUserGroupTag.getTagId(), existingUserGroupTag.getGroupId());
assertNotNull(result);
assertEqualsTagUserGroupMap(existingUserGroupTag, result);
}
use of org.ovirt.engine.core.common.businessentities.TagsUserGroupMap in project ovirt-engine by oVirt.
the class TagDaoImpl method getTagUserGroupByGroupIdAndByTagId.
@Override
public TagsUserGroupMap getTagUserGroupByGroupIdAndByTagId(Guid tag, Guid group) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("group_id", group).addValue("tag_id", tag);
RowMapper<TagsUserGroupMap> mapper = (rs, rowNum) -> {
TagsUserGroupMap entity = new TagsUserGroupMap();
entity.setGroupId(getGuidDefaultEmpty(rs, "group_id"));
entity.setTagId(getGuidDefaultEmpty(rs, "tag_id"));
return entity;
};
return getCallsHandler().executeRead("GetTagUserGroupByGroupIdAndByTagId", mapper, parameterSource);
}
use of org.ovirt.engine.core.common.businessentities.TagsUserGroupMap in project ovirt-engine by oVirt.
the class TagDaoTest method testDetachUserGroupFromTag.
@Test
public void testDetachUserGroupFromTag() {
dao.detachUserGroupFromTag(existingUserGroupTag.getTagId(), existingUserGroupTag.getGroupId());
TagsUserGroupMap result = dao.getTagUserGroupByGroupIdAndByTagId(existingUserGroupTag.getTagId(), existingUserGroupTag.getGroupId());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.TagsUserGroupMap in project ovirt-engine by oVirt.
the class AttachUserGroupToTagCommand method executeCommand.
@Override
protected void executeCommand() {
if (getTagId() != null) {
for (Guid groupGuid : getGroupList()) {
DbGroup group = dbGroupDao.get(groupGuid);
if (tagDao.getTagUserGroupByGroupIdAndByTagId(getTagId(), groupGuid) == null) {
TagsUserGroupMap map = new TagsUserGroupMap(groupGuid, getTagId());
tagDao.attachUserGroupToTag(map);
noActionDone = false;
if (group != null) {
appendCustomCommaSeparatedValue("AttachGroupsNames", group.getName());
}
} else {
if (group != null) {
appendCustomCommaSeparatedValue("AttachGroupsNamesExists", group.getName());
}
}
}
setSucceeded(true);
}
}
Aggregations