/src/test/resources/examples/ProjectCategoryEg.groovy
Groovy | 26 lines | 16 code | 5 blank | 5 comment | 0 complexity | 378eeec930156641a3dad86eb0c2beb9 MD5 | raw file
- package examples
-
- import com.atlassian.core.ofbiz.util.EntityUtils
- import com.atlassian.jira.ManagerFactory
- import org.ofbiz.core.entity.GenericValue
- import com.atlassian.jira.ComponentManager
- import com.atlassian.jira.project.ProjectManager
-
- // create project category
- // NB - check it doesn't already exist because the name is not a unique key
- EntityUtils.createValue("ProjectCategory", [
- name: "CategoryName",
- description: "the project category description",
- ]);
- ManagerFactory.getProjectManager().refresh();
-
- // get the GV for the category
- GenericValue pc = ManagerFactory.getProjectManager().getProjectCategoryByName("CategoryName")
-
- // get the project GV
- ComponentManager componentManager = ComponentManager.getInstance()
- ProjectManager projectManager = componentManager.getProjectManager()
- GenericValue project = projectManager.getProjectObjByKey("JRA").genericValue
-
- // associate the project with the category
- ManagerFactory.getProjectManager().setProjectCategory(project, pc)