@Service public class MetricCRUDController extends java.lang.Object implements MetricCRUDInterface
Modifier and Type | Field and Description |
---|---|
private BusApprovedElementInterface |
busApprovedElementRepository |
private MetricRepository |
metricRepository |
private ModelMapperFactoryInterface |
modelMapperFactory |
Constructor and Description |
---|
MetricCRUDController() |
Modifier and Type | Method and Description |
---|---|
MetricCrudDTO |
changeStateMetric(MetricDTO dto)
This method just change state to a Metric.
|
long |
countMetricByState(java.lang.String state,
java.lang.String userId) |
MetricCrudDTO |
createMetric(MetricDTO dto) |
void |
deleteMetricById(java.lang.String id) |
MetricCrudDTO |
getMetricById(java.lang.String id) |
MetricCrudDTO |
getMetricByIdAndVersion(java.lang.String id,
java.lang.String version) |
MetricDTO |
getMetricByIdLastApprovedVersion(java.lang.String id) |
MetricCrudDTO |
getMetricByState(java.lang.String state) |
MetricCrudDTO |
getMetricByStateAndMetricatorId(java.lang.String state,
java.lang.String userId) |
MetricCrudDTO |
getMetricCrudDTOByIdLastApprovedVersion(java.lang.String id) |
MetricCrudDTO |
getMetricOfUser(java.lang.String userId) |
java.util.ArrayList<MetricDTO> |
getMetricsByPointerBusList(java.util.List<PointerBus> list) |
private void |
stateTransition(Metric oldMetric,
Metric newMetric) |
MetricCrudDTO |
updateMetric(MetricDTO dto)
This method updates a Metric.
|
@Autowired private MetricRepository metricRepository
@Autowired private ModelMapperFactoryInterface modelMapperFactory
@Autowired private BusApprovedElementInterface busApprovedElementRepository
public MetricCrudDTO getMetricById(java.lang.String id) throws BadInputException, NotFoundException
getMetricById
in interface MetricCRUDInterface
BadInputException
NotFoundException
public MetricCrudDTO getMetricByIdAndVersion(java.lang.String id, java.lang.String version) throws BadInputException, NotFoundException
getMetricByIdAndVersion
in interface MetricCRUDInterface
BadInputException
NotFoundException
public MetricDTO getMetricByIdLastApprovedVersion(java.lang.String id) throws BadInputException, NotFoundException, BusException, java.io.IOException
getMetricByIdLastApprovedVersion
in interface MetricCRUDInterface
BadInputException
NotFoundException
BusException
java.io.IOException
public MetricCrudDTO getMetricCrudDTOByIdLastApprovedVersion(java.lang.String id) throws BadInputException, NotFoundException, BusException, java.io.IOException
getMetricCrudDTOByIdLastApprovedVersion
in interface MetricCRUDInterface
BadInputException
NotFoundException
BusException
java.io.IOException
public MetricCrudDTO getMetricOfUser(java.lang.String userId) throws NotFoundException, BadInputException
getMetricOfUser
in interface MetricCRUDInterface
NotFoundException
BadInputException
public java.util.ArrayList<MetricDTO> getMetricsByPointerBusList(java.util.List<PointerBus> list)
getMetricsByPointerBusList
in interface MetricCRUDInterface
public MetricCrudDTO createMetric(@Nonnull MetricDTO dto) throws BadInputException
createMetric
in interface MetricCRUDInterface
BadInputException
public MetricCrudDTO updateMetric(MetricDTO dto) throws BadInputException, IllegalStateTransitionException, NotFoundException, DBException
updateMetric
in interface MetricCRUDInterface
dto
- MetricDTOBadInputException
IllegalStateTransitionException
NotFoundException
DBException
public MetricCrudDTO changeStateMetric(MetricDTO dto) throws BadInputException, IllegalStateTransitionException, NotFoundException, DBException
changeStateMetric
in interface MetricCRUDInterface
dto,
- in which must be id, releaseNote, stateBadInputException
IllegalStateTransitionException
NotFoundException
DBException
public void deleteMetricById(java.lang.String id) throws BadInputException, IllegalStateTransitionException
deleteMetricById
in interface MetricCRUDInterface
BadInputException
IllegalStateTransitionException
private void stateTransition(Metric oldMetric, Metric newMetric) throws IllegalStateTransitionException, NotFoundException
public long countMetricByState(java.lang.String state, java.lang.String userId) throws BadInputException, NotFoundException
countMetricByState
in interface MetricCRUDInterface
BadInputException
NotFoundException
public MetricCrudDTO getMetricByStateAndMetricatorId(java.lang.String state, java.lang.String userId) throws NotFoundException, BadInputException
getMetricByStateAndMetricatorId
in interface MetricCRUDInterface
NotFoundException
BadInputException
public MetricCrudDTO getMetricByState(java.lang.String state) throws NotFoundException, BadInputException
getMetricByState
in interface MetricCRUDInterface
NotFoundException
BadInputException