forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColumn.java
More file actions
117 lines (97 loc) · 3.13 KB
/
Copy pathColumn.java
File metadata and controls
117 lines (97 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (C) 2007-2016, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata.md;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* Represents physical data model column. Doesn't implement all fields right now.
* Deserialization only.
*/
@JsonTypeName("column")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
public class Column extends AbstractObj implements Queryable {
public static final String TYPE_PK = "pk";
public static final String TYPE_INPUT_PK = "inputpk";
public static final String TYPE_FK = "fk";
public static final String TYPE_FACT = "fact";
public static final String TYPE_DISPLAY_FORM = "displayForm";
private final Content content;
private Column(@JsonProperty("meta") Meta meta, @JsonProperty("content")Content content) {
super(meta);
this.content = content;
}
/**
* @return uri of physical {@link Table}
*/
public String getTableUri() {
return content.getTable();
}
/**
* @return type of column, one of <code>pk,inputpk,fk,fact,displayForm</code> or null
*/
public String getType() {
return content.getColumnType();
}
/**
* @return name of the column in DB
*/
public String getDBName() {
return content.getColumnDBName();
}
/**
* @return true when type is <code>pk</code>, false otherwise
*/
public boolean isPk() {
return TYPE_PK.equals(getType());
}
/**
* @return true when type is <code>inputpk</code>, false otherwise
*/
public boolean isInputPk() {
return TYPE_INPUT_PK.equals(getType());
}
/**
* @return true when type is <code>fk</code>, false otherwise
*/
public boolean isFk() {
return TYPE_FK.equals(getType());
}
/**
* @return true when type is <code>fact</code>, false otherwise
*/
public boolean isFact() {
return TYPE_FACT.equals(getType());
}
/**
* @return true when type is <code>pk</code>, false otherwise
*/
public boolean isDisplayForm() {
return TYPE_DISPLAY_FORM.equals(getType());
}
@JsonIgnoreProperties(ignoreUnknown = true)
private static class Content {
private final String table;
private final String columnDBName;
private final String columnType;
@JsonCreator
private Content(@JsonProperty("table") String table, @JsonProperty("columnDBName") String columnDBName,
@JsonProperty("columnType") String columnType) {
this.table = table;
this.columnDBName = columnDBName;
this.columnType = columnType;
}
public String getTable() {
return table;
}
public String getColumnDBName() {
return columnDBName;
}
public String getColumnType() {
return columnType;
}
}
}