public class ComponentPropertyService
extends java.lang.Object
Constructor and Description |
---|
ComponentPropertyService(net.brokenbuild.subcomponents.service.customprops.propvalue.PropValueHelper propValueHelper) |
Modifier and Type | Method and Description |
---|---|
java.util.Optional<java.lang.String> |
getValue(long componentId,
int propertyId)
Retrieves the value of a specified property for a given component ID.
|
java.lang.String |
setValue(long componentId,
int propertyId,
java.lang.String propValue)
Sets the value of a specified property name for a given component ID.
|
public ComponentPropertyService(net.brokenbuild.subcomponents.service.customprops.propvalue.PropValueHelper propValueHelper)
public java.util.Optional<java.lang.String> getValue(long componentId, int propertyId)
This method fetches the value of a property associated with a specific component based on the given component ID
and property name. If the user is unauthorized to access this data, a SubcomponentsAuthException
is thrown.
If any other error occurs during the process, a SubcomponentsApiException
is thrown.
componentId
- The ID of the component for which the property value needs to be fetched.propertyId
- The ID of the property whose value is to be retrieved.Optional
containing the property value if found, or an empty Optional
if not found.SubcomponentsAuthException
- if the user is unauthorized to access the property value.SubcomponentsApiException
- if any other error occurs while fetching the property value.public java.lang.String setValue(long componentId, int propertyId, java.lang.String propValue)
This method sets the value of a property associated with a specific component based on the given component ID,
property id, and the new value to be set. If the updated value doesn't pass validation, a
SubcomponentsValidationException
is thrown. If the user is unauthorized to update this data,
a SubcomponentsAuthException
is thrown. For other unexpected errors, a SubcomponentsApiException
is thrown.
componentId
- The ID of the component for which the property value needs to be updated.propertyId
- The ID of the property whose value is to be updated.propValue
- The new value for the property.SubcomponentsValidationException
- if the updated value fails validation checks.SubcomponentsAuthException
- if the user is unauthorized to update the property value.SubcomponentsApiException
- if any other error occurs while updating the property value.