List of usage examples for org.apache.commons.lang ArrayUtils toObject
public static Boolean[] toObject(boolean[] array)
Converts an array of primitive booleans to objects.
From source file:v201302.creativesetservice.CreateCreativeSetExample.java
public static void main(String[] args) { try {//w w w. j av a 2s . c o m // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201302.CREATIVE_SET_SERVICE); // Set the ID of the creatives to associate with this set. Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE"); Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE"); CreativeSet creativeSet = new CreativeSet(); creativeSet.setName("Creative set #" + new Random().nextLong()); creativeSet.setMasterCreativeId(masterCreativeId); creativeSet.setCompanionCreativeIds(new long[] { companionCreativeId }); // Create the creative set on the server. creativeSet = creativeSetService.createCreativeSet(creativeSet); if (creativeSet != null) { System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was created."); } else { System.out.println("No creative sets created."); } } catch (Exception e) { e.printStackTrace(); } }
From source file:v201302.creativesetservice.GetAllCreativeSetsExample.java
public static void main(String[] args) { try {//w ww. jav a 2 s . c om // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201302.CREATIVE_SET_SERVICE); // Set defaults for page and filterStatement. CreativeSetPage page = new CreativeSetPage(); Statement filterStatement = new Statement(); int offset = 0; do { // Create a statement to get all creative sets. filterStatement.setQuery("LIMIT 500 OFFSET " + offset); // Get creative sets by statement. page = creativeSetService.getCreativeSetsByStatement(filterStatement); if (page.getResults() != null) { int i = page.getStartIndex(); for (CreativeSet creativeSet : page.getResults()) { System.out.println(i + ") Creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was found."); i++; } } offset += 500; } while (offset < page.getTotalResultSetSize()); System.out.println("Number of results found: " + page.getTotalResultSetSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201302.creativesetservice.GetCreativeSetsByStatementExample.java
public static void main(String[] args) { try {//w w w. j a v a 2 s. co m // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201302.CREATIVE_SET_SERVICE); // Set the ID of the master creative to get creative sets for. Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE"); // Create statement object to only select creative sets that have the // given master creative. Statement filterStatement = new StatementBuilder("WHERE masterCreativeId = :masterCreativeId LIMIT 500") .putValue("masterCreativeId", masterCreativeId).toStatement(); // Get creative sets by statement. CreativeSetPage page = creativeSetService.getCreativeSetsByStatement(filterStatement); if (page.getResults() != null) { int i = page.getStartIndex(); for (CreativeSet creativeSet : page.getResults()) { System.out .println(i + ") Creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils .join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was found."); i++; } } System.out.println("Number of results found: " + page.getTotalResultSetSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201302.creativesetservice.UpdateCreativeSetExample.java
public static void main(String[] args) { try {/* w ww .j a v a 2 s.co m*/ // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201302.CREATIVE_SET_SERVICE); // Set the ID of the creative set to get and the companion creative to // add. Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE"); Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE"); // Get the creative set. CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId); // Add the companion creative to the creative set. creativeSet.setCompanionCreativeIds( ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId)); // Update the creative set on the server. creativeSet = creativeSetService.updateCreativeSet(creativeSet); // Display results. System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was updated."); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201306.creativesetservice.CreateCreativeSetExample.java
public static void main(String[] args) { try {//w w w .j a v a2 s . c om // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201306.CREATIVE_SET_SERVICE); // Set the ID of the creatives to associate with this set. Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE"); Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE"); CreativeSet creativeSet = new CreativeSet(); creativeSet.setName("Creative set #" + new Random().nextLong()); creativeSet.setMasterCreativeId(masterCreativeId); creativeSet.setCompanionCreativeIds(new long[] { companionCreativeId }); // Create the creative set on the server. creativeSet = creativeSetService.createCreativeSet(creativeSet); if (creativeSet != null) { System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was created."); } else { System.out.println("No creative sets created."); } } catch (Exception e) { e.printStackTrace(); } }
From source file:v201306.creativesetservice.GetAllCreativeSetsExample.java
public static void main(String[] args) { try {//from w w w .j a v a 2 s.com // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201306.CREATIVE_SET_SERVICE); // Set defaults for page and filterStatement. CreativeSetPage page = new CreativeSetPage(); Statement filterStatement = new Statement(); int offset = 0; do { // Create a statement to get all creative sets. filterStatement.setQuery("LIMIT 500 OFFSET " + offset); // Get creative sets by statement. page = creativeSetService.getCreativeSetsByStatement(filterStatement); if (page.getResults() != null) { int i = page.getStartIndex(); for (CreativeSet creativeSet : page.getResults()) { System.out.println(i + ") Creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was found."); i++; } } offset += 500; } while (offset < page.getTotalResultSetSize()); System.out.println("Number of results found: " + page.getTotalResultSetSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201306.creativesetservice.GetCreativeSetsByStatementExample.java
public static void main(String[] args) { try {//ww w . jav a 2 s . c o m // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201306.CREATIVE_SET_SERVICE); // Set the ID of the master creative to get creative sets for. Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE"); // Create statement object to only select creative sets that have the // given master creative. Statement filterStatement = new StatementBuilder("WHERE masterCreativeId = :masterCreativeId LIMIT 500") .putValue("masterCreativeId", masterCreativeId).toStatement(); // Get creative sets by statement. CreativeSetPage page = creativeSetService.getCreativeSetsByStatement(filterStatement); if (page.getResults() != null) { int i = page.getStartIndex(); for (CreativeSet creativeSet : page.getResults()) { System.out .println(i + ") Creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils .join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was found."); i++; } } System.out.println("Number of results found: " + page.getTotalResultSetSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201306.creativesetservice.UpdateCreativeSetExample.java
public static void main(String[] args) { try {/* w ww.ja v a 2 s.c o m*/ // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201306.CREATIVE_SET_SERVICE); // Set the ID of the creative set to get and the companion creative to // add. Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE"); Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE"); // Get the creative set. CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId); // Add the companion creative to the creative set. creativeSet.setCompanionCreativeIds( ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId)); // Update the creative set on the server. creativeSet = creativeSetService.updateCreativeSet(creativeSet); // Display results. System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was updated."); } catch (Exception e) { e.printStackTrace(); } }
From source file:v201308.creativesetservice.CreateCreativeSetExample.java
public static void main(String[] args) { try {//www .j a v a 2 s . c o m // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201308.CREATIVE_SET_SERVICE); // Set the ID of the creatives to associate with this set. Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE"); Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE"); CreativeSet creativeSet = new CreativeSet(); creativeSet.setName("Creative set #" + new Random().nextLong()); creativeSet.setMasterCreativeId(masterCreativeId); creativeSet.setCompanionCreativeIds(new long[] { companionCreativeId }); // Create the creative set on the server. creativeSet = creativeSetService.createCreativeSet(creativeSet); if (creativeSet != null) { System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was created."); } else { System.out.println("No creative sets created."); } } catch (Exception e) { e.printStackTrace(); } }
From source file:v201308.creativesetservice.GetAllCreativeSetsExample.java
public static void main(String[] args) { try {//from ww w . ja v a 2 s.com // Log SOAP XML request and response. DfpServiceLogger.log(); // Get DfpUser from "~/dfp.properties". DfpUser user = new DfpUser(); // Get the CreativeSetService. CreativeSetServiceInterface creativeSetService = user .getService(DfpService.V201308.CREATIVE_SET_SERVICE); // Set defaults for page and filterStatement. CreativeSetPage page = new CreativeSetPage(); Statement filterStatement = new Statement(); int offset = 0; do { // Create a statement to get all creative sets. filterStatement.setQuery("LIMIT 500 OFFSET " + offset); // Get creative sets by statement. page = creativeSetService.getCreativeSetsByStatement(filterStatement); if (page.getResults() != null) { int i = page.getStartIndex(); for (CreativeSet creativeSet : page.getResults()) { System.out.println(i + ") Creative set with ID \"" + creativeSet.getId() + "\", master creative ID \"" + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {" + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',') + "} was found."); i++; } } offset += 500; } while (offset < page.getTotalResultSetSize()); System.out.println("Number of results found: " + page.getTotalResultSetSize()); } catch (Exception e) { e.printStackTrace(); } }