/
MetaPropConfiguration.java
85 lines (74 loc) · 2.89 KB
/
MetaPropConfiguration.java
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
package alien4cloud.model.common;
import javax.validation.constraints.NotNull;
import org.alien4cloud.tosca.model.definitions.PropertyDefinition;
import org.alien4cloud.tosca.model.definitions.PropertyValue;
import org.elasticsearch.annotation.ESObject;
import org.elasticsearch.annotation.Id;
import org.elasticsearch.annotation.ObjectField;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.annotation.query.TermsFacet;
import org.elasticsearch.mapping.IndexType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import alien4cloud.json.deserializer.PropertyValueDeserializer;
import alien4cloud.tosca.container.validation.ToscaPropertyConstraint;
import alien4cloud.tosca.container.validation.ToscaPropertyDefaultValueConstraints;
import alien4cloud.tosca.container.validation.ToscaPropertyDefaultValueType;
import alien4cloud.tosca.container.validation.ToscaPropertyPostValidationGroup;
import alien4cloud.ui.form.annotation.FormLabel;
import alien4cloud.ui.form.annotation.FormProperties;
import alien4cloud.ui.form.annotation.FormPropertyDefinition;
import alien4cloud.ui.form.annotation.FormValidValues;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
/**
* Predefined configuration for tag edit
*/
@ESObject
@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
@ToscaPropertyDefaultValueType
@ToscaPropertyConstraint
@ToscaPropertyDefaultValueConstraints(groups = { ToscaPropertyPostValidationGroup.class })
@FormProperties({ "name", "description", "required", "target", "type", "password", "default", "constraints" })
public class MetaPropConfiguration extends PropertyDefinition {
/**
* Auto generated id
*/
@Id
private String id;
/**
* The name of the tag
*/
@TermFilter
@StringField(includeInAll = true, indexType = IndexType.not_analyzed)
@NotNull
@FormLabel("COMMON.NAME")
private String name;
/**
* Target of the tag configuration (application or component or cloud)
*/
@StringField(includeInAll = true, indexType = IndexType.not_analyzed)
@FormValidValues({ MetaPropertyTarget.APPLICATION, MetaPropertyTarget.LOCATION, MetaPropertyTarget.COMPONENT, MetaPropertyTarget.SERVICE })
@NotNull
@TermsFacet
@FormLabel("COMMON.TARGET")
private String target;
@JsonProperty("default")
@JsonDeserialize(using = PropertyValueDeserializer.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private PropertyValue defaultValue;
@ObjectField(enabled = false)
@FormPropertyDefinition(type = "string")
public PropertyValue getDefault() {
return this.defaultValue;
}
public void setDefault(PropertyValue defaultValue) {
this.defaultValue = defaultValue;
}
}