use of org.ovirt.engine.core.common.businessentities.TagsUserMap in project ovirt-engine by oVirt.
the class AttachUserToTagCommand method executeCommand.
@Override
protected void executeCommand() {
TagsUserMap map;
if (getTagId() != null) {
for (Guid userGuid : getUserList()) {
DbUser user = dbUserDao.get(userGuid);
if (tagDao.getTagUserByTagIdAndByuserId(getTagId(), userGuid) == null) {
map = new TagsUserMap(getTagId(), userGuid);
tagDao.attachUserToTag(map);
noActionDone = false;
if (user != null) {
appendCustomCommaSeparatedValue("AttachUsersNames", user.getLoginName());
}
} else {
if (user != null) {
appendCustomCommaSeparatedValue("AttachUsersNamesExists", user.getLoginName());
}
}
}
setSucceeded(true);
}
}
use of org.ovirt.engine.core.common.businessentities.TagsUserMap in project ovirt-engine by oVirt.
the class TagDaoImpl method getTagUserByTagIdAndByuserId.
@Override
public TagsUserMap getTagUserByTagIdAndByuserId(Guid tagId, Guid userId) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("tag_id", tagId).addValue("user_id", userId);
RowMapper<TagsUserMap> mapper = (rs, rowNum) -> {
TagsUserMap entity = new TagsUserMap();
entity.setTagId(getGuidDefaultEmpty(rs, "tag_id"));
entity.setUserId(getGuidDefaultEmpty(rs, "user_id"));
return entity;
};
return getCallsHandler().executeRead("GetTagUserByTagIdAndByuserId", mapper, parameterSource);
}
use of org.ovirt.engine.core.common.businessentities.TagsUserMap in project ovirt-engine by oVirt.
the class TagDaoTest method testGetUserTag.
@Test
public void testGetUserTag() {
TagsUserMap result = dao.getTagUserByTagIdAndByuserId(existingUserTag.getTagId(), existingUserTag.getUserId());
assertNotNull(result);
assertEqualsTagUserMap(existingUserTag, result);
}
Aggregations