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