if (details.contains(VMDetails.all) || details.contains(VMDetails.nics)) {
List<NicProfile> nicProfiles = ApiDBUtils.getNics(userVm);
List<NicResponse> nicResponses = new ArrayList<NicResponse>();
for (NicProfile singleNicProfile : nicProfiles) {
NicResponse nicResponse = new NicResponse();
nicResponse.setId(singleNicProfile.getId());
nicResponse.setIpaddress(singleNicProfile.getIp4Address());
nicResponse.setGateway(singleNicProfile.getGateway());
nicResponse.setNetmask(singleNicProfile.getNetmask());
nicResponse.setNetworkid(singleNicProfile.getNetworkId());
nicResponse.setNetworkName(ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId()).getName());
if (acct.getType() == Account.ACCOUNT_TYPE_ADMIN) {
if (singleNicProfile.getBroadCastUri() != null) {
nicResponse.setBroadcastUri(singleNicProfile.getBroadCastUri().toString());
}
if (singleNicProfile.getIsolationUri() != null) {
nicResponse.setIsolationUri(singleNicProfile.getIsolationUri().toString());
}
}
// Long networkId = singleNicProfile.getNetworkId();
Network network = networks.get(singleNicProfile.getNetworkId());
if (network == null) {
network = ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId());
networks.put(singleNicProfile.getNetworkId(), network);
}
nicResponse.setTrafficType(network.getTrafficType().toString());
nicResponse.setType(network.getGuestType().toString());
nicResponse.setIsDefault(singleNicProfile.isDefaultNic());
nicResponse.setObjectName("nic");
nicResponses.add(nicResponse);
}
userVmResponse.setNics(nicResponses);
}