-
Notifications
You must be signed in to change notification settings - Fork 9
/
MetadataAttribute.java
107 lines (90 loc) · 3.28 KB
/
MetadataAttribute.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.czertainly.api.model.common.attribute.v2;
import com.czertainly.api.model.common.attribute.v2.content.*;
import com.czertainly.api.model.common.attribute.v2.properties.MetadataAttributeProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "Info attribute contains content that is for metadata. Its content can not be edited and is not send in requests to store.")
public class MetadataAttribute extends BaseAttribute<List<BaseAttributeContent>> {
/**
* Content of the Attribute
**/
@Schema(
description = "Content of the Attribute",
type = "object",
requiredMode = Schema.RequiredMode.REQUIRED,
discriminatorProperty = "contentType",
oneOf = {
BooleanAttributeContent.class,
CodeBlockAttributeContent.class,
CredentialAttributeContent.class,
DateAttributeContent.class,
DateTimeAttributeContent.class,
FileAttributeContent.class,
FloatAttributeContent.class,
IntegerAttributeContent.class,
ObjectAttributeContent.class,
SecretAttributeContent.class,
StringAttributeContent.class,
TextAttributeContent.class,
TimeAttributeContent.class
}
)
private List<BaseAttributeContent> content;
/**
* Type of the Attribute content
*/
@Schema(
description = "Type of the Content",
requiredMode = Schema.RequiredMode.REQUIRED
)
private AttributeContentType contentType;
/**
* Properties of the Attributes
*/
@Schema(
description = "Properties of the Attributes",
requiredMode = Schema.RequiredMode.REQUIRED
)
private MetadataAttributeProperties properties;
public MetadataAttribute() {
super(AttributeType.META);
}
public MetadataAttribute(AttributeType type) {
super(type);
}
public MetadataAttribute(String type) {
super(AttributeType.fromCode(type));
}
@Override
public List<BaseAttributeContent> getContent() {
return content;
}
@Override
public void setContent(List<BaseAttributeContent> content) {
this.content = content;
}
public AttributeContentType getContentType() {
return contentType;
}
public void setContentType(AttributeContentType contentType) {
this.contentType = contentType;
}
public MetadataAttributeProperties getProperties() {
return properties;
}
public void setProperties(MetadataAttributeProperties properties) {
this.properties = properties;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("content", content)
.append("contentType", contentType)
.append("properties", properties)
.toString();
}
}