public class PropertySchemaService
extends java.lang.Object
Constructor and Description |
---|
PropertySchemaService(net.brokenbuild.subcomponents.service.customprops.propschema.PropSchemaMapper propSchemaMapper,
net.brokenbuild.subcomponents.service.customprops.propschema.PropSchemaHelper propSchemaHelper) |
Modifier and Type | Method and Description |
---|---|
void |
assign(int schemaId,
java.lang.String projectKey)
Assigns a property schema to a project based on the given schema ID and project key.
|
PropSchemaDto |
create(PropSchemaCreateDto input)
Creates a new property schema based on the given input data.
|
void |
delete(int schemaId)
Deletes a property schema based on the given schema ID.
|
java.util.Optional<PropSchemaDto> |
get(int schemaId)
Retrieves a property schema based on the provided schema ID.
|
java.util.Optional<PropSchemaDto> |
getByProjectKey(java.lang.String projectKey,
PropSchemaTypeEnum schemaType)
Retrieves a property schema based on the given project key and schema type.
|
java.util.List<PropSchemaDto> |
list(PropSchemaTypeEnum schemaType)
Retrieves a list of property schemas based on the given schema type.
|
PropSchemaDto |
update(PropSchemaUpdateDto input)
Updates a property schema based on the given input data.
|
public PropertySchemaService(net.brokenbuild.subcomponents.service.customprops.propschema.PropSchemaMapper propSchemaMapper, net.brokenbuild.subcomponents.service.customprops.propschema.PropSchemaHelper propSchemaHelper)
public java.util.Optional<PropSchemaDto> get(int schemaId)
This method fetches a property schema associated with a specific ID. If the schema exists, it's mapped to
its DTO representation. If the user is unauthorized to access this data, a SubcomponentsAuthException
is thrown. For other unexpected errors, a SubcomponentsApiException
is thrown.
schemaId
- The ID of the property schema to be retrieved.Optional
containing the PropSchemaDto
if found, or an empty Optional
if not found.SubcomponentsAuthException
- if the user is unauthorized to access the property schema.SubcomponentsApiException
- if any other error occurs while fetching the property schema.public java.util.List<PropSchemaDto> list(PropSchemaTypeEnum schemaType)
This method fetches all property schemas associated with a specific schema type. If the user is
unauthorized to access this data, a SubcomponentsAuthException
is thrown. For other unexpected errors,
a SubcomponentsApiException
is thrown.
schemaType
- The type of the property schemas to be retrieved.PropSchemaDto
matching the given schema type.SubcomponentsAuthException
- if the user is unauthorized to access the list of property schemas.SubcomponentsApiException
- if any other error occurs while fetching the list of property schemas.public java.util.Optional<PropSchemaDto> getByProjectKey(java.lang.String projectKey, PropSchemaTypeEnum schemaType)
This method fetches a property schema associated with a specific project key and schema type. If the user is
unauthorized to access this data, a SubcomponentsAuthException
is thrown. For other unexpected errors,
a SubcomponentsApiException
is thrown.
projectKey
- The project key associated with the property schema.schemaType
- The type of the property schema to be retrieved.Optional
containing the PropSchemaDto
if found, or an empty Optional
if not found.SubcomponentsAuthException
- if the user is unauthorized to access the property schema.SubcomponentsApiException
- if any other error occurs while fetching the property schema.public PropSchemaDto create(PropSchemaCreateDto input)
This method attempts to create a new property schema using the information provided in the input data. If the
provided input data doesn't pass validation, a SubcomponentsValidationException
is thrown. If the user is
unauthorized to create the schema, a SubcomponentsAuthException
is thrown. For other unexpected errors,
a SubcomponentsApiException
is thrown.
input
- A data transfer object PropSchemaCreateDto
containing the necessary information to create the property schema.PropSchemaDto
representing the newly created property schema.SubcomponentsValidationException
- if the input data fails validation checks.SubcomponentsAuthException
- if the user is unauthorized to create the schema.SubcomponentsApiException
- if any other error occurs while creating the schema.public PropSchemaDto update(PropSchemaUpdateDto input)
This method attempts to update an existing property schema using the information provided in the input data. If the
provided input data doesn't pass validation, a SubcomponentsValidationException
is thrown. If the user is
unauthorized to update the schema, a SubcomponentsAuthException
is thrown. For other unexpected errors,
a SubcomponentsApiException
is thrown.
input
- A data transfer object PropSchemaUpdateDto
containing the necessary information to update the property schema.PropSchemaDto
representing the updated property schema.SubcomponentsValidationException
- if the input data fails validation checks.SubcomponentsAuthException
- if the user is unauthorized to update the schema.SubcomponentsApiException
- if any other error occurs while updating the schema.public void delete(int schemaId)
This method attempts to delete an existing property schema using the provided schema ID. If the user is
unauthorized to delete this schema, a SubcomponentsAuthException
is thrown. For other unexpected errors,
a SubcomponentsApiException
is thrown.
schemaId
- The ID of the property schema to be deleted.SubcomponentsAuthException
- if the user is unauthorized to delete the property schema.SubcomponentsApiException
- if any other error occurs while deleting the property schema.public void assign(int schemaId, java.lang.String projectKey)
This method attempts to associate an existing property schema (identified by its ID) with a project
(identified by its key). If the user is unauthorized to perform this action, a SubcomponentsAuthException
is thrown. For other unexpected errors, a SubcomponentsApiException
is thrown.
schemaId
- The ID of the property schema to be assigned.projectKey
- The key of the project to which the schema should be assigned.SubcomponentsAuthException
- if the user is unauthorized to assign the property schema to the project.SubcomponentsApiException
- if any other error occurs while assigning the property schema to the project.