Search in sources :

Example 11 with AfterMapping

use of org.mapstruct.AfterMapping in project cloud-pipeline by epam.

the class AbstractDataStorageMapper method fillS3Fields.

@AfterMapping
public void fillS3Fields(AbstractDataStorage dataStorage, @MappingTarget DataStorageVO dataStorageVO) {
    if (dataStorage instanceof S3bucketDataStorage) {
        S3bucketDataStorage s3bucketDataStorage = (S3bucketDataStorage) dataStorage;
        dataStorageVO.setAllowedCidrs(s3bucketDataStorage.getAllowedCidrs());
        dataStorageVO.setRegionId(s3bucketDataStorage.getRegionId());
    }
}
Also used : S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) AfterMapping(org.mapstruct.AfterMapping)

Example 12 with AfterMapping

use of org.mapstruct.AfterMapping in project scm-review-plugin by scm-manager.

the class ReplyMapper method appendLinks.

@AfterMapping
void appendLinks(@MappingTarget ReplyDto target, Reply source, @Context Repository repository, @Context String pullRequestId, @Context Comment comment, @Context BranchRevisionResolver.RevisionResult revisions) {
    String namespace = repository.getNamespace();
    String name = repository.getName();
    final Links.Builder linksBuilder = new Links.Builder();
    linksBuilder.self(commentPathBuilder.createReplySelfUri(namespace, name, pullRequestId, comment.getId(), target.getId()));
    if (PermissionCheck.mayModifyComment(repository, source) && !source.isSystemReply()) {
        linksBuilder.single(link("update", commentPathBuilder.createUpdateReplyUri(namespace, name, pullRequestId, comment.getId(), target.getId(), revisions)));
        linksBuilder.single(link("delete", commentPathBuilder.createDeleteReplyUri(namespace, name, pullRequestId, comment.getId(), target.getId(), revisions)));
    }
    applyEnrichers(new EdisonHalAppender(linksBuilder, new Embedded.Builder()), source, repository);
    target.add(linksBuilder.build());
}
Also used : EdisonHalAppender(sonia.scm.web.EdisonHalAppender) Links(de.otto.edison.hal.Links) AfterMapping(org.mapstruct.AfterMapping)

Aggregations

AfterMapping (org.mapstruct.AfterMapping)12 Links (de.otto.edison.hal.Links)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 BigDecimal (java.math.BigDecimal)2 EdisonHalAppender (sonia.scm.web.EdisonHalAppender)2 S3bucketDataStorage (com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage)1 NamePrefixType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NamePrefixType)1 NameSuffixType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NameSuffixType)1 AddressDTO (gov.ca.cwds.cals.service.dto.AddressDTO)1 FacilityAddressDTO (gov.ca.cwds.cals.service.dto.FacilityAddressDTO)1 BaseOutOfHomePlacement (gov.ca.cwds.data.legacy.cms.entity.BaseOutOfHomePlacement)1 BasePlacementEpisode (gov.ca.cwds.data.legacy.cms.entity.BasePlacementEpisode)1 County (gov.ca.cwds.data.legacy.cms.entity.syscodes.County)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Timestamp (java.sql.Timestamp)1 LocalDate (java.time.LocalDate)1 Period (java.time.Period)1