package org.ovirt.engine.core.bll;

import org.ovirt.engine.core.common.businessentities.tags;
import org.ovirt.engine.core.common.interfaces.ITagsHandler;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.dal.dbbroker.DbFacade;

public class TagsHandler implements ITagsHandler {

    public void MoveTag(Guid tagId, Guid newParent) {
        TagsDirector.getInstance().MoveTag(tagId, newParent);
    }

    @Override
    public tags GetTagByTagName(String tagName) {
        return TagsDirector.getInstance().GetTagByName(tagName);
    }

    @Override
    public String GetTagNamesAndChildrenNamesByRegExp(String tagNameRegExp) {
        return TagsDirector.getInstance().GetTagNamesAndChildrenNamesByRegExp(tagNameRegExp);
    }

    @Override
    public String GetTagIdAndChildrenIds(Guid tagId) {
        return TagsDirector.getInstance().GetTagIdAndChildrenIds(tagId);
    }

    @Override
    public String GetTagNameAndChildrenNames(Guid tagId) {
        return TagsDirector.getInstance().GetTagNameAndChildrenNames(tagId);
    }

    public static boolean IsUserAttachedToTag(Guid tagId, Guid userId) {
        return (DbFacade
                .getInstance()
                .getTagDao()
                .getAllForUsersWithIds(
                        TagsDirector.getInstance()
                                .GetTagIdAndChildrenIds(tagId)).size() != 0);
    }

    public static boolean IsUserGroupAttachedToTag(Guid tagId, Guid groupId) {
        return (DbFacade
                .getInstance()
                .getTagDao()
                .getAllForUsersWithIds(
                        TagsDirector.getInstance()
                                .GetTagIdAndChildrenIds(tagId)).size() != 0);
    }

    public static boolean IsVmAttachedToTag(Guid tagId, Guid vmId) {
        return (DbFacade
                .getInstance()
                .getTagDao()
                .getAllVmTagsWithIds(
                        TagsDirector.getInstance()
                                .GetTagIdAndChildrenIds(tagId)).size() != 0);
    }

    public static boolean IsVdsAttachedToTag(Guid tagId, int vdsId) {
        return (DbFacade
                .getInstance()
                .getTagDao()
                .getAllForVdsWithIds(
                        TagsDirector.getInstance()
                                .GetTagIdAndChildrenIds(tagId)).size() != 0);
    }
}

@@ -195,234 +195,59 @@
 id;%0A
-import org.ovirt.engine.core.dal.dbbroker.DbFacade;%0A%0Apublic class TagsHandler implements ITagsHandler %7B%0A%0A    public void MoveTag(Guid tagId, Guid newParent) %7B%0A        TagsDirector.getInstance().MoveTag(tagId, newParent);%0A    %7D
+%0Apublic class TagsHandler implements ITagsHandler %7B
 %0A%0A  
@@ -881,1338 +881,7 @@
    %7D
-%0A%0A    public static boolean IsUserAttachedToTag(Guid tagId, Guid userId) %7B%0A        return (DbFacade%0A                .getInstance()%0A                .getTagDao()%0A                .getAllForUsersWithIds(%0A                        TagsDirector.getInstance()%0A                                .GetTagIdAndChildrenIds(tagId)).size() != 0);%0A    %7D%0A%0A    public static boolean IsUserGroupAttachedToTag(Guid tagId, Guid groupId) %7B%0A        return (DbFacade%0A                .getInstance()%0A                .getTagDao()%0A                .getAllForUsersWithIds(%0A                        TagsDirector.getInstance()%0A                                .GetTagIdAndChildrenIds(tagId)).size() != 0);%0A    %7D%0A%0A    public static boolean IsVmAttachedToTag(Guid tagId, Guid vmId) %7B%0A        return (DbFacade%0A                .getInstance()%0A                .getTagDao()%0A                .getAllVmTagsWithIds(%0A                        TagsDirector.getInstance()%0A                                .GetTagIdAndChildrenIds(tagId)).size() != 0);%0A    %7D%0A%0A    public static boolean IsVdsAttachedToTag(Guid tagId, int vdsId) %7B%0A        return (DbFacade%0A                .getInstance()%0A                .getTagDao()%0A                .getAllForVdsWithIds(%0A                        TagsDirector.getInstance()%0A                                .GetTagIdAndChildrenIds(tagId)).size() != 0);%0A    %7D
 %0A%7D%0A

Remove unused TagsHandler methods