// ******************************
// SERVICE PLAN LIST
// ******************************
for (ServicePlan servicePlan : store.getServicePlans()) {
SearchResult sr = buildSearchResult(term, servicePlan.getName() + " " + servicePlan.getTag());
if (sr != null) {
sr.setType(SearchResultType.SERVICE_PLAN);
sr.setServicePlanId("" + servicePlan.getId());
sr.setServicePlanName(servicePlan.getName());
searchResultList.add(sr);
}
}
// ******************************
// SERVICE LIST
// ******************************
for (Service service : store.getServices()) {
boolean serviceAdded = false;
SearchResult sr = buildSearchResult(term,
service.getServiceName() + " " +service.getTag() + " ");
if (sr != null) {
sr.setType(SearchResultType.SERVICE);
sr.setServiceId("" + service.getId());
searchResultList.add(sr);
serviceAdded = true;
}
if (!serviceAdded) {
// No match; lets check RealServiceUrls
for (Url url : service.getRealServiceUrls()) {
SearchResult subresult = buildSearchResult(term,
url.toString());
if (subresult != null) {
subresult.setType(SearchResultType.SERVICE);
subresult.setServiceId("" + service.getId());
searchResultList.add(subresult);
serviceAdded = true;
break;
}
}
}
if (!serviceAdded) {
// No match; lets check RealServiceUrls
String mockurl = service.getUrl();
SearchResult subresult = buildSearchResult(term, mockurl);
if (subresult != null) {
subresult.setType(SearchResultType.SERVICE);
subresult.setServiceId("" + service.getId());
searchResultList.add(subresult);
serviceAdded = true;
}
}
// *****************************
// SERVICE SCENARIO
// ****************************
// REGARDLESS of Service being added, let's see if there is a
// matching scenario by Scenario RESPONSE
for (Scenario scenario : service.getScenarios()) {
// Append tags, name, and response...
// Why not? It's a hack to jumble all things together
SearchResult subresult = buildSearchResult(
term,
scenario.getResponseMessage() + " "
+ scenario.getScenarioName() + " "
+ scenario.getTag());
if (subresult != null) {
subresult.setType(SearchResultType.SERVICE_SCENARIO);
subresult.setServiceId("" + service.getId());
subresult.setScenarioId("" + scenario.getId());
subresult.setScenarioName(scenario.getScenarioName());
searchResultList.add(subresult);
}
}
}