1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.forgerock.api.transform;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.forgerock.util.i18n.LocalizableString;
23
24 import com.fasterxml.jackson.annotation.JsonIgnore;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26
27 import io.swagger.models.Operation;
28
29
30
31
32 public class LocalizableOperation extends Operation implements LocalizableDescription<Operation> {
33 private LocalizableString description;
34 private List<LocalizableString> tags;
35
36 @Override
37 public LocalizableOperation description(LocalizableString desc) {
38 this.description = desc;
39 return this;
40 }
41
42 @Override
43 public LocalizableOperation description(String description) {
44 setDescription(description);
45 return this;
46 }
47
48 @Override
49 public void setDescription(String description) {
50 super.setDescription(description);
51 this.description = new LocalizableString(description);
52 }
53
54 @Override
55 public LocalizableString getLocalizableDescription() {
56 return description;
57 }
58
59 @Override
60 public void addTag(String tag) {
61 super.addTag(tag);
62 addTag(new LocalizableString(tag));
63 }
64
65
66
67
68
69 public void addTag(LocalizableString tag) {
70 if (tags == null) {
71 tags = new ArrayList<>();
72 }
73 tags.add(tag);
74 }
75
76 @Override
77 public void setTags(List<String> tags) {
78 super.setTags(tags);
79 tags = new ArrayList<>();
80 for (String tag : tags) {
81 addTag(tag);
82 }
83 }
84
85
86
87
88
89
90 @JsonProperty("tags")
91 public List<LocalizableString> getLocalizableTags() {
92 return tags;
93 }
94
95 @Override
96 @JsonIgnore
97 public List<String> getTags() {
98 return super.getTags();
99 }
100 }