use of org.ovirt.engine.core.common.businessentities.TagsVmMap in project ovirt-engine by oVirt.
the class TagDaoImpl method getTagVmMapByVmIdAndDefaultTag.
@Override
public List<TagsVmMap> getTagVmMapByVmIdAndDefaultTag(Guid vmid) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", vmid);
RowMapper<TagsVmMap> mapper = (rs, rowNum) -> {
TagsVmMap entity = new TagsVmMap();
entity.setTagId(getGuidDefaultEmpty(rs, "tag_id"));
entity.setVmId(getGuidDefaultEmpty(rs, "vm_id"));
entity.setDefaultDisplayType((Integer) rs.getObject("DefaultDisplayType"));
return entity;
};
return getCallsHandler().executeReadList("GetnVmTagsByVmIdAndDefaultTag", mapper, parameterSource);
}
use of org.ovirt.engine.core.common.businessentities.TagsVmMap in project ovirt-engine by oVirt.
the class TagDaoTest method updateVmTag.
@Test
public void updateVmTag() {
existingVmTag.setDefaultDisplayType(existingVmTag.getDefaultDisplayType() + 1);
dao.updateDefaultDisplayForVmTag(existingVmTag);
TagsVmMap result = dao.getTagVmByTagIdAndByVmId(existingVmTag.getTagId(), existingVmTag.getVmId());
assertNotNull(result);
assertEqualsTagsVmMap(existingVmTag, result);
}
use of org.ovirt.engine.core.common.businessentities.TagsVmMap in project ovirt-engine by oVirt.
the class TagDaoTest method testAttachVmToTag.
@Test
public void testAttachVmToTag() {
dao.attachVmToTag(newVmTag);
TagsVmMap result = dao.getTagVmByTagIdAndByVmId(newVmTag.getTagId(), newVmTag.getVmId());
assertNotNull(result);
assertEqualsTagsVmMap(newVmTag, result);
}
use of org.ovirt.engine.core.common.businessentities.TagsVmMap in project ovirt-engine by oVirt.
the class UpdateTagsVmMapDefaultDisplayTypeCommand method validate.
@Override
protected boolean validate() {
TagsVmMap tagsVmMap;
tagsVmMap = tagDao.getTagVmByTagIdAndByVmId(getParameters().getTagsVmMap().getTagId(), getParameters().getTagsVmMap().getVmId());
if (tagsVmMap == null) {
addValidationMessage(EngineMessage.TAGS_SPECIFY_TAG_IS_NOT_EXISTS);
return false;
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.TagsVmMap in project ovirt-engine by oVirt.
the class AttachVmsToTagCommand method executeCommand.
@Override
protected void executeCommand() {
if (getTagId() != null) {
for (Guid vmGuid : getVmsList()) {
VM vm = vmDao.get(vmGuid);
if (tagDao.getTagVmByTagIdAndByVmId(getTagId(), vmGuid) == null) {
if (vm != null) {
appendCustomCommaSeparatedValue("VmsNames", vm.getName());
}
TagsVmMap map = new TagsVmMap(getTagId(), vmGuid);
tagDao.attachVmToTag(map);
noActionDone = false;
} else {
if (vm != null) {
appendCustomCommaSeparatedValue("VmsNamesExists", vm.getName());
}
}
}
}
setSucceeded(true);
}
Aggregations