use of org.jboss.pnc.model.Product in project pnc by project-ncl.
the class ProductVersionProviderImpl method store.
@Override
public ProductVersion store(ProductVersion restEntity) {
validateBeforeSaving(restEntity);
org.jboss.pnc.model.ProductVersion productVersionRestDb = mapper.toEntity(restEntity);
Product product = productRepository.queryById(Integer.valueOf(restEntity.getProduct().getId()));
productVersionRestDb.generateBrewTagPrefix(product.getAbbreviation(), restEntity.getVersion(), systemConfig.getBrewTagPattern());
org.jboss.pnc.model.ProductVersion productVersion = repository.save(productVersionRestDb);
for (BuildConfiguration bc : productVersionRestDb.getBuildConfigurations()) {
bc.setProductVersion(productVersion);
}
repository.flushAndRefresh(productVersion);
return mapper.toDTO(productVersion);
}
Aggregations