1
2
3
4
5 package org.apache.maven.model;
6
7 import java.io.Serializable;
8 import java.util.AbstractList;
9 import java.util.ArrayList;
10 import java.util.Collections;
11 import java.util.HashMap;
12 import java.util.List;
13 import java.util.Map;
14 import java.util.Objects;
15 import java.util.Set;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
18 import org.apache.maven.api.annotations.Generated;
19 import org.apache.maven.api.annotations.Nonnull;
20
21 @Generated
22 public class CiManagement
23 extends BaseObject
24 {
25
26 public CiManagement() {
27 this(org.apache.maven.api.model.CiManagement.newInstance());
28 }
29
30 public CiManagement(org.apache.maven.api.model.CiManagement delegate) {
31 this(delegate, null);
32 }
33
34 public CiManagement(org.apache.maven.api.model.CiManagement delegate, BaseObject parent) {
35 super(delegate, parent);
36 }
37
38 public CiManagement clone(){
39 return new CiManagement(getDelegate());
40 }
41
42 public org.apache.maven.api.model.CiManagement getDelegate() {
43 return (org.apache.maven.api.model.CiManagement) super.getDelegate();
44 }
45
46 @Override
47 public boolean equals(Object o) {
48 if (this == o) {
49 return true;
50 }
51 if (o == null || !(o instanceof CiManagement)) {
52 return false;
53 }
54 CiManagement that = (CiManagement) o;
55 return Objects.equals(this.delegate, that.delegate);
56 }
57
58 @Override
59 public int hashCode() {
60 return getDelegate().hashCode();
61 }
62
63 public String getSystem() {
64 return getDelegate().getSystem();
65 }
66
67 public void setSystem(String system) {
68 if (!Objects.equals(system, getSystem())) {
69 update(getDelegate().withSystem(system));
70 }
71 }
72
73 public String getUrl() {
74 return getDelegate().getUrl();
75 }
76
77 public void setUrl(String url) {
78 if (!Objects.equals(url, getUrl())) {
79 update(getDelegate().withUrl(url));
80 }
81 }
82
83 @Nonnull
84 public List<Notifier> getNotifiers() {
85 return new WrapperList<Notifier, org.apache.maven.api.model.Notifier>(
86 () -> getDelegate().getNotifiers(), l -> update(getDelegate().withNotifiers(l)),
87 d -> new Notifier(d, this), Notifier::getDelegate);
88 }
89
90 public void setNotifiers(List<Notifier> notifiers) {
91 if (notifiers == null) {
92 notifiers = Collections.emptyList();
93 }
94 if (!Objects.equals(notifiers, getNotifiers())) {
95 update(getDelegate().withNotifiers(
96 notifiers.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
97 notifiers.forEach(e -> e.childrenTracking = this::replace);
98 }
99 }
100
101 public void addNotifier(Notifier notifier) {
102 update(getDelegate().withNotifiers(
103 Stream.concat(getDelegate().getNotifiers().stream(), Stream.of(notifier.getDelegate()))
104 .collect(Collectors.toList())));
105 notifier.childrenTracking = this::replace;
106 }
107
108 public void removeNotifier(Notifier notifier) {
109 update(getDelegate().withNotifiers(
110 getDelegate().getNotifiers().stream()
111 .filter(e -> !Objects.equals(e, notifier))
112 .collect(Collectors.toList())));
113 notifier.childrenTracking = null;
114 }
115
116 public InputLocation getLocation(Object key) {
117 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
118 return loc != null ? new InputLocation(loc) : null;
119 }
120
121 public void setLocation(Object key, InputLocation location) {
122 update(org.apache.maven.api.model.CiManagement.newBuilder(getDelegate(), true)
123 .location(key, location.toApiLocation()).build());
124 }
125
126 public InputLocation getImportedFrom() {
127 org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
128 return loc != null ? new InputLocation(loc) : null;
129 }
130
131 public void setImportedFrom(InputLocation location) {
132 update(org.apache.maven.api.model.CiManagement.newBuilder(getDelegate(), true)
133 .importedFrom(location.toApiLocation()).build());
134 }
135
136 public Set<Object> getLocationKeys() {
137 return getDelegate().getLocationKeys();
138 }
139
140 protected boolean replace(Object oldDelegate, Object newDelegate) {
141 if (super.replace(oldDelegate, newDelegate)) {
142 return true;
143 }
144 if (getDelegate().getNotifiers().contains(oldDelegate)) {
145 List<org.apache.maven.api.model.Notifier> list = new ArrayList<>(getDelegate().getNotifiers());
146 list.replaceAll(d -> d == oldDelegate ? (org.apache.maven.api.model.Notifier) newDelegate : d);
147 update(getDelegate().withNotifiers(list));
148 return true;
149 }
150 return false;
151 }
152
153 public static List<org.apache.maven.api.model.CiManagement> ciManagementToApiV4(List<CiManagement> list) {
154 return list != null ? new WrapperList<>(list, CiManagement::getDelegate, CiManagement::new) : null;
155 }
156
157 public static List<CiManagement> ciManagementToApiV3(List<org.apache.maven.api.model.CiManagement> list) {
158 return list != null ? new WrapperList<>(list, CiManagement::new, CiManagement::getDelegate) : null;
159 }
160
161 }