|
1
|
|
|
/* |
|
2
|
|
|
* Copyright 2014, Armenak Grigoryan, and individual contributors as indicated |
|
3
|
|
|
* by the @authors tag. See the copyright.txt in the distribution for a |
|
4
|
|
|
* full listing of individual contributors. |
|
5
|
|
|
* |
|
6
|
|
|
* This is free software; you can redistribute it and/or modify it |
|
7
|
|
|
* under the terms of the GNU Lesser General Public License as |
|
8
|
|
|
* published by the Free Software Foundation; either version 2.1 of |
|
9
|
|
|
* the License, or (at your option) any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* This software is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14
|
|
|
* Lesser General Public License for more details. |
|
15
|
|
|
*/ |
|
16
|
|
|
package com.strider.datadefender.requirement; |
|
17
|
|
|
|
|
18
|
|
|
import java.util.List; |
|
19
|
|
|
|
|
20
|
|
|
import javax.xml.bind.annotation.XmlAccessType; |
|
21
|
|
|
import javax.xml.bind.annotation.XmlAccessorType; |
|
22
|
|
|
import javax.xml.bind.annotation.XmlAttribute; |
|
23
|
|
|
import javax.xml.bind.annotation.XmlElement; |
|
24
|
|
|
import javax.xml.bind.annotation.XmlElementWrapper; |
|
25
|
|
|
|
|
26
|
|
|
import lombok.Data; |
|
27
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* JAXB class that defines parameter table in Requirement.xml file |
|
31
|
|
|
* |
|
32
|
|
|
* @author Armenak Grigoryan |
|
33
|
|
|
*/ |
|
34
|
|
|
@XmlAccessorType(XmlAccessType.NONE) |
|
35
|
|
|
@Data |
|
36
|
|
|
public class Table { |
|
37
|
|
|
|
|
38
|
|
|
@XmlAttribute |
|
39
|
|
|
private String name; |
|
40
|
|
|
|
|
41
|
|
|
@XmlAttribute(name = "primary-key") |
|
42
|
|
|
private String primaryKey; |
|
43
|
|
|
|
|
44
|
|
|
@XmlElement |
|
45
|
|
|
private String where; |
|
46
|
|
|
|
|
47
|
|
|
@XmlElementWrapper(name = "primary-key") |
|
48
|
|
|
@XmlElement(name = "key") |
|
49
|
|
|
private List<String> primaryKeys; |
|
50
|
|
|
|
|
51
|
|
|
@XmlElementWrapper(name = "columns") |
|
52
|
|
|
@XmlElement(name = "column") |
|
53
|
|
|
private List<Column> columns; |
|
54
|
|
|
|
|
55
|
|
|
@XmlElementWrapper(name = "exclusions") |
|
56
|
|
|
@XmlElement(name = "exclude") |
|
57
|
|
|
private List<Exclude> exclusions; |
|
58
|
|
|
|
|
59
|
|
|
public Table() { |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public Table(String name) { |
|
63
|
|
|
this.name = name; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public List<String> getPrimaryKeyColumnNames() { |
|
67
|
|
|
if (CollectionUtils.isNotEmpty(primaryKeys)) { |
|
68
|
|
|
return primaryKeys; |
|
69
|
|
|
} |
|
70
|
|
|
return List.of(primaryKey); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|