class EventUtils {

  public static EventPartitions toEventPartitions(Table table, List<Partition> partitions) {
    LinkedHashMap<String, String> partitionKeyTypes = new LinkedHashMap<>();
    List<FieldSchema> partitionKeys = table.getPartitionKeys();
    for (FieldSchema partitionKey : partitionKeys) {
      partitionKeyTypes.put(partitionKey.getName(), partitionKey.getType());
    }
    EventPartitions eventPartitions = new EventPartitions(partitionKeyTypes);
    if (partitions != null) {
      for (Partition partition : partitions) {
        eventPartitions.add(new EventPartition(partition.getValues(),
            LocationUtils.hasLocation(partition) ? LocationUtils.locationAsUri(partition) : null));
      }
    }
    return eventPartitions;
  }

  private  EventUtils();

}