use of org.mapstruct.BeforeMapping in project pnc by project-ncl.
the class BuildBCRevisionFetcher method mapFromAuditedBuildConfig.
@BeforeMapping
public void mapFromAuditedBuildConfig(BuildRecord build, @MappingTarget Build.Builder dtoBuilder) {
Integer id = build.getBuildConfigurationId();
Integer revision = build.getBuildConfigurationRev();
// If somebody before us already set the BCA we don't need to query it from DB again
BuildConfigurationAudited bca = build.getBuildConfigurationAudited();
if (bca == null) {
bca = bcAuditedRepository.queryById(new IdRev(id, revision));
}
BuildConfigurationRevisionRef bcRevision = bcRevisionMapper.toRef(bca);
ProjectRef project = projectMapper.toRef(bca.getProject());
Environment environment = environmentMapper.toRef(bca.getBuildEnvironment());
SCMRepository scmRepository = scmRepositoryMapper.toRef(bca.getRepositoryConfiguration());
dtoBuilder.buildConfigRevision(bcRevision);
dtoBuilder.project(project);
dtoBuilder.environment(environment);
dtoBuilder.scmRepository(scmRepository);
}
use of org.mapstruct.BeforeMapping in project octopus by MetaHut.
the class FlowDefinitionFromDTOConverter method createSchedule.
@BeforeMapping
public void createSchedule(MonitorFlowDefinitionCreateOrUpdateRequestDTO source) {
if (StringUtils.isBlank(source.getSchedulerCode())) {
// TODO name parameter need to be optimized
MetaDatasetResponseDTO dataset = metaService.queryDatasetByCode(source.getDatasetCode());
StringJoiner taskName = new StringJoiner(NAME_SPLICE_SYMBOL).add(dataset.getDatasource().getCode()).add(source.getDatasetCode()).add(String.valueOf(source.getCode()));
String schedulerCode = schedulerService.createMetricsProductionTaskAndAddSchedule(taskName.toString(), source.getCode(), source.getCrontab());
source.setSchedulerCode(schedulerCode);
}
}
use of org.mapstruct.BeforeMapping in project springfox by springfox.
the class ServiceModelToSwagger2Mapper method beforeMappingOperations.
@BeforeMapping
@SuppressWarnings("deprecation")
void beforeMappingOperations(@MappingTarget Operation target, springfox.documentation.service.Operation source, @Context ModelNamesRegistry modelNamesRegistry) {
List<io.swagger.models.parameters.Parameter> parameters = new ArrayList<>();
if (useModelV3) {
for (RequestParameter each : source.getRequestParameters()) {
parameters.addAll(Mappers.getMapper(RequestParameterMapper.class).mapParameter(each, modelNamesRegistry));
}
target.setResponses(mapResponses(source.getResponses(), modelNamesRegistry));
} else {
for (springfox.documentation.service.Parameter each : source.getParameters()) {
parameters.add(Mappers.getMapper(ParameterMapper.class).mapParameter(each));
}
target.setResponses(mapResponseMessages(source.getResponseMessages()));
}
target.setParameters(parameters);
}
Aggregations