use of org.ovirt.engine.core.common.businessentities.TagsTemplateMap in project ovirt-engine by oVirt.
the class TagDaoImpl method getTagTemplateByTagIdAndByTemplateId.
/**
* In the database both Template and Vm Tags share the same tables and functions
*/
@Override
public TagsTemplateMap getTagTemplateByTagIdAndByTemplateId(Guid tagId, Guid vmId) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("tag_id", tagId).addValue("vm_id", vmId);
RowMapper<TagsTemplateMap> mapper = (rs, rowNum) -> {
TagsTemplateMap entity = new TagsTemplateMap();
entity.setTagId(getGuidDefaultEmpty(rs, "tag_id"));
entity.setTemplateId(getGuidDefaultEmpty(rs, "vm_id"));
entity.setDefaultDisplayType((Integer) rs.getObject("DefaultDisplayType"));
return entity;
};
return getCallsHandler().executeRead("GetTagVmByTagIdAndByvmId", mapper, parameterSource);
}
use of org.ovirt.engine.core.common.businessentities.TagsTemplateMap in project ovirt-engine by oVirt.
the class TagDaoTest method testAttachTemplateToTag.
@Test
public void testAttachTemplateToTag() {
dao.attachTemplateToTag(newTemplateTag);
TagsTemplateMap result = dao.getTagTemplateByTagIdAndByTemplateId(newTemplateTag.getTagId(), newTemplateTag.getTemplateId());
assertNotNull(result);
assertEqualsTagsTemplateMap(newTemplateTag, result);
}
use of org.ovirt.engine.core.common.businessentities.TagsTemplateMap in project ovirt-engine by oVirt.
the class TagDaoTest method testDetachTemplateFromTag.
@Test
public void testDetachTemplateFromTag() {
dao.detachTemplateFromTag(existingTemplateTag.getTagId(), existingTemplateTag.getTemplateId());
TagsTemplateMap result = dao.getTagTemplateByTagIdAndByTemplateId(existingTemplateTag.getTagId(), existingTemplateTag.getTemplateId());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.TagsTemplateMap in project ovirt-engine by oVirt.
the class TagDaoTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getTagDao();
existingTag = dao.get(EXISTING_TAG_ID);
existingTag = dao.get(new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0c"));
parent = FixturesTool.DATA_CENTER;
user = new Guid("9bf7c640-b620-456f-a550-0348f366544a");
vm = EXISTING_VM_ID;
template = new Guid("77296e00-0cad-4e5a-9299-008a7b6f4355");
vmPool = new Guid("103cfd1d-18b1-4790-8a0c-1e52621b0076");
newTag = new Tags();
newTag.setTagName("newtagname");
newTag.setIsReadonly(true);
newTag.setDescription("newtagdescription");
newTag.setParentId(parent);
existingUserGroupTag = dao.getTagUserGroupByGroupIdAndByTagId(EXISTING_TAG_ID, EXISTING_GROUP_ID);
existingUserTag = dao.getTagUserByTagIdAndByuserId(EXISTING_TAG_ID, EXISTING_USER_ID);
existingVdsTag = dao.getTagVdsByTagIdAndByVdsId(EXISTING_TAG_ID, FixturesTool.VDS_RHEL6_NFS_SPM);
newVdsTag = new TagsVdsMap(EXISTING_TAG_ID, FixturesTool.HOST_ID);
existingVmTag = dao.getTagVmByTagIdAndByVmId(EXISTING_TAG_ID, EXISTING_VM_ID);
existingTemplateTag = dao.getTagTemplateByTagIdAndByTemplateId(EXISTING_TAG_ID, EXISTING_TEMPLATE_ID);
newVmTag = new TagsVmMap(EXISTING_TAG_ID, FREE_VM_ID);
newTemplateTag = new TagsTemplateMap(EXISTING_TAG_ID, FREE_TEMPLATE_ID);
}
use of org.ovirt.engine.core.common.businessentities.TagsTemplateMap in project ovirt-engine by oVirt.
the class TagDaoTest method testGetTagTemplateMapByTag.
@Test
public void testGetTagTemplateMapByTag() {
TagsTemplateMap result = dao.getTagTemplateByTagIdAndByTemplateId(existingTemplateTag.getTagId(), existingTemplateTag.getTemplateId());
assertNotNull(result);
assertEqualsTagsTemplateMap(existingTemplateTag, result);
}
Aggregations