Skip to content

Commit

Permalink
Added a getKameletScheme method
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
  • Loading branch information
oscerd committed Oct 21, 2022
1 parent 6c61b44 commit 2172505
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

import com.fasterxml.jackson.databind.DeserializationFeature;
Expand Down Expand Up @@ -193,17 +199,23 @@ public List<ComponentModel.EndpointHeaderModel> getKameletSupportedHeaders(Strin
String prefixName = local.getMetadata().getName().substring(0, lastIndex);
String schemeName = enumValue(prefixName);
if (schemeName != null) {
List<ComponentModel.EndpointHeaderModel> headers = cc.componentModel(schemeName).getEndpointHeaders();
for (ComponentModel.EndpointHeaderModel e : headers) {
if (ObjectHelper.isEmpty(e.getLabel()) || e.getLabel().equalsIgnoreCase(camelType)) {
resultingHeaders.add(e);
if (ObjectHelper.isNotEmpty(cc.componentModel(schemeName).getEndpointHeaders())) {
List<ComponentModel.EndpointHeaderModel> headers = cc.componentModel(schemeName).getEndpointHeaders();
for (ComponentModel.EndpointHeaderModel e : headers) {
if (ObjectHelper.isEmpty(e.getLabel()) || e.getLabel().equalsIgnoreCase(camelType)) {
resultingHeaders.add(e);
}
}
}
}
}
return resultingHeaders;
}

public String getKameletScheme(String prefix) {
return enumValue(prefix);
}

private String enumValue(String prefix) {
for (KameletPrefixSchemeEnum c : KameletPrefixSchemeEnum.values()) {
if (c.name.equals(prefix)) return c.scheme;
Expand Down

0 comments on commit 2172505

Please sign in to comment.