Fixed imports in categorized views

Change-Id: Ia7c52cb21bd9133842c2ca378f12c724ac8e959e
diff --git a/_states/jenkins_view.py b/_states/jenkins_view.py
index 6f0d995..28b12e0 100644
--- a/_states/jenkins_view.py
+++ b/_states/jenkins_view.py
@@ -3,6 +3,9 @@
 logger = logging.getLogger(__name__)
 
 add_view_groovy = """\
+import java.util.stream.Collectors
+import org.jenkinsci.plugins.categorizedview.CategorizedJobsView
+import org.jenkinsci.plugins.categorizedview.GroupingRule
 view = Jenkins.instance.getView("{view_name}")
 if(view){{
   if(view.getClass().getName().equals("hudson.model.ListView")){{
@@ -113,7 +116,6 @@
                     include_regex)
         if type == "CategorizedJobsView":
             # add imports for categorized views
-            template = "import java.util.stream.Collectors\nimport org.jenkinsci.plugins.categorizedview.CategorizedJobsView\nimport org.jenkinsci.plugins.categorizedview.GroupingRule\n" + template
             if include_regex:
                 view_def += "\nview.setIncludeRegex(\"{}\")".format(
                     include_regex)