Project

General

Profile

Download (2.5 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2009 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9
package eu.etaxonomy.dataportal.pages;
10

    
11
import java.net.MalformedURLException;
12
import java.util.ArrayList;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import org.apache.commons.lang3.StringUtils;
17
import org.openqa.selenium.By;
18
import org.openqa.selenium.WebDriver;
19
import org.openqa.selenium.WebElement;
20

    
21
import eu.etaxonomy.dataportal.DataPortalContext;
22
import eu.etaxonomy.dataportal.elements.TaxonNodeStatusElement;
23

    
24
/**
25
 * TODO: subpages like /cdm_dataportal/taxon/{uuid}/images are not yet supported, implement means to handle page parts
26
 *
27
 * @author andreas
28
 * @since Jul 1, 2011
29
 */
30
public class TaxonPage extends PortalPage {
31

    
32
    protected static String drupalPagePathBase = "cdm_dataportal/taxon";
33

    
34
    @Override
35
    protected String getDrupalPageBase() {
36
        return drupalPagePathBase;
37
    }
38

    
39
    private UUID taxonUuid;
40

    
41
    private String subPage;
42

    
43

    
44
    public TaxonPage(WebDriver driver, DataPortalContext context, UUID taxonUuid) throws MalformedURLException {
45

    
46
        super(driver, context, taxonUuid.toString());
47

    
48
        this.taxonUuid = taxonUuid;
49
    }
50

    
51
    public TaxonPage(WebDriver driver, DataPortalContext context, UUID taxonUuid, String subPage) throws MalformedURLException {
52

    
53
        super(driver, context, taxonUuid.toString() + (!StringUtils.isEmpty(subPage) ? "/" + subPage : ""));
54

    
55
        this.taxonUuid = taxonUuid;
56
        this.subPage = subPage;
57
    }
58

    
59
    public TaxonPage(WebDriver driver, DataPortalContext context) throws Exception {
60
        super(driver, context);
61
    }
62

    
63

    
64
    public UUID getTaxonUuid() {
65
        return taxonUuid;
66
    }
67

    
68
    public String getSubPage() {
69
        return subPage;
70
    }
71

    
72
    public List<WebElement> getTaxonNodeStatusContainer() {
73
        List<WebElement> taxonNodeStatus = getDataPortalContent().getElement().findElements(By.className("taxon-node-status"));
74
        return taxonNodeStatus;
75
    }
76

    
77
    public List<TaxonNodeStatusElement> getTaxonNodeStates() {
78
        List<TaxonNodeStatusElement> statusEls = new ArrayList<>();
79
        List<WebElement> taxonNodeStatus = getDataPortalContent().getElement().findElements(By.className("taxon-node-status"));
80
        for(WebElement el : taxonNodeStatus) {
81
            statusEls.add(new TaxonNodeStatusElement(el));
82
        }
83
        return statusEls;
84
    }
85
}
(6-6/9)