public void removeAttribute(final @Nonnull String attributeCode) throws AttributeNotFound { AttributeFeature attributeFeature = getAttributeFeature(); if (attributeFeature != null) { attributeFeature.removeAttribute(attributeCode); } else { throw new AttributeNotFound(getFeatureEntityId(), attributeCode); } }
public void applyEffectOnAttribute( final @Nonnull String attributeCode, final @Nonnull Effect<BigDecimal> effect) throws AttributeNotFound { AttributeFeature attributeFeature = getAttributeFeature(); if (attributeFeature != null) { attributeFeature.applyEffectOnAttribute(attributeCode, effect); } else { throw new AttributeNotFound(getFeatureEntityId(), attributeCode); } }
public void setAttributeValue( final @Nonnull String attributeCode, final @Nonnull BigDecimal value) throws AttributeNotFound { AttributeFeature attributeFeature = getAttributeFeature(); if (attributeFeature != null) { attributeFeature.setAttributeValue(attributeCode, value); } else { throw new AttributeNotFound(getFeatureEntityId(), attributeCode); } }
public void addAttribute(final @Nonnull String attributeCode) throws AttributeNotExists { // add attribute feature if it is not added, yet addAttributeFeature(); Attribute attribute = attributeRepository.findByCode(attributeCode); if (attribute != null) { AttributeFeature attributeFeature = getAttributeFeature(); if (attributeFeature != null) { attributeFeature.addAttribute(attributeCode, attribute.getSettings()); } } else { throw new AttributeNotExists(attributeCode); } }