1 package com.randomnoun.common.db.to;
2
3 import java.util.ArrayList;
4 import java.util.LinkedHashMap;
5 import java.util.List;
6 import java.util.Map;
7
8 import com.randomnoun.common.db.enums.ConstraintTypeEnum;
9
10 public class ConstraintTO {
11
12 private String name;
13 private TableTO table;
14 private ConstraintTypeEnum constraintType;
15 private Map<String, ConstraintColumnTO> constraintColumnMap;
16
17 public ConstraintTO(TableTO table, ConstraintTypeEnum constraintType, String name) {
18 this.table = table;
19 this.constraintType = constraintType;
20 this.name = name;
21 this.constraintColumnMap = new LinkedHashMap<String, ConstraintColumnTO>();
22
23
24
25
26
27 }
28 public TableTO getTable() { return table; }
29 public String getName() { return name; }
30 public ConstraintTypeEnum getConstraintType() { return constraintType; }
31
32 public List<ConstraintColumnTO> getConstraintColumns() {
33 return new ArrayList<ConstraintColumnTO>(constraintColumnMap.values());
34 }
35
36 public List<String> getConstraintColumnNames() {
37 return new ArrayList<String>(constraintColumnMap.keySet());
38 }
39
40 public Map<String, ConstraintColumnTO> getConstraintColumnMap() {
41 return constraintColumnMap;
42 }
43 public void setConstraintColumnMap(Map<String, ConstraintColumnTO> constraintColumnMap) {
44 this.constraintColumnMap = constraintColumnMap;
45 }
46 public void setName(String name) {
47 this.name = name;
48 }
49 public void setTable(TableTO table) {
50 this.table = table;
51 }
52 public void setType(ConstraintTypeEnum type) {
53 this.constraintType = type;
54 }
55 }