}
@Override
public LBStickinessResponse createLBStickinessPolicyResponse(
List<? extends StickinessPolicy> stickinessPolicies, LoadBalancer lb) {
LBStickinessResponse spResponse = new LBStickinessResponse();
if (lb == null)
return spResponse;
spResponse.setlbRuleId(lb.getId());
Account account = ApiDBUtils.findAccountById(lb.getAccountId());
if (account != null) {
spResponse.setAccountName(account.getAccountName());
spResponse.setDomainId(account.getDomainId());
spResponse.setDomainName(ApiDBUtils.findDomainById(
account.getDomainId()).getName());
}
List<LBStickinessPolicyResponse> responses = new ArrayList<LBStickinessPolicyResponse>();
for (StickinessPolicy stickinessPolicy : stickinessPolicies) {
LBStickinessPolicyResponse ruleResponse = new LBStickinessPolicyResponse(stickinessPolicy);
responses.add(ruleResponse);
}
spResponse.setRules(responses);
spResponse.setObjectName("stickinesspolicies");
return spResponse;
}