for (IParameter nextParameterObj : params) {
if (!(nextParameterObj instanceof IQueryParameter)) {
continue;
}
IQueryParameter nextParameter = (IQueryParameter)nextParameterObj;
if (nextParameter.getName().startsWith("_")) {
continue;
}
if (searchParam == null) {
if (!nameToSearchParam.containsKey(nextParameter.getName())) {
RestResourceSearchParam param = resource.addSearchParam();
param.setName(nextParameter.getName());
searchParam = param;
} else {
searchParam = nameToSearchParam.get(nextParameter.getName());
}
if (searchParam !=null) {
searchParam.setType(nextParameter.getParamType());
}
} else if (searchParamChain == null) {
searchParam.addChain(nextParameter.getName());
searchParamChain = searchParam.getChain().get(searchParam.getChain().size()-1);
ExtensionDt ext = new ExtensionDt();
ext.setUrl(ExtensionConstants.CONF_CHAIN_REQUIRED);
ext.setValue(new BooleanDt(nextParameter.isRequired()));
searchParamChain.getUndeclaredExtensions().add(ext);
} else {
ExtensionDt ext = new ExtensionDt();
ext.setUrl(ExtensionConstants.CONF_ALSO_CHAIN);
searchParamChain.getUndeclaredExtensions().add(ext);
ExtensionDt extReq = new ExtensionDt();
extReq.setUrl(ExtensionConstants.CONF_CHAIN_REQUIRED);
extReq.setValue(new BooleanDt(nextParameter.isRequired()));
ext.getUndeclaredExtensions().add(extReq);
}
}