use of org.compiere.model.I_M_AttributeValue in project metasfresh-webui-api by metasfresh.
the class AvailableToPromiseAdapter method createClientResultGroup0.
private Group createClientResultGroup0(final ResultGroup commonsResultGroup) {
final GroupBuilder groupBuilder = Group.builder().productId(commonsResultGroup.getProductId());
final Quantity quantity = Quantity.of(commonsResultGroup.getQty(), retrieveStockingUOM(commonsResultGroup.getProductId()));
groupBuilder.qty(quantity);
final AttributesKey attributesKey = commonsResultGroup.getStorageAttributesKey();
final Type type = extractType(attributesKey);
groupBuilder.type(type);
if (type == Type.ATTRIBUTE_SET) {
final List<I_M_AttributeValue> attributevalues = extractAttributeSetFromStorageAttributesKey(attributesKey);
groupBuilder.attributeValues(attributevalues);
}
return groupBuilder.build();
}
use of org.compiere.model.I_M_AttributeValue in project metasfresh-webui-api by metasfresh.
the class AvailableToPromiseAdapterTests method extractAttributeSetFromStorageAttributesKey.
@Test
public void extractAttributeSetFromStorageAttributesKey() {
final I_M_Attribute attr1 = attributesTestHelper.createM_Attribute("attr1", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
final I_M_AttributeValue attributeValue1 = attributesTestHelper.createM_AttributeValue(attr1, "value1");
final I_M_Attribute attr2 = attributesTestHelper.createM_Attribute("attr2", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
final I_M_AttributeValue attributeValue2 = attributesTestHelper.createM_AttributeValue(attr2, "value2");
// invoke the method under test
final AttributesKey attributesKey = AttributesKey.ofAttributeValueIds(attributeValue1.getM_AttributeValue_ID(), attributeValue2.getM_AttributeValue_ID());
final List<I_M_AttributeValue> result = availableToPromiseAdapter.extractAttributeSetFromStorageAttributesKey(attributesKey);
assertThat(result).hasSize(2);
assertThat(result).anySatisfy(attributeValue -> {
assertThatModel(attributeValue).hasSameIdAs(attributeValue1);
assertThat(attributeValue.getValue()).isEqualTo("value1");
});
assertThat(result).anySatisfy(attributeValue -> {
assertThatModel(attributeValue).hasSameIdAs(attributeValue2);
assertThat(attributeValue.getValue()).isEqualTo("value2");
});
}
Aggregations