public Optional<String> getRackId(Offer offer) { for (Attribute attribute : offer.getAttributesList()) { if (attribute.getName().equals(rackIdAttributeKey)) { return Optional.of(attribute.getText().getValue()); } } return Optional.absent(); }
public Map<String, String> getTextAttributes(Offer offer) { Map<String, String> textAttributes = new HashMap<>(); for (Attribute attribute : offer.getAttributesList()) { if (!attribute.getName().equals(rackIdAttributeKey)) { if (attribute.hasText()) { textAttributes.put(attribute.getName(), attribute.getText().getValue()); } else if (attribute.hasScalar()) { textAttributes.put(attribute.getName(), Double.toString(attribute.getScalar().getValue())); } else if (attribute.hasRanges()) { textAttributes.put(attribute.getName(), attribute.getRanges().getRangeList().toString()); } } } return textAttributes; }
public Optional<String> getRackId(Offer offer) { for (Attribute attribute : offer.getAttributesList()) { if (attribute.getName().equals(rackIdAttributeKey)) { return Optional.of(attribute.getText().getValue()); } } return Optional.absent(); }
public Map<String, String> getTextAttributes(Offer offer) { Map<String, String> textAttributes = new HashMap<>(); for (Attribute attribute : offer.getAttributesList()) { if (!attribute.getName().equals(rackIdAttributeKey)) { if (attribute.hasText()) { textAttributes.put(attribute.getName(), attribute.getText().getValue()); } else if (attribute.hasScalar()) { textAttributes.put(attribute.getName(), Double.toString(attribute.getScalar().getValue())); } else if (attribute.hasRanges()) { textAttributes.put(attribute.getName(), attribute.getRanges().getRangeList().toString()); } } } return textAttributes; }