PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/resources/examples/ProjectCategoryEg.groovy

https://bitbucket.org/sorin/jira-plugin-intellij
Groovy | 26 lines | 16 code | 5 blank | 5 comment | 0 complexity | 378eeec930156641a3dad86eb0c2beb9 MD5 | raw file
  1. package examples
  2. import com.atlassian.core.ofbiz.util.EntityUtils
  3. import com.atlassian.jira.ManagerFactory
  4. import org.ofbiz.core.entity.GenericValue
  5. import com.atlassian.jira.ComponentManager
  6. import com.atlassian.jira.project.ProjectManager
  7. // create project category
  8. // NB - check it doesn't already exist because the name is not a unique key
  9. EntityUtils.createValue("ProjectCategory", [
  10. name: "CategoryName",
  11. description: "the project category description",
  12. ]);
  13. ManagerFactory.getProjectManager().refresh();
  14. // get the GV for the category
  15. GenericValue pc = ManagerFactory.getProjectManager().getProjectCategoryByName("CategoryName")
  16. // get the project GV
  17. ComponentManager componentManager = ComponentManager.getInstance()
  18. ProjectManager projectManager = componentManager.getProjectManager()
  19. GenericValue project = projectManager.getProjectObjByKey("JRA").genericValue
  20. // associate the project with the category
  21. ManagerFactory.getProjectManager().setProjectCategory(project, pc)