1
|
/**
|
2
|
* Copyright (C) 2020 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 java.util.ArrayList;
|
12
|
import java.util.List;
|
13
|
|
14
|
import org.openqa.selenium.By;
|
15
|
import org.openqa.selenium.NoSuchElementException;
|
16
|
import org.openqa.selenium.WebElement;
|
17
|
|
18
|
/**
|
19
|
* @author a.kohlbecker
|
20
|
*/
|
21
|
public class TaxonNodeStatusElement extends BaseElement {
|
22
|
|
23
|
List<TaxonNodeStatusData> taxonNodeStatus = new ArrayList<>();
|
24
|
|
25
|
|
26
|
public TaxonNodeStatusElement(WebElement element) {
|
27
|
super(element);
|
28
|
|
29
|
List<WebElement> taxonNodeElements = element.findElements(By.className("cdm\\:TaxonNodeDto"));
|
30
|
for(WebElement el : taxonNodeElements) {
|
31
|
TaxonNodeStatusData data = new TaxonNodeStatusData();
|
32
|
data.setTaxonNodeRef(EntityReference.from(el));
|
33
|
String statusText = el.getText();
|
34
|
String classificationText = "";
|
35
|
try {
|
36
|
WebElement classficationEl = el.findElement(By.className("cdm\\:Classification"));
|
37
|
classificationText = classficationEl.getText();
|
38
|
statusText = statusText.replace(classificationText, "");
|
39
|
data.setClassficationText(classificationText);
|
40
|
data.setClassificationRef(EntityReference.from(classficationEl));
|
41
|
} catch (NoSuchElementException e) {
|
42
|
// IGNORE (classification information is not mandatory) //
|
43
|
}
|
44
|
data.setStatusText(statusText);
|
45
|
taxonNodeStatus.add(data);
|
46
|
}
|
47
|
}
|
48
|
|
49
|
public List<TaxonNodeStatusData> getTaxonNodeStatus() {
|
50
|
return taxonNodeStatus;
|
51
|
}
|
52
|
|
53
|
public class TaxonNodeStatusData{
|
54
|
/**
|
55
|
* @return the taxonNodeRef
|
56
|
*/
|
57
|
public EntityReference getTaxonNodeRef() {
|
58
|
return taxonNodeRef;
|
59
|
}
|
60
|
/**
|
61
|
* @param taxonNodeRef the taxonNodeRef to set
|
62
|
*/
|
63
|
public void setTaxonNodeRef(EntityReference taxonNodeRef) {
|
64
|
this.taxonNodeRef = taxonNodeRef;
|
65
|
}
|
66
|
/**
|
67
|
* @return the statusText
|
68
|
*/
|
69
|
public String getStatusText() {
|
70
|
return statusText;
|
71
|
}
|
72
|
/**
|
73
|
* @param statusText the statusText to set
|
74
|
*/
|
75
|
public void setStatusText(String statusText) {
|
76
|
this.statusText = statusText;
|
77
|
}
|
78
|
/**
|
79
|
* @return the classficationtext
|
80
|
*/
|
81
|
public String getClassficationText() {
|
82
|
return classficationtext;
|
83
|
}
|
84
|
/**
|
85
|
* @param classficationtext the classficationtext to set
|
86
|
*/
|
87
|
public void setClassficationText(String classficationtext) {
|
88
|
this.classficationtext = classficationtext;
|
89
|
}
|
90
|
/**
|
91
|
* @return the classificationRef
|
92
|
*/
|
93
|
public EntityReference getClassificationRef() {
|
94
|
return classificationRef;
|
95
|
}
|
96
|
/**
|
97
|
* @param classificationRef the classificationRef to set
|
98
|
*/
|
99
|
public void setClassificationRef(EntityReference classificationRef) {
|
100
|
this.classificationRef = classificationRef;
|
101
|
}
|
102
|
EntityReference taxonNodeRef;
|
103
|
String statusText;
|
104
|
String classficationtext = null;
|
105
|
EntityReference classificationRef = null;
|
106
|
}
|
107
|
|
108
|
}
|