private void updateReduceCapability( ReduceCapability reduceCapability, ReduceCapabilityDto reduceCapabilityDto) { reduceCapability.setMaxDtus(reduceCapabilityDto.getMaxDtus()); reduceCapability.setPowerStep(reduceCapabilityDto.getPowerStep()); reduceCapability.setMinPower(reduceCapabilityDto.getMinPower()); reduceCapability.setDurationMultiplier(reduceCapabilityDto.getDurationMultiplier()); LOGGER.debug("Updated reduce-capability with id [{}] ", reduceCapabilityDto.getId()); }
private ReduceCapability createReduceCapability( ReduceCapabilityDto reduceCapabilityDto, UdiEvent udiEvent) { ReduceCapability reduceCapability = new ReduceCapability(); reduceCapability.setId(getDeviceCapabilityId(reduceCapabilityDto)); reduceCapability.setMaxDtus(reduceCapabilityDto.getMaxDtus()); reduceCapability.setPowerStep(reduceCapabilityDto.getPowerStep()); reduceCapability.setMinPower(reduceCapabilityDto.getMinPower()); reduceCapability.setDurationMultiplier(reduceCapabilityDto.getDurationMultiplier()); reduceCapability.setConsumptionProductionType( UdiEventTransformer.transformToModel(reduceCapabilityDto.getConsumptionProductionType())); reduceCapability.setUdiEvent(udiEvent); reduceCapabilityRepository.persist(reduceCapability); LOGGER.debug( "Created new reduce-capability with id [{}] for event with id [{}]", reduceCapabilityDto.getId(), udiEvent.getId()); return reduceCapability; }