1
|
/**
|
2
|
* Copyright (C) 2012 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.elements;
|
10
|
|
11
|
import org.apache.logging.log4j.LogManager;
|
12
|
import org.apache.logging.log4j.Logger;
|
13
|
import org.openqa.selenium.By;
|
14
|
import org.openqa.selenium.NoSuchElementException;
|
15
|
import org.openqa.selenium.WebElement;
|
16
|
|
17
|
import eu.etaxonomy.dataportal.CdmEntityClassAttributes;
|
18
|
|
19
|
/**
|
20
|
* @author andreas
|
21
|
* @since Jul 30, 2012
|
22
|
*/
|
23
|
public class TypeDesignationElement extends BaseElement {
|
24
|
|
25
|
private static final Logger logger = LogManager.getLogger();
|
26
|
|
27
|
private final WebElement status;
|
28
|
|
29
|
private WebElement nameDescription = null;
|
30
|
|
31
|
private TypeDesignationType typeDesignationType = null;
|
32
|
|
33
|
public TypeDesignationElement(WebElement element) {
|
34
|
super(element);
|
35
|
System.err.println(element.getTagName() + " | " + element.getText());
|
36
|
status = element.findElement(By.cssSelector(".type-status"));
|
37
|
try {
|
38
|
nameDescription = element.findElement(By.cssSelector(".description"));
|
39
|
} catch (NoSuchElementException e) {
|
40
|
// IGNORE
|
41
|
}
|
42
|
CdmEntityClassAttributes attr;
|
43
|
try {
|
44
|
attr = new CdmEntityClassAttributes(element.getAttribute("class"));
|
45
|
typeDesignationType = TypeDesignationType.valueOfCdmClass(attr.getCdmType());
|
46
|
} catch (Exception e) {
|
47
|
logger.error(e);
|
48
|
}
|
49
|
|
50
|
}
|
51
|
|
52
|
public String statusToString(){
|
53
|
return status.getText();
|
54
|
}
|
55
|
|
56
|
public TypeDesignationType getTypeDesignationType() {
|
57
|
return typeDesignationType;
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* contains nomenclatorical status, protologues, etc.
|
62
|
*
|
63
|
* @return the nameDescription
|
64
|
*/
|
65
|
public WebElement getNameDescription() {
|
66
|
return nameDescription;
|
67
|
}
|
68
|
|
69
|
}
|