/**
   * Execute individual put and get, getting value in portable format, without de-serializing it.
   *
   * @param cache Cache.
   */
  private static void putGetPortable(IgniteCache<Integer, Organization> cache) {
    // Create new Organization portable object to store in cache.
    Organization org =
        new Organization(
            "Microsoft", // Name.
            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
            OrganizationType.PRIVATE, // Type.
            new Timestamp(System.currentTimeMillis())); // Last update time.

    // Put created data entry to cache.
    cache.put(1, org);

    // Get cache that will get values as portable objects.
    IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();

    // Get recently created organization as a portable object.
    PortableObject po = portableCache.get(1);

    // Get organization's name from portable object (note that
    // object doesn't need to be fully deserialized).
    String name = po.field("name");

    System.out.println();
    System.out.println(">>> Retrieved organization name from portable object: " + name);
  }
  /**
   * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations, getting values in portable
   * format, without de-serializing it.
   *
   * @param cache Cache.
   */
  private static void putGetAllPortable(IgniteCache<Integer, Organization> cache) {
    // Create new Organization portable objects to store in cache.
    Organization org1 =
        new Organization(
            "Microsoft", // Name.
            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
            OrganizationType.PRIVATE, // Type.
            new Timestamp(System.currentTimeMillis())); // Last update time.

    Organization org2 =
        new Organization(
            "Red Cross", // Name.
            new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
            OrganizationType.NON_PROFIT, // Type.
            new Timestamp(System.currentTimeMillis())); // Last update time.

    Map<Integer, Organization> map = new HashMap<>();

    map.put(1, org1);
    map.put(2, org2);

    // Put created data entries to cache.
    cache.putAll(map);

    // Get cache that will get values as portable objects.
    IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();

    // Get recently created organizations as portable objects.
    Map<Integer, PortableObject> poMap = portableCache.getAll(map.keySet());

    Collection<String> names = new ArrayList<>();

    // Get organizations' names from portable objects (note that
    // objects don't need to be fully deserialized).
    for (PortableObject po : poMap.values()) names.add(po.<String>field("name"));

    System.out.println();
    System.out.println(">>> Retrieved organization names from portable objects: " + names);
  }