| 23 | import org.apache.commons.collections4.map.ListOrderedMap; |
| 24 | |
| 25 | public class TransactionTypes implements Collection<TransactionType> { |
| 26 | |
| 27 | private final ListOrderedMap<String, TransactionType> types = new ListOrderedMap<>(); |
| 28 | |
| 29 | public TransactionTypes(List<TransactionType> transactiontypes) { |
| 30 | transactiontypes.sort(TransactionType::compareTo); |
| 31 | for (TransactionType tt : transactiontypes) { |
| 32 | String key = tt.getName().toUpperCase(); |
| 33 | this.types.put(key, tt); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | public TransactionType getType(String procName) { |
| 38 | return (this.types.get(procName.toUpperCase())); |
| 39 | } |
| 40 | |
| 41 | public TransactionType getType(Class<? extends Procedure> procClass) { |
| 42 | return (this.getType(procClass.getSimpleName())); |
| 43 | } |
| 44 | |
| 45 | public TransactionType getType(int id) { |
| 46 | return (this.types.getValue(id)); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public String toString() { |
| 51 | return this.types.values().toString(); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public boolean add(TransactionType tt) { |
| 56 | String key = tt.getName().toUpperCase(); |
| 57 | this.types.put(key, tt); |
| 58 | return (true); |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public boolean addAll(Collection<? extends TransactionType> c) { |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public void clear() { |
| 68 | this.types.clear(); |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public boolean contains(Object o) { |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public boolean containsAll(Collection<?> c) { |
| 78 | return (this.types.values().containsAll(c)); |
| 79 | } |
| 80 | |
| 81 | @Override |
| 82 | public boolean isEmpty() { |
nothing calls this directly
no outgoing calls
no test coverage detected