return response;
}
@Override
public StaticRouteResponse createStaticRouteResponse(StaticRoute result) {
StaticRouteResponse response = new StaticRouteResponse();
response.setId(result.getUuid());
if (result.getVpcId() != null) {
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
if (vpc != null) {
response.setVpcId(vpc.getUuid());
}
}
response.setCidr(result.getCidr());
StaticRoute.State state = result.getState();
if (state.equals(StaticRoute.State.Revoke)) {
state = StaticRoute.State.Deleting;
}
response.setState(state.toString());
populateAccount(response, result.getAccountId());
populateDomain(response, result.getDomainId());
// set tag information
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.StaticRoute, result.getId());
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
for (ResourceTag tag : tags) {
ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
tagResponses.add(tagResponse);
}
response.setTags(tagResponses);
response.setObjectName("staticroute");
return response;
}