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 (!Objects.equals(notifiers, getNotifiers())) {
91 update(getDelegate().withNotifiers(
92 notifiers.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
93 notifiers.forEach(e -> e.childrenTracking = this::replace);
94 }
95 }
96
97 public void addNotifier(Notifier notifier) {
98 update(getDelegate().withNotifiers(
99 Stream.concat(getDelegate().getNotifiers().stream(), Stream.of(notifier.getDelegate()))
100 .collect(Collectors.toList())));
101 notifier.childrenTracking = this::replace;
102 }
103
104 public void removeNotifier(Notifier notifier) {
105 update(getDelegate().withNotifiers(
106 getDelegate().getNotifiers().stream()
107 .filter(e -> !Objects.equals(e, notifier))
108 .collect(Collectors.toList())));
109 notifier.childrenTracking = null;
110 }
111
112 public InputLocation getLocation(Object key) {
113 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
114 return loc != null ? new InputLocation(loc) : null;
115 }
116
117 public void setLocation(Object key, InputLocation location) {
118 update(org.apache.maven.api.model.CiManagement.newBuilder(getDelegate(), true)
119 .location(key, location.toApiLocation()).build());
120 }
121
122 protected boolean replace(Object oldDelegate, Object newDelegate) {
123 if (super.replace(oldDelegate, newDelegate)) {
124 return true;
125 }
126 if (getDelegate().getNotifiers().contains(oldDelegate)) {
127 List<org.apache.maven.api.model.Notifier> list = new ArrayList<>(getDelegate().getNotifiers());
128 list.replaceAll(d -> d == oldDelegate ? (org.apache.maven.api.model.Notifier) newDelegate : d);
129 update(getDelegate().withNotifiers(list));
130 return true;
131 }
132 return false;
133 }
134
135 public static List<org.apache.maven.api.model.CiManagement> ciManagementToApiV4(List<CiManagement> list) {
136 return list != null ? new WrapperList<>(list, CiManagement::getDelegate, CiManagement::new) : null;
137 }
138
139 public static List<CiManagement> ciManagementToApiV3(List<org.apache.maven.api.model.CiManagement> list) {
140 return list != null ? new WrapperList<>(list, CiManagement::new, CiManagement::getDelegate) : null;
141 }
142
143 }