-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathCodeTemplateContextSet.java
More file actions
120 lines (96 loc) · 3.12 KB
/
CodeTemplateContextSet.java
File metadata and controls
120 lines (96 loc) · 3.12 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
* http://www.mirthcorp.com
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/
package com.mirth.connect.model.codetemplates;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.Set;
public class CodeTemplateContextSet implements Set<ContextType>, Serializable {
private Set<ContextType> delegate;
public CodeTemplateContextSet(ContextType... contextTypes) {
this(Arrays.asList(contextTypes));
}
public CodeTemplateContextSet(Collection<ContextType> contextTypes) {
delegate = new TreeSet<ContextType>(contextTypes);
}
public CodeTemplateContextSet addContext(ContextType... contextTypes) {
addAll(Arrays.asList(contextTypes));
return this;
}
public static CodeTemplateContextSet getGlobalContextSet() {
return new CodeTemplateContextSet(ContextType.values());
}
public static CodeTemplateContextSet getChannelContextSet() {
return getConnectorContextSet().addContext(ContextType.CHANNEL_DEPLOY, ContextType.CHANNEL_UNDEPLOY, ContextType.CHANNEL_PREPROCESSOR, ContextType.CHANNEL_POSTPROCESSOR, ContextType.CHANNEL_ATTACHMENT, ContextType.CHANNEL_BATCH);
}
public static CodeTemplateContextSet getConnectorContextSet() {
return new CodeTemplateContextSet(ContextType.SOURCE_RECEIVER, ContextType.SOURCE_FILTER_TRANSFORMER, ContextType.DESTINATION_FILTER_TRANSFORMER, ContextType.DESTINATION_DISPATCHER, ContextType.DESTINATION_RESPONSE_TRANSFORMER);
}
@Override
public int size() {
return delegate.size();
}
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
@Override
public boolean contains(Object o) {
return delegate.contains(o);
}
@Override
public Iterator<ContextType> iterator() {
return delegate.iterator();
}
@Override
public Object[] toArray() {
return delegate.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return delegate.toArray(a);
}
@Override
public boolean add(ContextType e) {
return delegate.add(e);
}
@Override
public boolean remove(Object o) {
return delegate.remove(o);
}
@Override
public boolean containsAll(Collection<?> c) {
return delegate.containsAll(c);
}
@Override
public boolean addAll(Collection<? extends ContextType> c) {
return delegate.addAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return delegate.retainAll(c);
}
@Override
public boolean removeAll(Collection<?> c) {
return delegate.removeAll(c);
}
@Override
public void clear() {
delegate.clear();
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof Set) {
return delegate.equals(obj);
}
return false;
}
}