/** * Add a partition to a collection of partitions associated with this message * * @param partitionName the partition name to add */ public void addPartitionName(String partitionName) { if (_record.getListField(Attributes.PARTITION_NAME.toString()) == null) { _record.setListField(Attributes.PARTITION_NAME.toString(), new ArrayList<String>()); } List<String> partitionNames = _record.getListField(Attributes.PARTITION_NAME.toString()); if (!partitionNames.contains(partitionName)) { partitionNames.add(partitionName); } }
/** * Get a list of partitions associated with this message * * @return list of partition ids */ public List<PartitionId> getPartitionIds() { List<String> partitionNames = _record.getListField(Attributes.PARTITION_NAME.toString()); if (partitionNames == null) { return Collections.emptyList(); } List<PartitionId> partitionIds = Lists.newArrayList(); for (String partitionName : partitionNames) { partitionIds.add(PartitionId.from(partitionName)); } return partitionIds; }
/** * Get a list of partitions associated with this message * * @return list of partition ids */ public List<String> getPartitionNames() { return _record.getListField(Attributes.PARTITION_NAME.toString()); }
/** * Get the resource partition associated with this message * * @return partition id */ public String getPartitionName() { return _record.getSimpleField(Attributes.PARTITION_NAME.toString()); }
/** * Set the id of the partition this message concerns * * @param partitionId */ public void setPartitionName(String partitionName) { _record.setSimpleField(Attributes.PARTITION_NAME.toString(), partitionName); }