1 package com.atlassian.webdriver.jira.component.project;
2
3 import com.atlassian.pageobjects.Page;
4 import com.atlassian.webdriver.utils.Check;
5 import org.openqa.selenium.By;
6 import org.openqa.selenium.WebElement;
7
8 import java.util.List;
9
10
11
12
13
14 public class ProjectSummary
15 {
16
17 private final WebElement projectViewRow;
18
19 private String name;
20 private String key;
21 private WebElement url;
22 private String urlStr;
23 private String projectLead;
24 private String defaultAssignee;
25 private WebElement viewOpertaion;
26 private WebElement editOperation;
27 private WebElement deleteOperation;
28
29 public ProjectSummary(WebElement projectViewRow)
30 {
31 this.projectViewRow = projectViewRow;
32 List<WebElement> cols = projectViewRow.findElements(By.tagName("td"));
33
34 name = cols.get(0).getText();
35 key = cols.get(1).getText();
36
37 WebElement urlEl = cols.get(2);
38
39 if (Check.elementExists(By.tagName("a"), urlEl))
40 {
41 url = urlEl.findElement(By.tagName("a"));
42 urlStr = url.getText();
43 }
44 else
45 {
46 url = null;
47 urlStr = "";
48 }
49
50 projectLead = cols.get(3).getText();
51 defaultAssignee = cols.get(4).getText();
52
53 List<WebElement> operations = cols.get(5).findElements(By.tagName("a"));
54
55 viewOpertaion = operations.get(0);
56 editOperation = operations.get(1);
57 deleteOperation = operations.get(2);
58 }
59
60 public Page viewProject()
61 {
62 throw new UnsupportedOperationException("view Project operation on ProjectSummary has not been implemented");
63 }
64
65 public Page editProject()
66 {
67 throw new UnsupportedOperationException("edit project operation on ProjectSummary has not been implemented");
68 }
69
70 public Page deleteProject()
71 {
72 throw new UnsupportedOperationException("delete project operation on ProjectSummary has not been implemented");
73 }
74
75 public boolean hasUrl()
76 {
77 return url != null;
78 }
79
80
81
82
83
84 public String getName()
85 {
86 return name;
87 }
88
89 public String getKey()
90 {
91 return key;
92 }
93
94 public WebElement getUrl()
95 {
96 return url;
97 }
98
99 public String getUrlStr()
100 {
101 return urlStr;
102 }
103
104 public String getProjectLead()
105 {
106 return projectLead;
107 }
108
109 public String getDefaultAssignee()
110 {
111 return defaultAssignee;
112 }
113 }