1
|
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.dataportal.pages;
|
11
|
|
12
|
import java.net.MalformedURLException;
|
13
|
import java.util.ArrayList;
|
14
|
import java.util.List;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.apache.commons.lang3.StringUtils;
|
18
|
import org.apache.log4j.Logger;
|
19
|
import org.openqa.selenium.By;
|
20
|
import org.openqa.selenium.WebDriver;
|
21
|
import org.openqa.selenium.WebElement;
|
22
|
|
23
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
24
|
import eu.etaxonomy.dataportal.elements.TaxonNodeStatusElement;
|
25
|
|
26
|
/**
|
27
|
* TODO: subpages like /cdm_dataportal/taxon/{uuid}/images are not yet supported, implement means to handle page parts
|
28
|
*
|
29
|
* @author andreas
|
30
|
* @since Jul 1, 2011
|
31
|
*
|
32
|
*/
|
33
|
public class TaxonPage extends PortalPage {
|
34
|
|
35
|
public static final Logger logger = Logger.getLogger(TaxonProfilePage.class);
|
36
|
|
37
|
protected static String drupalPagePathBase = "cdm_dataportal/taxon";
|
38
|
|
39
|
|
40
|
@Override
|
41
|
protected String getDrupalPageBase() {
|
42
|
return drupalPagePathBase;
|
43
|
}
|
44
|
|
45
|
private UUID taxonUuid;
|
46
|
|
47
|
private String subPage;
|
48
|
|
49
|
|
50
|
public TaxonPage(WebDriver driver, DataPortalContext context, UUID taxonUuid) throws MalformedURLException {
|
51
|
|
52
|
super(driver, context, taxonUuid.toString());
|
53
|
|
54
|
this.taxonUuid = taxonUuid;
|
55
|
}
|
56
|
|
57
|
public TaxonPage(WebDriver driver, DataPortalContext context, UUID taxonUuid, String subPage) throws MalformedURLException {
|
58
|
|
59
|
super(driver, context, taxonUuid.toString() + (!StringUtils.isEmpty(subPage) ? "/" + subPage : ""));
|
60
|
|
61
|
this.taxonUuid = taxonUuid;
|
62
|
this.subPage = subPage;
|
63
|
}
|
64
|
|
65
|
public TaxonPage(WebDriver driver, DataPortalContext context) throws Exception {
|
66
|
super(driver, context);
|
67
|
}
|
68
|
|
69
|
|
70
|
public UUID getTaxonUuid() {
|
71
|
return taxonUuid;
|
72
|
}
|
73
|
|
74
|
public String getSubPage() {
|
75
|
return subPage;
|
76
|
}
|
77
|
|
78
|
public List<WebElement> getTaxonNodeStatusContainer() {
|
79
|
List<WebElement> taxonNodeStatus = getDataPortalContent().getElement().findElements(By.className("taxon-node-status"));
|
80
|
return taxonNodeStatus;
|
81
|
}
|
82
|
|
83
|
public List<TaxonNodeStatusElement> getTaxonNodeStates() {
|
84
|
List<TaxonNodeStatusElement> statusEls = new ArrayList<>();
|
85
|
List<WebElement> taxonNodeStatus = getDataPortalContent().getElement().findElements(By.className("taxon-node-status"));
|
86
|
for(WebElement el : taxonNodeStatus) {
|
87
|
statusEls.add(new TaxonNodeStatusElement(el));
|
88
|
}
|
89
|
return statusEls;
|
90
|
}
|
91
|
|
92
|
}
|