private List<Campaign> buildCampaigns(Drive drive) { List<Campaign> campaigns = new ArrayList<Campaign>(); try { List<Client> clients = clientService.getClients(); for (Client client : clients) { Campaign campaign = new Campaign(); campaign.setDrive(drive); campaign.setClient(client); campaign.setCampaignYear(String.valueOf(drive.getDriveYear())); campaigns.add(campaign); } } catch (HelixServiceException e) { e.printStackTrace(); } return campaigns; }
public Document buildCampaignListInfoResponseXML(Integer driveId) throws HelixServiceException { Document document = DocumentHelper.createDocument(); Element root = document.addElement("campaigns"); List<Campaign> campaignList = campaignService.getDriveCampaignList(driveId); if (campaignList != null) { for (Campaign campaign : campaignList) { Element element = root.addElement("campaign"); element.addAttribute("campaignId", campaign.getIdCampaign().toString()); element.addAttribute( "edit", "<a href='client'> C </a> | <a href='campaign?clientId=" + campaign.getClient().getIdClient() + "'> C </a> | <a href='#'> D </a> " + "| <a href='#'> F </a>"); element.addAttribute("client", campaign.getClient().getClientName()); element.addAttribute("year", campaign.getCampaignYear()); element.addAttribute( "type", (campaign.getCampaigntype() != null) ? campaign.getCampaigntype().getCampaignType() : ""); element.addAttribute("amount", ""); element.addAttribute("ccAmount", ""); element.addAttribute("count", ""); element.addAttribute("average", ""); element.addAttribute("response", ""); } } return document; }